Refactored into a class.

This commit is contained in:
Zed A. Shaw 2024-08-31 17:11:12 -04:00
parent 846d5964fe
commit fda281be1d
2 changed files with 84 additions and 47 deletions

39
sfmlgui.hpp Normal file
View file

@ -0,0 +1,39 @@
#pragma once
#include <SFML/System.hpp>
#include <SFML/Graphics/RenderWindow.hpp>
#include <SFML/Graphics/Sprite.hpp>
#include <SFML/Graphics/Font.hpp>
constexpr int FPS=30;
constexpr int X_DIM = 1920 / 2;
constexpr int Y_DIM = 1080 / 2;
class SFMLGui {
sf::ContextSettings settings;
sf::RenderWindow window;
sf::Clock clock;
sf::Clock deltaClock;
sf::Sprite background;
sf::Texture texture;
bool window_active_out = false;
bool show_build_log = false;
int hit_points = 50;
sf::Font font;
public:
SFMLGui();
void startup();
bool is_open();
void shutdown();
void handle_events();
void update_entities();
void write_text(sf::Vector2f position, const char *content);
void ImGui_setup();
void ImGui_update();
void Window_update();
};