summaryrefslogtreecommitdiff
path: root/gfx.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'gfx.cpp')
-rw-r--r--gfx.cpp9
1 files changed, 7 insertions, 2 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;