From 080a553e6d7fdc2420e1fe1f5bb30b08e9d57613 Mon Sep 17 00:00:00 2001 From: Maic Siemering Date: Thu, 23 Jul 2026 10:54:09 +0200 Subject: [PATCH] gui: add experiemntal function to activate pixelated ui & text --- arcade/gui/experimental/__init__.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/arcade/gui/experimental/__init__.py b/arcade/gui/experimental/__init__.py index a875d5057..0d6b10f12 100644 --- a/arcade/gui/experimental/__init__.py +++ b/arcade/gui/experimental/__init__.py @@ -4,6 +4,8 @@ No Deprecation warnings are given for changes in this module. """ +from arcade.gui import UIManager + from arcade.gui.experimental.scroll_area import UIScrollArea from arcade.gui.experimental.password_input import UIPasswordInput from arcade.gui.experimental.animate import Animation, rel @@ -19,6 +21,27 @@ TransitionDelay, ) + +def pixelated_ui(): + """ + Set the UI to be pixelated, with no text anti-aliasing and nearest-neighbor + font filtering. This is useful for pixel-art games that want to maintain a + pixelated look for their UI. + + This will take effect to any text within the game and has to be activated before + any text or UIManager is created. + + (Best Practices: within main function, before creating the window.) + """ + import pyglet + + pyglet.options.text_antialiasing = False + pyglet.font.base.Font.texture_min_filter = pyglet.gl.GL_NEAREST + pyglet.font.base.Font.texture_mag_filter = pyglet.gl.GL_NEAREST + + UIManager._pixelated = True + + __all__ = [ "UIScrollArea", "UIPasswordInput", @@ -34,4 +57,5 @@ "TransitionChain", "TransitionParallel", "TransitionDelay", + "pixelated_ui", ]