I’m in and what I started with

I haven’t started yet. I was trying to make stuff using SDL2 a while back and had some skeleton code – don’t think I’ll end up making much, but In the interests of full disclosure, here is the entirety of the code I’ve written before the start of the competition.

Makefile:

all:
g++ `sdl2-config –cppflags` `sdl2-config –libs` -o ld30 main.cpp

main.cpp:

#include <SDL2/SDL.h>
#include <iostream>

using namespace std;

int main(int argc, char *args[]) {
// initialise
bool running = true;

SDL_Event event;

if (SDL_Init(SDL_INIT_EVERYTHING) < 0) {
cerr << “Error in SDL_Init: ” << SDL_GetError() << endl;
return EXIT_FAILURE;
}
SDL_Window* screen = SDL_CreateWindow(“LD30”, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 480, 0);
if (screen == NULL) {
cerr << “Error in SDL_CreateWindow: ” << SDL_GetError() << endl;
return EXIT_FAILURE;
}
SDL_Renderer* renderer = SDL_CreateRenderer(screen, -1, 0);
if (renderer == NULL) {
cerr << “Error in SDL_CreateRenderer: ” << SDL_GetError() << endl;
return EXIT_FAILURE;
}
SDL_SetRenderDrawColor(renderer, 0, 0, 255, 255);
SDL_RenderClear(renderer);
SDL_RenderPresent(renderer);

while(running) {
// events
while(SDL_PollEvent(&event)) {
if(event.type == SDL_QUIT) {
running = false;
}
}

}

// cleanup
SDL_Quit();

return 0;
}

Impressive, huh? Feel free to re-use and good luck out there! We all start somewhere. The indentation broke, but I’m not going back to fix it :)