Skip to content

Commit

Permalink
Add CODENAMES.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
jdeokkim committed Nov 12, 2024
1 parent 0a856fe commit 1f7ea88
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 27 deletions.
3 changes: 3 additions & 0 deletions CODENAMES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
v0.8.x "Pentafist": CrossCode
v0.9.x "Lemurian": Golden Sun: The Lost Age
v0.10.x "Daybreak": Terraria
9 changes: 5 additions & 4 deletions examples/src/basic.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
static const Rectangle SCREEN_BOUNDS = { .width = SCREEN_WIDTH,
.height = SCREEN_HEIGHT };

static const float BOX_WIDTH = 40.0f, BOX_HEIGHT = 40.0f;
static const float BOX_WIDTH = 1.25f, BOX_HEIGHT = 1.25f;

static const float CELL_SIZE = 1.5f, DELTA_TIME = 1.0f / (TARGET_FPS << 1);

Expand Down Expand Up @@ -112,15 +112,16 @@ static void InitExample(void) {

boxShape = frCreateRectangle((frMaterial) { .density = 1.0f,
.friction = 0.75f },
frPixelsToUnits(BOX_WIDTH),
frPixelsToUnits(BOX_HEIGHT));
BOX_WIDTH,
BOX_HEIGHT);

for (int i = 0; i < BOX_COUNT; i++) {
boxes[i] = frCreateBodyFromShape(
FR_BODY_DYNAMIC,
frVector2PixelsToUnits((frVector2) {
.x = 0.5f * SCREEN_WIDTH,
.y = (0.74f * SCREEN_HEIGHT) - (i * (BOX_HEIGHT + 1.0f)) }),
.y = (0.74f * SCREEN_HEIGHT)
- (i * (frUnitsToPixels(BOX_HEIGHT) + 1.0f)) }),
boxShape);

frAddBodyToWorld(world, boxes[i]);
Expand Down
3 changes: 2 additions & 1 deletion examples/src/bricks.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ static frWorld *world;

static frBody *borders[BORDER_COUNT], *platforms[PLATFORM_COUNT], *cursor;

static Color boxColor = LIGHTGRAY, borderColor = BROWN, platformColor = BROWN;
static Color boxColor = LIGHTGRAY, borderColor = DARKBROWN,
platformColor = BROWN;

static float cursorCounter;

Expand Down
14 changes: 4 additions & 10 deletions src/broad_phase.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,8 @@ void frQuerySpatialHash(frSpatialHash *sh,
if (entry == NULL) continue;

for (int i = 0; i < frGetDynArrayLength(entry->value); i++)
frDynArrayPush(
sh->queryResult,
frGetDynArrayValue(entry->value, i)
);
frDynArrayPush(sh->queryResult,
frGetDynArrayValue(entry->value, i));
}

{
Expand All @@ -176,10 +174,6 @@ void frQuerySpatialHash(frSpatialHash *sh,
will be called with the user data pointer `ctx`.
*/
for (int i = 0; i < frGetDynArrayLength(sh->queryResult); i++)
func(
(frContextNode) {
.id = frGetDynArrayValue(sh->queryResult, i),
.ctx = userData
}
);
func((frContextNode) { .id = frGetDynArrayValue(sh->queryResult, i),
.ctx = userData });
}
12 changes: 5 additions & 7 deletions src/collision.c
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,7 @@ static bool frComputeCollisionCirclePoly(const frShape *s1,
NOTE: This will find the edge of the 'polygon' collision shape
closest to the center of the 'circle' collision shape.
*/
for (int j = vertices->count - 1, i = 0; i < vertices->count;
j = i, i++) {
for (int j = vertices->count - 1, i = 0; i < vertices->count; j = i, i++) {
float dot = frVector2Dot(normals->data[i],
frVector2Subtract(txCenter,
vertices->data[i]));
Expand Down Expand Up @@ -405,8 +404,8 @@ static bool frComputeCollisionCirclePoly(const frShape *s1,
if (magnitude <= 0.0f) magnitude = FLT_EPSILON;

collision->direction = frVector2ScalarMultiply(
frVector2RotateTx(frVector2Negate(direction), polyTx),
1.0f / magnitude);
frVector2RotateTx(frVector2Negate(direction), polyTx),
1.0f / magnitude);

if (frVector2Dot(deltaPosition, collision->direction) < 0.0f)
collision->direction = frVector2Negate(
Expand Down Expand Up @@ -508,9 +507,8 @@ static bool frComputeCollisionPolys(const frShape *s1,
float refDot1 = frVector2Dot(refEdge.data[0], refEdgeVector);
float refDot2 = frVector2Dot(refEdge.data[1], refEdgeVector);

if (!frClipEdge(&incEdge, refEdgeVector, refDot1))
return false;

if (!frClipEdge(&incEdge, refEdgeVector, refDot1)) return false;

if (!frClipEdge(&incEdge, frVector2Negate(refEdgeVector), -refDot2))
return false;

Expand Down
7 changes: 2 additions & 5 deletions src/rigid_body.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,7 @@ float frGetBodyTorque(const frBody *b) {

/* Returns the AABB (Axis-Aligned Bounding Box) of `b`. */
frAABB frGetBodyAABB(const frBody *b) {
return (b != NULL && b->shape != NULL) ? b->aabb
: frStructZero(frAABB);
return (b != NULL && b->shape != NULL) ? b->aabb : frStructZero(frAABB);
}

/* Returns the user data of `b`. */
Expand Down Expand Up @@ -208,8 +207,7 @@ void frSetBodyShape(frBody *b, frShape *s) {

b->shape = s;

b->aabb = (s != NULL) ? frGetShapeAABB(s, b->tx)
: frStructZero(frAABB);
b->aabb = (s != NULL) ? frGetShapeAABB(s, b->tx) : frStructZero(frAABB);

frComputeBodyMass(b);
}
Expand Down Expand Up @@ -589,6 +587,5 @@ static void frComputeBodyMass(frBody *b) {

/* Normalizes the `angle` to a range `[-2π, 2π]`. */
static FR_API_INLINE float frNormalizeAngle(float angle) {
// return angle - (TWO_PI * floorf((angle + (M_PI - ?)) * INVERSE_TWO_PI));
return angle - (TWO_PI * floorf((angle + -M_PI) * INVERSE_TWO_PI));
}

0 comments on commit 1f7ea88

Please sign in to comment.