aboutsummaryrefslogtreecommitdiff
path: root/src/includes
diff options
context:
space:
mode:
Diffstat (limited to 'src/includes')
-rw-r--r--src/includes/Game.hpp9
-rw-r--r--src/includes/State.hpp8
2 files changed, 9 insertions, 8 deletions
diff --git a/src/includes/Game.hpp b/src/includes/Game.hpp
index d893fd8..529b13a 100644
--- a/src/includes/Game.hpp
+++ b/src/includes/Game.hpp
@@ -7,11 +7,12 @@
#include"Enemy3.hpp"
#include"Powerup.hpp"
+#include<memory>
class Game
{
private:
- std::map<std::string,sf::Font*> font;
- std::map<std::string,sf::Texture*> tex;
+ std::map<std::string,std::shared_ptr<sf::Font>> font;
+ std::map<std::string,std::shared_ptr<sf::Texture>> tex;
float dt;
sf::Clock sat,time;
@@ -22,7 +23,7 @@ class Game
std::vector<Powerup> pow;
int visina,sirina;
- sf::RenderWindow *prozor;
+ std::shared_ptr<sf::RenderWindow> prozor;
sf::RectangleShape health,healthblank,stomp,stompblank,vampiric,vampiricblank;
sf::Text healthtext,stomptext,fps,score,vampirictext;
@@ -44,7 +45,7 @@ class Game
void initent();
void updatewin();
public:
- Game(sf::RenderWindow *glprozor,std::map<std::string,sf::Font*> mainfont,std::map<std::string,sf::Texture*> maintex);
+ Game(std::shared_ptr<sf::RenderWindow> mainprozor,std::map<std::string,std::shared_ptr<sf::Font>> mainfont,std::map<std::string,std::shared_ptr<sf::Texture>> maintex);
void loop(bool ischanged,bool pause);
void draw();
bool gameover();
diff --git a/src/includes/State.hpp b/src/includes/State.hpp
index c9dffb9..5623bbf 100644
--- a/src/includes/State.hpp
+++ b/src/includes/State.hpp
@@ -2,15 +2,16 @@
#define STATE_H
#include<SFML/Graphics.hpp>
+#include<memory>
class State
{
private:
- sf::RenderWindow *prozor;
+ std::shared_ptr<sf::RenderWindow> prozor;
int visina,sirina;
bool ischanged=0,newgame=0,pause=0,kraj=0;
- std::map<std::string,sf::Font*> font;
- std::map<std::string,sf::Texture*> tex;
+ std::map<std::string,std::shared_ptr<sf::Font>> font;
+ std::map<std::string,std::shared_ptr<sf::Texture>> tex;
sf::RectangleShape podloga;
sf::Text pausetext,krajtext;
@@ -23,7 +24,6 @@ class State
void keyboard();
public:
State();
- ~State();
void loop();
};