diff --git a/arcade/__init__.py b/arcade/__init__.py index 05c4afd90e..a4c812d3ea 100644 --- a/arcade/__init__.py +++ b/arcade/__init__.py @@ -59,6 +59,11 @@ def configure_logging(level: int | None = None): import pyglet +# Enable HiDPI support +if os.environ.get("ARCADE_TEST"): + pyglet.options.dpi_scaling = "real" +else: + pyglet.options.dpi_scaling = "stretch" # Env variable shortcut for headless mode headless: Final[bool] = bool(os.environ.get("ARCADE_HEADLESS")) @@ -72,9 +77,6 @@ def configure_logging(level: int | None = None): if sys.platform == "darwin" or os.environ.get("ARCADE_HEADLESS") or utils.is_raspberry_pi(): pyglet.options.shadow_window = False # type: ignore # pending https://github.com/pyglet/pyglet/issues/1164 -# Use the old gdi fonts on windows until directwrite is fast/stable -# pyglet.options.win32_gdi_font = True - # Imports from modules that don't do anything circular # Complex imports with potential circularity diff --git a/arcade/application.py b/arcade/application.py index c683212ef7..bad37616db 100644 --- a/arcade/application.py +++ b/arcade/application.py @@ -195,7 +195,7 @@ def __init__( alpha_size=8, ) display = pyglet.display.get_display() - screen = display.get_default_screen() # type: ignore # pending: resolve upstream type tricks + screen = screen or display.get_default_screen() if screen: config = screen.get_best_config(config) except pyglet.window.NoSuchConfigException: @@ -260,11 +260,9 @@ def __init__( self.set_vsync(vsync) - super().set_fullscreen(fullscreen, screen) - # This used to be necessary on Linux, but no longer appears to be. - # With Pyglet 2.0+, setting this to false will not allow the screen to - # update. It does, however, cause flickering if creating a window that - # isn't derived from the Window class. + if fullscreen is True: + super().set_fullscreen(True, screen) + set_window(self) self.push_handlers(on_resize=self._on_resize) @@ -472,7 +470,7 @@ def center_window(self) -> None: # Get the display screen using pyglet screen_width, screen_height = get_display_size() - window_width, window_height = self.get_size() + window_width, window_height = self.get_framebuffer_size() # Center the window self.set_location((screen_width - window_width) // 2, (screen_height - window_height) // 2) diff --git a/arcade/start_finish_data.py b/arcade/start_finish_data.py index 52ccff1d11..31e7384457 100644 --- a/arcade/start_finish_data.py +++ b/arcade/start_finish_data.py @@ -52,7 +52,10 @@ def begin(self): Should only be called once followed by a call to :py:meth:`end`. """ - self.generator_func = self.atlas.render_into(self.texture) + self.generator_func = self.atlas.render_into( + self.texture, + projection=(0, self.window.width, 0, self.window.height), + ) fbo = self.generator_func.__enter__() fbo.clear(color=self.window.background_color) diff --git a/tests/conftest.py b/tests/conftest.py index 2abf2d8e7f..422288e635 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -3,6 +3,9 @@ import os from pathlib import Path +os.environ["ARCADE_TEST"] = "True" + + if os.environ.get("ARCADE_PYTEST_USE_RUST"): import arcade_accelerate # pyright: ignore [reportMissingImports]