game/player.hpp
noerw 28e2667d41 Player as direct subclass from CircleShape
also apply transforms of custom Transformables when drawing
2017-10-23 02:25:19 +02:00

25 lines
674 B
C++

#pragma once
#include <SFML/Graphics.hpp>
#include <SFML/System.hpp>
#include <SFML/Window.hpp>
namespace Proto4 {
class Player : public sf::CircleShape {
sf::Vector2f speed {0.f, 0.f};
const float acceleration = 2500;
const float deceleration = 3;
const float maxSpeed = 850;
const float maxRotationSpeed = 800;
sf::Vector2f keyboard2Acceleration();
void updateSpeed(float timeStep, sf::Vector2f acceleration);
void updateRotation(float timeStep, sf::Vector2f mousePos);
public:
Player();
void update(sf::Time timeStep, sf::Vector2f mousePosition);
void reset();
};
}