diff options
author | Juan Manuel Tomas <jtomas1815@gmail.com> | 2022-01-14 09:56:40 -0300 |
---|---|---|
committer | Juan Manuel Tomas <jtomas1815@gmail.com> | 2022-01-14 09:56:40 -0300 |
commit | 29145a136faf9acd7442708741fd26bb56dba66f (patch) | |
tree | 9f27ed2d7355f9623d927482a1dfb83c6c36f60a /main.c | |
parent | f3f382fe4f3a6b074be6fead547f149cafc113d9 (diff) | |
download | cannons-29145a136faf9acd7442708741fd26bb56dba66f.tar.gz cannons-29145a136faf9acd7442708741fd26bb56dba66f.zip |
Add mask array
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -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); |