pyglet 2.1.2__py3-none-any.whl → 2.1.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pyglet/__init__.py +1 -1
- pyglet/app/xlib.py +1 -1
- pyglet/display/cocoa.py +2 -2
- pyglet/display/win32.py +3 -3
- pyglet/display/xlib.py +2 -2
- pyglet/gui/frame.py +4 -4
- pyglet/image/__init__.py +0 -2
- pyglet/image/codecs/dds.py +1 -1
- pyglet/input/linux/x11_xinput.py +3 -3
- pyglet/input/linux/x11_xinput_tablet.py +2 -2
- pyglet/input/win32/directinput.py +1 -1
- pyglet/input/win32/wintab.py +1 -1
- pyglet/math.py +5 -5
- pyglet/model/__init__.py +78 -57
- pyglet/window/__init__.py +11 -8
- pyglet/window/xlib/__init__.py +2 -2
- {pyglet-2.1.2.dist-info → pyglet-2.1.3.dist-info}/METADATA +2 -3
- {pyglet-2.1.2.dist-info → pyglet-2.1.3.dist-info}/RECORD +20 -20
- {pyglet-2.1.2.dist-info → pyglet-2.1.3.dist-info}/LICENSE +0 -0
- {pyglet-2.1.2.dist-info → pyglet-2.1.3.dist-info}/WHEEL +0 -0
pyglet/__init__.py
CHANGED
pyglet/app/xlib.py
CHANGED
|
@@ -54,7 +54,7 @@ class NotificationDevice(XlibSelectDevice):
|
|
|
54
54
|
|
|
55
55
|
class XlibEventLoop(PlatformEventLoop):
|
|
56
56
|
def __init__(self):
|
|
57
|
-
super(
|
|
57
|
+
super().__init__()
|
|
58
58
|
self._notification_device = NotificationDevice()
|
|
59
59
|
self.select_devices = set()
|
|
60
60
|
self.select_devices.add(self._notification_device)
|
pyglet/display/cocoa.py
CHANGED
|
@@ -31,7 +31,7 @@ class CocoaScreen(Screen):
|
|
|
31
31
|
# http://www.cocoabuilder.com/archive/cocoa/233492-ns-cg-rect-conversion-and-screen-coordinates.html
|
|
32
32
|
x, y = bounds.origin.x, bounds.origin.y
|
|
33
33
|
width, height = bounds.size.width, bounds.size.height
|
|
34
|
-
super(
|
|
34
|
+
super().__init__(display, int(x), int(y), int(width), int(height))
|
|
35
35
|
self._cg_display_id = displayID
|
|
36
36
|
# Save the default mode so we can restore to it.
|
|
37
37
|
self._default_mode = self.get_mode()
|
|
@@ -111,7 +111,7 @@ class CocoaScreen(Screen):
|
|
|
111
111
|
class CocoaScreenMode(ScreenMode):
|
|
112
112
|
|
|
113
113
|
def __init__(self, screen, cgmode):
|
|
114
|
-
super(
|
|
114
|
+
super().__init__(screen)
|
|
115
115
|
quartz.CGDisplayModeRetain(cgmode)
|
|
116
116
|
self.cgmode = cgmode
|
|
117
117
|
self.width = int(quartz.CGDisplayModeGetWidth(cgmode))
|
pyglet/display/win32.py
CHANGED
|
@@ -63,7 +63,7 @@ class Win32Screen(Screen):
|
|
|
63
63
|
_initial_mode = None
|
|
64
64
|
|
|
65
65
|
def __init__(self, display, handle, x, y, width, height):
|
|
66
|
-
super(
|
|
66
|
+
super().__init__(display, x, y, width, height)
|
|
67
67
|
self._handle = handle
|
|
68
68
|
|
|
69
69
|
def get_matching_configs(self, template):
|
|
@@ -145,7 +145,7 @@ class Win32Screen(Screen):
|
|
|
145
145
|
|
|
146
146
|
class Win32ScreenMode(ScreenMode):
|
|
147
147
|
def __init__(self, screen, mode):
|
|
148
|
-
super(
|
|
148
|
+
super().__init__(screen)
|
|
149
149
|
self._mode = mode
|
|
150
150
|
self.width = mode.dmPelsWidth
|
|
151
151
|
self.height = mode.dmPelsHeight
|
|
@@ -158,6 +158,6 @@ class Win32ScreenMode(ScreenMode):
|
|
|
158
158
|
|
|
159
159
|
class Win32Canvas(Canvas):
|
|
160
160
|
def __init__(self, display, hwnd, hdc):
|
|
161
|
-
super(
|
|
161
|
+
super().__init__(display)
|
|
162
162
|
self.hwnd = hwnd
|
|
163
163
|
self.hdc = hdc
|
pyglet/display/xlib.py
CHANGED
|
@@ -96,7 +96,7 @@ class XlibDisplay(XlibSelectDevice, Display):
|
|
|
96
96
|
if x_screen >= screen_count:
|
|
97
97
|
raise NoSuchDisplayException(f'Display "{name}" has no screen {x_screen:d}')
|
|
98
98
|
|
|
99
|
-
super(
|
|
99
|
+
super().__init__()
|
|
100
100
|
self.name = name
|
|
101
101
|
self.x_screen = x_screen
|
|
102
102
|
|
|
@@ -276,7 +276,7 @@ class XlibScreenMode(ScreenMode):
|
|
|
276
276
|
self.info = info
|
|
277
277
|
self.width = info.hdisplay
|
|
278
278
|
self.height = info.vdisplay
|
|
279
|
-
self.rate = info.dotclock
|
|
279
|
+
self.rate = (info.dotclock * 1000) / (info.htotal * info.vtotal)
|
|
280
280
|
self.depth = None
|
|
281
281
|
|
|
282
282
|
|
pyglet/gui/frame.py
CHANGED
|
@@ -32,7 +32,7 @@ class Frame:
|
|
|
32
32
|
The cell ("bucket") size for each cell in the hash.
|
|
33
33
|
Widgets may span multiple cells.
|
|
34
34
|
order:
|
|
35
|
-
Widgets use internal
|
|
35
|
+
Widgets use internal ordered Groups for draw sorting.
|
|
36
36
|
This is the base value for these Groups.
|
|
37
37
|
"""
|
|
38
38
|
self._window = window
|
|
@@ -149,7 +149,7 @@ class MovableFrame(Frame):
|
|
|
149
149
|
When a specified modifier key is held down, Widgets can be
|
|
150
150
|
repositioned by dragging them. Examples of modifier keys are
|
|
151
151
|
Ctrl, Alt, Shift. These are defined in the `pyglet.window.key`
|
|
152
|
-
module, and start
|
|
152
|
+
module, and start with `MOD_`. For example::
|
|
153
153
|
|
|
154
154
|
from pyglet.window.key import MOD_CTRL
|
|
155
155
|
|
|
@@ -163,7 +163,7 @@ class MovableFrame(Frame):
|
|
|
163
163
|
"""Create an instance of a MovableFrame.
|
|
164
164
|
|
|
165
165
|
This is a similar to the standard Frame class, except that
|
|
166
|
-
you can specify a
|
|
166
|
+
you can specify a modifier key. When this key is held down,
|
|
167
167
|
Widgets can be re-positioned by drag-and-dropping.
|
|
168
168
|
|
|
169
169
|
Args:
|
|
@@ -173,7 +173,7 @@ class MovableFrame(Frame):
|
|
|
173
173
|
enable:
|
|
174
174
|
Whether to enable frame.
|
|
175
175
|
order:
|
|
176
|
-
Widgets use internal
|
|
176
|
+
Widgets use internal ordered Groups for draw sorting.
|
|
177
177
|
This is the base value for these Groups.
|
|
178
178
|
modifier:
|
|
179
179
|
A key modifier, such as `pyglet.window.key.MOD_CTRL`
|
pyglet/image/__init__.py
CHANGED
|
@@ -1258,8 +1258,6 @@ class Texture(AbstractImage):
|
|
|
1258
1258
|
|
|
1259
1259
|
return cls(width, height, target, tex_id.value, min_filter, mag_filter)
|
|
1260
1260
|
|
|
1261
|
-
return texture
|
|
1262
|
-
|
|
1263
1261
|
def get_image_data(self, z: int = 0) -> ImageData:
|
|
1264
1262
|
"""Get the image data of this texture.
|
|
1265
1263
|
|
pyglet/image/codecs/dds.py
CHANGED
pyglet/input/linux/x11_xinput.py
CHANGED
|
@@ -43,7 +43,7 @@ class DeviceResponder:
|
|
|
43
43
|
|
|
44
44
|
class XInputDevice(DeviceResponder, Device):
|
|
45
45
|
def __init__(self, display, device_info):
|
|
46
|
-
super(
|
|
46
|
+
super().__init__(display, asstr(device_info.name))
|
|
47
47
|
|
|
48
48
|
self._device_id = device_info.id
|
|
49
49
|
self._device = None
|
|
@@ -104,7 +104,7 @@ class XInputDevice(DeviceResponder, Device):
|
|
|
104
104
|
def open(self, window=None, exclusive=False):
|
|
105
105
|
# Checks for is_open and raises if already open.
|
|
106
106
|
# TODO allow opening on multiple windows.
|
|
107
|
-
super(
|
|
107
|
+
super().open(window, exclusive)
|
|
108
108
|
|
|
109
109
|
if window is None:
|
|
110
110
|
self._is_open = False
|
|
@@ -126,7 +126,7 @@ class XInputDevice(DeviceResponder, Device):
|
|
|
126
126
|
self._install_events(window)
|
|
127
127
|
|
|
128
128
|
def close(self):
|
|
129
|
-
super(
|
|
129
|
+
super().close()
|
|
130
130
|
|
|
131
131
|
if not self._device:
|
|
132
132
|
return
|
|
@@ -23,7 +23,7 @@ class XInputTablet(Tablet):
|
|
|
23
23
|
|
|
24
24
|
class XInputTabletCanvas(DeviceResponder, TabletCanvas):
|
|
25
25
|
def __init__(self, window, cursors):
|
|
26
|
-
super(
|
|
26
|
+
super().__init__(window)
|
|
27
27
|
self.cursors = cursors
|
|
28
28
|
|
|
29
29
|
dispatcher = XInputWindowEventDispatcher.get_dispatcher(window)
|
|
@@ -71,7 +71,7 @@ class XInputTabletCanvas(DeviceResponder, TabletCanvas):
|
|
|
71
71
|
|
|
72
72
|
class XInputTabletCursor(TabletCursor):
|
|
73
73
|
def __init__(self, device):
|
|
74
|
-
super(
|
|
74
|
+
super().__init__(device.name)
|
|
75
75
|
self.device = device
|
|
76
76
|
|
|
77
77
|
|
|
@@ -64,7 +64,7 @@ def _create_control(object_instance):
|
|
|
64
64
|
class DirectInputDevice(base.Device):
|
|
65
65
|
def __init__(self, display, device, device_instance):
|
|
66
66
|
name = device_instance.tszInstanceName
|
|
67
|
-
super(
|
|
67
|
+
super().__init__(display, name)
|
|
68
68
|
|
|
69
69
|
self._type = device_instance.dwDevType & 0xff
|
|
70
70
|
self._subtype = device_instance.dwDevType & 0xff00
|
pyglet/input/win32/wintab.py
CHANGED
|
@@ -86,7 +86,7 @@ class WintabTabletCanvas(TabletCanvas):
|
|
|
86
86
|
override_keys = False
|
|
87
87
|
|
|
88
88
|
def __init__(self, device, window, msg_base=wintab.WT_DEFBASE):
|
|
89
|
-
super(
|
|
89
|
+
super().__init__(window)
|
|
90
90
|
|
|
91
91
|
self.device = device
|
|
92
92
|
self.msg_base = msg_base
|
pyglet/math.py
CHANGED
|
@@ -35,7 +35,7 @@ class Vec2(_typing.NamedTuple):
|
|
|
35
35
|
`Vec2` is an immutable 2D Vector, including most common
|
|
36
36
|
operators. As an immutable type, all operations return a new object.
|
|
37
37
|
|
|
38
|
-
.. note:: The Python
|
|
38
|
+
.. note:: The Python ``len`` operator returns the number of elements in
|
|
39
39
|
the vector. For the vector length, use the `length()` method.
|
|
40
40
|
|
|
41
41
|
.. note:: Python's :py:func:`sum` requires the first item to be a ``Vec2``.
|
|
@@ -370,10 +370,10 @@ class Vec2(_typing.NamedTuple):
|
|
|
370
370
|
class Vec3(_typing.NamedTuple):
|
|
371
371
|
"""A three-dimensional vector represented as X Y Z coordinates.
|
|
372
372
|
|
|
373
|
-
`Vec3` is an immutable
|
|
373
|
+
`Vec3` is an immutable 3D Vector, including most common operators.
|
|
374
374
|
As an immutable type, all operations return a new object.
|
|
375
375
|
|
|
376
|
-
.. note:: The Python
|
|
376
|
+
.. note:: The Python ``len`` operator returns the number of elements in
|
|
377
377
|
the vector. For the vector length, use the `length()` method.
|
|
378
378
|
"""
|
|
379
379
|
|
|
@@ -671,10 +671,10 @@ class Vec3(_typing.NamedTuple):
|
|
|
671
671
|
class Vec4(_typing.NamedTuple):
|
|
672
672
|
"""A four-dimensional vector represented as X Y Z W coordinates.
|
|
673
673
|
|
|
674
|
-
`Vec4` is an immutable
|
|
674
|
+
`Vec4` is an immutable 4D Vector, including most common operators.
|
|
675
675
|
As an immutable type, all operations return a new object.
|
|
676
676
|
|
|
677
|
-
.. note:: The Python
|
|
677
|
+
.. note:: The Python ``len` operator returns the number of elements in
|
|
678
678
|
the vector. For the vector length, use the `length()` method.
|
|
679
679
|
"""
|
|
680
680
|
|
pyglet/model/__init__.py
CHANGED
|
@@ -37,7 +37,7 @@ from pyglet.math import Mat4
|
|
|
37
37
|
|
|
38
38
|
from .codecs import add_default_codecs as _add_default_codecs
|
|
39
39
|
from .codecs import registry as _codec_registry
|
|
40
|
-
from .codecs.base import Material, Scene
|
|
40
|
+
from .codecs.base import Material, Scene, SimpleMaterial
|
|
41
41
|
|
|
42
42
|
if TYPE_CHECKING:
|
|
43
43
|
from typing import BinaryIO, TextIO
|
|
@@ -137,22 +137,13 @@ class Model:
|
|
|
137
137
|
for group in self.groups:
|
|
138
138
|
group.matrix = matrix
|
|
139
139
|
|
|
140
|
-
def draw(self) -> None:
|
|
141
|
-
"""Draw the model.
|
|
142
|
-
|
|
143
|
-
This is not recommended. See the module documentation
|
|
144
|
-
for information on efficient drawing of multiple models.
|
|
145
|
-
"""
|
|
146
|
-
gl.current_context.window_block.bind(0)
|
|
147
|
-
self._batch.draw_subset(self.vertex_lists)
|
|
148
|
-
|
|
149
140
|
|
|
150
141
|
class BaseMaterialGroup(graphics.Group):
|
|
151
142
|
default_vert_src: str
|
|
152
143
|
default_frag_src: str
|
|
153
144
|
matrix: Mat4 = Mat4()
|
|
154
145
|
|
|
155
|
-
def __init__(self, material:
|
|
146
|
+
def __init__(self, material: SimpleMaterial, program: ShaderProgram, order: int = 0, parent: Group | None = None) -> None:
|
|
156
147
|
super().__init__(order, parent)
|
|
157
148
|
self.material = material
|
|
158
149
|
self.program = program
|
|
@@ -209,7 +200,7 @@ class TexturedMaterialGroup(BaseMaterialGroup):
|
|
|
209
200
|
}
|
|
210
201
|
"""
|
|
211
202
|
|
|
212
|
-
def __init__(self, material:
|
|
203
|
+
def __init__(self, material: SimpleMaterial, program: ShaderProgram,
|
|
213
204
|
texture: Texture, order: int = 0, parent: Group | None = None):
|
|
214
205
|
super().__init__(material, program, order, parent)
|
|
215
206
|
self.texture = texture
|
|
@@ -305,7 +296,7 @@ class Cube(Model):
|
|
|
305
296
|
self._program = program if program else get_default_shader()
|
|
306
297
|
|
|
307
298
|
# Create a Material and Group for the Model
|
|
308
|
-
self._material = material if material else
|
|
299
|
+
self._material = material if material else SimpleMaterial(name="cube")
|
|
309
300
|
self._group = pyglet.model.MaterialGroup(material=self._material, program=self._program, parent=group)
|
|
310
301
|
|
|
311
302
|
self._vlist = self._create_vertexlist()
|
|
@@ -317,30 +308,51 @@ class Cube(Model):
|
|
|
317
308
|
h = self._height / 2
|
|
318
309
|
d = self._depth / 2
|
|
319
310
|
|
|
320
|
-
vertices =
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
311
|
+
vertices = [
|
|
312
|
+
-w, -h, -d, # front, bottom-left 0
|
|
313
|
+
w, -h, -d, # front, bottom-right 1
|
|
314
|
+
w, h, -d, # front, top-right 2 Front
|
|
315
|
+
-w, h, -d, # front, top-left 3
|
|
316
|
+
|
|
317
|
+
w, -h, d, # back, bottom-right 4
|
|
318
|
+
-w, -h, d, # back, bottom-left 5
|
|
319
|
+
-w, h, d, # back, top-left 6 Back
|
|
320
|
+
w, h, d, # back, top-right 7
|
|
321
|
+
|
|
322
|
+
w, -h, -d, # front, bottom-right 8
|
|
323
|
+
w, -h, d, # back, bottom-right 9
|
|
324
|
+
w, h, d, # back, top-right 10 Right
|
|
325
|
+
w, h, -d, # front, top-right 11
|
|
326
|
+
|
|
327
|
+
-w, -h, d, # back, bottom-left 12
|
|
328
|
+
-w, -h, -d, # front, bottom-left 13
|
|
329
|
+
-w, h, -d, # front, top-left 14 Left
|
|
330
|
+
-w, h, d, # back, top-left 15
|
|
331
|
+
|
|
332
|
+
-w, h, -d, # front, top-left 16
|
|
333
|
+
w, h, -d, # front, top-right 17
|
|
334
|
+
w, h, d, # back, top-right 18 Top
|
|
335
|
+
-w, h, d, # back, top-left 19
|
|
336
|
+
|
|
337
|
+
-w, -h, d, # back, bottom-left 20
|
|
338
|
+
w, -h, d, # back, bottom-right 21
|
|
339
|
+
w, -h, -d, # front, bottom-right 22 Bottom
|
|
340
|
+
-w, -h, -d, # front, bottom-left 23
|
|
341
|
+
]
|
|
342
|
+
|
|
343
|
+
normals = [0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, # front face
|
|
344
|
+
0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, # back face
|
|
345
|
+
1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, # right face
|
|
346
|
+
-1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, # left face
|
|
347
|
+
0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, # top face
|
|
348
|
+
0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0] # bottom face
|
|
349
|
+
|
|
350
|
+
indices = [23, 22, 20, 22, 21, 20, # bottom
|
|
351
|
+
19, 18, 16, 18, 17, 16, # top
|
|
352
|
+
15, 14, 12, 14, 13, 12, # left
|
|
353
|
+
11, 10, 8, 10, 9, 8, # right
|
|
354
|
+
7, 6, 4, 6, 5, 4, # back
|
|
355
|
+
3, 2, 0, 2, 1, 0] # front
|
|
344
356
|
|
|
345
357
|
return self._program.vertex_list_indexed(len(vertices) // 3, pyglet.gl.GL_TRIANGLES, indices,
|
|
346
358
|
batch=self._batch, group=self._group,
|
|
@@ -351,17 +363,18 @@ class Cube(Model):
|
|
|
351
363
|
|
|
352
364
|
class Sphere(Model):
|
|
353
365
|
|
|
354
|
-
def __init__(self, radius=1.0,
|
|
366
|
+
def __init__(self, radius=1.0, stacks=30, sectors=30, color=(1.0, 1.0, 1.0, 1.0),
|
|
355
367
|
material=None, batch=None, group=None, program=None):
|
|
356
368
|
self._radius = radius
|
|
357
|
-
self.
|
|
369
|
+
self._stacks = stacks
|
|
370
|
+
self._sectors = sectors
|
|
358
371
|
self._color = color
|
|
359
372
|
|
|
360
373
|
self._batch = batch
|
|
361
374
|
self._program = program if program else get_default_shader()
|
|
362
375
|
|
|
363
376
|
# Create a Material and Group for the Model
|
|
364
|
-
self._material = material if material else
|
|
377
|
+
self._material = material if material else SimpleMaterial(name="sphere")
|
|
365
378
|
self._group = pyglet.model.MaterialGroup(material=self._material, program=self._program, parent=group)
|
|
366
379
|
|
|
367
380
|
self._vlist = self._create_vertexlist()
|
|
@@ -369,27 +382,35 @@ class Sphere(Model):
|
|
|
369
382
|
super().__init__([self._vlist], [self._group], self._batch)
|
|
370
383
|
|
|
371
384
|
def _create_vertexlist(self):
|
|
372
|
-
radius = self._radius
|
|
373
|
-
|
|
385
|
+
radius = self._radius / 2
|
|
386
|
+
sectors = self._sectors
|
|
387
|
+
stacks = self._stacks
|
|
374
388
|
|
|
375
389
|
vertices = []
|
|
390
|
+
normals = []
|
|
376
391
|
indices = []
|
|
377
392
|
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
vertices.
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
+
sector_step = 2 * pi / sectors
|
|
394
|
+
stack_step = pi / stacks
|
|
395
|
+
|
|
396
|
+
for i in range(stacks + 1):
|
|
397
|
+
stack_angle = pi / 2 - i * stack_step
|
|
398
|
+
for j in range(sectors + 1):
|
|
399
|
+
sector_angle = j * sector_step
|
|
400
|
+
vertices.append(radius * cos(stack_angle) * cos(sector_angle)) # x
|
|
401
|
+
vertices.append(radius * cos(stack_angle) * sin(sector_angle)) # y
|
|
402
|
+
vertices.append(radius * sin(stack_angle)) # z
|
|
403
|
+
normals.append(cos(stack_angle) * cos(sector_angle)) # x
|
|
404
|
+
normals.append(cos(stack_angle) * sin(sector_angle)) # y
|
|
405
|
+
normals.append(sin(stack_angle)) # z
|
|
406
|
+
|
|
407
|
+
# Generate indices
|
|
408
|
+
for i in range(stacks):
|
|
409
|
+
for j in range(sectors):
|
|
410
|
+
first = i * (sectors + 1) + j
|
|
411
|
+
second = first + sectors + 1
|
|
412
|
+
indices.extend([first, second, second + 1])
|
|
413
|
+
indices.extend([first, second + 1, first + 1])
|
|
393
414
|
|
|
394
415
|
return self._program.vertex_list_indexed(len(vertices) // 3, pyglet.gl.GL_TRIANGLES, indices,
|
|
395
416
|
batch=self._batch, group=self._group,
|
pyglet/window/__init__.py
CHANGED
|
@@ -191,6 +191,7 @@ class ImageMouseCursor(MouseCursor):
|
|
|
191
191
|
self.texture = image.get_texture()
|
|
192
192
|
self.hot_x = hot_x
|
|
193
193
|
self.hot_y = hot_y
|
|
194
|
+
self.scaling = 1.0
|
|
194
195
|
|
|
195
196
|
self.gl_drawable = not acceleration
|
|
196
197
|
self.hw_drawable = acceleration
|
|
@@ -198,7 +199,7 @@ class ImageMouseCursor(MouseCursor):
|
|
|
198
199
|
def draw(self, x: int, y: int) -> None:
|
|
199
200
|
gl.glEnable(gl.GL_BLEND)
|
|
200
201
|
gl.glBlendFunc(gl.GL_SRC_ALPHA, gl.GL_ONE_MINUS_SRC_ALPHA)
|
|
201
|
-
self.texture.blit(x - self.hot_x, y - self.hot_y, 0)
|
|
202
|
+
self.texture.blit((x - self.hot_x) / self.scaling, (y - self.hot_y) / self.scaling, 0)
|
|
202
203
|
gl.glDisable(gl.GL_BLEND)
|
|
203
204
|
|
|
204
205
|
|
|
@@ -459,10 +460,10 @@ class BaseWindow(EventDispatcher, metaclass=_WindowMetaclass):
|
|
|
459
460
|
|
|
460
461
|
``config`` is a special case; it can be a template created by the
|
|
461
462
|
user specifying the attributes desired, or it can be a complete
|
|
462
|
-
``config`` as returned from :py:meth:`~pyglet.display.Screen.get_matching_configs
|
|
463
|
+
``config`` as returned from :py:meth:`~pyglet.display.Screen.get_matching_configs` or similar.
|
|
463
464
|
|
|
464
465
|
The context will be active as soon as the window is created, as if
|
|
465
|
-
:py:meth:`~pyglet.window.Window.switch_to
|
|
466
|
+
:py:meth:`~pyglet.window.Window.switch_to` was just called.
|
|
466
467
|
|
|
467
468
|
Args:
|
|
468
469
|
width:
|
|
@@ -497,7 +498,7 @@ class BaseWindow(EventDispatcher, metaclass=_WindowMetaclass):
|
|
|
497
498
|
The context to attach to this window. The context must not already be attached to another window.
|
|
498
499
|
mode:
|
|
499
500
|
The screen will be switched to this mode if `fullscreen` is
|
|
500
|
-
True. If None, an appropriate mode is selected to accommodate ``width`` and ``height
|
|
501
|
+
True. If None, an appropriate mode is selected to accommodate ``width`` and ``height``.
|
|
501
502
|
|
|
502
503
|
"""
|
|
503
504
|
EventDispatcher.__init__(self)
|
|
@@ -590,11 +591,11 @@ class BaseWindow(EventDispatcher, metaclass=_WindowMetaclass):
|
|
|
590
591
|
|
|
591
592
|
self.ubo = self._default_program.uniform_blocks['WindowBlock'].create_ubo()
|
|
592
593
|
|
|
593
|
-
self._viewport =
|
|
594
|
+
self._viewport = 0, 0, *self.get_framebuffer_size()
|
|
594
595
|
|
|
595
596
|
width, height = self.get_size()
|
|
596
597
|
self.view = Mat4()
|
|
597
|
-
self.projection = Mat4.orthogonal_projection(0, width, 0, height, -
|
|
598
|
+
self.projection = Mat4.orthogonal_projection(0, width, 0, height, -8192, 8192)
|
|
598
599
|
|
|
599
600
|
def __del__(self) -> None:
|
|
600
601
|
# Always try to clean up the window when it is dereferenced.
|
|
@@ -842,13 +843,14 @@ class BaseWindow(EventDispatcher, metaclass=_WindowMetaclass):
|
|
|
842
843
|
def _on_internal_resize(self, width: int, height: int) -> None:
|
|
843
844
|
gl.glViewport(0, 0, *self.get_framebuffer_size())
|
|
844
845
|
w, h = self.get_size()
|
|
845
|
-
self.projection = Mat4.orthogonal_projection(0, w, 0, h, -
|
|
846
|
+
self.projection = Mat4.orthogonal_projection(0, w, 0, h, -8192, 8192)
|
|
846
847
|
self.dispatch_event('on_resize', w, h)
|
|
847
848
|
|
|
848
849
|
def _on_internal_scale(self, scale: float, dpi: int) -> None:
|
|
849
850
|
gl.glViewport(0, 0, *self.get_framebuffer_size())
|
|
850
851
|
w, h = self.get_size()
|
|
851
|
-
self.projection = Mat4.orthogonal_projection(0, w, 0, h, -
|
|
852
|
+
self.projection = Mat4.orthogonal_projection(0, w, 0, h, -8192, 8192)
|
|
853
|
+
self._mouse_cursor.scaling = scale
|
|
852
854
|
self.dispatch_event('on_scale', scale, dpi)
|
|
853
855
|
|
|
854
856
|
def on_resize(self, width: int, height: int) -> EVENT_HANDLE_STATE:
|
|
@@ -1116,6 +1118,7 @@ class BaseWindow(EventDispatcher, metaclass=_WindowMetaclass):
|
|
|
1116
1118
|
if cursor is None:
|
|
1117
1119
|
cursor = DefaultMouseCursor()
|
|
1118
1120
|
self._mouse_cursor = cursor
|
|
1121
|
+
self._mouse_cursor.scaling = self.scale
|
|
1119
1122
|
self.set_mouse_platform_visible()
|
|
1120
1123
|
|
|
1121
1124
|
def set_exclusive_mouse(self, exclusive: bool = True) -> None:
|
pyglet/window/xlib/__init__.py
CHANGED
|
@@ -1600,8 +1600,8 @@ class XlibWindow(BaseWindow):
|
|
|
1600
1600
|
w, h = ev.xconfigure.width, ev.xconfigure.height
|
|
1601
1601
|
x, y = ev.xconfigure.x, ev.xconfigure.y
|
|
1602
1602
|
if self._width != w or self._height != h:
|
|
1603
|
-
self._width = w
|
|
1604
|
-
self._height = h
|
|
1603
|
+
self._width = max(1, w)
|
|
1604
|
+
self._height = max(1, h)
|
|
1605
1605
|
self._update_view_size()
|
|
1606
1606
|
self.dispatch_event('_on_internal_resize', self._width, self._height)
|
|
1607
1607
|
if self._x != x or self._y != y:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: pyglet
|
|
3
|
-
Version: 2.1.
|
|
3
|
+
Version: 2.1.3
|
|
4
4
|
Summary: pyglet is a cross-platform games and multimedia package.
|
|
5
5
|
Author-email: Alex Holkner & contributors <Alex.Holkner@gmail.com>
|
|
6
6
|
Requires-Python: >=3.8
|
|
@@ -150,12 +150,11 @@ for more information about running and writing tests.
|
|
|
150
150
|
## Contact
|
|
151
151
|
|
|
152
152
|
pyglet is developed by many individual volunteers, and there is no central point of contact. If you have a question
|
|
153
|
-
about developing with pyglet, or you wish to contribute, please join the [
|
|
153
|
+
about developing with pyglet, or you wish to contribute, please join the [discord] server, or [subreddit].
|
|
154
154
|
|
|
155
155
|
For legal issues, please contact [Alex Holkner](mailto:Alex.Holkner@gmail.com).
|
|
156
156
|
|
|
157
157
|
[discord]: https://discord.gg/QXyegWe
|
|
158
|
-
[mailing list]: http://groups.google.com/group/pyglet-users
|
|
159
158
|
[subreddit]: https://www.reddit.com/r/pyglet/
|
|
160
159
|
[documentation]: https://pyglet.readthedocs.io
|
|
161
160
|
[wiki]: https://github.com/pyglet/pyglet/wiki
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
pyglet/__init__.py,sha256=
|
|
1
|
+
pyglet/__init__.py,sha256=_2cToHIzz3aWUJVu5YGot98oZ1csJgn7eGM7n5RCycA,20916
|
|
2
2
|
pyglet/__init__.pyi,sha256=uX92LgdKvrYDvhOKRGj86k_33H-P0Yy4AvMClyKlLHo,1932
|
|
3
3
|
pyglet/clock.py,sha256=kGQIw6WDFOHVi5IQKCNyoOlOf65B2gVk342M200MaVo,21892
|
|
4
4
|
pyglet/customtypes.py,sha256=e9AB-8WPPhhZXqfDEf4r2Lv0vAQUBjwig5EBejBDz0k,608
|
|
5
5
|
pyglet/event.py,sha256=GvtY8dsJjEYeIZTlZ4BOZY4kff8Nme-yMQBMtob0ke8,18533
|
|
6
6
|
pyglet/info.py,sha256=pDfF59S5uuo_QouRG3I-0j5WVrwxpVYH8EzH2a0qx_8,5835
|
|
7
7
|
pyglet/lib.py,sha256=lf8TGjHU0vu8IQW1ihF8tWaFn0bW8UG-EFzzohTVXMA,11379
|
|
8
|
-
pyglet/math.py,sha256=
|
|
8
|
+
pyglet/math.py,sha256=BCSmydmyvRMov1t6GUXZ8Em3F_8TjU82cyvTqMj-QfI,55528
|
|
9
9
|
pyglet/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10
10
|
pyglet/resource.py,sha256=EknGIAxDuc8prrGd5faOM4MNPT2q6NN4r3KQlrRg2dM,29374
|
|
11
11
|
pyglet/shapes.py,sha256=mJQGCjnoq9Wm4J5PXp3JASVbpCxguSsaNRN3P9_RpyU,97419
|
|
@@ -15,14 +15,14 @@ pyglet/app/__init__.py,sha256=Cc21DTHddyf-YaTvwiZ5y6iKmrnEgyyVAdjVBAbiw5Y,2879
|
|
|
15
15
|
pyglet/app/base.py,sha256=xksFpBE4-0E65DiKKPn4ZnS6jPBC2y48JEmdqDkOMUo,11594
|
|
16
16
|
pyglet/app/cocoa.py,sha256=B7T8RttBwdOKB01bRMok8gbFk-Yew0U-Ql9JQbhaR2A,10717
|
|
17
17
|
pyglet/app/win32.py,sha256=252RfeIBB9TtytMf1bd6Zc1FDF0W3bukCJAlqfP4ioM,4340
|
|
18
|
-
pyglet/app/xlib.py,sha256
|
|
18
|
+
pyglet/app/xlib.py,sha256=7gBureT60LHaROH9ah1jC62FwqsOZqNESPu1HpilLAs,2524
|
|
19
19
|
pyglet/display/__init__.py,sha256=qz5Zy1S8XfapRys08uapOZK4N8Iian68yPCla505dcg,3313
|
|
20
20
|
pyglet/display/__init__.pyi,sha256=JRd3vFMahd1YC3r-uPgr99V9yAmiut1QZXKMFmstg5o,65
|
|
21
21
|
pyglet/display/base.py,sha256=uxNmwkKG6u1aR0FKj6HPcPtixiWoQbsAqrYMlTXPuHk,9563
|
|
22
|
-
pyglet/display/cocoa.py,sha256=
|
|
22
|
+
pyglet/display/cocoa.py,sha256=DULyq1maTlaG36PH9vB23mTUlwlaeZIfkaY0jk-Q40E,5562
|
|
23
23
|
pyglet/display/headless.py,sha256=TJRak_6wAOwvLJjb_fTzbqTLxfMdgeSlDfiS7mTbJac,2156
|
|
24
|
-
pyglet/display/win32.py,sha256
|
|
25
|
-
pyglet/display/xlib.py,sha256=
|
|
24
|
+
pyglet/display/win32.py,sha256=HvrJSnERQwjLBysZKSZ8fPkbHr0avbAN-mB4U31KX2s,5129
|
|
25
|
+
pyglet/display/xlib.py,sha256=RIGQvxHTKVNNv0KRdU-jiL-7jdv8X4iZUZxtG9_Zs68,9378
|
|
26
26
|
pyglet/display/xlib_vidmoderestore.py,sha256=JQpc7BXJUB7rHRptXoVIyATb36y3F9g3OfatnsX2nA8,5654
|
|
27
27
|
pyglet/experimental/README.md,sha256=CdgjOAzL-9A92ueJ8YCgW2y4wNG7bkEbrZSl9PJYBFk,221
|
|
28
28
|
pyglet/experimental/geoshader_sprite.py,sha256=emDi61iMeGsQLKoXtvbKOSRDrJJX_TRkZQdMcUp0mNU,24652
|
|
@@ -75,16 +75,16 @@ pyglet/graphics/vertexarray.py,sha256=BWJFvP79JHpKwY91mrkjjhlbK3g87nIpMbCsc4FCcE
|
|
|
75
75
|
pyglet/graphics/vertexbuffer.py,sha256=_z8Yq-U5tsfWj1VU-onfGNeJB10fgtLcTIMBMBXEZGs,15283
|
|
76
76
|
pyglet/graphics/vertexdomain.py,sha256=Y4tAi26ABf5kLBGJ0QDvTVeWEL2vSN4HuIeS5svZjsg,32764
|
|
77
77
|
pyglet/gui/__init__.py,sha256=vW9yvUBoKz6nG-VpyIYwHMmq_y_2LWAZvFW9LYQALog,77
|
|
78
|
-
pyglet/gui/frame.py,sha256
|
|
78
|
+
pyglet/gui/frame.py,sha256=-_RHDalwIEiLIR1JkxzUAiypr2PqxgWW8psI2CAkFcE,8413
|
|
79
79
|
pyglet/gui/ninepatch.py,sha256=f3iOQr6GOhoCUCIcwltsqrEILZz-BhKwnGr9rcsfohM,11376
|
|
80
80
|
pyglet/gui/widgets.py,sha256=wn8GLKxasElaQUibl9TNLQAT6RUrDtncm75nLVTMYdo,20363
|
|
81
|
-
pyglet/image/__init__.py,sha256=
|
|
81
|
+
pyglet/image/__init__.py,sha256=lrFDtbFXjRw7SztxHaDck3fXJ_mBdBB2XgeJoj1_svw,83851
|
|
82
82
|
pyglet/image/animation.py,sha256=ThMlyHFlqQkCRh7WdlCRy-uhMN62rFiME_qSxBUaEB4,5564
|
|
83
83
|
pyglet/image/atlas.py,sha256=svY5NWVVAjIhtGEeAJS_4PcLtg8QctPIBrpa_4C69KM,9913
|
|
84
84
|
pyglet/image/buffer.py,sha256=YiYxohlR4-hA3o9S2RUqkj7wYX_ExgG2l4YqtPqDTHw,10824
|
|
85
85
|
pyglet/image/codecs/__init__.py,sha256=NXBFOb_v_txapXwZcp_x3vtf---ShInVtdobsfULGcE,6559
|
|
86
86
|
pyglet/image/codecs/bmp.py,sha256=-2Cqo0oporGYQ8Y6kryn243oLiQaTgAZlQU0cVQfdF4,10642
|
|
87
|
-
pyglet/image/codecs/dds.py,sha256=
|
|
87
|
+
pyglet/image/codecs/dds.py,sha256=SwqVrBp0-5Ku9cI-C-p3taJ3FcLWYH_RdLM06QSuBIc,5648
|
|
88
88
|
pyglet/image/codecs/gdiplus.py,sha256=Rpa-6uUvZ_xmKrDH2I674yuNxub4_v6f8tmOK0Wlb_o,11012
|
|
89
89
|
pyglet/image/codecs/gdkpixbuf2.py,sha256=xIGV5FA3804UceYSVyUlAm9xx2ZWk3vlw0uk4CNWdyw,8939
|
|
90
90
|
pyglet/image/codecs/gif.py,sha256=h8JZhWo5uJFhavLVQ2CI8jfb3u4wuQca4RPawLa6F2g,3571
|
|
@@ -100,13 +100,13 @@ pyglet/input/controller_db.py,sha256=KFgHVcwDKO6nC6qw_JDT-fE7BsgsYh76aKupc6fOKJY
|
|
|
100
100
|
pyglet/input/linux/__init__.py,sha256=fd8rAts7soFEND4l5rUtLmEwK4rRpfFZ7Ibj9EOcrrA,391
|
|
101
101
|
pyglet/input/linux/evdev.py,sha256=u2dcCuBZ4C6_7e7aabTE4HzdTYtqRKVB0m5WMqikNRE,18200
|
|
102
102
|
pyglet/input/linux/evdev_constants.py,sha256=7nCbrg7Wh3hzlRnW3b0XjMNz_od5qCZ35ewMtIpWqkw,9789
|
|
103
|
-
pyglet/input/linux/x11_xinput.py,sha256=
|
|
104
|
-
pyglet/input/linux/x11_xinput_tablet.py,sha256=
|
|
103
|
+
pyglet/input/linux/x11_xinput.py,sha256=eezRkEM_Xl8MJcvHpGXUjliz4E-DBVEUNNooWr-LT_k,10939
|
|
104
|
+
pyglet/input/linux/x11_xinput_tablet.py,sha256=wnLrTQLwtAOrOPac3BJPXqBP_nygwRJtnHmdzJoCFjE,2959
|
|
105
105
|
pyglet/input/macos/__init__.py,sha256=5VQqkzxDR6gZfF21vxEG-GKts-BRRpETxJaK7OYiBoo,348
|
|
106
106
|
pyglet/input/macos/darwin_hid.py,sha256=Z2fm8EIJKAM7Hmq3Fkp-XV00D5w9W2fsJNnFefm_PZA,24540
|
|
107
107
|
pyglet/input/win32/__init__.py,sha256=xYVWmf1_510qFJyPDXIhp6xnULP_B4qpLbFGSQrjX3g,4220
|
|
108
|
-
pyglet/input/win32/directinput.py,sha256
|
|
109
|
-
pyglet/input/win32/wintab.py,sha256=
|
|
108
|
+
pyglet/input/win32/directinput.py,sha256=zaR1sCc-WNmfRJ6QDGPm5pRP0Y-JTCx53BR4CQY9qek,16911
|
|
109
|
+
pyglet/input/win32/wintab.py,sha256=ST0pYMMTJ0feQHPQqmgkjMjhS1AaTLbiBA2KK4FmXJ8,14430
|
|
110
110
|
pyglet/input/win32/xinput.py,sha256=qbtNi1wdTJ-uAHh-DrDbfUhpHYdAR7UIMrSVbcI5vJs,21397
|
|
111
111
|
pyglet/libs/__init__.py,sha256=GQaW5m1MjFBnoUBcfY1AfHY1C1MiXpbagsS8FVUT7Ck,584
|
|
112
112
|
pyglet/libs/ioctl.py,sha256=OJanBmy-oRp07CA3zi5ieIM_1WEmJ5f_ZpCsqufU0Og,3688
|
|
@@ -187,7 +187,7 @@ pyglet/media/drivers/xaudio2/__init__.py,sha256=RipwpSVIsNEqgUYYFA0TbxHEBl41pre0
|
|
|
187
187
|
pyglet/media/drivers/xaudio2/adaptation.py,sha256=uV2U7Em2GGWJBtve7Pv9jUjpOYVglhIxjw53kKmMW38,12769
|
|
188
188
|
pyglet/media/drivers/xaudio2/interface.py,sha256=7vtFiBozSjG7QPzq8kKMMo-ff9Kg9ygUJGlO-jj0KzU,25003
|
|
189
189
|
pyglet/media/drivers/xaudio2/lib_xaudio2.py,sha256=LrBEJzOY4vpyHfstDfZ29oTUxODO5V9dfHApC9PXIFc,27709
|
|
190
|
-
pyglet/model/__init__.py,sha256=
|
|
190
|
+
pyglet/model/__init__.py,sha256=Sfq9xkgJo3EEtTHqG-6kfyPuXX6GZGzz76WzkH1tEhg,14584
|
|
191
191
|
pyglet/model/codecs/__init__.py,sha256=7ezyORi1RBfH-KAmcrfHjNxe4LSTKJDpG4BXHJ-ghwU,1450
|
|
192
192
|
pyglet/model/codecs/base.py,sha256=887X8f3ZeePihCI4GSbhjY4oqsaVP0qMtqCaMLSZd94,4380
|
|
193
193
|
pyglet/model/codecs/gltf.py,sha256=VcTvYSaL3uRmuroaHBgV8lKvu4_TuERfrAJleQtb1Ns,14108
|
|
@@ -205,7 +205,7 @@ pyglet/text/layout/__init__.py,sha256=40UfnGLx-JczJqL46kLomLB1dPKXR3aqEo3aW9alJi
|
|
|
205
205
|
pyglet/text/layout/base.py,sha256=up1xXV7rDRuYXEgXDLj3m4yKnSHqWi87QCm7BJKBcXQ,74770
|
|
206
206
|
pyglet/text/layout/incremental.py,sha256=cwlOEWFnmYigQbQycRmeKd5WUWHt5Tj1sha9g0XtdKg,34932
|
|
207
207
|
pyglet/text/layout/scrolling.py,sha256=mBtU48ujJ4GOqHjFptFztu4iwfd0PvZ4CLSV0s46HuA,9579
|
|
208
|
-
pyglet/window/__init__.py,sha256=
|
|
208
|
+
pyglet/window/__init__.py,sha256=SjZVxTPNeQ8JXtOhhilLcn-N5h9wmsokB7wfw9WfIGo,69449
|
|
209
209
|
pyglet/window/event.py,sha256=Be4We1jfM_q5uMIqTXQjT9UFMMXE-QTo_KDV_M020ZI,4265
|
|
210
210
|
pyglet/window/key.py,sha256=Q29wUkA3stzTGGD0lTNJ-pIRsi61wrlUPuAVhB9ZKZY,9560
|
|
211
211
|
pyglet/window/mouse.py,sha256=nuaNSXhW7LwYUAJMYdtcV4HebcSx5CfI9bRPOWa70Kc,2935
|
|
@@ -217,8 +217,8 @@ pyglet/window/cocoa/pyglet_window.py,sha256=ttcI6ox5ijDu-f1JJMAzdqK31kBv22iOQHbf
|
|
|
217
217
|
pyglet/window/cocoa/systemcursor.py,sha256=-rMhvPH3DWl4gsSTCUbkn-yUnbyKM7JdQLfb5RKb8xM,775
|
|
218
218
|
pyglet/window/headless/__init__.py,sha256=BLmawFLSJqV_ZjwePGT8DxFSc2ZWuVMDbxATvu1qFX4,3251
|
|
219
219
|
pyglet/window/win32/__init__.py,sha256=kYiWz9XJ8hEHec2gr6yLejiRFggQEU1M83PBQW8PBho,54808
|
|
220
|
-
pyglet/window/xlib/__init__.py,sha256=
|
|
221
|
-
pyglet-2.1.
|
|
222
|
-
pyglet-2.1.
|
|
223
|
-
pyglet-2.1.
|
|
224
|
-
pyglet-2.1.
|
|
220
|
+
pyglet/window/xlib/__init__.py,sha256=kTeJUNpByqIBDk2L_5dbfsAFB2UNmH7WP_79ZwqOVM8,70060
|
|
221
|
+
pyglet-2.1.3.dist-info/LICENSE,sha256=V-fuy2c8jUDPMZJjPEgH-6jIFoUymjfht2PhVW1d7TQ,1546
|
|
222
|
+
pyglet-2.1.3.dist-info/WHEEL,sha256=CpUCUxeHQbRN5UGRQHYRJorO5Af-Qy_fHMctcQ8DSGI,82
|
|
223
|
+
pyglet-2.1.3.dist-info/METADATA,sha256=VBTBA6BJHMBJFKrgouEb-Tj9QwwzIjxmiQqYjh-mLR4,7650
|
|
224
|
+
pyglet-2.1.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|