add game scene

This commit is contained in:
2023-01-21 17:04:58 +01:00
parent 814d135ada
commit 98d4db02fa
9 changed files with 74 additions and 6 deletions
+13 -2
View File
@@ -1,3 +1,4 @@
#include "game.h"
#include "input.h"
#include "renderer.h"
#include "text.h"
@@ -15,6 +16,7 @@ clock_t timecode;
long iter;
Mix_Music *prout;
static void space(void) {
printf("space!\n");
if(Mix_PlayMusic(prout, 0) != 0){
@@ -23,6 +25,11 @@ static void space(void) {
Mix_FreeMusic(prout);
running = false;
}
if(renderer_getScene() == &menuScene){
menu_remove();
renderer_setScene(&gameScene);
game_staticRender();
}
}
Scene_t demo;
@@ -43,8 +50,12 @@ static void game_loop(void) {
float delta = ((float)(clock() - timecode)) / CLOCKS_PER_SEC;
//update time
menu_render(delta);
if(renderer_getScene() == &menuScene){
menu_render(delta);
}
else{
game_render(delta);
}
timecode = clock();
}