-
Notifications
You must be signed in to change notification settings - Fork 0
/
Components.h
69 lines (58 loc) · 1.07 KB
/
Components.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#pragma once
#include "Vec2.h"
#include<SFML/Graphics.hpp>
class CTransform
{
public:
Vec2 pos = { 0.0, 0.0 };
Vec2 velocity = { 0.0, 0.0 };
float angle = 0;
CTransform(const Vec2& p, const Vec2& v, float a)
: pos(p), velocity(v), angle(a) {}
};
class CShape
{
public:
sf::CircleShape circle;
CShape(float radius, int points, const sf::Color& fill,
const sf::Color& outline, float thickness)
: circle(radius, points)
{
circle.setFillColor(fill);
circle.setOutlineColor(outline);
circle.setOutlineThickness(thickness);
circle.setOrigin(radius, radius);
}
};
class CCollision
{
public:
float radius = 0;
CCollision(float r)
: radius(r) {}
};
class CScore
{
public:
int score = 0;
CScore(int s)
: score(s) {}
};
class CLifespan
{
public:
int remaining = 0; // amount of lifespan remaining on the entity
int total = 0; // the total initial amount of lifespan
CLifespan(int total)
: remaining(total), total(total) {}
};
class CInput
{
public:
bool up = false;
bool left = false;
bool right = false;
bool down = false;
bool shoot = false;
CInput() {}
};