Moved working systems into InGame

This commit is contained in:
Kayne Ruse
2013-04-29 17:25:56 +10:00
parent c9447fcf3b
commit ecdf658463
15 changed files with 186 additions and 151 deletions
+9 -2
View File
@@ -1,7 +1,7 @@
#include "sprite_sheet.h"
SpriteSheet::SpriteSheet(SDL_Surface* s, int w, int h)
: Image(s, {0, 0, (Uint16)w, (Uint16)h})
SpriteSheet::SpriteSheet(SDL_Surface* s, Uint16 w, Uint16 h)
: Image(s, {0, 0, w, h})
{
currentFrame = 0; maxFrames = GetSurface()->w / GetClipW();
currentStrip = 0; maxStrips = GetSurface()->h / GetClipH();
@@ -18,3 +18,10 @@ void SpriteSheet::Update(int delta) {
SetClipX(currentFrame * GetClipW());
SetClipY(currentStrip * GetClipH());
}
void SpriteSheet::SetSurface(SDL_Surface* s, Uint16 w, Uint16 h) {
Image::SetSurface(s, {0, 0, w, h});
currentFrame = 0; maxFrames = GetSurface()->w / GetClipW();
currentStrip = 0; maxStrips = GetSurface()->h / GetClipH();
interval = ticks = 0;
}