#include "player.hpp" sf::Vector2f Player::getTrackablePosition() const { return coordinates.isometric().toScreen(); } sf::Vector2f Player::getTrackableSize() const { // TODO: Proper implementation return {static_cast(circle->getRadius() * 2), static_cast(circle->getRadius() * 2)}; } void Player::update(Game *game) { // Get gamepad input std::shared_ptr gamepadIdentity = nullptr; for (auto inputIdentity: InputMapper::getInstance()->getAllInputIdentities()) { if (inputIdentity->deviceType == InputDeviceType::GAMEPAD) { gamepadIdentity = inputIdentity; break; } } if (gamepadIdentity == nullptr) { return; } // auto moveDirection = InputMapper::getInstance()->getInputIdentity(InputDeviceType::KEYBOARD)->direction.asVector(); auto moveDirection = gamepadIdentity->direction.asVector(); auto moveDelta = moveDirection * 30.0f * FRAME_TIME.asSeconds(); coordinates.move(moveDelta); circle->coordinates.set(coordinates); } void Player::draw(sf::RenderWindow *window) const { circle->draw(window); } Player::~Player() { delete circle; } Player::Player(const sf::Color color, WorldCoordinates initCoordinates) { coordinates.set(initCoordinates); circle = new CircleObject(10, color); circle->coordinates.set(coordinates); }