Skip to content

Instantly share code, notes, and snippets.

@py4
Created March 17, 2014 09:13
Show Gist options
  • Save py4/9596166 to your computer and use it in GitHub Desktop.
Save py4/9596166 to your computer and use it in GitHub Desktop.
my main file
#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