diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index d62da65..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "files.associations": { - "position_component.h": "c", - "movable_component.h": "c" - } -} \ No newline at end of file diff --git a/include/runner.h b/include/runner.h index df556cb..1cff6c9 100644 --- a/include/runner.h +++ b/include/runner.h @@ -11,4 +11,4 @@ #include "scene.h" int start_game(void); -gc_scene *create_game_scene(gc_engine *engine); \ No newline at end of file +int create_game_scene(gc_engine *engine); \ No newline at end of file diff --git a/lib/gamacon b/lib/gamacon index cae301c..a02f75c 160000 --- a/lib/gamacon +++ b/lib/gamacon @@ -1 +1 @@ -Subproject commit cae301c417e99788ec85c4087936b9a8639d285c +Subproject commit a02f75c10fa543214ee8bc75cb8b00b9d1ab0b87 diff --git a/prefabs/player.gcprefab b/prefabs/player.gcprefab index c12ad5e..068a16c 100644 --- a/prefabs/player.gcprefab +++ b/prefabs/player.gcprefab @@ -1,4 +1,4 @@ 0: -PositionComponent 0,0 +PositionComponent 500,500 MovableComponent Q D Z TextureRenderer assets/sprites/bck_layer1.png \ No newline at end of file diff --git a/src/game_loader.c b/src/game_loader.c index 1996751..5641d35 100644 --- a/src/game_loader.c +++ b/src/game_loader.c @@ -11,14 +11,11 @@ int start_game(void) { gc_engine *engine = engine_create("Runner"); - gc_scene *scene; if (!engine) return (ERROR); - scene = create_game_scene(engine); - if (!scene) + if (create_game_scene(engine) < 0) return (ERROR); - engine->change_scene(engine, scene); while (engine->is_open(engine)) { engine->game_loop(engine); } diff --git a/src/scenes/game_scene.c b/src/scenes/game_scene.c index d537964..6cc9466 100644 --- a/src/scenes/game_scene.c +++ b/src/scenes/game_scene.c @@ -13,14 +13,15 @@ static const char *textures[] = {"assets/sprites/bck_layer1.png", \ "assets/sprites/bck_layer2.png", "assets/sprites/bck_layer3.png", \ "assets/sprites/bck_layer4.png", NULL}; -gc_scene *create_game_scene(gc_engine *engine) +int create_game_scene(gc_engine *engine) { gc_scene *scene = scene_create(textures); gc_entity *entity; if (!scene) - return (NULL); + return (-1); + engine->change_scene(engine, scene); entity = prefab_load(engine, "prefabs/player.gcprefab"); scene->add_entity(scene, entity); - return (scene); + return (0); } \ No newline at end of file