Update main.c
This commit is contained in:
+8
-44
@@ -11,62 +11,26 @@
|
||||
#include <sodium.h>
|
||||
#include <math.h>
|
||||
#include <stdint.h>
|
||||
#include "research.h"
|
||||
#include "render.h"
|
||||
#include "column.h"
|
||||
#include "sdl.h"
|
||||
#include "events.h"
|
||||
#include "hiscore.h"
|
||||
#include "menu.h"
|
||||
|
||||
///////////////// MAIN MENU ////////////////////////////
|
||||
int menu(void) {
|
||||
quit = false;
|
||||
Ren_menu();
|
||||
while (quit == false) {
|
||||
// SDL_Delay(20);
|
||||
SDL_PollEvent(&event);
|
||||
switch (event.type) {
|
||||
case SDL_KEYDOWN:
|
||||
if (event.key.keysym.sym == SDLK_q) {
|
||||
quit = true; // quit
|
||||
}
|
||||
if (event.key.keysym.sym == SDLK_a) {
|
||||
Ren_about(); // about
|
||||
check_key();
|
||||
Ren_menu();
|
||||
}
|
||||
if (event.key.keysym.sym == SDLK_i) {
|
||||
Ren_info(); // info (instructions)
|
||||
check_key();
|
||||
Ren_menu();
|
||||
}
|
||||
if (event.key.keysym.sym > SDLK_0 && event.key.keysym.sym < SDLK_7) {
|
||||
if (event.key.keysym.sym == SDLK_1) {speed = 1.0;}
|
||||
if (event.key.keysym.sym == SDLK_2) {speed = 1.5;}
|
||||
if (event.key.keysym.sym == SDLK_3) {speed = 2.0;}
|
||||
if (event.key.keysym.sym == SDLK_4) {speed = 2.5;}
|
||||
if (event.key.keysym.sym == SDLK_5) {speed = 3.0;}
|
||||
if (event.key.keysym.sym == SDLK_6) {speed = 3.5;}
|
||||
handle_events(); // game levels
|
||||
end_game();
|
||||
Ren_menu();
|
||||
}
|
||||
}
|
||||
}
|
||||
//////////////// ABOUT ///////////////////////
|
||||
void about_fc() {
|
||||
printf("Fun Columns\nOriginal IIGS version: Olivier Goguel (FTA 1990/91)\nSDL version 1.0: Jason Bou-Samra\n");
|
||||
}
|
||||
|
||||
///////////////////// MAIN ROUTINE /////////////////////////
|
||||
int main(void) {
|
||||
|
||||
about_fc();
|
||||
if (sodium_init() < 0) { // initialise sodium
|
||||
printf("error\n"); // -1 = failure
|
||||
}
|
||||
initSDL();
|
||||
init_gfx();
|
||||
next_brick();
|
||||
initial_brick();
|
||||
col = new_column();
|
||||
menu();
|
||||
initSDL(); // init. SDL subsystem
|
||||
init_gfx(); // sprite map
|
||||
menu(); // main menu
|
||||
shutdownSDL();
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user