updated todos and began extending Point2D
authorIvan Hernandez <iturtleman128@gmail.com>
Fri, 17 Dec 2010 06:07:03 +0000 (00:07 -0600)
committerIvan Hernandez <iturtleman128@gmail.com>
Fri, 17 Dec 2010 06:07:03 +0000 (00:07 -0600)
Actor.h
Background.h
Level.h
LevelWorld.cpp
fns.cpp
fns.h

diff --git a/Actor.h b/Actor.h
index 26f4708..f928bcb 100644 (file)
--- a/Actor.h
+++ b/Actor.h
@@ -18,7 +18,6 @@ class Actor
        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:
index 23bf3d5..2742d6c 100644 (file)
@@ -18,8 +18,7 @@ class Background{
        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.
diff --git a/Level.h b/Level.h
index d0a089f..76f1ff5 100644 (file)
--- a/Level.h
+++ b/Level.h
@@ -29,7 +29,7 @@ public:
        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
index 34f77ae..5e36006 100644 (file)
@@ -1,7 +1,6 @@
 #include "LevelWorld.h"
 #include "fns.h"
 
-/// \todo set up a level to be poplulated from something.
 LevelWorld::LevelWorld(SDL_Surface* screen) :
        Level(screen, "World")
 {
diff --git a/fns.cpp b/fns.cpp
index 607f0bf..77c1115 100644 (file)
--- a/fns.cpp
+++ b/fns.cpp
@@ -40,6 +40,28 @@ SDL_Surface* LoadImage( std::string filename )
        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)
 {
diff --git a/fns.h b/fns.h
index 2047c42..d9d6423 100644 (file)
--- a/fns.h
+++ b/fns.h
@@ -9,7 +9,6 @@ using namespace std;
 
 SDL_Surface* LoadImage( std::string filename );/**< Loads supported images. */
 
-//class SizeD;
 /** 2D position or vector placed here because of general access*/
 class Point2D
 {
@@ -17,20 +16,24 @@ 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*/