]> git.localhorst.tv Git - l2e.git/blob - src/graphics/Sprite.cpp
afd6209546c3a6bdcb8f359f43e89dd8c75ec8c5
[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 using geometry::Point;
11
12 namespace graphics {
13
14 void Sprite::Draw(SDL_Surface *dest, Point<int> position, int col, int row) const {
15         SDL_Rect srcRect, destRect;
16         srcRect.x = col * Width();
17         srcRect.y = row * Height();
18         srcRect.w = Width();
19         srcRect.h = Height();
20         destRect.x = position.X();
21         destRect.y = position.Y();
22         destRect.w = Width();
23         destRect.h = Height();
24         SDL_BlitSurface(surface, &srcRect, dest, &destRect);
25 }
26
27 }