summaryrefslogtreecommitdiff
path: root/main.c
blob: 0d14b641b1366560a51fab02678b847fee3a8d7e (plain)
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 <stdio.h>
#include <SDL2/SDL.h>

int main() {
	SDL_Init(SDL_INIT_VIDEO);

	SDL_Window *window = SDL_CreateWindow("Cannons",
			SDL_WINDOWPOS_UNDEFINED,
			SDL_WINDOWPOS_UNDEFINED,
			1280,
			720,
			0);

	SDL_Renderer *context = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);

	SDL_SetRenderDrawColor(context, 40, 40, 40, 255);
	SDL_RenderClear(context);

	SDL_Surface *map_surface = SDL_LoadBMP("test-map.bmp");
	SDL_Texture *map = SDL_CreateTextureFromSurface(context, map_surface);
	SDL_RenderCopy(context, map, 0, 0);

	SDL_RenderPresent(context);

	SDL_Delay(1000);

	SDL_DestroyRenderer(context);
	SDL_DestroyWindow(window);
	SDL_Quit();
	return 0;
}