Jamie Slowgrove - MGP Assignment 2 - JAM
 All Classes Namespaces Files Functions Variables Macros
Flocking.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <SDL.h>
4 #include <time.h>
5 #include <vector>
6 #include "Texture.h"
7 #include "Particle.h"
8 #include "Vec2.h"
9 #include "Utilities.h"
10 
17 {
18 private:
22  std::vector<JAM_Particle*> boids;
28  float maxVel;
31 
37  JAM_Vec2 rule1(int index);
38 
44  JAM_Vec2 rule2(int index);
45 
51  JAM_Vec2 rule3(int index);
52 
58  JAM_Vec2 roughBoundaries(int index);
59 
64  void limitVelocity(int index);
65 
66 public:
76  JAM_Flocking(int numberOfBoids, JAM_Texture* texture, int xBoundary, int yBoundary, float maxVel, int screenHeight);
77 
81  ~JAM_Flocking();
82 
87  void update(float dt);
88 
93  void draw(SDL_Renderer* renderer);
94 
99  void setRule1(int applyRule1);
100 
105  void setRule2(int applyRule2);
106 
111  void setRule3(int applyRule3);
112 };
JAM_Flocking(int numberOfBoids, JAM_Texture *texture, int xBoundary, int yBoundary, float maxVel, int screenHeight)
Definition: Flocking.cpp:7
int yBoundary
Definition: Flocking.h:26
int applyRule1
Definition: Flocking.h:24
Creates a Texture for use with a renderer. Creates a Texture from an image file, this can then be use...
Definition: Texture.h:13
void draw(SDL_Renderer *renderer)
Definition: Flocking.cpp:82
int applyRule2
Definition: Flocking.h:24
void setRule2(int applyRule2)
Definition: Flocking.cpp:258
void setRule3(int applyRule3)
Definition: Flocking.cpp:267
JAM_Vec2 roughBoundaries(int index)
Definition: Flocking.cpp:187
JAM_Vec2 rule3(int index)
Definition: Flocking.cpp:158
void limitVelocity(int index)
Definition: Flocking.cpp:225
void update(float dt)
Definition: Flocking.cpp:49
Creates a Flocking object.
Definition: Flocking.h:16
int screenHeight
Definition: Flocking.h:30
void setRule1(int applyRule1)
Definition: Flocking.cpp:249
JAM_Vec2 rule1(int index)
Definition: Flocking.cpp:95
JAM_Vec2 rule2(int index)
Definition: Flocking.cpp:126
std::vector< JAM_Particle * > boids
Definition: Flocking.h:22
int xBoundary
Definition: Flocking.h:26
float maxVel
Definition: Flocking.h:28
~JAM_Flocking()
Definition: Flocking.cpp:37
int applyRule3
Definition: Flocking.h:24
Creates an Vec2 structure with functions. Creates an Vec2 structure with overloaded operators to crea...
Definition: Vec2.h:9
JAM_Texture * whiteSquare
Definition: Flocking.h:20