feature: Add ability to draw to display directly from Python

This commit is contained in:
Tera << 8 2025-06-08 09:19:04 -04:00
parent 81b89a1a4f
commit d15a716476
Signed by: imterah
GPG key ID: 8FA7DD57BA6CEA37
8 changed files with 32 additions and 27 deletions

View file

@ -5,26 +5,10 @@ import pyray
from libunreal import EvdiDisplaySpec
def render_loop(display_metadata: EvdiDisplaySpec, cards: list[PyEvdi.Card]):
pyray.init_window(display_metadata.max_width, display_metadata.max_height, "UnrealXR")
while not pyray.window_should_close():
# Implement fullscreen toggle
if pyray.is_key_pressed(pyray.KeyboardKey.KEY_F11):
display = pyray.get_current_monitor()
if pyray.is_window_fullscreen():
pyray.set_window_size(display_metadata.max_width, display_metadata.max_height)
else:
pyray.set_window_size(pyray.get_monitor_width(display), pyray.get_monitor_height(display))
pyray.toggle_fullscreen()
# Ctrl-C to quit
elif pyray.is_key_down(pyray.KeyboardKey.KEY_LEFT_CONTROL) and pyray.is_key_down(pyray.KeyboardKey.KEY_C):
break
pyray.begin_drawing()
pyray.clear_background(pyray.BLACK)
pyray.draw_text("Hello world", 190, 200, 20, pyray.VIOLET)
pyray.draw_text("Hello world from Python!", 190, 200, 96, pyray.WHITE)
pyray.end_drawing()
logger.info("Goodbye!")