]>
git.r.bdr.sh - rbdr/super-polarity/blob - src/main.c
97d1e38facb0e054e792dff023ba7ce5f343f534
5 // Created by Ruben Beltran del Rio on 8/13/13.
6 // Copyright (c) 2013 Abuguet. All rights reserved.
14 // TODO: Move these guys to a config header file
15 #define SCREEN_WIDTH 640
16 #define SCREEN_HEIGHT 480
19 int main(int argc
, const char * argv
[])
22 // SDL Initialization. TODO: Should have an initializer.
24 SDL_Renderer
*renderer
;
30 if (SDL_Init(SDL_INIT_VIDEO
) < 0) {
31 printf("Could not initialize SDL");
35 window
= SDL_CreateWindow("Super Polarity", 50, 50, SCREEN_WIDTH
, SCREEN_HEIGHT
, SDL_WINDOW_OPENGL
| SDL_WINDOW_BORDERLESS
);
37 renderer
= SDL_CreateRenderer(window
, -1, 0);
43 startFrame
= SDL_GetTicks();
45 while (SDL_PollEvent(&event
)) {
46 if (event
.type
== SDL_QUIT
) {
51 endFrame
= SDL_GetTicks();
53 /* see if we have time to sleep */
54 delay
= 1000 / FPS
- (endFrame
- startFrame
);
55 if (delay
> 1000 / FPS
) {