2024-08-03 04:11:49 +08:00
|
|
|
#ifndef WINDOW_HPP
|
|
|
|
#define WINDOW_HPP
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include <gtypes.hpp>
|
|
|
|
#include <exceptions.hpp>
|
|
|
|
#include <containers/container.hpp>
|
|
|
|
|
|
|
|
namespace sftk
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @brief Window type
|
|
|
|
*
|
|
|
|
* To create a unique SFML window in the current thread.
|
|
|
|
*/
|
|
|
|
class Window : public Container
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
static Window &create(int width, int height, std::wstring name = L"");
|
|
|
|
|
|
|
|
void exec();
|
|
|
|
|
|
|
|
void setSize(sf::Vector2u size);
|
2024-08-20 10:39:38 +08:00
|
|
|
void setBackgroudColor(sf::Color color);
|
|
|
|
|
|
|
|
const sf::Color &getBackgroundColor() const;
|
2024-08-03 04:11:49 +08:00
|
|
|
|
|
|
|
bool isRoot() const;
|
|
|
|
|
|
|
|
sf::Vector2f &getPosition() const;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
Window(int width, int height, std::wstring name = L"");
|
|
|
|
|
|
|
|
private:
|
|
|
|
sf::RenderWindow &windowSFWindow();
|
|
|
|
|
|
|
|
sf::RenderWindow sfwindow;
|
|
|
|
|
|
|
|
std::unique_ptr<bool> running;
|
|
|
|
|
|
|
|
private:
|
|
|
|
std::unique_ptr<std::vector<sf::Vector2f>> v2f_dumpst;
|
2024-08-20 10:39:38 +08:00
|
|
|
sf::Color backgroud;
|
2024-08-03 04:11:49 +08:00
|
|
|
|
|
|
|
public:
|
|
|
|
class WindowMultipleConstructed : public SFTKException<Window>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
WindowMultipleConstructed(Window *);
|
|
|
|
const char *what() const noexcept override;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
#endif
|