Files
OpenVulkano/openVulkanoCpp/Base/UI/BaseWindow.hpp

118 lines
2.0 KiB
C++

#pragma once
#include "IWindow.hpp"
namespace openVulkanoCpp
{
class BaseWindow : virtual public IWindow
{
protected:
const int windowId;
WindowConfiguration windowConfig;
public:
BaseWindow() : windowId(CreateWindowId()) {}
virtual ~BaseWindow() = default;
const WindowConfiguration& GetWindowConfiguration() override
{
return windowConfig;
}
void GetSize(int* width, int* height) override = 0;
void GetSize(uint32_t* width, uint32_t* height) override
{
int w, h;
GetSize(&w, &h);
*width = w;
*height = h;
}
uint32_t GetWidth() override
{
uint32_t width, height;
GetSize(&width, &height);
return width;
}
uint32_t GetHeight() override
{
uint32_t width, height;
GetSize(&width, &height);
return height;
}
glm::ivec2 GetSize() override
{
glm::ivec2 size;
this->GetSize(&size.x, &size.y);
return size;
}
void SetSize(uint32_t width, uint32_t height) override = 0;
void SetSize(glm::ivec2 size) override
{
SetSize(size.x, size.y);
}
void GetPosition(int* x, int* y) override = 0;
int GetPositionX() override
{
int x, y;
GetPosition(&x, &y);
return x;
}
int GetPositionY() override
{
int x, y;
GetPosition(&x, &y);
return y;
}
glm::ivec2 GetPosition() override
{
glm::ivec2 position;
GetPosition(&position.x, &position.y);
return position;
}
const std::string& GetTitle() override
{
return windowConfig.title;
}
WindowMode GetWindowMode() override
{
return windowConfig.windowMode;
}
void SetPosition(int posX, int posY) override = 0;
void SetPosition(glm::ivec2 pos) override { SetPosition(pos.x, pos.y); }
void Show() override = 0;
void Hide() override = 0;
void Show(const bool show) override { if (show) Show(); else Hide(); }
IVulkanWindow* GetVulkanWindow() override
{
return nullptr;
}
IOpenGlWindow* GetOpenGlWindow() override
{
return nullptr;
}
int GetWindowId() const override
{
return windowId;
}
};
}