-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathBoids.h
39 lines (29 loc) · 988 Bytes
/
Boids.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#ifndef BOIDS_H
#define BOIDS_H
#include "Vector2.h"
class Boids
{
Vector2f position;
Vector2f velocity;
Vector2f acceleration;
float maxSpeed, maxForce;
sf::Texture texture;
sf::Sprite sprite;
public:
Boids();
void AvoidEdges(const int& HEIGHT, const int& WIDTH);
template < std::size_t S>
Vector2f align(Boids (&otherBoids)[S], int alignmentRadius);
template < std::size_t S>
Vector2f separation(Boids (&otherBoids)[S], int separationRadius);
template < std::size_t S>
Vector2f cohesion(Boids (&otherBoids)[S], int cohesionRadius);
Vector2f collision(std::vector<sf::CircleShape>& shape);
template <std::size_t S>
void flock(Boids (&otherBoids)[S], std::vector<sf::CircleShape> &shape, int alignmentRadius, int aohesionRadius, int separationRadius);
void update();
void draw(sf::RenderWindow& window);
friend bool operator==(const Boids &a, const Boids &b);
friend bool operator!=(const Boids &a, const Boids &b);
};
#endif //BOIDS_H