diff options
Diffstat (limited to 'gfx.cpp')
| -rwxr-xr-x | gfx.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
@@ -0,0 +1,24 @@ +#include "stdafx.h"
+
+/*Draws a rectangular surface (specify only the x and y)*/
+void Gfx::drawsurface(SDL_Surface *src, int dx, int dy, SDL_Surface *dst)
+{
+ SDL_Rect dst_rect;
+
+ dst_rect.x = dx; dst_rect.y = dy;
+ SDL_BlitSurface(src, NULL, dst, &dst_rect);
+}
+
+/*Draws a rectangular surface from sx,sy of swxsh dimensions to dx, dy*/
+void Gfx::drawsurface(int sx, int sy, int sw, int sh, SDL_Surface *src,
+ int dx, int dy, SDL_Surface *dst)
+{
+ SDL_Rect src_rect, dst_rect;
+
+ src_rect.x = sx; src_rect.y = sy;
+ src_rect.w = sw; src_rect.h = sh;
+ dst_rect.x = dx; dst_rect.y = dy;
+ SDL_BlitSurface(src, &src_rect, dst, &dst_rect);
+
+
+}
\ No newline at end of file |