Rework the GUI so it uses SFMLBackend by moving the SoundQuip into SFMLBackend.

This commit is contained in:
Zed A. Shaw 2024-09-10 22:40:02 -04:00
parent 1badbd5942
commit c0ad0c8d23
4 changed files with 39 additions and 38 deletions

View file

@ -3,6 +3,8 @@
#include <SFML/Graphics/RenderWindow.hpp>
#include <SFML/Graphics/Sprite.hpp>
#include <SFML/Graphics/Font.hpp>
#include <SFML/Audio.hpp>
#include <nlohmann/json.hpp>
#include "game_engine.hpp"
#include <string>
@ -15,6 +17,19 @@ constexpr int TEXT_SIZE = 48;
constexpr int Y_LINES = 23;
constexpr int X_ROWS = 48;
class SoundQuip {
public:
sf::Sound sound;
sf::SoundBuffer buffer;
bool initialized;
SoundQuip() {};
void load(nlohmann::json &data, const char *in_file);
void play();
void stop();
};
class SFMLBackend {
sf::ContextSettings settings;
sf::RenderWindow window;