1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- /**
- * 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 <http://www.gnu.org/licenses/>.
- */
- #pragma once
- #include <SFML/Audio.hpp>
- #include "Triangle.hpp"
- #include "InputTarget.hpp"
- #include "Utility.hpp"
- #include "Bullet.hpp"
- #include "Collidable.hpp"
- #include "Context.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<int>, 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:
- Context* _context;
- std::vector<Bullet> _bullets;
- sf::Clock _bulletTimer;
- InputMap<int> _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;
- };
|