-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathComp_Control.h
More file actions
41 lines (34 loc) · 910 Bytes
/
Comp_Control.h
File metadata and controls
41 lines (34 loc) · 910 Bytes
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
#pragma once
#include <SFML/System/Vector2.hpp>
#include "Comp.h"
/// <summary>
/// Class used to store the control components of an actor.
/// This class is accessed by the controls system to move the actor.
/// </summary>
class Comp_Control : public Comp
{
public:
void setMovementInput(const sf::Vector2f& movementInput)
{
m_movementInput = movementInput;
}
const sf::Vector2f& getMovementInput() const { return m_movementInput; }
void setMaxAcceleration(const float& maxAcceleration)
{
m_maxAcceleration = maxAcceleration;
}
float getMaxAcceleration() const { return m_maxAcceleration; }
void setMaxSpeed(const float& maxSpeed)
{
m_maxSpeed = maxSpeed;
}
float getMaxSpeed() const { return m_maxSpeed; }
private:
void load(std::stringstream& ss) override
{
ss >> m_maxSpeed >> m_maxAcceleration;
}
sf::Vector2f m_movementInput;
float m_maxAcceleration;
float m_maxSpeed;
};