Loading Shapes/Animated.h +1 −1 Original line number Diff line number Diff line Loading @@ -6,7 +6,7 @@ #define HW6_ANIMATED_H /** * Represents an animated figure * An abstract class representing an animated figure. */ class Animated { public: Loading Shapes/El/AnimatedEl.h +13 −9 Original line number Diff line number Diff line Loading @@ -9,9 +9,13 @@ #include "El.h" namespace draw { /** * Represents an animated El shape. */ class AnimatedEl : public El, public Animated { public: explicit AnimatedEl(Color theColor, int theX1 = 0, int theY1 = 0, float theLen = 0, float theAngle = 0) : El(theColor, theX1, theY1, theLen, theAngle) {} explicit AnimatedEl(Color theColor, int theX1 = 0, int theY1 = 0, float theLen = 0, float theAngle = 0) : El(theColor, theX1, theY1, theLen, theAngle) {} void draw() override { update(); Loading Shapes/El/BoundedMovingRotatingEl.h +2 −2 Original line number Diff line number Diff line Loading @@ -31,8 +31,8 @@ class BoundedMovingRotatingEl : virtual public MovingEl, virtual public Rotating float theYVel = 3) : MovingEl(theColor, theX1, theY1, theLen, theAngle, theXVel, theYVel), RotatingEl(theColor, theX1, theY1, theLen, theAngle, theAngleVel), AnimatedEl(theColor, theX1, theY1, theLen, theAngle), RotatingEl(theColor, (int) theX1, (int) theY1, theLen, theAngle, theAngleVel), AnimatedEl(theColor, (int) theX1, (int) theY1, theLen, theAngle), myBounds(theBounds) {} void update() override { Loading Shapes/El/RotatingEl.h +6 −1 Original line number Diff line number Diff line Loading @@ -19,7 +19,12 @@ class RotatingEl : virtual public AnimatedEl { * @param theAngVel angular velocity of the El, in radians / frame. * Note: The variable {@link Window#FRAME_RATE} determines the number of frames per second. */ explicit RotatingEl(Color theColor, int theX1 = 0, int theY1 = 0, float theLen = 0, float theAngle = 0, float theAngVel = 0.01) explicit RotatingEl(Color theColor, int theX1 = 0, int theY1 = 0, float theLen = 0, float theAngle = 0, float theAngVel = 0.01) : AnimatedEl(theColor, theX1, theY1, theLen, theAngle), myAngVel(theAngVel) {} void update() override { Loading Shapes/El/RotatingSensingEl.h +21 −17 Original line number Diff line number Diff line Loading @@ -14,10 +14,14 @@ namespace draw { */ class RotatingSensingEl : public RotatingEl { public: RotatingSensingEl(Color theColor, int theX1 = 0, int theY1 = 0, float theLen = 0, float theAngle = 0, float theAngVel = 0.01): RotatingSensingEl(Color theColor, int theX1 = 0, int theY1 = 0, float theLen = 0, float theAngle = 0, float theAngVel = 0.01) : RotatingEl(theColor, theX1, theY1, theLen, theAngle, theAngVel), AnimatedEl(theColor, theX1, theY1, theLen, theAngle) {} AnimatedEl(theColor, theX1, theY1, theLen, theAngle) {} /** * If the left mouse button is pressed, change the direction of the El's rotation Loading Loading
Shapes/Animated.h +1 −1 Original line number Diff line number Diff line Loading @@ -6,7 +6,7 @@ #define HW6_ANIMATED_H /** * Represents an animated figure * An abstract class representing an animated figure. */ class Animated { public: Loading
Shapes/El/AnimatedEl.h +13 −9 Original line number Diff line number Diff line Loading @@ -9,9 +9,13 @@ #include "El.h" namespace draw { /** * Represents an animated El shape. */ class AnimatedEl : public El, public Animated { public: explicit AnimatedEl(Color theColor, int theX1 = 0, int theY1 = 0, float theLen = 0, float theAngle = 0) : El(theColor, theX1, theY1, theLen, theAngle) {} explicit AnimatedEl(Color theColor, int theX1 = 0, int theY1 = 0, float theLen = 0, float theAngle = 0) : El(theColor, theX1, theY1, theLen, theAngle) {} void draw() override { update(); Loading
Shapes/El/BoundedMovingRotatingEl.h +2 −2 Original line number Diff line number Diff line Loading @@ -31,8 +31,8 @@ class BoundedMovingRotatingEl : virtual public MovingEl, virtual public Rotating float theYVel = 3) : MovingEl(theColor, theX1, theY1, theLen, theAngle, theXVel, theYVel), RotatingEl(theColor, theX1, theY1, theLen, theAngle, theAngleVel), AnimatedEl(theColor, theX1, theY1, theLen, theAngle), RotatingEl(theColor, (int) theX1, (int) theY1, theLen, theAngle, theAngleVel), AnimatedEl(theColor, (int) theX1, (int) theY1, theLen, theAngle), myBounds(theBounds) {} void update() override { Loading
Shapes/El/RotatingEl.h +6 −1 Original line number Diff line number Diff line Loading @@ -19,7 +19,12 @@ class RotatingEl : virtual public AnimatedEl { * @param theAngVel angular velocity of the El, in radians / frame. * Note: The variable {@link Window#FRAME_RATE} determines the number of frames per second. */ explicit RotatingEl(Color theColor, int theX1 = 0, int theY1 = 0, float theLen = 0, float theAngle = 0, float theAngVel = 0.01) explicit RotatingEl(Color theColor, int theX1 = 0, int theY1 = 0, float theLen = 0, float theAngle = 0, float theAngVel = 0.01) : AnimatedEl(theColor, theX1, theY1, theLen, theAngle), myAngVel(theAngVel) {} void update() override { Loading
Shapes/El/RotatingSensingEl.h +21 −17 Original line number Diff line number Diff line Loading @@ -14,10 +14,14 @@ namespace draw { */ class RotatingSensingEl : public RotatingEl { public: RotatingSensingEl(Color theColor, int theX1 = 0, int theY1 = 0, float theLen = 0, float theAngle = 0, float theAngVel = 0.01): RotatingSensingEl(Color theColor, int theX1 = 0, int theY1 = 0, float theLen = 0, float theAngle = 0, float theAngVel = 0.01) : RotatingEl(theColor, theX1, theY1, theLen, theAngle, theAngVel), AnimatedEl(theColor, theX1, theY1, theLen, theAngle) {} AnimatedEl(theColor, theX1, theY1, theLen, theAngle) {} /** * If the left mouse button is pressed, change the direction of the El's rotation Loading