summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorJuan Manuel Tomas <jtomas1815@gmail.com>2022-01-14 09:56:40 -0300
committerJuan Manuel Tomas <jtomas1815@gmail.com>2022-01-14 09:56:40 -0300
commit29145a136faf9acd7442708741fd26bb56dba66f (patch)
tree9f27ed2d7355f9623d927482a1dfb83c6c36f60a /main.c
parentf3f382fe4f3a6b074be6fead547f149cafc113d9 (diff)
downloadcannons-29145a136faf9acd7442708741fd26bb56dba66f.tar.gz
cannons-29145a136faf9acd7442708741fd26bb56dba66f.zip
Add mask array
Diffstat (limited to 'main.c')
-rw-r--r--main.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/main.c b/main.c
index 0f5f4c7..b3824f4 100644
--- a/main.c
+++ b/main.c
@@ -1,4 +1,5 @@
#include <stdio.h>
+#include <stdlib.h>
#include <SDL2/SDL.h>
#define WINDOW_W 1280
@@ -46,6 +47,7 @@ int main() {
// TODO:
// - Map has a mask generated by the game, of where the terrain (foregroud) exists
+ float *mask = calloc(WINDOW_W * WINDOW_H, 4);
int exit = 0;
while (!exit) {
@@ -55,7 +57,13 @@ int main() {
exit = 1;
}
}
- SDL_RenderCopy(context, foreground, 0, 0);
+ SDL_RenderCopy(context, background, 0, 0);
+ SDL_SetRenderTarget(context, foreground);
+
+ // TODO: Get masking right
+ SDL_SetTextureBlendMode(mask_texture, SDL_BLENDMODE_MUL);
+ SDL_RenderCopy(context, mask_texture, 0, 0);
+ SDL_SetRenderTarget(context, 0);
SDL_RenderPresent(context);
SDL_Delay(10);