Source code for simvx.editor.about_dialog

"""About dialog for the SimVX editor: minimal modal overlay."""

from simvx.core import Key, KeyEvent, Pointer, PointerEvent, PointerPhase, ScrollEvent
from simvx.core.descriptors import Property
from simvx.core.ui.enums import Anchor

from .modal_dialog import BaseModalDialog

_W = 360.0
_H = 160.0
_BG = (0.16, 0.16, 0.18, 1.0)
_BORDER = (0.35, 0.35, 0.38, 1.0)
_TEXT = (0.92, 0.92, 0.94, 1.0)
_DIM = (0.55, 0.55, 0.58, 1.0)


[docs] class AboutDialog(BaseModalDialog): """Minimal modal about dialog for the SimVX editor.""" PAUSE_TREE_WHEN_MODAL = True # Above every panel: a modal answer is what the user is looking at. z_index = Property(2000, range=(-4096, 4096), hint="Draw order (higher = on top)", on_change="_invalidate_z_cache") anchor = Property(Anchor.FULL_RECT, group="Layout", hint="A full-screen overlay unless the caller places it") def __init__(self, **kwargs): super().__init__(**kwargs)
[docs] def show_dialog(self): self.open_modal()
[docs] def hide_dialog(self): self.dismiss()
[docs] def on_gui_input(self, event): if not self.visible: return if isinstance(event, PointerEvent): if event.button in Pointer.PRIMARY and event.phase is PointerPhase.DOWN: # Click anywhere closes the dialog. self.hide_dialog() return True return None if isinstance(event, ScrollEvent): return None if isinstance(event, KeyEvent) and event.pressed and event.key is Key.ENTER: self.hide_dialog() return True
[docs] def on_draw(self, renderer): if not self.visible: return ss = self._get_parent_size() sw, sh = ss.x, ss.y # The blocking overlay's dim scrim already paints the backdrop; just the card here. dx = (sw - _W) / 2 dy = (sh - _H) / 2 renderer.rect((dx, dy), (_W, _H), fill=_BG) renderer.rect((dx, dy), (_W, _H), stroke=_BORDER) renderer.text("SimVX Engine", (dx + 20, dy + 18), fill=_TEXT, scale=1.3) renderer.text("A node-based game engine in pure Python.", (dx + 20, dy + 54), fill=_DIM, scale=0.85) renderer.text("Node-based scene hierarchy with Vulkan rendering.", (dx + 20, dy + 76), fill=_DIM, scale=0.85) renderer.text("GPU-driven forward renderer, multi-draw indirect.", (dx + 20, dy + 98), fill=_DIM, scale=0.85) renderer.text("Click or press Escape to close.", (dx + 20, dy + 130), fill=_DIM, scale=0.75)