]> git.mmlx.us Git - IvanGame.git/commitdiff
Sprite now has scale
authorIvan Hernanez <iturtleman128@gmail.com>
Mon, 28 May 2012 04:56:07 +0000 (23:56 -0500)
committerIvan Hernanez <iturtleman128@gmail.com>
Mon, 28 May 2012 04:56:07 +0000 (23:56 -0500)
Sprite.cpp
Sprite.h
WorldObject.h

index ccc19a6c08899246ee6d4a42b0f091605836f8c5..3d15232e1cace4d74e90b3c5aa65b67b63e57138 100644 (file)
@@ -49,6 +49,7 @@ void Sprite::draw()
                glTranslated(mPos.x,mPos.y,0);//move to position
                glTranslated(frame->animationPeg.x,frame->animationPeg.y,0);//move back to where it was
                glRotatef(mAngle,0.0f,0.0f,1.0f);//rotate shape
+               glScaled(mScale);
                glTranslated(-frame->animationPeg.x,-frame->animationPeg.y,0);//place animation peg on origin
                glBindTexture(GL_TEXTURE_2D, frame->image);
                glBegin( GL_QUADS );
index ad75f001b871a52355229f735a6bd7309c7667f0..0bb6ab46343e431ea9309a21382987deeff81df8 100644 (file)
--- a/Sprite.h
+++ b/Sprite.h
@@ -21,13 +21,13 @@ class Sprite : public WorldObject
        SpriteFrame* getAnimation(){ return &mActor.mAnimations[mActor.mCurrentAnimation]->mFrames[mActor.mFrame]; }/**< returns active animation. (actually the current frame within the animation) \todo see if this is slower maybe undo */
        void setFrame(int frame) { mActor.mFrame = frame; }/**< cahnges to the specified frame of the animation beginning at 0. */
        int getFrame() { return mActor.mFrame; }/**< returns active frame. */
-       void setSpeed(float speed) {mSpeed = speed;}/**< sets the Sprite's speed. */
-       float getSpeed() {return mSpeed;}/**< returns a Sprite's current speed. */
-       std::string getName(){ return mName;}/**< returns the Sprite's name */
-       void toggleAnim(){ mAnimating = !mAnimating;}/**< Pauses or resumes an animation. */
-       void startAnim() {mAnimating = 1;}/**< Causes the animation to play. */
-       void stopAnim() {mAnimating = 0;}/**< Causes the animation to stop. */
-       void rewind() {mActor.mFrame = 0;}/**< Resets the Sprite's animation to the first frame. */
+       void setSpeed(float speed) { mSpeed = speed; }/**< sets the Sprite's speed. */
+       float getSpeed() { return mSpeed;}/**< returns a Sprite's current speed. */
+       std::string getName(){ return mName; }/**< returns the Sprite's name */
+       void toggleAnim(){ mAnimating = !mAnimating; }/**< Pauses or resumes an animation. */
+       void startAnim() {mAnimating = 1; }/**< Causes the animation to play. */
+       void stopAnim() {mAnimating = 0; }/**< Causes the animation to stop. */
+       void rewind() {mActor.mFrame = 0; }/**< Resets the Sprite's animation to the first frame. */
        void draw();/**< draws Sprite. */
        void drawCollisions();/**< Draws Collision data for the Object (from outside) */
        Sprite* collisionWithSprite(string name);/**< checks for collision with sprite of a given name. */
index 09794d033bcaa6b4629838728934c5f17bc78611..3995954f29f9421db4efc8bb1421735408b42c2f 100644 (file)
@@ -29,6 +29,7 @@ protected:
        bool mVisible;/**< Determine if Object should be visible */
        float mTransparency;/**< Transparency! */
        float mAngle;/**< Angle of rotation */
+       float mScale;/**< Scale for the sprite*/
        int ZOrder;/**< Stacking order. Determines what draws on top. \todo implement. */
 };
 #endif