Creates a Flocking object.  
 More...
#include <Flocking.h>
Creates a Flocking object. 
- Author
 - Jamie Slowgrove Reference ~ This code is based upon Pseudo code from https://www.macs.hw.ac.uk/~dwcorne/Teaching/Boids%20Pseudocode.htm 
 
 
      
        
          | JAM_Flocking::JAM_Flocking  | 
          ( | 
          int  | 
          numberOfBoids,  | 
        
        
           | 
           | 
          JAM_Texture *  | 
          texture,  | 
        
        
           | 
           | 
          int  | 
          xBoundary,  | 
        
        
           | 
           | 
          int  | 
          yBoundary,  | 
        
        
           | 
           | 
          float  | 
          maxVel,  | 
        
        
           | 
           | 
          int  | 
          screenHeight  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
Constructs the Flocking object. 
- Parameters
 - 
  
    | numberOfBoids | The number of boids.  | 
    | texture | A pointer to the texture for the boids.  | 
    | xBoundary | The rough x boundary of the boids.  | 
    | yBoundary | The rough y boundary of the boids.  | 
    | maxVel | The maximum velocity of the boids.  | 
    | screenHeight | The screen height.  | 
  
   
 
 
      
        
          | JAM_Flocking::~JAM_Flocking  | 
          ( | 
           | ) | 
           | 
        
      
 
Destructs the Flocking object. 
 
 
      
        
          | void JAM_Flocking::draw  | 
          ( | 
          SDL_Renderer *  | 
          renderer | ) | 
           | 
        
      
 
Draws the Flocking. 
- Parameters
 - 
  
    | renderer | A pointer to the renderer.  | 
  
   
 
 
  
  
      
        
          | void JAM_Flocking::limitVelocity  | 
          ( | 
          int  | 
          index | ) | 
           | 
         
       
   | 
  
private   | 
  
 
Limits the Boid velocity. 
- Parameters
 - 
  
    | index | The index of the Boid to test.  | 
  
   
 
 
  
  
      
        
          | JAM_Vec2 JAM_Flocking::roughBoundaries  | 
          ( | 
          int  | 
          index | ) | 
           | 
         
       
   | 
  
private   | 
  
 
Applies Boid rough boundaries. 
- Parameters
 - 
  
    | index | The index of the Boid to test.  | 
  
   
- Returns
 - The resultant velocity of the boundary. 
 
 
 
  
  
      
        
          | JAM_Vec2 JAM_Flocking::rule1  | 
          ( | 
          int  | 
          index | ) | 
           | 
         
       
   | 
  
private   | 
  
 
Applies Boid Rule 1. 
- Parameters
 - 
  
    | index | The index of the Boid to test.  | 
  
   
- Returns
 - The resultant velocity of the rule. 
 
 
 
  
  
      
        
          | JAM_Vec2 JAM_Flocking::rule2  | 
          ( | 
          int  | 
          index | ) | 
           | 
         
       
   | 
  
private   | 
  
 
Applies Boid Rule 2. 
- Parameters
 - 
  
    | index | The index of the Boid to test.  | 
  
   
- Returns
 - The resultant velocity of the rule. 
 
 
 
  
  
      
        
          | JAM_Vec2 JAM_Flocking::rule3  | 
          ( | 
          int  | 
          index | ) | 
           | 
         
       
   | 
  
private   | 
  
 
Applies Boid Rule 3. 
- Parameters
 - 
  
    | index | The index of the Boid to test.  | 
  
   
- Returns
 - The resultant velocity of the rule. 
 
 
 
      
        
          | void JAM_Flocking::setRule1  | 
          ( | 
          int  | 
          applyRule1 | ) | 
           | 
        
      
 
Setter # Set applyRule1. 
- Parameters
 - 
  
    | applyRule1 | What to do with the rule. (1 == possitve, 0 = neutral, -1 == negative)  | 
  
   
 
 
      
        
          | void JAM_Flocking::setRule2  | 
          ( | 
          int  | 
          applyRule2 | ) | 
           | 
        
      
 
Setter # Set applyRule2. 
- Parameters
 - 
  
    | applyRule2 | What to do with the rule. (1 == possitve, 0 = neutral, -1 == negative)  | 
  
   
 
 
      
        
          | void JAM_Flocking::setRule3  | 
          ( | 
          int  | 
          applyRule3 | ) | 
           | 
        
      
 
Setter # Set applyRule3. 
- Parameters
 - 
  
    | applyRule3 | What to do with the rule. (1 == possitve, 0 = neutral, -1 == negative)  | 
  
   
 
 
      
        
          | void JAM_Flocking::update  | 
          ( | 
          float  | 
          dt | ) | 
           | 
        
      
 
A function that updates the Flocking. 
- Parameters
 - 
  
  
 
 
 
  
  
      
        
          | int JAM_Flocking::applyRule1 | 
         
       
   | 
  
private   | 
  
 
What to do with the rule. (1 == possitve, 0 = neutral, -1 == negative) 
 
 
  
  
      
        
          | int JAM_Flocking::applyRule2 | 
         
       
   | 
  
private   | 
  
 
 
  
  
      
        
          | int JAM_Flocking::applyRule3 | 
         
       
   | 
  
private   | 
  
 
 
A vector of Particle boids. 
 
 
  
  
      
        
          | float JAM_Flocking::maxVel | 
         
       
   | 
  
private   | 
  
 
 
  
  
      
        
          | int JAM_Flocking::screenHeight | 
         
       
   | 
  
private   | 
  
 
 
A texture of a white square. 
 
 
  
  
      
        
          | int JAM_Flocking::xBoundary | 
         
       
   | 
  
private   | 
  
 
The boundaries of the boids. 
 
 
  
  
      
        
          | int JAM_Flocking::yBoundary | 
         
       
   | 
  
private   | 
  
 
 
The documentation for this class was generated from the following files: