]> git.mmlx.us Git - IvanGame.git/commitdiff
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 26f4708c122cfb9d99b5633bc997503af6ad40dd..f928bcb648b058ca7a451bd191154c3d4de85031 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 23bf3d581829ce33aa812cec3efff01a339a7545..2742d6c33652395120d9eb704329b9095370c300 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 d0a089f69f29c309f4f2c415f1ab5fb61d400ef8..76f1ff5c1df6b1dd6916908a9c2ec894e5e7628e 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 34f77aebabefb36f1911ee354025fc294e3981c7..5e3600629d7cdbed2450e9e20f0055641d7bb9a8 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 607f0bfd3dfdcfe7cf0d3e27566570f19f07f29d..77c111509f857d0370cedeb17b809ea56cf2992e 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 2047c42f788e55c298b9e6615caafa4a5242a7c9..d9d6423e9abd434d59e2ba4e66c8c0dea16bd24f 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*/