1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- /**
- * 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/Graphics.hpp>
- #include <SFML/Audio.hpp>
- #include "Collidable.hpp"
- /**
- * @class Bullet
- * @author POSITIVE MENTAL ATTITUDE
- * @date 06/09/16
- * @file Bullet.hpp
- * @brief When created, it moves forward until it crashes with a wall.
- */
- class Bullet: public sf::Drawable, public sf::Transformable, public Collidable
- {
- public:
- Bullet() = delete;
- Bullet(float rotation, sf::Vector2f initialPosition, sf::SoundBuffer& buffer1, sf::SoundBuffer& buffer2, Foreground* foreground);
- void setTexture(sf::Texture& texture);
- void update(sf::Time delta);
- const bool isDead() const;
- private:
- sf::Vertex _vertex[4];
- const sf::Texture* _texture;
- virtual void draw(sf::RenderTarget& target, sf::RenderStates states) const override;
- void destroyPixels(int& k, int x, int y);
- sf::Sound _sound;
- sf::Sound _explosion;
- Foreground* _foreground;
- bool _hit;
- bool _dead;
- };
|