summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan Manuel Tomas <jtomas1815@gmail.com>2022-01-12 01:12:23 -0300
committerJuan Manuel Tomas <jtomas1815@gmail.com>2022-01-12 01:12:23 -0300
commit8cea7cf2986a36d51c1ce81d36d2d7c3dffa071c (patch)
tree1b6e0af158f44179d3861e0b28ee97ea5e76a936
downloadcannons-8cea7cf2986a36d51c1ce81d36d2d7c3dffa071c.tar.gz
cannons-8cea7cf2986a36d51c1ce81d36d2d7c3dffa071c.zip
Initial Commit
-rw-r--r--.gitignore2
-rwxr-xr-xbuild.sh3
-rw-r--r--main.c31
-rw-r--r--test-map.bmpbin0 -> 2764854 bytes
4 files changed, 36 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..f0c9b81
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+*.o
+main
diff --git a/build.sh b/build.sh
new file mode 100755
index 0000000..d4db25e
--- /dev/null
+++ b/build.sh
@@ -0,0 +1,3 @@
+gcc -c main.c -o main.o
+gcc main.o -lSDL2 -o main
+./main
diff --git a/main.c b/main.c
new file mode 100644
index 0000000..0d14b64
--- /dev/null
+++ b/main.c
@@ -0,0 +1,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;
+}
diff --git a/test-map.bmp b/test-map.bmp
new file mode 100644
index 0000000..7632ee6
--- /dev/null
+++ b/test-map.bmp
Binary files differ