-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
31 lines (25 loc) · 752 Bytes
/
main.cpp
File metadata and controls
31 lines (25 loc) · 752 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include "Game.h"
#include "text.h"
Game *game = nullptr;
int main(int argc, char **argv)
{
game = new Game();
const int FPS = 60;
const int Framedelay = 1000/FPS;
Uint32 framestart;
int frametime;
game->init("Archery", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 1300, 800, false);
text text(Game::renderer,"ARCADECLASSIC.TTF",30,"Scoreboard:",{255,0,0,255});
while(game->running())
{
framestart = SDL_GetTicks();
game->handle_events();
game->update();
game->render();
text.display(100,100,Game::renderer);
frametime = SDL_GetTicks() - framestart;
if(Framedelay > frametime) SDL_Delay(Framedelay-frametime);
}
game->clean();
return 0;
}