-
Notifications
You must be signed in to change notification settings - Fork 1
/
assets.h
67 lines (53 loc) · 1.16 KB
/
assets.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#ifndef ASSETS_H
#define ASSETS_H
#include<SFML/Graphics.hpp>
#include<string>
#include"parameters.h"
#include"gamemap.h"
class Assets
{
private:
sf::Texture tbackground;
sf::Sprite background;
public:
void drawBackground(sf::RenderWindow&);
void loadPictures(Construct&);
void loadCoin(Construct&);
void loadBot();
};
void Assets::drawBackground(sf::RenderWindow &app)
{
tbackground.loadFromFile("Images/bg.png");
tbackground.setRepeated(true);
background.setTexture(tbackground);
background.setTextureRect(IntRect(0,0,5000,1000));
background.setPosition(-1500,-410);
app.draw(background);
}
void Assets::loadPictures(Construct& c)
{
for(int i=1;i<14;i++)
{
t[i].loadFromFile("Images/"+std::to_string(i)+".png");
t[i].setSmooth(true);
pictures[i].setTexture(t[i]);
}
c.constructPictures(pictures);
}
void Assets::loadCoin(Construct &c)
{
tcoin.loadFromFile("Images/coin.png");
tcoin.setSmooth(true);
scoin.setTexture(tcoin);
c.constructCoin(scoin);
}
void Assets::loadBot()
{
for(int i=0;i<6;i++)
{
tbot[i].loadFromFile("Images/Obstacles/"+std::to_string(i)+".png");
tbot[i].setSmooth(true);
sbot[i].setTexture(tbot[i]);
}
}
#endif