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 +++++++-- gfx.o | Bin 9008 -> 9328 bytes gui.cpp | 3 ++- gui.o | Bin 92736 -> 92744 bytes libgfx.a | Bin 9470 -> 9840 bytes libgui.a | Bin 103782 -> 103790 bytes 6 files changed, 9 insertions(+), 3 deletions(-) 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; diff --git a/gfx.o b/gfx.o index 485e58e..7ff5ff5 100644 Binary files a/gfx.o and b/gfx.o differ diff --git a/gui.cpp b/gui.cpp index 30889b9..82feb94 100644 --- a/gui.cpp +++ b/gui.cpp @@ -63,8 +63,9 @@ int butt::press(int x, int y) { int c = boxes.check(x, y); if (c != -1) { states[c] = states[c] ^ TOGGLE; + return 0; } - return 0; + return -1; } //doesn't do anything for now because just press will do the trick int butt::unpress(int index) { diff --git a/gui.o b/gui.o index 7032d20..ed22f81 100644 Binary files a/gui.o and b/gui.o differ diff --git a/libgfx.a b/libgfx.a index 2964b8d..1ef166d 100644 Binary files a/libgfx.a and b/libgfx.a differ diff --git a/libgui.a b/libgui.a index 0b25307..65325c6 100644 Binary files a/libgui.a and b/libgui.a differ -- cgit v1.1