# HG changeset patch # User Sam # Date 1694108064 -25200 # Node ID a9c67e1ecb8da78263d36c663be75dcca16b63bf # Parent 73de86a9ec0a8e6ce5a1ad689ce06edb5b2ddc8c did: small font improvments diff -r 73de86a9ec0a -r a9c67e1ecb8d src/semicongine/renderer.nim --- a/src/semicongine/renderer.nim Fri Sep 08 00:05:19 2023 +0700 +++ b/src/semicongine/renderer.nim Fri Sep 08 00:34:24 2023 +0700 @@ -66,7 +66,9 @@ if scene.usesMaterial(materialName): for input in pipeline.inputs: if found.contains(input.name): - assert input == found[input.name], &"{input} != {found[input.name]}" + assert input.name == found[input.name].name, &"{input.name} != {found[input.name].name}" + assert input.theType == found[input.name].theType, &"{input.theType} != {found[input.name].theType}" + assert input.arrayCount == found[input.name].arrayCount, &"{input.arrayCount} != {found[input.name].arrayCount}" else: result.add input found[input.name] = input diff -r 73de86a9ec0a -r a9c67e1ecb8d src/semicongine/text.nim --- a/src/semicongine/text.nim Fri Sep 08 00:05:19 2023 +0700 +++ b/src/semicongine/text.nim Fri Sep 08 00:34:24 2023 +0700 @@ -82,8 +82,10 @@ proc `text=`*(textbox: var Textbox, text: seq[Rune]) = textbox.text = text textbox.updateMesh() +proc `text=`*(textbox: var Textbox, text: string) = + `text=`(textbox, text.toRunes) -proc initTextbox*(maxLen: int, font: Font, text=toRunes("")): Textbox = +proc initTextbox*(maxLen: int, font: Font, text="".toRunes): Textbox = var positions = newSeq[Vec3f](int(maxLen * 4)) indices: seq[array[3, uint16]] @@ -103,3 +105,6 @@ ) result.updateMesh() + +proc initTextbox*(maxLen: int, font: Font, text=""): Textbox = + initTextbox(maxLen=maxLen, font=font, text=text.toRunes) diff -r 73de86a9ec0a -r a9c67e1ecb8d tests/test_font.nim --- a/tests/test_font.nim Fri Sep 08 00:05:19 2023 +0700 +++ b/tests/test_font.nim Fri Sep 08 00:34:24 2023 +0700 @@ -6,7 +6,7 @@ proc main() = var font = loadFont("DejaVuSans.ttf", color=newVec4f(1, 0.5, 0.5, 1), resolution=20) - var textbox = initTextbox(32, font, "".toRunes) + var textbox = initTextbox(32, font, "") var scene = Scene(name: "main") scene.add textbox textbox.mesh.transform = scale(0.01, 0.01)