# HG changeset patch # User Sam # Date 1708165115 -25200 # Node ID 63797470148460161fea14a015c536ccbba2f4fc # Parent afdd5ca14abfbf63e550b13530777ad2adc226cd fix: problem with text-position, simpler test-update function diff -r afdd5ca14abf -r 637974701484 semicongine/engine.nim --- 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() diff -r afdd5ca14abf -r 637974701484 semicongine/text.nim --- 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