The Game Engine
1
Main Page
Related Pages
Classes
Files
File List
File Members
Sprite.h
Go to the documentation of this file.
1
#ifndef __SPRITE_H__
2
#define __SPRITE_H__
3
#include <SDL/SDL.h>
4
#include <string>
5
#include "
fns.h
"
6
#include "
Actor.h
"
7
#include "
WorldObject.h
"
8
20
class
Sprite
:
public
WorldObject
21
{
22
public
:
23
Sprite
(std::string name,
Actor
actor,
bool
menuSprite=
false
);
24
~Sprite
();
25
30
void
setAnimation
(
int
animation) {
mActor
.
CurrentAnimation
= animation; }
31
36
SpriteFrame
*
getAnimation
() {
return
mActor
.
Animations
[
mActor
.
CurrentAnimation
]->Frames[
mActor
.
Frame
]; }
37
42
void
setFrame
(
int
frame) {
mActor
.
Frame
= frame; }
43
48
int
getFrame
() {
return
mActor
.
Frame
; }
49
54
void
setSpeed
(
float
speed) {
mSpeed
= speed; }
55
60
float
getSpeed
() {
return
mSpeed
;}
61
65
void
toggleAnim
() {
mAnimating
= !
mAnimating
; }
66
70
void
startAnim
() {
mAnimating
= 1; }
71
75
void
stopAnim
() {
mAnimating
= 0; }
76
80
void
rewind
() {
mActor
.
Frame
= 0; }
81
85
void
draw
();
86
90
void
drawCollisions
();
91
95
virtual
void
update
();
96
100
virtual
void
runBehavior
();
101
105
vector<Sprite*>
collisionWithSprites
(
string
name,
int
count = -1);
106
110
vector<CollisionObject*>&
getCollisionData
();
111
115
Point2D
getBasePos
();
116
120
Point2D
getCenterPos
();
121
125
virtual
WorldObjectType
getType
(){
return
SPRITE
; }
126
127
protected
:
129
bool
mAnimating
;
130
132
bool
mDrawn
;
133
135
float
mSpeed
;
136
138
Actor
mActor
;
139
};
140
#endif
Sprite.h
Generated on Tue Apr 16 2013 02:32:41 for The Game Engine by
1.8.3.1