#include <time.h>
#include "SDL2/SDL.h"
+#include "SDL2_image/SDL_image.h"
// TODO: Move these guys to a config header file
#define SCREEN_WIDTH 640
#define SCREEN_HEIGHT 480
#define FPS 30
-int main(int argc, const char * argv[])
-{
-
- // SDL Initialization. TODO: Should have an initializer.
- SDL_Window *window;
- SDL_Renderer *renderer;
- Uint32 startFrame;
- Uint32 endFrame;
- Uint32 delay;
- int done;
-
+SDL_Window *window;
+SDL_Renderer *renderer;
+SDL_Surface *benHead;
+
+void init () {
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
printf("Could not initialize SDL");
exit(1);
}
- window = SDL_CreateWindow("Super Polarity", 50, 50, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_OPENGL | SDL_WINDOW_BORDERLESS);
+ // Load the window and renderer
+ window = SDL_CreateWindow("Super Polarity", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 0, 0, SDL_WINDOW_OPENGL | SDL_WINDOW_FULLSCREEN_DESKTOP);
renderer = SDL_CreateRenderer(window, -1, 0);
+ // Set linear quality for scaling, and the "logical" window size.
+ SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "linear");
+ SDL_RenderSetLogicalSize(renderer, SCREEN_WIDTH, SCREEN_HEIGHT);
+
+ // Load the surface.
+ // benHead = IMG_Load("data/img/static/ben.png");
+}
+
+void render (SDL_Renderer *renderer) {
+ SDL_SetRenderDrawColor(renderer, 255, 255, 255, 255);
+ SDL_RenderClear(renderer);
+ SDL_RenderPresent(renderer);
+}
+
+int mainC(int argc, const char * argv[])
+{
+
+ // SDL Initialization. TODO: Should have an initializer.
+ Uint32 startFrame;
+ Uint32 endFrame;
+ Uint32 delay;
+ int done;
+
+
done = 0;
// Event Loop.
}
}
+ render(renderer);
+
endFrame = SDL_GetTicks();
/* see if we have time to sleep */