-
Notifications
You must be signed in to change notification settings - Fork 0
/
Player.hpp
50 lines (31 loc) · 1.04 KB
/
Player.hpp
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
#pragma once
#include "ResourceIdentifiers.hpp"
#include <SFML/Graphics/Sprite.hpp>
#include <SFML/System/NonCopyable.hpp>
#include <memory>
class Player final : public sf::Drawable, public sf::Transformable, private sf::NonCopyable
{
public:
using Ptr = std::unique_ptr<Player>;
public:
explicit Player(const TextureHolder& textures, const sf::IntRect& rect, float z);
void setOffset(float offset);
float getOffset() const;
void setZValue(float z);
float getZValue() const;
void setSpeed(float speed);
float getSpeed() const;
void moveLeft(float amount);
void moveRight(float amount);
void adaptMoving(float amount);
void accelerate(float amount);
sf::FloatRect getBoundingRect() const;
void update(float width, float roadWidth, float scaleXY, float destX, float destY, int steer, float updown);
private:
void draw(sf::RenderTarget& target, sf::RenderStates states) const override;
private:
sf::Sprite mSprite;
float mOffset;
float mZvalue;
float mSpeed;
};