From 10a0e290ac07524dc129cc2b227b0f9e95df0f8e Mon Sep 17 00:00:00 2001 From: Ben Beltran Date: Mon, 16 Apr 2012 09:39:52 -0500 Subject: first commit --- gfx.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 gfx.cpp (limited to 'gfx.cpp') 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 -- cgit