mirror of
https://github.com/zoriya/Twac.git
synced 2025-12-06 06:36:09 +00:00
Freeing everything
This commit is contained in:
Submodule lib/gamacon updated: a1e4936dba...bf80bda8a2
Submodule lib/xmlparser updated: 29f8d8b910...e060848bef
@@ -56,16 +56,12 @@
|
||||
</gc_entity>
|
||||
|
||||
<gc_entity id="50">
|
||||
<transform_component>
|
||||
<Position x="500" y="-200" />
|
||||
<Size x="1000000" y="10" />
|
||||
</transform_component>
|
||||
<transform_component />
|
||||
<renderer text="" />
|
||||
<collision_component layer="00000000" />
|
||||
<fixed_to_cam />
|
||||
<timer_component time="60"/>
|
||||
</gc_entity>
|
||||
|
||||
|
||||
<gc_entity>
|
||||
<transform_component>
|
||||
<Position x="-500" y="-200" />
|
||||
|
||||
@@ -22,13 +22,13 @@ static void on_collide(gc_engine *engine, gc_entity *entity, int id)
|
||||
if (GETCOLCMP(kill_component)) {
|
||||
cmp->live--;
|
||||
if (cmp->live < 0) {
|
||||
exit(0);
|
||||
engine->should_close = true;
|
||||
} else {
|
||||
trans->position = cmp->spawn_position;
|
||||
}
|
||||
}
|
||||
if (GETCOLCMP(win_component)) {
|
||||
exit(0);
|
||||
engine->should_close = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -63,13 +63,8 @@ int start_game(const char *map)
|
||||
return (ERROR);
|
||||
if (create_game_scene(engine, map) < 0)
|
||||
return (ERROR);
|
||||
while (engine->is_open(engine)) {
|
||||
while (engine->is_open(engine))
|
||||
engine->game_loop(engine, sfTime_asSeconds(sfClock_restart(clock)));
|
||||
if (engine->is_keypressed(sfKeyEscape)) {
|
||||
prefab_load(engine, "prefabs/pause.gcprefab");
|
||||
sfClock_restart(clock);
|
||||
}
|
||||
}
|
||||
engine->destroy(engine);
|
||||
sfClock_destroy(clock);
|
||||
return (0);
|
||||
|
||||
@@ -23,6 +23,8 @@ gc_entity *entity, float dtime)
|
||||
if (!rend || rend->type != GC_TXTREND)
|
||||
return;
|
||||
timer->time_left -= dtime;
|
||||
if (((gc_text *)rend->data)->text)
|
||||
free(((gc_text *)rend->data)->text);
|
||||
((gc_text *)rend->data)->text = tostr((int)timer->time_left);
|
||||
(void)system;
|
||||
(void)engine;
|
||||
|
||||
Reference in New Issue
Block a user