Created
March 17, 2014 09:13
-
-
Save py4/9596166 to your computer and use it in GitHub Desktop.
my main file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstring> | |
#include <cmath> | |
#include "backend.h" | |
#include <cstdlib> | |
using namespace std; | |
int main(int argc,char* args[]) | |
{ | |
Game game; | |
SDL_Event event; | |
vector <Object> selected_objects; | |
srand(time(NULL)); | |
if(!init_game(game)) | |
{ | |
cout << "couldn't init!" << endl; | |
return -1; | |
} | |
while(!game.quit) | |
{ | |
dump_time(game.board); | |
game.board.time = (SDL_GetTicks() / 1000); | |
if(game.board.time >= TOTAL_TIME) | |
{ | |
cout << "time is up!" << endl; | |
return 0; | |
} | |
while(SDL_PollEvent(&event)) | |
{ | |
if(event.type == SDL_QUIT) | |
{ | |
game.quit = true; | |
break; | |
} | |
if(event.type == SDL_MOUSEBUTTONDOWN) | |
handle_mouse_event(game.board,event,selected_objects); | |
} | |
} | |
free_everything(game.board); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment