/** * Triangles * Copyright (C) 2016 POSITIVE MENTAL ATTITUDE * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, version 3 of the License. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #pragma once #include #include "Triangle.hpp" #include "InputTarget.hpp" #include "Utility.hpp" #include "Bullet.hpp" #include "Collidable.hpp" #include "Context.hpp" #include "Particle.hpp" #include "Circle.hpp" /** * @class Player * @author POSITIVE MENTAL ATTITUDE * @date 06/09/16 * @file Player.hpp * @brief TODO Player class is in fact a class for everything related to a moving triangles. * This has to be moved to an Entity class or something * and leave the camera and input stuff to the Player class. */ class Player: public Triangle, public InputTarget, public Collidable { public: Player(); void update(sf::Time delta); void setTexture(sf::Texture& texture) override; /** * @brief * @param foreground * @return Returns true if the target died. */ bool checkCollision(Foreground& foreground); bool isDead(); Rect getBounds(); sf::Image _image; sf::Texture _innerTexture; void setContext(Context* context); private: void keyboardControls(sf::Time delta); void padControls(sf::Time delta); Context* _context; std::vector _bullets; sf::Clock _bulletTimer; InputMap _inputMap; float _movement, _movementSpeed, _movementMomentum, _movementAcceleration, _movementSuppresion; float _rotation, _rotationSpeed, _rotationMomentum, _rotationAcceleration, _rotationSuppresion; bool _canStrafe; float _strafe; bool _hit; bool _dead; virtual void draw(sf::RenderTarget& target, sf::RenderStates states) const final override; sf::Sound _glass; sf::Sound _deathSound; ParticleSystem _particleSystem; int _ammo; Circle _life; Circle _mana; };