Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions arcade/gui/experimental/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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",
Expand All @@ -34,4 +57,5 @@
"TransitionChain",
"TransitionParallel",
"TransitionDelay",
"pixelated_ui",
]
Loading