Update main.c

This commit is contained in:
Jason Bou-Samra
2024-09-28 09:46:53 +10:00
committed by GitHub
parent 77e7318eca
commit f22a207dd4
+6 -8
View File
@@ -16,13 +16,14 @@
#include "column.h" #include "column.h"
#include "sdl.h" #include "sdl.h"
#include "events.h" #include "events.h"
#include "hiscore.h"
///////////////// MAIN MENU //////////////////////////// ///////////////// MAIN MENU ////////////////////////////
int menu(void) { int menu(void) {
quit = false; quit = false;
Ren_menu(); Ren_menu();
while (quit == false) { while (quit == false) {
SDL_Delay(20); // SDL_Delay(20);
SDL_PollEvent(&event); SDL_PollEvent(&event);
switch (event.type) { switch (event.type) {
case SDL_KEYDOWN: case SDL_KEYDOWN:
@@ -47,10 +48,7 @@ int menu(void) {
if (event.key.keysym.sym == SDLK_5) {speed = 3.0;} if (event.key.keysym.sym == SDLK_5) {speed = 3.0;}
if (event.key.keysym.sym == SDLK_6) {speed = 3.5;} if (event.key.keysym.sym == SDLK_6) {speed = 3.5;}
handle_events(); // game levels handle_events(); // game levels
reset(); end_game();
Ren_restart();
check_key();
restart = false;
Ren_menu(); Ren_menu();
} }
} }
@@ -63,11 +61,11 @@ int main(void) {
if (sodium_init() < 0) { // initialise sodium if (sodium_init() < 0) { // initialise sodium
printf("error\n"); // -1 = failure printf("error\n"); // -1 = failure
} }
initSDL(); initSDL();
init_gfx(); init_gfx();
research (); next_brick();
eliminate_c (); initial_brick();
col = new_column();
menu(); menu();
shutdownSDL(); shutdownSDL();
return 0; return 0;