Actor(Animation *anim);
int mFrame;/**< The frame # */
int mCurrentAnimation;/**< Index to the current loaded animation */
- int mAnimation;/**< \todo See if this is used anywhere. Else Del */
std::vector<Animation*> mAnimations;/**< Vector of pointers to all of this sprite's Animations */
private:
SizeD _imageSize;///<The actual background image's full size.
SDL_Surface *mBackground;///<pointer to the actual screen
- /** \todo _sections;//if needed */
- SDL_Surface *mScreen;//<\todo see about a way to know about the screen without passing around the value (though this is probably most cost effective processor-wise)
+ SDL_Surface *mScreen;///< The screen to be drawn to.
Point2D mPos;///<The current (x,y) position
SizeD mScreenSize;///<This is the size of the screen to be drawn to. used to get the sections of the background when moving and for screen-at-a-time scrolling.
SDL_Rect source;///< This is the rectangle that gets taken from the actual background image (h,w) determine the size of the rectangle to sample from the background image. (x,y) determine the position of the rectangle's top left corner on the actual background image.
virtual void drawScene();/**< Draws everything that is set to draw on the screen. */
void LoadBG(string name);/**< Loads the Background. */
virtual void postEvent(SDL_Event event);/**< Passes along SDL events */
- virtual void update();/**< Loop that runs every game frame that calculates movement, placement, etc. \todo make this be abstract so that levels are based off this class.*/
+ virtual void update();/**< Loop that runs every game frame that calculates movement, placement, etc. */
void addSprite(Sprite* sp);///< add a Sprite to the list of sprites
void removeSprite(Sprite* sp);///< remove the Sprite sp from the list of sprites
void addActor(string name, Actor actor);///< add a Actor to the list of sprites
#include "LevelWorld.h"
#include "fns.h"
-/// \todo set up a level to be poplulated from something.
LevelWorld::LevelWorld(SDL_Surface* screen) :
Level(screen, "World")
{
return compatible_image;
}
+double Point2D::length(){
+ return sqrt(X*X + Y*Y);///< \todo find math.sqrt
+}
+
+Point2D Point2D::add(Point2D pt){
+ X += pt.X;
+ Y += pt.Y;
+}
+Point2D Point2D::sub(Point2D pt){
+ X -= pt.X;
+ Y -= pt.Y;
+}
+Point2D Point2D::mult(double d){
+ X *= d;
+ Y *= d;
+}
+Point2D Point2D::div(double d){
+ X /= d;
+ Y /= d;
+}
+
+
/*
template<class T> string to_string(const T& t)
{
SDL_Surface* LoadImage( std::string filename );/**< Loads supported images. */
-//class SizeD;
/** 2D position or vector placed here because of general access*/
class Point2D
{
friend class SizeD;
Point2D ():X(0),Y(0){}
Point2D (double x, double y):X(x),Y(y){}
- Point2D (const Point2D& copy)/**< Copy object */
+ Point2D (const Point2D& copy)///< Copy object
{
X = copy.X;
Y = copy.Y;
}
-// Point2D (const SizeD& copy)/**< Copy object */ /// \todo make SizeD work here
-/* {
- X = copy.width;
- Y = copy.height;
- }
-*/
+ Point2D (/*const SizeD& copy*/int i);///< Copy object \todo make SizeD work here
+
/** \todo add typical vector functionality like length, nomal vectors etc. */
double X;/**< X position */
double Y;/**< Y Position */
+ double length();/**< The length of the Point (from origin)
+ \return length of the vector/point
+ */
+ Point2D add(Point2D pt);/**< Adds the value of the point to this \return This after modificaiton*/
+ Point2D sub(Point2D pt);/**< Subtracts the value of the point from this \return This after modification*/
+ Point2D mult(double d);/**< Multiplies the values of this by i \return This after modificaiton*/
+ Point2D div(double d);/**< Divides the values of this by i \return This after modificaiton*/
+
};
/** Just for more logical names for sizes of objects*/