]> git.localhorst.tv Git - l2e.git/blob - src/graphics/Sprite.cpp
added simple sprite class
[l2e.git] / src / graphics / Sprite.cpp
1 /*
2  * Sprite.cpp
3  *
4  *  Created on: Aug 5, 2012
5  *      Author: holy
6  */
7
8 #include "Sprite.h"
9
10 namespace graphics {
11
12 void Sprite::Draw(SDL_Surface *dest, int x, int y, int col, int row) const {
13         SDL_Rect srcRect, destRect;
14         srcRect.x = col * Width();
15         srcRect.y = row * Height();
16         srcRect.w = Width();
17         srcRect.h = Height();
18         destRect.x = x;
19         destRect.y = y;
20         destRect.w = Width();
21         destRect.h = Height();
22         SDL_BlitSurface(surface, &srcRect, dest, &destRect);
23 }
24
25 }