feature: Add ability to draw to display directly from Python
This commit is contained in:
parent
81b89a1a4f
commit
d15a716476
8 changed files with 32 additions and 27 deletions
18
render.py
18
render.py
|
@ -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!")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue