Mercurial > games > semicongine
changeset 903:f3e53f865e98
fix: problem with text-position, simpler test-update function
author | Sam <sam@basx.dev> |
---|---|
date | Sat, 17 Feb 2024 17:18:35 +0700 |
parents | 904e0a827ef3 |
children | a253a691e0d6 |
files | semicongine/engine.nim semicongine/text.nim |
diffstat | 2 files changed, 6 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/semicongine/engine.nim Sat Feb 17 16:37:24 2024 +0700 +++ b/semicongine/engine.nim Sat Feb 17 17:18:35 2024 +0700 @@ -221,6 +221,11 @@ func limits*(engine: Engine): VkPhysicalDeviceLimits = engine.gpuDevice().physicalDevice.properties.limits +proc processEventsFor*(engine: Engine, text: var Text) = + if engine.input.windowWasResized: + text.aspect_ratio = engine.getAspectRatio() + text.refresh() + proc processEventsFor*(engine: Engine, panel: var Panel) = if engine.input.windowWasResized: panel.aspect_ratio = engine.getAspectRatio()
--- a/semicongine/text.nim Sat Feb 17 16:37:24 2024 +0700 +++ b/semicongine/text.nim Sat Feb 17 17:18:35 2024 +0700 @@ -142,7 +142,7 @@ text.mesh[POSITION_ATTRIB, vertexOffset + 1] = newVec3f() text.mesh[POSITION_ATTRIB, vertexOffset + 2] = newVec3f() text.mesh[POSITION_ATTRIB, vertexOffset + 3] = newVec3f() - text.mesh.transform = translate(text.position.x, text.position.y, 0) * scale(text.scale, text.scale * text.aspect_ratio) + text.mesh.transform = translate(text.position.x, text.position.y * text.aspect_ratio, 0) * scale(text.scale, text.scale * text.aspect_ratio) text.lastRenderedText = text.processedText text.dirty = false