Commit 0d2e9128 authored by Ari Trachtenberg's avatar Ari Trachtenberg
Browse files

Minor tweaks

parent 7f97bbe6
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -6,7 +6,7 @@
#define HW6_ANIMATED_H

/**
 * Represents an animated figure
 * An abstract class representing an animated figure.
 */
class Animated {
 public:
+13 −9
Original line number Diff line number Diff line
@@ -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();
+2 −2
Original line number Diff line number Diff line
@@ -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 {
+6 −1
Original line number Diff line number Diff line
@@ -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 {
+21 −17
Original line number Diff line number Diff line
@@ -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