*/
class Background : public WorldObject{
- private:
- Texture mBackground;///<Background Texture
+private:
+ ///<Background Texture
+ Texture mBackground;
+ /// Width of the background
int width;
+ /// Height of the background
int height;
+ /// Flag to determine whether or not a background should wrap
bool wrapping;
- vector<Collision*> collisionData;///<The collision data for this Background \todo implement collisions
+ ///The collision data for this Background \todo implement collisions
+ vector<Collision*> collisionData;
- public:
+public:
+ /**
+ Initializes the Background
+ \param name Name of the background for reference in the program
+ \param filename Name of the file in ArtAssets
+ \param wrap Whether you want the background to tile or not
+ \param ScreenPosition Position on the screen where the background should begin to draw.
+ */
Background( string name="default",
- string filename="bg.bmp",
- bool wrap=true,
- Point2D ScreenPosition=Point2D()
- );
- void draw();/**< Draw background. */
- void update();/**< Update to run each loop */
- string getName() { return mName; }/** Returns name. */
- void setName(string name) { mName = name; }/** Set Name. */
- int load(string name="default");///< Loads a Bacground by name.
+ string filename="bg.bmp",
+ bool wrap=true,
+ Point2D ScreenPosition=Point2D()
+ );
+
+ /**
+ Draw background.
+ */
+ void draw();
+
+ /**
+ Update to run each loop
+ */
+ void update();
+
+ /**
+ Returns name.
+ \return Name of the Background
+ */
+ string getName() { return mName; }
+
+ /**
+ Set Name.
+ \param name Name for the Background
+ */
+ void setName(string name) { mName = name; }
+
+ /**
+ Loads a Bacground by name.
+ \param name Name of the background to load (defaults to default)
+ */
+ int load(string name="default");
+
+ /**
+ Obtains the Background's position
+ \return Current position of the Background's top left corner
+ */
SizeD getPosition() {return mPos;}
+
+ /**
+ Obtains the Background's position
+ \return Current position of the Background's top left corner
+ */
void setWrap(bool tf);
+
+ /**
+ Returns whether the background wraps or not
+ \return Wrapping
+ */
bool getWrap();
- void drawCollisions();/**< Draws Collision data for the Object (from outside) */
+
+ /**
+ Draws Collision data for the Object (from outside)
+ */
+ void drawCollisions();
};
#endif
class Game
{
public:
- /** This Makes an instance of Game if there is not one and then returns it \return The level.*/
+ /**
+ This Makes an instance of Game if there is not one and then returns it
+ \return The level.
+ */
static Game* game();
- /** Decides whether or not to draw bounding boxes*/
+ /// Decides whether or not to draw bounding boxes
bool ShowCollisions;
- /** Decides whether or not to output FPS*/
+ /// Decides whether or not to output FPS
bool ShowFPS;
/**
*/
Font* getFont(int size, FontType type);
- /** Makes the game loop begin and load objects. */
+ /**
+ Makes the game loop begin and load objects.
+ */
void run();
- /** Returns the main screen to allow for drawing */
+ /**
+ Returns the main screen to allow for drawing \return Pointer to the SDL_Surface of the screen
+ */
SDL_Surface* Screen() { return mScreen; }
- /** Retrns the Current FPS of the game */
+ /**
+ Returns the Current FPS of the game \return Unsigned int representing the FPS
+ */
Uint32 getFPS() { return currentFPS; }
- /** The current Sprite selected by the game */
+ /// The current Sprite selected by the game
static Sprite* CurrentSprite;
- /** State of if the game should be paused or not. */
+ /// State of if the game should be paused or not.
bool Paused;
- /** The level that will be active next (for onloadFunctions)*/
+ /// The level that will be active next (for onloadFunctions)
Level* LoadingLevel;
protected:
Game();
~Game();
- /** This is the pointer to the Static Game object insuring only one */
+ /// This is the pointer to the Static Game object insuring only one
static Game* m_instance;
- /** Loads the game's resources. */
+ /**
+ Loads the game's resources.
+ */
void LoadResources();
private:
static const Uint32 waitTime;
-
- int mCurrentLevel;/**< Current Level index. */
- std::vector<Level*> mLevels;/**< Vector of pointers to all of the levels. \todo Make into map? */
- SDL_Surface *mScreen;/**< The surface to draw to. */
- map<string,Behavior*> mBehaviors;/**< This level's Behaviors */
+ /// Current Level index.
+ int mCurrentLevel;
+ /// Vector of pointers to all of the levels. \todo Make into map?
+ std::vector<Level*> mLevels;
+ /// The surface to draw to.
+ SDL_Surface *mScreen;
+ /// This level's Behaviors
+ map<string,Behavior*> mBehaviors;
map<int, Font*> mEnglishFonts;
map<int, Font*> mJapaneseFonts;
public:
Sprite(std::string name, Actor actor);
/**
- Changes to the specified animation beginning at 0.
- \param animation The index representing the animation to move to
+ Changes to the specified animation beginning at 0.
+ \param animation The index representing the animation to move to
*/
void setAnimation(int animation) { mActor.mCurrentAnimation = animation; }
/**
- Returns active animation. (actually the current frame within the animation) \todo see if this is slower maybe undo
- \return Pointer to the active Animation
+ Returns active animation. (actually the current frame within the animation) \todo see if this is slower maybe undo
+ \return Pointer to the active Animation
*/
SpriteFrame* getAnimation() { return &mActor.mAnimations[mActor.mCurrentAnimation]->mFrames[mActor.mFrame]; }
/**
- Changes to the specified frame of the animation beginning at 0.
- \param frame The frame of the animation to move to
+ Changes to the specified frame of the animation beginning at 0.
+ \param frame The frame of the animation to move to
*/
void setFrame(int frame) { mActor.mFrame = frame; }
/**
- Returns active frame.
- \return The index representing the Active Frame
+ Returns active frame.
+ \return The index representing the Active Frame
*/
int getFrame() { return mActor.mFrame; }
/**
- Sets the Sprite's speed.
- \param speed Speed for the sprite (directly correlates to number of pixels)
+ Sets the Sprite's speed.
+ \param speed Speed for the sprite (directly correlates to number of pixels)
*/
void setSpeed(float speed) { mSpeed = speed; }
/**
- Returns a Sprite's current speed.
- \return Speed of the Sprite
+ Returns a Sprite's current speed.
+ \return Speed of the Sprite
*/
float getSpeed() { return mSpeed;}
/**
- Pauses or resumes an animation.
+ Pauses or resumes an animation.
*/
void toggleAnim() { mAnimating = !mAnimating; }
- /**< Causes the animation to play. */
+ /**
+ Causes the animation to play.
+ */
void startAnim() {mAnimating = 1; }
- /**< Causes the animation to stop. */
+ /**
+ Causes the animation to stop.
+ */
void stopAnim() {mAnimating = 0; }
- /**< Resets the Sprite's animation to the first frame. */
+ /**
+ Resets the Sprite's animation to the first frame.
+ */
void rewind() {mActor.mFrame = 0; }
/**
- Draws Sprite.
+ Draws Sprite.
*/
void draw();
/**
- Draws Collision data for the Object (from outside)
+ Draws Collision data for the Object (from outside)
*/
void drawCollisions();
/**
- Update to run each loop
+ Update to run each loop
*/
void update();
/**
- Checks for collision with sprite of a given name.
+ Checks for collision with sprite of a given name.
*/
Sprite* collisionWithSprite(string name);
/**
- Returns collision data
+ Returns collision data
*/
vector<Collision*>& getCollisionData();