refactor: add Window interface

This commit is contained in:
MihailRis
2025-04-02 14:59:53 +03:00
parent cd5c6a889c
commit 9694a59649
31 changed files with 859 additions and 923 deletions
+9 -7
View File
@@ -18,7 +18,8 @@ MenuScreen::MenuScreen(Engine& engine) : Screen(engine) {
menu->reset();
menu->setPage("main");
uicamera = std::make_unique<Camera>(glm::vec3(), Window::height);
uicamera =
std::make_unique<Camera>(glm::vec3(), engine.getWindow().getSize().y);
uicamera->perspective = false;
uicamera->flipped = true;
}
@@ -31,13 +32,14 @@ void MenuScreen::update(float delta) {
void MenuScreen::draw(float delta) {
auto assets = engine.getAssets();
Window::clear();
Window::setBgColor(glm::vec3(0.2f));
display::clear();
display::setBgColor(glm::vec3(0.2f));
uint width = Window::width;
uint height = Window::height;
const auto& size = engine.getWindow().getSize();
uint width = size.x;
uint height = size.y;
uicamera->setFov(Window::height);
uicamera->setFov(height);
uicamera->setAspectRatio(width / static_cast<float>(height));
auto uishader = assets->get<Shader>("ui");
uishader->use();
@@ -49,7 +51,7 @@ void MenuScreen::draw(float delta) {
batch->rect(
0, 0,
width, height, 0, 0, 0,
UVRegion(0, 0, width/bg->getWidth(), height/bg->getHeight()),
UVRegion(0, 0, width / bg->getWidth(), height / bg->getHeight()),
false, false, glm::vec4(1.0f)
);
batch->flush();