This commit is contained in:
bMorgan01 2022-03-08 10:18:34 -07:00
parent 54f5313273
commit b49080f675
83 changed files with 2083 additions and 0 deletions

48
Sprite.h Normal file
View file

@ -0,0 +1,48 @@
//
// Created by Benjamin on 1/25/2022.
//
#ifndef SFML_TEMPLATE_SPRITE_H
#define SFML_TEMPLATE_SPRITE_H
#include <SFML/Graphics.hpp>
class Sprite : public sf::Sprite {
protected:
bool hovered = false;
bool clicked = false;
bool visible = true;
Sprite *riding = nullptr;
public:
static const int TOP_LEFT = 0;
static const int CENTER = 1;
static const int BOTTOM_RIGHT = 2;
explicit Sprite(const sf::Texture &);
Sprite(const sf::Texture &, int);
Sprite(const sf::Texture &, float, float, float, int);
Sprite(const sf::Texture &, float, float, float, float, int);
~Sprite() noexcept;
void setOrigin(int);
bool isHovered() const { return hovered; };
bool isVisible() const;
virtual void setVisible(bool visible);
void setMount(Sprite *);
bool hasMount() { return riding; };
void removeMounts();
void kill();
virtual void update();
virtual void click() {};
virtual void noClick() {};
virtual void hover() { hovered = true; };
virtual void unHover() { hovered = false; };
void draw(sf::RenderWindow *window);
};
#endif //SFML_TEMPLATE_SPRITE_H