5 // Created by Ruben Beltran del Rio on 8/13/13.
6 // Copyright (c) 2013 Abuguet. All rights reserved.
13 #include "SDL2_image/SDL_image.h"
15 // TODO: Move these guys to a config header file
16 #define SCREEN_WIDTH 640
17 #define SCREEN_HEIGHT 480
21 SDL_Renderer
*renderer
;
25 if (SDL_Init(SDL_INIT_VIDEO
) < 0) {
26 printf("Could not initialize SDL");
30 // Load the window and renderer
31 window
= SDL_CreateWindow("Super Polarity", SDL_WINDOWPOS_CENTERED
, SDL_WINDOWPOS_CENTERED
, 0, 0, SDL_WINDOW_OPENGL
| SDL_WINDOW_FULLSCREEN_DESKTOP
);
33 renderer
= SDL_CreateRenderer(window
, -1, 0);
35 // Set linear quality for scaling, and the "logical" window size.
36 SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY
, "linear");
37 SDL_RenderSetLogicalSize(renderer
, SCREEN_WIDTH
, SCREEN_HEIGHT
);
40 // benHead = IMG_Load("data/img/static/ben.png");
43 void render (SDL_Renderer
*renderer
) {
44 SDL_SetRenderDrawColor(renderer
, 255, 255, 255, 255);
45 SDL_RenderClear(renderer
);
46 SDL_RenderPresent(renderer
);
49 int mainC(int argc
, const char * argv
[])
52 // SDL Initialization. TODO: Should have an initializer.
63 startFrame
= SDL_GetTicks();
65 while (SDL_PollEvent(&event
)) {
66 if (event
.type
== SDL_QUIT
) {
73 endFrame
= SDL_GetTicks();
75 /* see if we have time to sleep */
76 delay
= 1000 / FPS
- (endFrame
- startFrame
);
77 if (delay
> 1000 / FPS
) {