-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGameResources.cpp
More file actions
127 lines (105 loc) · 3.86 KB
/
Copy pathGameResources.cpp
File metadata and controls
127 lines (105 loc) · 3.86 KB
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#include "headers.h"
#include "GameResources.h"
sf::Font* GameResources::font = new sf::Font{};
sf::Texture* GameResources::grassTexture = new sf::Texture;
sf::Texture* GameResources::heartTexture = new sf::Texture;
sf::Texture* GameResources::halfHeartTexture = new sf::Texture;
sf::Texture* GameResources::emptyHeartTexture = new sf::Texture;
sf::Texture* GameResources::rifleTexture = new sf::Texture;
sf::Texture* GameResources::ninjaTexture = new sf::Texture;
sf::Texture* GameResources::batTexture = new sf::Texture;
sf::Texture* GameResources::playerTexture = new sf::Texture;
sf::Texture* GameResources::birdTexture = new sf::Texture;
sf::Texture* GameResources::stoneTexture = new sf::Texture;
sf::Texture* GameResources::doorTexture = new sf::Texture;
sf::Texture* GameResources::starTexture = new sf::Texture;
sf::Texture* GameResources::spikeTexture = new sf::Texture;
sf::Texture* GameResources::nestTexture = new sf::Texture;
void GameResources::initFont()
{
if (!GameResources::font->loadFromFile("Fonts/PixellettersFull.ttf"))
{
std::cout << "ERROR::GAMERESOURCES::Font could not load\n";
}
}
void GameResources::initTextures()
{
if (!GameResources::grassTexture->loadFromFile("Textures/grassTexture.jpg"))
{
std::cout << "GAME RESOURCES:: Grass texture could not load\n";
}
if (!GameResources::heartTexture->loadFromFile("Textures/heartTexture.png"))
{
std::cout << "GAME RESOURCES:: Heart texture could not load\n";
}
if (!GameResources::halfHeartTexture->loadFromFile("Textures/halfHeartTexture.png"))
{
std::cout << "GAME RESOURCES:: Half Heart texture could not load\n";
}
if (!GameResources::emptyHeartTexture->loadFromFile("Textures/emptyHeartTexture.png"))
{
std::cout << "GAME RESOURCES:: Empty Heart texture could not load\n";
}
if (!GameResources::spikeTexture->loadFromFile("Textures/spikeTexture.png"))
{
std::cout << "GAME RESOURCES:: Spike texture could not load\n";
}
if (!GameResources::rifleTexture->loadFromFile("Textures/rifleTexture.png"))
{
std::cout << "GAME RESOURCES:: Rifle texture could not load\n";
}
if (!GameResources::ninjaTexture->loadFromFile("Textures/ninjaTexture.png"))
{
std::cout << "GAME RESOURCES:: Ninja texture could not load\n";
}
if (!GameResources::batTexture->loadFromFile("Textures/batTexture.png"))
{
std::cout << "GAME RESOURCES:: Bat texture could not load\n";
}
if (!GameResources::playerTexture->loadFromFile("Textures/playerTexture.png"))
{
std::cout << "GAME RESOURCES:: Player texture could not load\n";
}
if (!GameResources::birdTexture->loadFromFile("Textures/birdTexture.png"))
{
std::cout << "GAME RESOURCES:: Bird texture could not load\n";
}
if (!GameResources::stoneTexture->loadFromFile("Textures/stoneTexture.jpg"))
{
std::cout << "GAME RESOURCES:: Stone texture could not load\n";
}
if (!GameResources::doorTexture->loadFromFile("Textures/doorTexture.png"))
{
std::cout << "GAME RESOURCES:: Door texture could not load\n";
}
if (!GameResources::starTexture->loadFromFile("Textures/starTexture.png"))
{
std::cout << "GAME RESOURCES:: Star texture could not load\n";
}
if (!GameResources::nestTexture->loadFromFile("Textures/nestTexture.png"))
{
std::cout << "GAME RESOURCES:: Nest texture could not load\n";
}
}
void GameResources::initResources()
{
GameResources::initFont();
GameResources::initTextures();
}
void GameResources::deleteResources()
{
delete GameResources::font;
delete GameResources::grassTexture;
delete GameResources::heartTexture;
delete GameResources::halfHeartTexture;
delete GameResources::emptyHeartTexture;
delete GameResources::spikeTexture;
delete GameResources::ninjaTexture;
delete GameResources::batTexture;
delete GameResources::playerTexture;
delete GameResources::birdTexture;
delete GameResources::stoneTexture;
delete GameResources::doorTexture;
delete GameResources::starTexture;
delete GameResources::nestTexture;
}