4from pathlib
import Path
7from ._native
import mxvk
10"""Alias for MXVK's RGBA color class."""
13class App(mxvk.Window):
18 def __init__(self, title: str =
"MXVK", width: int = 1280, height: int = 720, *, fullscreen: bool =
False, vsync: bool =
True, validation: bool =
False, shader_directory: str | Path |
None =
None) ->
None:
27 if shader_directory
is not None:
28 mxvk.set_default_shader_directory(str(shader_directory))
29 present_mode = mxvk.PresentModePreference.vsync
if vsync
else mxvk.PresentModePreference.low_latency
30 super().
__init__(title, width, height, fullscreen, validation, present_mode, mxvk.RuntimeMode.windowed)
48 def event(self, event: mxvk.Event) ->
None:
52 def add(self, resource: Any) -> Any:
59 def draw_text(self, text: str, x: int, y: int, font: Any, color: Color =
Color(255, 255, 255, 255)) ->
None:
68 self.print_text(text, x, y, color, font.native)
70 def text_size(self, text: str, font: Any) -> tuple[int, int] |
None:
75 return self.get_text_dimensions(text, font.native)
77 def run(self) -> None:
95 for resource
in reversed(self.
_managed):
96 close = getattr(resource,
"close",
None)
bool _closed
Safely release managed objects and Vulkan window resources.
None __init__(self, str title="MXVK", int width=1280, int height=720, *, bool fullscreen=False, bool vsync=True, bool validation=False, str|Path|None shader_directory=None)
A simple callback-driven MXVK application.
None __exit__(self, *object _)
Any add(self, Any resource)
None on_event(self, mxvk.Event event)
list _managed
Safely release managed objects and Vulkan window resources.
None event(self, mxvk.Event event)
None draw_text(self, str text, int x, int y, Any font, Color color=Color(255, 255, 255, 255))
tuple[int, int]|None text_size(self, str text, Any font)