From 29145a136faf9acd7442708741fd26bb56dba66f Mon Sep 17 00:00:00 2001 From: Juan Manuel Tomas Date: Fri, 14 Jan 2022 09:56:40 -0300 Subject: Add mask array --- main.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'main.c') diff --git a/main.c b/main.c index 0f5f4c7..b3824f4 100644 --- a/main.c +++ b/main.c @@ -1,4 +1,5 @@ #include +#include #include #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); -- cgit v1.2.3