# HG changeset patch # User Sam # Date 1694108064 -25200 # Node ID 6cc16b62e4973d41c3a86f4967dc76319bbee5e5 # Parent 01ccd1393e7ff48e5273e42acd39b88e94ddcd54 did: small font improvments diff -r 01ccd1393e7f -r 6cc16b62e497 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 01ccd1393e7f -r 6cc16b62e497 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 01ccd1393e7f -r 6cc16b62e497 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)