From 11fed0a893f0875ed4c643215db738b491aa170e Mon Sep 17 00:00:00 2001 From: knolax <1339802534.kk@gmail.com> Date: Tue, 7 Mar 2017 12:06:19 -0500 Subject: fixed blending of draw --- gfx.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'gfx.cpp') diff --git a/gfx.cpp b/gfx.cpp index ca597d5..1a8649e 100644 --- a/gfx.cpp +++ b/gfx.cpp @@ -4,6 +4,8 @@ SDL_Window *mwindowp; // main window were everything foes SDL_DisplayMode * screenp; SDL_Renderer * renderp; TTF_Font * fontp; +SDL_Surface * msurface; +bool surface; int maxx; int maxy; int initgfx(int x, int y,const char * title) { @@ -34,6 +36,9 @@ int initgfx(int x, int y,const char * title) { } return 0; } +int surfacerender(int w, int h) { + msurface = SDL_CreateRGBSurface(0, w, h, 32, 0xff000000, 0x00ff0000, 0x0000ff00, 0x000000ff); +} //two draw functions for convenience int drawimg(int x, int y, int w, int h,SDL_Texture * tex) { SDL_Rect r; @@ -55,7 +60,7 @@ SDL_Texture * loadtexture(const char * file) { SDL_Texture * ttp; tsp = SDL_LoadBMP(file); ttp = SDL_CreateTextureFromSurface(renderp, tsp); - SDL_SetTextureBlendMode(ttp, SDL_BLENDMODE_ADD); + SDL_SetTextureBlendMode(ttp, SDL_BLENDMODE_BLEND); SDL_FreeSurface(tsp); return ttp; } @@ -98,7 +103,7 @@ int drawrect (int x, int y, int w, int h,int r, int g, int b, int a) { rect.w = w; rect.h = h; SDL_SetRenderDrawColor(renderp,r,g,b,a); - SDL_SetRenderDrawBlendMode(renderp, SDL_BLENDMODE_ADD); + SDL_SetRenderDrawBlendMode(renderp, SDL_BLENDMODE_BLEND); SDL_RenderFillRect(renderp,&rect); SDL_SetRenderDrawColor(renderp,0,0,0,255); return 0; -- cgit v1.1