refactoring
This commit is contained in:
43
src/GraphicalUI/PlayerCursor.h
Normal file
43
src/GraphicalUI/PlayerCursor.h
Normal file
@@ -0,0 +1,43 @@
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include <SFML/Graphics.hpp>
|
||||
|
||||
|
||||
class PlayerCursor {
|
||||
private:
|
||||
std::vector<unsigned int> rows;
|
||||
sf::Vector2u position;
|
||||
int leftDAS;
|
||||
int rightDAS;
|
||||
int upDAS;
|
||||
int downDAS;
|
||||
|
||||
public:
|
||||
PlayerCursor(std::vector<unsigned int> rows);
|
||||
|
||||
void updatePosition();
|
||||
|
||||
bool movedLeft() const;
|
||||
|
||||
bool movedRight() const;
|
||||
|
||||
bool movedUp() const;
|
||||
|
||||
bool movedDown() const;
|
||||
|
||||
void goToPosition(const sf::Vector2u& newPosition);
|
||||
|
||||
const sf::Vector2u& getPosition() const;
|
||||
|
||||
private:
|
||||
bool shouldMove(int DAS) const;
|
||||
|
||||
void moveLeft();
|
||||
|
||||
void moveRight();
|
||||
|
||||
void moveUp();
|
||||
|
||||
void moveDown();
|
||||
};
|
||||
Reference in New Issue
Block a user