aboutsummaryrefslogtreecommitdiff
path: root/gfx.cpp
diff options
context:
space:
mode:
authorBen Beltran <ben@nsovocal.com>2012-04-16 09:39:52 -0500
committerBen Beltran <ben@nsovocal.com>2012-04-16 09:39:52 -0500
commit10a0e290ac07524dc129cc2b227b0f9e95df0f8e (patch)
treeed518c45c45d96e37e28640f745496fffb8e1325 /gfx.cpp
first commit
Diffstat (limited to 'gfx.cpp')
-rwxr-xr-xgfx.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/gfx.cpp b/gfx.cpp
new file mode 100755
index 0000000..838803f
--- /dev/null
+++ b/gfx.cpp
@@ -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