Remove most of the image/sound managing stuff.

This commit is contained in:
Zed A. Shaw 2025-04-22 01:22:33 -04:00
parent 1be770d62d
commit e78340a0cd
10 changed files with 34 additions and 110 deletions

View file

@ -8,6 +8,7 @@
#include <nlohmann/json.hpp>
#include "game_engine.hpp"
#include <string>
#include "textures.hpp"
using std::string;
@ -33,30 +34,16 @@ enum class Button {
NONE, START, STOP
};
class SoundQuip {
public:
std::shared_ptr<sf::Sound> sound = nullptr;
std::shared_ptr<sf::SoundBuffer> buffer = nullptr;
bool initialized;
SoundQuip() {};
void load(nlohmann::json &data, const char *file_key, bool loop=false);
void play();
void stop();
};
class SFMLBackend {
sf::ContextSettings settings;
sf::RenderWindow window;
std::shared_ptr<sf::Sprite> face_sprite = nullptr;
std::shared_ptr<sf::Texture> face_texture = nullptr;
std::chrono::time_point<std::chrono::system_clock> clock_start;
Button buttons = Button::STOP;
int hit_points = 50;
sf::Font font;
GameEngine &game;
std::vector<string> log;
GameEngine &game;
textures::SpriteTexture current_face;
public:
SFMLBackend(GameEngine &g);
@ -69,7 +56,7 @@ public:
bool is_open();
void shutdown();
void change_face(const string name);
void change_face(const string& name);
void handle_events();
void update_entities();
void update_log(std::vector<string> &lines);