Removed box2d physics because of linking problems (and nothing's using it yet). Also tests work now.

```
ln -s ../tests/assets build/assets
cd build
make test
```
This commit is contained in:
2025-08-03 14:06:40 -04:00
parent 9ebb0d50c9
commit 0a386a6a67
17 changed files with 188 additions and 115 deletions

View File

@@ -1,6 +1,5 @@
#include <SDL3/SDL.h>
#include <SDL3_image/SDL_image.h>
#include <box2d/box2d.h>
#include <string.h>
#include <sdlerror.h>

View File

@@ -1,6 +1,5 @@
#include <SDL3/SDL.h>
#include <SDL3_image/SDL_image.h>
#include <box2d/box2d.h>
#include <sdlerror.h>
#include <string.h>
#include <jansson.h>

View File

@@ -1,7 +1,6 @@
#include <SDL3/SDL.h>
#include <SDL3_image/SDL_image.h>
#include <SDL3_mixer/SDL_mixer.h>
#include <box2d/box2d.h>
#include <sdl3game/game.h>
/* Draw a Gimpish background pattern to show transparency in the image */

View File

@@ -1,12 +1,10 @@
#include <SDL3/SDL.h>
#include <SDL3_image/SDL_image.h>
#include <SDL3_mixer/SDL_mixer.h>
#include <box2d/box2d.h>
#include <stdio.h>
#include <sdlerror.h>
#include <sdl3game/game.h>
#include <sdl3game/physics.h>
#include <sdl3game/tilemap.h>
#include <sdl3game/sprite.h>
#include <sdl3game/heap.h>
@@ -23,5 +21,6 @@ GAME_frame table;
tilemap gamemap;
MIX_Audio *bgm = NULL;
MIX_Mixer *GAME_mixer = NULL;
MIX_Track *GAME_tracks[64];
SDL_FRect camera;
GameState gamestate;

View File

@@ -1,52 +0,0 @@
#include <SDL3/SDL.h>
#include <SDL3_image/SDL_image.h>
#include <SDL3_mixer/SDL_mixer.h>
#include <box2d/box2d.h>
#include <sdl3game/physics.h>
b2WorldDef physicsWorldDef;
b2WorldId physicsWorldId;
b2BodyDef physicsGroundBodyDef;
b2BodyId physicsGroundBodyId;
b2Polygon physicsGroundBox;
b2ShapeDef physicsGroundShapeDef;
b2BodyDef physicsBallBodyDef;
b2BodyId physicsBallBodyId;
b2Polygon physicsBallBodyBox;
b2ShapeDef physicsBallShapeDef;
// Should do this more intelligently at some point -
// https://gafferongames.com/post/fix_your_timestep/
float physicsTimeStep = 1.0f / 60.0f;
int physicsSubStepCount = 4;
void GAME_init_physics(void)
{
/* Create the physics world */
physicsWorldDef = b2DefaultWorldDef();
physicsWorldDef.gravity = (b2Vec2){0.0f, 10.0f};
physicsWorldId = b2CreateWorld(&physicsWorldDef);
/* Create the ground box */
physicsGroundBodyDef = b2DefaultBodyDef();
physicsGroundBodyDef.position = (b2Vec2){0.0f, PHYSICS_SCREEN_SCALE(480.0f)};
physicsGroundBodyId = b2CreateBody(physicsWorldId, &physicsGroundBodyDef);
physicsGroundBox = b2MakeBox(PHYSICS_SCREEN_SCALE(320.0f), PHYSICS_SCREEN_SCALE(1.0f));
physicsGroundShapeDef = b2DefaultShapeDef();
b2CreatePolygonShape(physicsGroundBodyId, &physicsGroundShapeDef, &physicsGroundBox);
/* Create a dynamic physics body for the ball */
physicsBallBodyDef = b2DefaultBodyDef();
physicsBallBodyDef.type = b2_dynamicBody;
physicsBallBodyDef.position = (b2Vec2){0.0f, 0.0f};
physicsBallBodyId = b2CreateBody(physicsWorldId, &physicsBallBodyDef);
physicsBallBodyBox = b2MakeBox(PHYSICS_SCREEN_SCALE(128.0f), PHYSICS_SCREEN_SCALE(128.0f));
physicsBallShapeDef = b2DefaultShapeDef();
physicsBallShapeDef.density = 1.0f;
physicsBallShapeDef.restitution = 0.75f;
physicsBallShapeDef.friction = 0.3f;
b2CreatePolygonShape(physicsBallBodyId, &physicsBallShapeDef, &physicsBallBodyBox);
//b2CreateFixture(physicsBallBodyId, &physicsBallShapeDef);
}

View File

@@ -1,6 +1,5 @@
#include <SDL3/SDL.h>
#include <SDL3_image/SDL_image.h>
#include <box2d/box2d.h>
#include <string.h>
#include <jansson.h>
#include <sdlerror.h>