From 2ac3b9831ba058539e3056761d76db90950b1bb5 Mon Sep 17 00:00:00 2001 From: ValeriiKoniushenko Date: Tue, 25 Jul 2023 23:39:54 +0300 Subject: [PATCH] Buf fixing --- game/assets/shaders/text.vert | 7 ++++--- game/assets/shaders/widget.vert | 6 +++--- game/source/VaKon2D.cpp | 2 +- lib/core/input-devices/source/Mouse.cpp | 2 -- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/game/assets/shaders/text.vert b/game/assets/shaders/text.vert index 41b6f509d..c1db27e4c 100644 --- a/game/assets/shaders/text.vert +++ b/game/assets/shaders/text.vert @@ -1,6 +1,7 @@ #version 330 core -layout (location = 0) in vec2 aVertex;// -layout (location = 1) in vec2 aUv;// + +layout (location = 0) in vec2 aVertex; +layout (location = 1) in vec2 aUv; out vec2 TexCoords; @@ -9,6 +10,6 @@ uniform mat4 uTransform; void main() { - gl_Position = uTransform * vec4(aVertex / uResolution, 0.0, 1.0); TexCoords = aUv; + gl_Position = uTransform * vec4(aVertex / uResolution, 0.0, 1.0); } \ No newline at end of file diff --git a/game/assets/shaders/widget.vert b/game/assets/shaders/widget.vert index a59bc39e1..adb1e9ebe 100644 --- a/game/assets/shaders/widget.vert +++ b/game/assets/shaders/widget.vert @@ -1,15 +1,15 @@ #version 330 core -layout (location = 0) in vec2 aPos; +layout (location = 0) in vec2 aVertex; layout (location = 1) in vec2 aCv; out vec2 ioCv; -uniform mat4 uTransform; uniform vec2 uResolution; +uniform mat4 uTransform; void main() { ioCv = aCv; - gl_Position = uTransform * vec4(aPos / uResolution, 0.0, 1.0); + gl_Position = uTransform * vec4(aVertex / uResolution, 0.0, 1.0); } \ No newline at end of file diff --git a/game/source/VaKon2D.cpp b/game/source/VaKon2D.cpp index 3ec321e8b..079b43de8 100644 --- a/game/source/VaKon2D.cpp +++ b/game/source/VaKon2D.cpp @@ -65,7 +65,7 @@ void VaKon2D::start() Font font("assets/fonts/Roboto-Medium.ttf"); LineText text(font, "Hello world"); text.setTexture(texture); - text.move({100.f, 100.f}); + text.setPosition({100.f, 100.f}); text.prepare(shaderPack); KeyboardInputAction iaWidgetReflector("WidgetReflector", Keyboard::Key::F1); diff --git a/lib/core/input-devices/source/Mouse.cpp b/lib/core/input-devices/source/Mouse.cpp index 410b2136b..38c76c0dd 100644 --- a/lib/core/input-devices/source/Mouse.cpp +++ b/lib/core/input-devices/source/Mouse.cpp @@ -18,8 +18,6 @@ glm::ivec2 Mouse::getPosition(Window& wnd) POINT p{}; GetCursorPos(&p); ScreenToClient(wnd.getHwnd(), &p); - p.x += -wnd.getSize().width / 2; - p.y += -wnd.getSize().height / 2; return glm::ivec2(static_cast(p.x), static_cast(p.y)); }