Skip to content
Merged
Show file tree
Hide file tree
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
15 changes: 11 additions & 4 deletions arcade/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import pyglet.config
import pyglet.window.mouse
from pyglet.config import GraphicsAPI
from pyglet.display.base import Screen, ScreenMode
from pyglet.event import EVENT_HANDLE_STATE, EVENT_UNHANDLED
from pyglet.window import MouseCursor
Expand Down Expand Up @@ -211,15 +212,21 @@ def __init__(
self._pixel_perfect: bool = pixel_perfect
"""If True, ignore OS DPI scaling and use a 1:1 pixel ratio."""

_GL_API_MAP = {
"opengl": GraphicsAPI.OPENGL,
"opengles": GraphicsAPI.OPENGL_ES_3,
}

config = None
# Attempt to make window with antialiasing
if gl_api == "opengl" or gl_api == "opengles":
graphics_api = _GL_API_MAP[gl_api]
if antialiasing:
try:
config = pyglet.config.OpenGLConfig(
config = pyglet.config.OpenGLUserConfig(
major_version=gl_version[0],
minor_version=gl_version[1],
opengl_api=gl_api.replace("open", ""), # type: ignore # pending: upstream fix
api=graphics_api,
double_buffer=True,
sample_buffers=1,
samples=samples,
Expand All @@ -236,10 +243,10 @@ def __init__(
antialiasing = False
# If we still don't have a config
if not config:
config = pyglet.config.OpenGLConfig(
config = pyglet.config.OpenGLUserConfig(
major_version=gl_version[0],
minor_version=gl_version[1],
opengl_api=gl_api.replace("open", ""), # type: ignore # pending: upstream fix
api=graphics_api,
double_buffer=True,
depth_size=24,
stencil_size=8,
Expand Down
6 changes: 3 additions & 3 deletions arcade/examples/gui/exp_controller_inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@

import pyglet.font
from pyglet.event import EVENT_HANDLED
from pyglet.gl import GL_NEAREST
from pyglet.input import Controller

import arcade
from arcade.gl.enums import NEAREST
from arcade import Rect
from arcade.examples.gui.exp_controller_support_grid import (
ControllerIndicator,
Expand Down Expand Up @@ -412,8 +412,8 @@ def on_draw_before_ui(self):

if __name__ == "__main__":
# pixelate the font
pyglet.font.base.Font.texture_min_filter = GL_NEAREST # type: ignore
pyglet.font.base.Font.texture_mag_filter = GL_NEAREST # type: ignore
pyglet.font.base.Font.texture_min_filter = NEAREST # type: ignore
pyglet.font.base.Font.texture_mag_filter = NEAREST # type: ignore

load_kenney_fonts()

Expand Down
2 changes: 1 addition & 1 deletion arcade/future/video/video_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class VideoPlayer:
def __init__(self, path: str | Path, loop: bool = False):
self.player = pyglet.media.VideoPlayer()
self.player.loop = loop
self.player.queue(pyglet.media.load(str(arcade.resources.resolve(path))))
self.player.queue(pyglet.media.load_video(str(arcade.resources.resolve(path))))
self.player.play()

self.ctx = arcade.get_window().ctx
Expand Down
2 changes: 1 addition & 1 deletion arcade/gl/backends/opengl/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ def get(self, enum, default=0) -> int:
value = c_int()
gl.glGetIntegerv(enum, value)
return value.value
except pyglet.gl.lib.GLException:
except gl.lib.GLException:
return default

def get_float(self, enum, default=0.0) -> float:
Expand Down
2 changes: 1 addition & 1 deletion arcade/gl/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ def blend_func(self) -> Tuple[int, int] | Tuple[int, int, int, int]:

These enums can be accessed in the ``arcade.gl``
module or simply as attributes of the context object.
The raw enums from ``pyglet.gl`` can also be used.
The raw enums from ``pyglet.graphics.api.gl`` can also be used.

Example::

Expand Down
2 changes: 1 addition & 1 deletion arcade/sound.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def __init__(self, file_name: str | Path, streaming: bool = False):
raise FileNotFoundError(f"The sound file '{file_name}' is not a file or can't be read.")
self.file_name = str(file_name)

self.source: Source = media.load(self.file_name, streaming=streaming)
self.source: Source = media.load_audio(self.file_name, streaming=streaming)
"""
The :py:class:`pyglet.media.Source` object that holds the audio data.
"""
Expand Down
7 changes: 7 additions & 0 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@
# 2. The commit: https://github.com/pyglet/pyglet/commit/97076c3a33a7d368cc9c9e44ca67769b6a16a905
sys.is_pyglet_doc_run = True

# pyglet 3.0.dev3 LibraryMock lacks __iter__/__bool__, causing crashes
# when ffmpeg codec init calls get_input_extensions() during doc builds.
# Patch before any pyglet imports trigger media codec loading.
import pyglet.lib # noqa: E402
pyglet.lib.LibraryMock.__bool__ = lambda self: False
pyglet.lib.LibraryMock.__iter__ = lambda self: iter([])

# --- Pre-processing Tasks

# Report our diagnostic info
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ classifiers = [
dependencies = [
"pillow>=11.3.0",
"pytiled-parser~=2.2.9",
"pyglet==3.0.dev2",
"pyglet==3.0.dev3",
]
dynamic = ["version"]

Expand Down
Loading