-
Notifications
You must be signed in to change notification settings - Fork 0
/
sprite_loader.h
694 lines (577 loc) · 24.2 KB
/
sprite_loader.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
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
#ifndef SPRITELOADER_H
#define SPRITELOADER_H
#include <SFML/Graphics.hpp>
#include <fstream>
#include <iostream>
#include <string>
#include "adult_avo.h"
#include "adult_ghost.h"
#include "baby_avo.h"
#include "baby_ghost.h"
#include "pet_stats.h"
#include "quotesFile.h"
class SpriteLoader {
public:
static sf::Texture sleeping_button_texture;
static sf::Sprite sleeping_button_sprite;
static sf::Texture adult_avo_normal;
static sf::Sprite adult_avo_normal_sprite;
static sf::Texture baby_avo_normal;
static sf::Sprite baby_avo_normal_sprite;
static sf::Texture adult_ghost_normal;
static sf::Sprite adult_ghost_normal_sprite;
static sf::Texture baby_ghost_normal;
static sf::Sprite baby_ghost_normal_sprite;
static sf::Texture shower_button_texture;
static sf::Sprite shower_button_sprite;
static sf::Texture game_button_texture;
static sf::Sprite game_button_sprite;
static sf::Texture food_button_texture;
static sf::Sprite food_button_sprite;
static sf::Texture health_button_texture;
static sf::Sprite health_button_sprite;
static sf::Texture shopping_button_texture;
static sf::Sprite shopping_button_sprite;
static sf::Texture info_button_texture;
static sf::Sprite info_button_sprite;
static sf::Texture math_button_texture;
static sf::Sprite math_button_sprite;
static sf::RectangleShape line;
static bool loadResources() {
line.setSize(sf::Vector2f(1920, 5));
line.setFillColor(sf::Color::Black);
line.setPosition(0, 120);
// Load sleeping button texture
if (!sleeping_button_texture.loadFromFile("moon.png")) {
std::cout << "Sleeping button image not found." << std::endl;
return false;
}
sleeping_button_sprite.setTexture(sleeping_button_texture);
sleeping_button_sprite.setPosition(40, 130);
// Load adult avo texture
if (!adult_avo_normal.loadFromFile("bigCharNormalAvo.png")) return false;
adult_avo_normal_sprite.setTexture(adult_avo_normal);
adult_avo_normal_sprite.setPosition(600, 350);
adult_avo_normal_sprite.setScale(8.0f, 8.0f);
// Load baby avo texture
if (!baby_avo_normal.loadFromFile("smallAvoNormal.png")) return false;
baby_avo_normal_sprite.setTexture(baby_avo_normal);
baby_avo_normal_sprite.setPosition(600, 350);
baby_avo_normal_sprite.setScale(8.0f, 8.0f);
// Load adult ghost texture
if (!adult_ghost_normal.loadFromFile("bigCharNormalGhost.png"))
return false;
adult_ghost_normal_sprite.setTexture(adult_ghost_normal);
adult_ghost_normal_sprite.setPosition(600, 350);
adult_ghost_normal_sprite.setScale(8.0f, 8.0f);
// Load baby ghost texture
if (!baby_ghost_normal.loadFromFile("smallGhostNormal.png")) return false;
baby_ghost_normal_sprite.setTexture(baby_ghost_normal);
baby_ghost_normal_sprite.setPosition(600, 350);
baby_ghost_normal_sprite.setScale(8.0f, 8.0f);
// Load shower button texture
if (!shower_button_texture.loadFromFile("shower (1).png")) {
std::cout << "Shower button image not found." << std::endl;
return false;
}
shower_button_sprite.setTexture(shower_button_texture);
shower_button_sprite.setPosition(470, 130);
// Load game button texture
if (!game_button_texture.loadFromFile("console.png")) {
std::cout << "Game button image not found." << std::endl;
return false;
}
game_button_sprite.setTexture(game_button_texture);
game_button_sprite.setPosition(900, 130);
// Load food button texture
if (!food_button_texture.loadFromFile("cutlery.png")) {
std::cout << "Food button image not found." << std::endl;
return false;
}
food_button_sprite.setTexture(food_button_texture);
food_button_sprite.setPosition(1310, 130);
// Load health button texture
if (!health_button_texture.loadFromFile("first-aid-kit.png")) {
std::cout << "Health button image not found." << std::endl;
return false;
}
health_button_sprite.setTexture(health_button_texture);
health_button_sprite.setPosition(40, 680);
// Load shopping button texture
if (!shopping_button_texture.loadFromFile("grocery-cart.png")) {
std::cout << "Shopping button image not found." << std::endl;
return false;
}
shopping_button_sprite.setTexture(shopping_button_texture);
shopping_button_sprite.setPosition(470, 680);
// Load info button texture
if (!info_button_texture.loadFromFile("info.png")) {
std::cout << "Info button image not found." << std::endl;
}
info_button_sprite.setTexture(info_button_texture);
info_button_sprite.setPosition(1310, 680);
// Load math button texture
if (!math_button_texture.loadFromFile("math.png")) {
std::cout << "Math button image not found." << std::endl;
}
math_button_sprite.setTexture(math_button_texture);
math_button_sprite.setPosition(900, 680);
return true;
}
static void drawSprites(sf::RenderWindow& window) {
window.clear(sf::Color(230, 230, 220));
window.draw(line);
window.draw(sleeping_button_sprite);
window.draw(shower_button_sprite);
window.draw(game_button_sprite);
window.draw(food_button_sprite);
window.draw(health_button_sprite);
window.draw(shopping_button_sprite);
window.draw(info_button_sprite);
window.draw(math_button_sprite);
}
static PetStats* initialize_pet(std::string user_pet) {
if (user_pet.find("avo") != std::string::npos) {
std::cout << "The pet is an avo!" << std::endl;
return new avo;
} else {
std::cout << "The pet is not an avo." << std::endl;
return new ghost;
}
}
static std::string show_intro_screen(sf::RenderWindow& window,
sf::Font& font) {
// Load button textures
sf::Texture avo_texture, ghost_texture;
if (!avo_texture.loadFromFile("avoButton.png") ||
!ghost_texture.loadFromFile("ghostButton.png")) {
std::cout << "Button Images Not Found" << std::endl;
return "";
}
// Create sprites for the buttons
sf::Sprite avoButton(avo_texture);
avoButton.setScale(0.02f, 0.02f);
avoButton.setPosition(300, 400); // Adjust position based on button size
sf::Sprite ghostButton(ghost_texture);
ghostButton.setScale(0.2f, 0.2f);
ghostButton.setPosition(900, 400); // Adjust position based on button size
// Create text objects
sf::Text title("Choose a Pet :)", font, 80); // Title text
title.setFillColor(sf::Color::Black);
title.setPosition((window.getSize().x - title.getGlobalBounds().width) / 2,
50); // Center the title
sf::Text avoText("Avo", font, 50); // Avo text
avoText.setFillColor(sf::Color::Black);
avoText.setPosition(300, 560); // Position below the Avo button
sf::Text ghostText("Ghost", font, 50); // Ghost text
ghostText.setFillColor(sf::Color::Black);
ghostText.setPosition(900, 560); // Position below the Ghost button
// Text for selecting Adult or Baby
sf::Text adultText("Adult", font, 40);
adultText.setFillColor(sf::Color::Black);
adultText.setPosition((window.getSize().x / 2) - 100,
700); // Center below the options
sf::Text babyText("Baby", font, 40);
babyText.setFillColor(sf::Color::Black);
babyText.setPosition((window.getSize().x / 2) + 50,
700); // Center next to Adult
bool inIntro = true; // Track whether we are in the intro screen
std::string selectedPet; // To store the selected pet type
while (inIntro) {
sf::Event event;
// Clear the window
window.clear(sf::Color(230, 230, 220));
// Draw the buttons
window.draw(avoButton);
window.draw(ghostButton);
// Draw the title and button labels
window.draw(title);
window.draw(avoText);
window.draw(ghostText);
// If a pet is selected, show the Adult/Baby options
if (!selectedPet.empty()) {
window.draw(adultText);
window.draw(babyText);
}
// Display the window contents
window.display();
// Event loop to handle user input
while (window.pollEvent(event)) {
std::cout << "test" << std::endl;
if (event.type == sf::Event::Closed) {
window.close();
return "";
}
// Check if user clicked a button
if (event.type == sf::Event::MouseButtonPressed) {
sf::Vector2i click_position = sf::Mouse::getPosition(window);
int x = click_position.x;
int y = click_position.y;
std::cout << "Mouse clicked at: " << x << ", " << y << std::endl;
if (avoButton.getGlobalBounds().contains(x, y)) {
std::cout << "Avocado selected!" << std::endl;
selectedPet = "Avo"; // Set the selected pet type
} else if (ghostButton.getGlobalBounds().contains(x, y)) {
std::cout << "Ghost selected!" << std::endl;
selectedPet = "Ghost"; // Set the selected pet type
} else if (selectedPet == "Avo" &&
adultText.getGlobalBounds().contains(x, y)) {
std::cout << "Adult Avo selected!" << std::endl;
return "adult_avo"; // Return adult Avo
} else if (selectedPet == "Avo" &&
babyText.getGlobalBounds().contains(x, y)) {
std::cout << "Baby Avo selected!" << std::endl;
return "baby_avo"; // Return baby Avo
} else if (selectedPet == "Ghost" &&
adultText.getGlobalBounds().contains(x, y)) {
std::cout << "Adult Ghost selected!" << std::endl;
return "adult_ghost"; // Return adult Ghost
} else if (selectedPet == "Ghost" &&
babyText.getGlobalBounds().contains(x, y)) {
std::cout << "Baby Ghost selected!" << std::endl;
return "baby_ghost"; // Return baby Ghost
}
}
}
}
return ""; // Default return value
}
static void animateSleepingPet(const std::string& user_pet,
sf::RenderWindow& main_window,
sf::Font font_type, std::string& quote,
PetStats* current_stats) {
Sleeping* sleeping = nullptr;
std::string spriteSheetPath;
if (user_pet == "adult_avo") {
spriteSheetPath = "Big2/sleeping/spritesheet.png";
sleeping = new adult_avo(spriteSheetPath, 0.8f, 8.0f, 8.0f);
} else if (user_pet == "baby_avo") {
spriteSheetPath = "Small2/Sleeping/spritesheet.png";
sleeping = new baby_avo(spriteSheetPath, 0.8f, 8.0f, 8.0f);
} else if (user_pet == "adult_ghost") {
spriteSheetPath = "Big/Sleeping.png";
sleeping = new adult_ghost(spriteSheetPath, 0.8f, 8.0f, 8.0f);
} else if (user_pet == "baby_ghost") {
spriteSheetPath = "Small/Sleeping.png";
sleeping = new baby_ghost(spriteSheetPath, 0.8f, 8.0f, 8.0f);
}
sleeping->startAnimation_sleeping();
sf::Clock clock; // Clock to track time
sf::Clock total_animation_time;
while (main_window.isOpen()) {
sf::Event event;
while (main_window.pollEvent(event)) {
if (event.type == sf::Event::Closed) main_window.close();
}
// Get the time elapsed since the last frame
float deltaTime = clock.restart().asSeconds();
// Update the Sleeping pet
sleeping->update_sleeping(deltaTime);
// Draw the Sleeping sprite
SpriteLoader::drawSprites(main_window);
sleeping->draw_sleeping(main_window);
renderQuote(main_window, font_type, quote);
current_stats->renderStats(main_window, font_type);
// Display the window contents
main_window.display();
if (total_animation_time.getElapsedTime().asSeconds() >= 6) {
break; // Exit the animation after 6 seconds
}
}
}
static void animateShoweringPet(const std::string& user_pet,
sf::RenderWindow& main_window,
sf::Font font_type, std::string& quote,
PetStats* current_stats) {
Shower* showering = nullptr; // Pointer to handle different pet types
std::string spriteSheetPath;
// Determine the correct pet type and create the corresponding showering
// object
if (user_pet == "adult_avo") {
spriteSheetPath = "Big2/showering/spritesheet.png";
showering = new adult_avo(spriteSheetPath, 1.4f, 8.0f, 8.0f);
} else if (user_pet == "baby_avo") {
spriteSheetPath = "Small2/Showering/spritesheet.png";
showering = new baby_avo(spriteSheetPath, 0.8f, 8.0f, 8.0f);
} else if (user_pet == "adult_ghost") {
spriteSheetPath = "Big/Shower.png";
showering = new adult_ghost(spriteSheetPath, 0.8f, 8.0f, 8.0f);
} else if (user_pet == "baby_ghost") {
spriteSheetPath = "Small/Shower.png";
showering = new baby_ghost(spriteSheetPath, 0.8f, 8.0f, 8.0f);
}
// Start the showering animation
showering->startAnimation_shower();
sf::Clock clock; // Clock to track time
sf::Clock total_animation_time;
// Animation loop
while (main_window.isOpen()) {
sf::Event event;
while (main_window.pollEvent(event)) {
if (event.type == sf::Event::Closed) {
main_window.close();
}
}
// Get the time elapsed since the last frame
float deltaTime = clock.restart().asSeconds();
// Update the showering pet
showering->update_shower(deltaTime);
// Draw the showering sprite
SpriteLoader::drawSprites(main_window);
showering->draw_shower(main_window);
// Render additional stats and quotes
renderQuote(main_window, font_type, quote);
current_stats->renderStats(main_window, font_type);
// Display the window contents
main_window.display();
// Exit the animation after 6 seconds
if (total_animation_time.getElapsedTime().asSeconds() >= 6) {
break;
}
}
delete showering;
}
static void animateEatingPet(const std::string& user_pet,
sf::RenderWindow& main_window,
sf::Font font_type, std::string& quote,
PetStats* current_stats) {
Eating* eating = nullptr; // Pointer to handle different pet types
std::string spriteSheetPath;
// Determine the correct pet type and create the corresponding eating object
if (user_pet == "adult_avo") {
spriteSheetPath = "Big2/Eating/spritesheet.png";
eating = new adult_avo(spriteSheetPath, 1.4f, 8.0f, 8.0f);
} else if (user_pet == "baby_avo") {
spriteSheetPath = "Small2/Eating/spritesheet.png";
eating = new baby_avo(spriteSheetPath, 1.4f, 8.0f, 8.0f);
} else if (user_pet == "adult_ghost") {
spriteSheetPath = "Big/eating.png";
eating = new adult_ghost(spriteSheetPath, 1.4f, 8.0f, 8.0f);
} else if (user_pet == "baby_ghost") {
spriteSheetPath = "Small/eating.png";
eating = new baby_ghost(spriteSheetPath, 1.4f, 8.0f, 8.0f);
}
// Start the eating animation
eating->startAnimation_eating();
sf::Clock clock; // Clock to track time
sf::Clock total_animation_time;
// Animation loop
while (main_window.isOpen()) {
sf::Event event;
while (main_window.pollEvent(event)) {
if (event.type == sf::Event::Closed) {
main_window.close();
}
}
// Get the time elapsed since the last frame
float deltaTime = clock.restart().asSeconds();
// Update the eating pet
eating->update_eating(deltaTime);
// Draw the eating sprite
SpriteLoader::drawSprites(main_window);
eating->draw_eating(main_window);
// Render additional stats and quotes
renderQuote(main_window, font_type, quote);
current_stats->renderStats(main_window, font_type);
// Display the window contents
main_window.display();
// Exit the animation after 6 seconds
if (total_animation_time.getElapsedTime().asSeconds() >= 6) {
break;
}
}
delete eating;
}
static void animateGivingMedicine(const std::string& user_pet,
sf::RenderWindow& main_window,
sf::Font font_type, std::string& quote,
PetStats* current_stats) {
Medicine* medicine = nullptr; // Pointer to handle different pet types
std::string spriteSheetPath;
// Determine the correct pet type and create the corresponding medicine
// object
if (user_pet == "adult_avo") {
spriteSheetPath = "New Piskel-1 10.15.48 PM.png (2).png";
medicine = new adult_avo(spriteSheetPath, 1.4f, 8.0f, 8.0f);
} else if (user_pet == "baby_avo") {
spriteSheetPath = "Small2/medications/spritesheet.png";
medicine = new baby_avo(spriteSheetPath, 1.4f, 8.0f, 8.0f);
} else if (user_pet == "adult_ghost") {
spriteSheetPath = "Big/Medicine .png";
medicine = new adult_ghost(spriteSheetPath, 1.4f, 8.0f, 8.0f);
} else if (user_pet == "baby_ghost") {
spriteSheetPath = "Small/Medicine .png";
medicine = new baby_ghost(spriteSheetPath, 1.4f, 8.0f, 8.0f);
}
// Start the medicine animation
medicine->startAnimation_medicine();
sf::Clock clock; // Clock to track time
sf::Clock total_animation_time;
// Animation loop
while (main_window.isOpen()) {
sf::Event event;
while (main_window.pollEvent(event)) {
if (event.type == sf::Event::Closed) {
main_window.close();
}
}
// Get the time elapsed since the last frame
float deltaTime = clock.restart().asSeconds();
// Update the medicine pet
medicine->update_medicine(deltaTime);
// Draw the medicine sprite
SpriteLoader::drawSprites(main_window);
medicine->draw_medicine(main_window);
// Render additional stats and quotes
renderQuote(main_window, font_type, quote);
current_stats->renderStats(main_window, font_type);
// Display the window contents
main_window.display();
// Exit the animation after 6 seconds
if (total_animation_time.getElapsedTime().asSeconds() >= 6) {
break;
}
}
}
static bool showGameMenu(sf::RenderWindow& parentWindow, sf::Font& font) {
// Set up menu text
sf::Text newGameText("New Game", font, 70);
newGameText.setFillColor(sf::Color::Black);
sf::Vector2u windowSize = parentWindow.getSize();
// Get the text size for newGameText
sf::FloatRect textBoundsNewGame = newGameText.getGlobalBounds();
// Calculate the center position for newGameText
float newGamePosX =
(windowSize.x - textBoundsNewGame.width) / 2; // Center horizontally
float newGamePosY = (windowSize.y - textBoundsNewGame.height) / 2 -
120; // Center vertically, offset by 50 for spacing
newGameText.setPosition(newGamePosX, newGamePosY);
// Set up load game text
sf::Text loadGameText("Load Previous Game", font, 70);
loadGameText.setFillColor(sf::Color::Black);
// Get the text size for loadGameText
sf::FloatRect textBoundsLoadGame = loadGameText.getGlobalBounds();
// Calculate the center position for loadGameText
float loadGamePosX =
(windowSize.x - textBoundsLoadGame.width) / 2; // Center horizontally
float loadGamePosY = newGamePosY + textBoundsNewGame.height +
120; // Position below newGameText with some spacing
loadGameText.setPosition(loadGamePosX, loadGamePosY);
// Text for no previous games found
sf::Text noGamesText("No Previous Games Found", font, 30);
noGamesText.setFillColor(sf::Color::Red);
// Get the text size for noGamesText
sf::FloatRect textBoundsNoGames = noGamesText.getGlobalBounds();
// Calculate the position for noGamesText
float noGamesPosX =
(windowSize.x - textBoundsNoGames.width) / 2; // Center horizontally
float noGamesPosY = loadGamePosY + textBoundsLoadGame.height +
20; // Position below loadGameText with some spacing
noGamesText.setPosition(noGamesPosX, noGamesPosY);
bool showNoGamesMessage = false; // Flag to show the no games message
// Main loop for the menu window
while (parentWindow.isOpen()) {
sf::Event event;
while (parentWindow.pollEvent(event)) {
if (event.type == sf::Event::Closed) {
parentWindow.close();
return -1; // Close event
}
if (event.type == sf::Event::MouseButtonPressed) {
if (event.mouseButton.button == sf::Mouse::Left) {
// Get the mouse position
sf::Vector2i mousePos = sf::Mouse::getPosition(parentWindow);
if (newGameText.getGlobalBounds().contains(
static_cast<sf::Vector2f>(mousePos))) {
return true; // New Game selected
} else if (loadGameText.getGlobalBounds().contains(
static_cast<sf::Vector2f>(mousePos))) {
// Check if the pet_stats.txt file exists
std::ifstream file("pet_stats.txt");
if (file) {
return false; // Load Previous Game selected
} else {
showNoGamesMessage = true; // Show the no games message
}
}
}
}
}
// Clear the window with the specified color
parentWindow.clear(sf::Color(230, 230, 220));
// Draw the texts
parentWindow.draw(newGameText);
parentWindow.draw(loadGameText);
// Draw the no games message if needed
if (showNoGamesMessage) {
parentWindow.draw(noGamesText);
}
// Display the contents of the window
parentWindow.display();
}
return false; // Default return value (shouldn't reach here)
}
static std::vector<int> readPetStats(const std::string& filename) {
std::ifstream statsFile(filename);
std::vector<int> petStats;
if (statsFile.is_open()) {
std::string line;
// Read the first line (you can adjust this if you expect multiple lines)
if (std::getline(statsFile, line)) {
std::istringstream iss(line);
std::string userPet;
int healthLevel, sleepLevel, hungerLevel, iqLevel, totalMoney;
// Read the values from the line
iss >> userPet >> healthLevel >> sleepLevel >> hungerLevel >> iqLevel >>
totalMoney;
// Store the values in the vector
petStats.push_back(healthLevel);
petStats.push_back(sleepLevel);
petStats.push_back(hungerLevel);
petStats.push_back(iqLevel);
petStats.push_back(totalMoney);
}
statsFile.close();
} else {
std::cerr << "Unable to open file: " << filename << std::endl;
}
return petStats;
}
static void draw_default_sprite(sf::RenderWindow& window,std::string user_pet){
if (user_pet == "adult_avo") {
window.draw(SpriteLoader::adult_avo_normal_sprite);
} else if (user_pet == "baby_avo") {
window.draw(SpriteLoader::baby_avo_normal_sprite);
} else if (user_pet == "adult_ghost") {
window.draw(SpriteLoader::adult_ghost_normal_sprite);
} else {
window.draw(SpriteLoader::baby_ghost_normal_sprite);
} }
};
// Definition of static members
sf::Texture SpriteLoader::sleeping_button_texture;
sf::Sprite SpriteLoader::sleeping_button_sprite;
sf::Texture SpriteLoader::adult_avo_normal;
sf::Sprite SpriteLoader::adult_avo_normal_sprite;
sf::Texture SpriteLoader::baby_avo_normal;
sf::Sprite SpriteLoader::baby_avo_normal_sprite;
sf::Texture SpriteLoader::adult_ghost_normal;
sf::Sprite SpriteLoader::adult_ghost_normal_sprite;
sf::Texture SpriteLoader::baby_ghost_normal;
sf::Sprite SpriteLoader::baby_ghost_normal_sprite;
sf::Texture SpriteLoader::shower_button_texture;
sf::Sprite SpriteLoader::shower_button_sprite;
sf::Texture SpriteLoader::game_button_texture;
sf::Sprite SpriteLoader::game_button_sprite;
sf::Texture SpriteLoader::food_button_texture;
sf::Sprite SpriteLoader::food_button_sprite;
sf::Texture SpriteLoader::health_button_texture;
sf::Sprite SpriteLoader::health_button_sprite;
sf::Texture SpriteLoader::shopping_button_texture;
sf::Sprite SpriteLoader::shopping_button_sprite;
sf::Texture SpriteLoader::info_button_texture;
sf::Sprite SpriteLoader::info_button_sprite;
sf::Texture SpriteLoader::math_button_texture;
sf::Sprite SpriteLoader::math_button_sprite;
sf::RectangleShape SpriteLoader::line;
#endif