Implement quit function in main menu

Will need to revise this in the future
scene_man
En Yi 2023-08-18 23:10:48 +08:00
parent 209f09e307
commit 42e5caf695
2 changed files with 19 additions and 11 deletions

5
main.c
View File

@ -99,6 +99,11 @@ int main(void)
{ {
sc_queue_clear(&key_buffer); sc_queue_clear(&key_buffer);
} }
if (curr_scene->state == SCENE_ENDED && engine.curr_scene == 0)
{
break;
}
} }
free_sandbox_scene(&sandbox_scene); free_sandbox_scene(&sandbox_scene);
free_game_scene(&level_scene); free_game_scene(&level_scene);

View File

@ -26,6 +26,9 @@ static void exec_component_function(Scene_t* scene, int sel)
case 1: case 1:
change_scene(scene->engine, 2); change_scene(scene->engine, 2);
break; break;
case 3:
scene->state = SCENE_ENDED;
break;
default: default:
break; break;
} }