-
Notifications
You must be signed in to change notification settings - Fork 0
/
EatingAdultGhostWindow.h
49 lines (38 loc) · 1.69 KB
/
EatingAdultGhostWindow.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
#pragma once
#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include "EatingAdultAvo.h"
// EatingAdultGhostWindow class to handle the interaction with the items
class EatingAdultGhostWindow {
public:
EatingAdultGhostWindow(sf::Font& font, ItemList* basket, int& basketSize,
int& basketCapacity, int& trolleyCount);
~EatingAdultGhostWindow(); // Destructor to clean up dynamic memory
// Open the eating window and handle interactions
void open(PetStats& petStats);
private:
sf::RenderWindow* window; // Pointer for dynamic allocation
sf::Texture fridgeTexture; // Texture for fridge background
sf::Sprite fridgeSprite; // Sprite for fridge background
sf::Font& font; // Font used for text display
ItemList* basket; // Dynamically allocated array for basket items
int& basketSize; // Reference to the current size of the basket
int& basketCapacity; // Reference to the current capacity of the basket
int& trolleyCount; // Reference to the trolley count
sf::Text insufficientFundsText; // Text to display insufficient funds message
std::vector<ItemList> foodItems; // Vector to hold food items
// Load food items into the window
void loadFoodItems();
// Handle window events like clicking items
void handleEvents(PetStats& petStats);
// Render the window and items
void render();
// Play animation or sound when an item is consumed
void playEatingAnimation(const std::string& foodName);
// Helper function to add an item to the basket
void addToBasket(const ItemList& item);
};