Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Text node: updating text causing crash #133

Open
PawelRoman opened this issue Dec 30, 2021 · 0 comments
Open

Text node: updating text causing crash #133

PawelRoman opened this issue Dec 30, 2021 · 0 comments

Comments

@PawelRoman
Copy link
Contributor

PawelRoman commented Dec 30, 2021

Kaaengine build v. 0.11+75.gbc2555f

Add Text node and on keyboard text event we try to update text node's text. When we do that, engine crashes with

Traceback (most recent call last):
  File "/home/pawel/Dev/gates-of-valhalla/demos/text_typing/main.py", line 34, in <module>
    engine.run(MyScene())
  File "engine.pxi", line 100, in kaa._kaa._Engine.run
kaa._kaa.KaacoreError: /host/kaacore/src/draw_unit.cpp:212 !(draw_unit_it != this->draw_units.end()) - Target draw unit not found, end of draw units vector reached.

Code to replicate the issue:

import logging
from logging import DEBUG

from kaa.fonts import TextNode
from kaa.geometry import Vector
from kaa.engine import Engine

from scenes.base import SceneBase

logging.basicConfig(level=DEBUG, format="%(levelname)s | %(asctime)s | %(module)s:%(lineno)d | %(message)s")


class MyScene(SceneBase):

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.text_node = TextNode(font_size=40, text="", position=Vector(200, 200))
        self.root.add_child(self.text_node)

    def update(self, dt):
        for event in self.input.events():
            if event.keyboard_text:
                self.text_node.text = event.keyboard_text.text


if __name__ == "__main__":

    with Engine(virtual_resolution=Vector(1800, 900)) as engine:

        engine.window.size = Vector(1800, 900)
        engine.window.fullscreen = False
        engine.window.title = "Text typing"
        engine.window.center()
        engine.run(MyScene())

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant