ObjectItem class added to accordance of diagram class

This commit is contained in:
2024-12-05 12:46:03 +01:00
parent 087a8d7672
commit b6830c305b
7 changed files with 62 additions and 39 deletions

View File

@@ -4,22 +4,12 @@
#include "SFML/Graphics/Texture.hpp"
#include "SFML/Graphics/Sprite.hpp"
#include "Position.h"
#include "ObjectItem.hpp"
class Meteor {
class Meteor : public ObjectItem {
public:
Meteor(float x, float y, sf::Texture &texture);
sf::Sprite &getSprite();
bool getStatus();
void update();
// ~Meteor();
private:
sf::Texture meteorTexture;
sf::Sprite meteorSprite;
Position meteorPosition;
float meteorRotationSpeed;
float meteorSpeed;
bool outOfBounds;
static unsigned int counter;
};

24
headers/ObjectItem.hpp Normal file
View File

@@ -0,0 +1,24 @@
#ifndef LOTOSTATEK_OBJECTITEM_HPP
#define LOTOSTATEK_OBJECTITEM_HPP
#include "SFML/Graphics/Sprite.hpp"
#include "Position.h"
#include "SFML/Graphics/Texture.hpp"
class ObjectItem {
public:
ObjectItem(float x, float y, sf::Texture &texture);
sf::Sprite &getSprite();
bool getStatus();
virtual void update() = 0;
protected:
sf::Texture texture;
sf::Sprite sprite;
Position position;
float rotationSpeed;
float movingSpeed;
bool outOfBounds;
static unsigned int counter;
};
#endif //LOTOSTATEK_OBJECTITEM_HPP