SFTK/include/window.hpp

60 lines
1.1 KiB
C++

#ifndef WINDOW_HPP
#define WINDOW_HPP
#include <memory>
#include <string>
#include <vector>
#include <gtypes.hpp>
#include <exceptions.hpp>
#include <containers/container.hpp>
namespace sftk
{
class Window;
typedef std::shared_ptr<Window> pWindow;
/**
* @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);
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;
public:
class WindowMultipleConstructed : public SFTKException<Window>
{
public:
WindowMultipleConstructed(Window *);
const char *what() const noexcept override;
};
};
};
#endif