Gerard-Meier

Boid hdr

Mar 2nd, 2011
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.74 KB | None | 0 0
  1. #ifndef BOID_H
  2. #define BOID_H
  3.  
  4. // Forward declarations:
  5. class Application;
  6. class Graphics;
  7.  
  8. #include "Vector2D.h"
  9. #include "Boid.h"
  10.  
  11. class Boid {
  12.     private:
  13.         Vector2D* lastPosition;
  14.         Vector2D* position;
  15.         Vector2D* velocity;
  16.         unsigned int color;
  17.         Application* owner;
  18.        
  19.     public:
  20.         Boid(Application* argOwner, int argX, int argY);
  21.         void update(void);
  22.         void draw(Graphics* g);
  23.        
  24.        
  25.         void setColor(unsigned int argColor) { color = argColor; }
  26.         Vector2D* getPosition() { return position; }   
  27.         Vector2D* getVelocity() { return velocity; }   
  28.        
  29.         Vector2D* getNormalizedDirection(void) {
  30.             Vector2D* direction = new Vector2D(velocity->x, velocity->y);
  31.             direction->normalize();
  32.             return direction;
  33.         }
  34. };
  35.  
  36.  
  37. #endif
Add Comment
Please, Sign In to add comment