pyglet 2.1.12__py3-none-any.whl → 3.0.dev1__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.
Files changed (267) hide show
  1. pyglet/__init__.py +67 -61
  2. pyglet/__init__.pyi +15 -8
  3. pyglet/app/__init__.py +22 -13
  4. pyglet/app/async_app.py +212 -0
  5. pyglet/app/base.py +2 -1
  6. pyglet/app/{xlib.py → linux.py} +3 -3
  7. pyglet/config/__init__.py +101 -0
  8. pyglet/config/gl/__init__.py +30 -0
  9. pyglet/config/gl/egl.py +120 -0
  10. pyglet/config/gl/macos.py +262 -0
  11. pyglet/config/gl/windows.py +267 -0
  12. pyglet/config/gl/x11.py +142 -0
  13. pyglet/customtypes.py +43 -2
  14. pyglet/display/__init__.py +8 -6
  15. pyglet/display/base.py +3 -63
  16. pyglet/display/cocoa.py +12 -17
  17. pyglet/display/emscripten.py +39 -0
  18. pyglet/display/headless.py +23 -30
  19. pyglet/display/wayland.py +157 -0
  20. pyglet/display/win32.py +4 -17
  21. pyglet/display/xlib.py +19 -27
  22. pyglet/display/xlib_vidmoderestore.py +2 -2
  23. pyglet/enums.py +183 -0
  24. pyglet/event.py +0 -1
  25. pyglet/experimental/geoshader_sprite.py +15 -13
  26. pyglet/experimental/hidraw.py +6 -15
  27. pyglet/experimental/multitexture_sprite.py +31 -19
  28. pyglet/experimental/particles.py +13 -35
  29. pyglet/font/__init__.py +251 -85
  30. pyglet/font/base.py +116 -61
  31. pyglet/font/dwrite/__init__.py +349 -204
  32. pyglet/font/dwrite/dwrite_lib.py +27 -5
  33. pyglet/font/fontconfig.py +14 -6
  34. pyglet/font/freetype.py +138 -87
  35. pyglet/font/freetype_lib.py +19 -0
  36. pyglet/font/group.py +179 -0
  37. pyglet/font/harfbuzz/__init__.py +3 -3
  38. pyglet/font/pyodide_js.py +310 -0
  39. pyglet/font/quartz.py +319 -126
  40. pyglet/font/ttf.py +45 -3
  41. pyglet/font/user.py +14 -19
  42. pyglet/font/win32.py +45 -21
  43. pyglet/graphics/__init__.py +8 -787
  44. pyglet/graphics/allocation.py +115 -1
  45. pyglet/graphics/api/__init__.py +77 -0
  46. pyglet/graphics/api/base.py +299 -0
  47. pyglet/graphics/api/gl/__init__.py +58 -0
  48. pyglet/graphics/api/gl/base.py +24 -0
  49. pyglet/graphics/{vertexbuffer.py → api/gl/buffer.py} +104 -159
  50. pyglet/graphics/api/gl/cocoa/context.py +76 -0
  51. pyglet/graphics/api/gl/context.py +391 -0
  52. pyglet/graphics/api/gl/default_shaders.py +0 -0
  53. pyglet/graphics/api/gl/draw.py +627 -0
  54. pyglet/graphics/api/gl/egl/__init__.py +0 -0
  55. pyglet/graphics/api/gl/egl/context.py +92 -0
  56. pyglet/graphics/api/gl/enums.py +76 -0
  57. pyglet/graphics/api/gl/framebuffer.py +315 -0
  58. pyglet/graphics/api/gl/gl.py +5463 -0
  59. pyglet/graphics/api/gl/gl_info.py +188 -0
  60. pyglet/graphics/api/gl/global_opengl.py +226 -0
  61. pyglet/{gl → graphics/api/gl}/lib.py +34 -18
  62. pyglet/graphics/api/gl/shader.py +1476 -0
  63. pyglet/graphics/api/gl/shapes.py +55 -0
  64. pyglet/graphics/api/gl/sprite.py +102 -0
  65. pyglet/graphics/api/gl/state.py +219 -0
  66. pyglet/graphics/api/gl/text.py +190 -0
  67. pyglet/graphics/api/gl/texture.py +1526 -0
  68. pyglet/graphics/{vertexarray.py → api/gl/vertexarray.py} +11 -13
  69. pyglet/graphics/api/gl/vertexdomain.py +751 -0
  70. pyglet/graphics/api/gl/win32/__init__.py +0 -0
  71. pyglet/graphics/api/gl/win32/context.py +108 -0
  72. pyglet/graphics/api/gl/win32/wgl_info.py +24 -0
  73. pyglet/graphics/api/gl/xlib/__init__.py +0 -0
  74. pyglet/graphics/api/gl/xlib/context.py +174 -0
  75. pyglet/{gl → graphics/api/gl/xlib}/glx_info.py +26 -31
  76. pyglet/graphics/api/gl1/__init__.py +0 -0
  77. pyglet/{gl → graphics/api/gl1}/gl_compat.py +3 -2
  78. pyglet/graphics/api/gl2/__init__.py +0 -0
  79. pyglet/graphics/api/gl2/buffer.py +320 -0
  80. pyglet/graphics/api/gl2/draw.py +600 -0
  81. pyglet/graphics/api/gl2/global_opengl.py +122 -0
  82. pyglet/graphics/api/gl2/shader.py +200 -0
  83. pyglet/graphics/api/gl2/shapes.py +51 -0
  84. pyglet/graphics/api/gl2/sprite.py +79 -0
  85. pyglet/graphics/api/gl2/text.py +175 -0
  86. pyglet/graphics/api/gl2/vertexdomain.py +364 -0
  87. pyglet/graphics/api/webgl/__init__.py +233 -0
  88. pyglet/graphics/api/webgl/buffer.py +302 -0
  89. pyglet/graphics/api/webgl/context.py +234 -0
  90. pyglet/graphics/api/webgl/draw.py +590 -0
  91. pyglet/graphics/api/webgl/enums.py +76 -0
  92. pyglet/graphics/api/webgl/framebuffer.py +360 -0
  93. pyglet/graphics/api/webgl/gl.py +1537 -0
  94. pyglet/graphics/api/webgl/gl_info.py +130 -0
  95. pyglet/graphics/api/webgl/shader.py +1346 -0
  96. pyglet/graphics/api/webgl/shapes.py +92 -0
  97. pyglet/graphics/api/webgl/sprite.py +102 -0
  98. pyglet/graphics/api/webgl/state.py +227 -0
  99. pyglet/graphics/api/webgl/text.py +187 -0
  100. pyglet/graphics/api/webgl/texture.py +1227 -0
  101. pyglet/graphics/api/webgl/vertexarray.py +54 -0
  102. pyglet/graphics/api/webgl/vertexdomain.py +616 -0
  103. pyglet/graphics/api/webgl/webgl_js.pyi +307 -0
  104. pyglet/{image → graphics}/atlas.py +33 -32
  105. pyglet/graphics/base.py +10 -0
  106. pyglet/graphics/buffer.py +245 -0
  107. pyglet/graphics/draw.py +578 -0
  108. pyglet/graphics/framebuffer.py +26 -0
  109. pyglet/graphics/instance.py +178 -69
  110. pyglet/graphics/shader.py +267 -1553
  111. pyglet/graphics/state.py +83 -0
  112. pyglet/graphics/texture.py +703 -0
  113. pyglet/graphics/vertexdomain.py +695 -538
  114. pyglet/gui/ninepatch.py +10 -10
  115. pyglet/gui/widgets.py +120 -10
  116. pyglet/image/__init__.py +20 -1973
  117. pyglet/image/animation.py +12 -12
  118. pyglet/image/base.py +730 -0
  119. pyglet/image/codecs/__init__.py +9 -0
  120. pyglet/image/codecs/bmp.py +53 -30
  121. pyglet/image/codecs/dds.py +53 -31
  122. pyglet/image/codecs/gdiplus.py +38 -14
  123. pyglet/image/codecs/gdkpixbuf2.py +0 -2
  124. pyglet/image/codecs/js_image.py +99 -0
  125. pyglet/image/codecs/ktx2.py +161 -0
  126. pyglet/image/codecs/pil.py +1 -1
  127. pyglet/image/codecs/png.py +1 -1
  128. pyglet/image/codecs/wic.py +11 -2
  129. pyglet/info.py +26 -24
  130. pyglet/input/__init__.py +8 -0
  131. pyglet/input/base.py +163 -105
  132. pyglet/input/controller.py +13 -19
  133. pyglet/input/controller_db.py +39 -24
  134. pyglet/input/emscripten/__init__.py +18 -0
  135. pyglet/input/emscripten/gamepad_js.py +397 -0
  136. pyglet/input/linux/__init__.py +11 -5
  137. pyglet/input/linux/evdev.py +10 -11
  138. pyglet/input/linux/x11_xinput.py +2 -2
  139. pyglet/input/linux/x11_xinput_tablet.py +1 -1
  140. pyglet/input/macos/__init__.py +7 -2
  141. pyglet/input/macos/darwin_gc.py +559 -0
  142. pyglet/input/win32/__init__.py +1 -1
  143. pyglet/input/win32/directinput.py +34 -29
  144. pyglet/input/win32/xinput.py +11 -61
  145. pyglet/lib.py +3 -3
  146. pyglet/libs/__init__.py +1 -1
  147. pyglet/{gl → libs/darwin}/agl.py +1 -1
  148. pyglet/libs/darwin/cocoapy/__init__.py +2 -2
  149. pyglet/libs/darwin/cocoapy/cocoahelpers.py +181 -0
  150. pyglet/libs/darwin/cocoapy/cocoalibs.py +31 -0
  151. pyglet/libs/darwin/cocoapy/cocoatypes.py +27 -0
  152. pyglet/libs/darwin/cocoapy/runtime.py +81 -45
  153. pyglet/libs/darwin/coreaudio.py +4 -4
  154. pyglet/{gl → libs/darwin}/lib_agl.py +9 -8
  155. pyglet/libs/darwin/quartzkey.py +1 -3
  156. pyglet/libs/egl/__init__.py +2 -0
  157. pyglet/libs/egl/egl_lib.py +576 -0
  158. pyglet/libs/egl/eglext.py +51 -5
  159. pyglet/libs/linux/__init__.py +0 -0
  160. pyglet/libs/linux/egl/__init__.py +0 -0
  161. pyglet/libs/linux/egl/eglext.py +22 -0
  162. pyglet/libs/linux/glx/__init__.py +0 -0
  163. pyglet/{gl → libs/linux/glx}/glx.py +13 -14
  164. pyglet/{gl → libs/linux/glx}/glxext_arb.py +408 -192
  165. pyglet/{gl → libs/linux/glx}/glxext_mesa.py +1 -1
  166. pyglet/{gl → libs/linux/glx}/glxext_nv.py +345 -164
  167. pyglet/{gl → libs/linux/glx}/lib_glx.py +3 -2
  168. pyglet/libs/linux/wayland/__init__.py +0 -0
  169. pyglet/libs/linux/wayland/client.py +1068 -0
  170. pyglet/libs/linux/wayland/lib_wayland.py +207 -0
  171. pyglet/libs/linux/wayland/wayland_egl.py +38 -0
  172. pyglet/libs/{wayland → linux/wayland}/xkbcommon.py +26 -0
  173. pyglet/libs/{x11 → linux/x11}/xf86vmode.py +4 -4
  174. pyglet/libs/{x11 → linux/x11}/xinerama.py +2 -2
  175. pyglet/libs/{x11 → linux/x11}/xinput.py +10 -10
  176. pyglet/libs/linux/x11/xrandr.py +0 -0
  177. pyglet/libs/{x11 → linux/x11}/xrender.py +1 -1
  178. pyglet/libs/shared/__init__.py +0 -0
  179. pyglet/libs/shared/spirv/__init__.py +0 -0
  180. pyglet/libs/shared/spirv/lib_shaderc.py +85 -0
  181. pyglet/libs/shared/spirv/lib_spirv_cross.py +126 -0
  182. pyglet/libs/win32/__init__.py +27 -5
  183. pyglet/libs/win32/constants.py +59 -48
  184. pyglet/libs/win32/context_managers.py +20 -3
  185. pyglet/libs/win32/dinput.py +105 -88
  186. pyglet/{gl → libs/win32}/lib_wgl.py +52 -26
  187. pyglet/libs/win32/types.py +58 -23
  188. pyglet/{gl → libs/win32}/wgl.py +32 -25
  189. pyglet/{gl → libs/win32}/wglext_arb.py +364 -2
  190. pyglet/media/__init__.py +9 -10
  191. pyglet/media/codecs/__init__.py +12 -1
  192. pyglet/media/codecs/base.py +99 -96
  193. pyglet/media/codecs/ffmpeg.py +2 -2
  194. pyglet/media/codecs/ffmpeg_lib/libavformat.py +3 -8
  195. pyglet/media/codecs/webaudio_pyodide.py +111 -0
  196. pyglet/media/drivers/__init__.py +9 -4
  197. pyglet/media/drivers/base.py +4 -4
  198. pyglet/media/drivers/openal/__init__.py +1 -1
  199. pyglet/media/drivers/openal/adaptation.py +3 -3
  200. pyglet/media/drivers/pulse/__init__.py +1 -1
  201. pyglet/media/drivers/pulse/adaptation.py +3 -3
  202. pyglet/media/drivers/pyodide_js/__init__.py +8 -0
  203. pyglet/media/drivers/pyodide_js/adaptation.py +288 -0
  204. pyglet/media/drivers/xaudio2/adaptation.py +3 -3
  205. pyglet/media/player.py +276 -193
  206. pyglet/media/player_worker_thread.py +1 -1
  207. pyglet/model/__init__.py +39 -29
  208. pyglet/model/codecs/base.py +4 -4
  209. pyglet/model/codecs/gltf.py +3 -3
  210. pyglet/model/codecs/obj.py +71 -43
  211. pyglet/resource.py +129 -78
  212. pyglet/shapes.py +147 -177
  213. pyglet/sprite.py +47 -164
  214. pyglet/text/__init__.py +44 -54
  215. pyglet/text/caret.py +12 -7
  216. pyglet/text/document.py +19 -17
  217. pyglet/text/formats/html.py +2 -2
  218. pyglet/text/formats/structured.py +10 -40
  219. pyglet/text/layout/__init__.py +20 -13
  220. pyglet/text/layout/base.py +176 -287
  221. pyglet/text/layout/incremental.py +9 -10
  222. pyglet/text/layout/scrolling.py +7 -95
  223. pyglet/window/__init__.py +183 -172
  224. pyglet/window/cocoa/__init__.py +62 -51
  225. pyglet/window/cocoa/pyglet_delegate.py +2 -25
  226. pyglet/window/cocoa/pyglet_view.py +9 -8
  227. pyglet/window/dialog/__init__.py +184 -0
  228. pyglet/window/dialog/base.py +99 -0
  229. pyglet/window/dialog/darwin.py +121 -0
  230. pyglet/window/dialog/linux.py +72 -0
  231. pyglet/window/dialog/windows.py +194 -0
  232. pyglet/window/emscripten/__init__.py +779 -0
  233. pyglet/window/headless/__init__.py +44 -28
  234. pyglet/window/key.py +2 -0
  235. pyglet/window/mouse.py +2 -2
  236. pyglet/window/wayland/__init__.py +377 -0
  237. pyglet/window/win32/__init__.py +101 -46
  238. pyglet/window/xlib/__init__.py +104 -66
  239. {pyglet-2.1.12.dist-info → pyglet-3.0.dev1.dist-info}/METADATA +2 -3
  240. pyglet-3.0.dev1.dist-info/RECORD +322 -0
  241. {pyglet-2.1.12.dist-info → pyglet-3.0.dev1.dist-info}/WHEEL +1 -1
  242. pyglet/gl/__init__.py +0 -208
  243. pyglet/gl/base.py +0 -499
  244. pyglet/gl/cocoa.py +0 -309
  245. pyglet/gl/gl.py +0 -4625
  246. pyglet/gl/gl.pyi +0 -2320
  247. pyglet/gl/gl_compat.pyi +0 -3097
  248. pyglet/gl/gl_info.py +0 -190
  249. pyglet/gl/headless.py +0 -166
  250. pyglet/gl/wgl_info.py +0 -36
  251. pyglet/gl/wglext_nv.py +0 -1096
  252. pyglet/gl/win32.py +0 -268
  253. pyglet/gl/xlib.py +0 -295
  254. pyglet/image/buffer.py +0 -274
  255. pyglet/image/codecs/s3tc.py +0 -354
  256. pyglet/libs/x11/xrandr.py +0 -166
  257. pyglet-2.1.12.dist-info/RECORD +0 -234
  258. /pyglet/{libs/wayland → graphics/api/gl/cocoa}/__init__.py +0 -0
  259. /pyglet/libs/{egl → linux/egl}/egl.py +0 -0
  260. /pyglet/libs/{egl → linux/egl}/lib.py +0 -0
  261. /pyglet/libs/{ioctl.py → linux/ioctl.py} +0 -0
  262. /pyglet/libs/{wayland → linux/wayland}/gbm.py +0 -0
  263. /pyglet/libs/{x11 → linux/x11}/__init__.py +0 -0
  264. /pyglet/libs/{x11 → linux/x11}/cursorfont.py +0 -0
  265. /pyglet/libs/{x11 → linux/x11}/xlib.py +0 -0
  266. /pyglet/libs/{x11 → linux/x11}/xsync.py +0 -0
  267. {pyglet-2.1.12.dist-info/licenses → pyglet-3.0.dev1.dist-info}/LICENSE +0 -0
@@ -0,0 +1,207 @@
1
+ from __future__ import annotations
2
+
3
+ from ctypes import POINTER, Structure, _Pointer, addressof, c_char_p, c_int, c_size_t, c_uint32, c_void_p, cast, sizeof
4
+
5
+ import pyglet.lib
6
+
7
+ _lib_wl = pyglet.lib.load_library("libwayland-client.so")
8
+
9
+
10
+ class wl_proxy(Structure):
11
+ pass
12
+
13
+
14
+ class wl_interface(Structure):
15
+
16
+ def __repr__(self) -> str:
17
+ return f"{self.__class__.__name__}(name={self.name.decode()}, version={self.version}, methods={self.method_count}, events={self.event_count})"
18
+
19
+
20
+ class wl_message(Structure):
21
+ _fields_ = [
22
+ ("name", c_char_p),
23
+ ("signature", c_char_p),
24
+ ("types", c_void_p), # POINTER(POINTER(wl_interface))),
25
+ ]
26
+
27
+
28
+ wl_interface._fields_ = [
29
+ ("name", c_char_p),
30
+ ("version", c_int),
31
+ ("method_count", c_int),
32
+ ("methods", POINTER(wl_message)), # not POINTER(c_void_p)!
33
+ ("event_count", c_int),
34
+ ("events", POINTER(wl_message)),
35
+ ]
36
+
37
+
38
+ class wl_display(Structure): pass
39
+
40
+
41
+ class wl_registry(Structure): pass
42
+
43
+
44
+ class wl_compositor(Structure): pass
45
+
46
+
47
+ class wl_surface(Structure): pass
48
+
49
+
50
+ class wl_event_queue(Structure): pass
51
+
52
+
53
+ class wl_array(Structure):
54
+ _fields_ = [
55
+ ("size", c_size_t),
56
+ ("alloc", c_size_t),
57
+ ("data", c_void_p),
58
+ ]
59
+
60
+
61
+ def as_proxy(ptr: c_void_p) -> _Pointer[wl_proxy]:
62
+ return cast(ptr, POINTER(wl_proxy))
63
+
64
+
65
+ WL_DISPLAY_SYNC = 0
66
+ WL_DISPLAY_GET_REGISTRY = 1
67
+ WL_REGISTRY_BIND = 0
68
+
69
+ wl_proxy_get_id = _lib_wl.wl_proxy_get_id
70
+ wl_proxy_get_id.restype = c_uint32
71
+ wl_proxy_get_id.argtypes = [POINTER(wl_proxy)]
72
+
73
+ wl_proxy_destroy = _lib_wl.wl_proxy_destroy
74
+ wl_proxy_destroy.restype = None
75
+ wl_proxy_destroy.argtypes = [POINTER(wl_proxy)]
76
+
77
+ wl_proxy_add_listener = _lib_wl.wl_proxy_add_listener
78
+ wl_proxy_add_listener.restype = c_int
79
+ wl_proxy_add_listener.argtypes = [c_void_p, POINTER(c_void_p), c_void_p]
80
+
81
+ wl_display_get_fd = _lib_wl.wl_display_get_fd
82
+ wl_display_get_fd.restype = c_int
83
+ wl_display_get_fd.argtypes = [POINTER(wl_display)]
84
+
85
+ wl_display_flush = _lib_wl.wl_display_flush
86
+ wl_display_flush.restype = c_int
87
+ wl_display_flush.argtypes = [POINTER(wl_display)]
88
+
89
+ wl_display_dispatch = _lib_wl.wl_display_dispatch
90
+ wl_display_dispatch.restype = c_int
91
+ wl_display_dispatch.argtypes = [POINTER(wl_display)]
92
+
93
+ wl_display_dispatch_pending = _lib_wl.wl_display_dispatch_pending
94
+ wl_display_dispatch_pending.restype = c_int
95
+ wl_display_dispatch_pending.argtypes = [POINTER(wl_display)]
96
+
97
+ wl_display_prepare_read = _lib_wl.wl_display_prepare_read
98
+ wl_display_prepare_read.restype = c_int
99
+ wl_display_prepare_read.argtypes = [POINTER(wl_display)]
100
+
101
+ wl_display_cancel_read = _lib_wl.wl_display_cancel_read
102
+ wl_display_cancel_read.restype = None
103
+ wl_display_cancel_read.argtypes = [POINTER(wl_display)]
104
+
105
+ wl_display_read_events = _lib_wl.wl_display_read_events
106
+ wl_display_read_events.restype = c_int
107
+ wl_display_read_events.argtypes = [POINTER(wl_display)]
108
+
109
+ wl_display_roundtrip = _lib_wl.wl_display_roundtrip
110
+ wl_display_roundtrip.restype = c_int
111
+ wl_display_roundtrip.argtypes = [POINTER(wl_display)]
112
+
113
+ wl_display_disconnect = _lib_wl.wl_display_disconnect
114
+ wl_display_disconnect.restype = None
115
+ wl_display_disconnect.argtypes = [POINTER(wl_display)]
116
+
117
+ wl_display_connect = _lib_wl.wl_display_connect
118
+ wl_display_connect.restype = POINTER(wl_display)
119
+ wl_display_connect.argtypes = [c_char_p]
120
+
121
+ wl_display_connect_to_fd = _lib_wl.wl_display_connect_to_fd
122
+ wl_display_connect_to_fd.restype = POINTER(wl_display)
123
+ wl_display_connect_to_fd.argtypes = [c_int]
124
+
125
+ wl_display_create_queue = _lib_wl.wl_display_create_queue
126
+ wl_display_create_queue.restype = POINTER(wl_event_queue)
127
+ wl_display_create_queue.argtypes = [POINTER(wl_display)]
128
+
129
+ wl_display_get_error = _lib_wl.wl_display_get_error
130
+ wl_display_get_error.restype = c_int
131
+ wl_display_get_error.argtypes = [POINTER(wl_display)]
132
+
133
+ wl_display_get_protocol_error = _lib_wl.wl_display_get_protocol_error
134
+ wl_display_get_protocol_error.restype = c_uint32
135
+ wl_display_get_protocol_error.argtypes = [POINTER(wl_display), POINTER(POINTER(wl_interface)), POINTER(c_int)]
136
+
137
+ wl_display_dispatch_queue = _lib_wl.wl_display_dispatch_queue
138
+ wl_display_dispatch_queue.restype = c_int
139
+ wl_display_dispatch_queue.argtypes = [POINTER(wl_display),
140
+ POINTER(wl_event_queue)]
141
+
142
+ wl_display_dispatch_queue_pending = _lib_wl.wl_display_dispatch_queue_pending
143
+ wl_display_dispatch_queue_pending.restype = c_int
144
+ wl_display_dispatch_queue_pending.argtypes = [POINTER(wl_display),
145
+ POINTER(wl_event_queue)]
146
+
147
+ wl_display_prepare_read_queue = _lib_wl.wl_display_prepare_read_queue
148
+ wl_display_prepare_read_queue.restype = c_int
149
+ wl_display_prepare_read_queue.argtypes = [POINTER(wl_display),
150
+ POINTER(wl_event_queue)]
151
+
152
+ wl_proxy_marshal_constructor = _lib_wl.wl_proxy_marshal_constructor
153
+ # Args are variadic, setting types may cause issues...
154
+ # wl_proxy_marshal_constructor.argtypes = [POINTER(wl_proxy), c_uint32, POINTER(wl_interface)]
155
+ wl_proxy_marshal_constructor.restype = POINTER(wl_proxy)
156
+
157
+ wl_proxy_marshal = _lib_wl.wl_proxy_marshal
158
+ wl_proxy_marshal.restype = None
159
+ # Args are variadic, setting types may cause issues...
160
+
161
+ wl_proxy_marshal_constructor_versioned = _lib_wl.wl_proxy_marshal_constructor_versioned
162
+ wl_proxy_marshal_constructor_versioned.restype = POINTER(wl_proxy)
163
+ # Args are variadic, setting types may cause issues...
164
+ # wl_proxy_marshal_constructor_versioned.argtypes = [POINTER(wl_proxy), c_uint32, POINTER(wl_interface), c_uint32]
165
+
166
+ wl_display_roundtrip = _lib_wl.wl_display_roundtrip
167
+ wl_display_roundtrip.argtypes = [c_void_p]
168
+ wl_display_roundtrip.restype = c_int
169
+
170
+
171
+ def wl_interface_object(name: str) -> wl_interface:
172
+ return wl_interface.in_dll(_lib_wl, f"{name}_interface")
173
+
174
+
175
+ def wl_registry_bind(wl_registry_ptr, name, interface, interface_name, version):
176
+ wl_registry_proxy = wl_registry_ptr
177
+ return wl_proxy_marshal_constructor_versioned(
178
+ wl_registry_proxy,
179
+ c_uint32(WL_REGISTRY_BIND),
180
+ interface,
181
+ c_uint32(version),
182
+ c_uint32(name),
183
+ c_char_p(interface_name),
184
+ c_uint32(version),
185
+ )
186
+
187
+
188
+ def dump_iface(iface: wl_interface):
189
+ """Debugging..."""
190
+ print(f"--- {iface.name} ---")
191
+ print("addr:", hex(addressof(iface)))
192
+ print("sizeof:", sizeof(iface))
193
+ print("name:", iface.name)
194
+ print("version:", int(iface.version))
195
+ print("method_count:", int(iface.method_count))
196
+ print("methods ptr:", bool(iface.methods))
197
+ print("event_count:", int(iface.event_count))
198
+ print("events ptr:", bool(iface.events))
199
+ if bool(iface.events):
200
+ for i in range(iface.event_count):
201
+ msg = iface.events[i]
202
+ print(f" event[{i}] name={msg.name} sig={msg.signature} types={msg.types}")
203
+ if bool(iface.methods):
204
+ for i in range(iface.method_count):
205
+ msg = iface.methods[i]
206
+ print(f" method[{i}] name={msg.name} sig={msg.signature} types={msg.types}")
207
+ print("----------------")
@@ -0,0 +1,38 @@
1
+ from __future__ import annotations
2
+
3
+ from ctypes import POINTER, c_int, c_void_p
4
+
5
+ import pyglet
6
+
7
+ _lib = pyglet.lib.load_library('wayland-egl')
8
+
9
+ wl_egl_window_ptr = c_void_p
10
+ wl_surface_ptr = c_void_p
11
+
12
+
13
+ wl_egl_window_create = _lib.wl_egl_window_create
14
+ wl_egl_window_create.restype = wl_egl_window_ptr
15
+ wl_egl_window_create.argtypes = [wl_surface_ptr, c_int, c_int]
16
+
17
+
18
+ wl_egl_window_destroy = _lib.wl_egl_window_destroy
19
+ wl_egl_window_destroy.restype = None
20
+ wl_egl_window_destroy.argtypes = [wl_egl_window_ptr]
21
+
22
+
23
+ wl_egl_window_resize = _lib.wl_egl_window_resize
24
+ wl_egl_window_resize.restype = None
25
+ wl_egl_window_resize.argtypes = [wl_egl_window_ptr, c_int, c_int, c_int, c_int]
26
+
27
+
28
+ wl_egl_window_get_attached_size = _lib.wl_egl_window_get_attached_size
29
+ wl_egl_window_get_attached_size.restype = None
30
+ wl_egl_window_get_attached_size.argtypes = [wl_egl_window_ptr, POINTER(c_int), POINTER(c_int)]
31
+
32
+
33
+ __all__ = [
34
+ 'wl_egl_window_create',
35
+ 'wl_egl_window_destroy',
36
+ 'wl_egl_window_get_attached_size',
37
+ 'wl_egl_window_resize',
38
+ ]
@@ -69,6 +69,32 @@ XKB_CONTEXT_NO_ENVIRONMENT_NAMES = (1 << 1)
69
69
  XKB_KEYMAP_COMPILE_NO_FLAGS = 0
70
70
  XKB_KEYMAP_FORMAT_TEXT_V1 = 1
71
71
 
72
+ XKB_MOD_NAME_SHIFT = c_char_p(b'Shift')
73
+ XKB_MOD_NAME_CAPS = c_char_p(b'Lock')
74
+ XKB_MOD_NAME_CTRL = c_char_p(b'Control')
75
+ XKB_MOD_NAME_MOD1 = c_char_p(b'Mod1')
76
+ XKB_MOD_NAME_MOD2 = c_char_p(b'Mod2')
77
+ XKB_MOD_NAME_MOD3 = c_char_p(b'Mod3')
78
+ XKB_MOD_NAME_MOD4 = c_char_p(b'Mod4')
79
+ XKB_MOD_NAME_MOD5 = c_char_p(b'Mod5')
80
+ XKB_MOD_NAME_ALT = c_char_p(b'Mod1')
81
+ XKB_MOD_NAME_LOGO = c_char_p(b'Mod4')
82
+ XKB_MOD_NAME_NUM = c_char_p(b'Mod2')
83
+ XKB_VMOD_NAME_ALT = c_char_p(b'Alt')
84
+ XKB_VMOD_NAME_HYPER = c_char_p(b'Hyper')
85
+ XKB_VMOD_NAME_LEVEL3 = c_char_p(b'LevelThree')
86
+ XKB_VMOD_NAME_LEVEL5 = c_char_p(b'LevelFive')
87
+ XKB_VMOD_NAME_META = c_char_p(b'Meta')
88
+ XKB_VMOD_NAME_NUM = c_char_p(b'NumLock')
89
+ XKB_VMOD_NAME_SCROLL = c_char_p(b'ScrollLock')
90
+ XKB_VMOD_NAME_SUPER = c_char_p(b'Super')
91
+ XKB_LED_NAME_NUM = c_char_p(b'Num')
92
+ XKB_LED_NAME_CAPS = c_char_p(b'Caps')
93
+ XKB_LED_NAME_SCROLL = c_char_p(b'Scroll')
94
+ XKB_LED_NAME_COMPOSE = c_char_p(b'Compose')
95
+ XKB_LED_NAME_KANA = c_char_p(b'Kana')
96
+
97
+
72
98
  xkb_keycode_t = c_uint32 # /usr/include/xkbcommon/xkbcommon.h:165
73
99
  xkb_keysym_t = c_uint32 # /usr/include/xkbcommon/xkbcommon.h:195
74
100
  xkb_layout_index_t = c_uint32 # /usr/include/xkbcommon/xkbcommon.h:224
@@ -31,7 +31,7 @@ class c_void(Structure):
31
31
  _fields_ = [('dummy', c_int)]
32
32
 
33
33
 
34
- import pyglet.libs.x11.xlib
34
+ import pyglet.libs.linux.x11.xlib
35
35
 
36
36
  X_XF86VidModeQueryVersion = 0 # /usr/include/X11/extensions/xf86vmode.h:4885
37
37
  X_XF86VidModeGetModeLine = 1 # /usr/include/X11/extensions/xf86vmode.h:4886
@@ -175,9 +175,9 @@ class struct_anon_97(Structure):
175
175
  'forced',
176
176
  'time',
177
177
  ]
178
- Display = pyglet.libs.x11.xlib.Display
179
- Window = pyglet.libs.x11.xlib.Window
180
- Time = pyglet.libs.x11.xlib.Time
178
+ Display = pyglet.libs.linux.x11.xlib.Display
179
+ Window = pyglet.libs.linux.x11.xlib.Window
180
+ Time = pyglet.libs.linux.x11.xlib.Time
181
181
  struct_anon_97._fields_ = [
182
182
  ('type', c_int),
183
183
  ('serial', c_ulong),
@@ -30,7 +30,7 @@ class c_void(Structure):
30
30
  _fields_ = [('dummy', c_int)]
31
31
 
32
32
 
33
- import pyglet.libs.x11.xlib
33
+ import pyglet.libs.linux.x11.xlib
34
34
 
35
35
  class struct_anon_93(Structure):
36
36
  __slots__ = [
@@ -49,7 +49,7 @@ struct_anon_93._fields_ = [
49
49
  ]
50
50
 
51
51
  XineramaScreenInfo = struct_anon_93 # /usr/include/X11/extensions/Xinerama.h:40
52
- Display = pyglet.libs.x11.xlib.Display
52
+ Display = pyglet.libs.linux.x11.xlib.Display
53
53
  # /usr/include/X11/extensions/Xinerama.h:44
54
54
  XineramaQueryExtension = _lib.XineramaQueryExtension
55
55
  XineramaQueryExtension.restype = c_int
@@ -30,7 +30,7 @@ class c_void(Structure):
30
30
  _fields_ = [('dummy', c_int)]
31
31
 
32
32
 
33
- import pyglet.libs.x11.xlib
33
+ import pyglet.libs.linux.x11.xlib
34
34
 
35
35
  sz_xGetExtensionVersionReq = 8 # /usr/include/X11/extensions/XI.h:56
36
36
  sz_xGetExtensionVersionReply = 32 # /usr/include/X11/extensions/XI.h:57
@@ -241,10 +241,10 @@ class struct_anon_94(Structure):
241
241
  'first_axis',
242
242
  'axis_data',
243
243
  ]
244
- Display = pyglet.libs.x11.xlib.Display
245
- Window = pyglet.libs.x11.xlib.Window
246
- XID = pyglet.libs.x11.xlib.XID
247
- Time = pyglet.libs.x11.xlib.Time
244
+ Display = pyglet.libs.linux.x11.xlib.Display
245
+ Window = pyglet.libs.linux.x11.xlib.Window
246
+ XID = pyglet.libs.linux.x11.xlib.XID
247
+ Time = pyglet.libs.linux.x11.xlib.Time
248
248
  struct_anon_94._fields_ = [
249
249
  ('type', c_int),
250
250
  ('serial', c_ulong),
@@ -686,7 +686,7 @@ class struct_anon_111(Structure):
686
686
  'num_syms_supported',
687
687
  'syms_supported',
688
688
  ]
689
- KeySym = pyglet.libs.x11.xlib.KeySym
689
+ KeySym = pyglet.libs.linux.x11.xlib.KeySym
690
690
  struct_anon_111._fields_ = [
691
691
  ('class', XID),
692
692
  ('length', c_int),
@@ -1113,7 +1113,7 @@ class struct__XDeviceInfo(Structure):
1113
1113
  'use',
1114
1114
  'inputclassinfo',
1115
1115
  ]
1116
- Atom = pyglet.libs.x11.xlib.Atom
1116
+ Atom = pyglet.libs.linux.x11.xlib.Atom
1117
1117
  struct__XDeviceInfo._fields_ = [
1118
1118
  ('id', XID),
1119
1119
  ('type', Atom),
@@ -1427,7 +1427,7 @@ XDeviceBell = _lib.XDeviceBell
1427
1427
  XDeviceBell.restype = c_int
1428
1428
  XDeviceBell.argtypes = [POINTER(Display), POINTER(XDevice), XID, XID, c_int]
1429
1429
 
1430
- KeyCode = pyglet.libs.x11.xlib.KeyCode
1430
+ KeyCode = pyglet.libs.linux.x11.xlib.KeyCode
1431
1431
  # /usr/include/X11/extensions/XInput.h:5878
1432
1432
  XGetDeviceKeyMapping = _lib.XGetDeviceKeyMapping
1433
1433
  XGetDeviceKeyMapping.restype = POINTER(KeySym)
@@ -1438,7 +1438,7 @@ XChangeDeviceKeyMapping = _lib.XChangeDeviceKeyMapping
1438
1438
  XChangeDeviceKeyMapping.restype = c_int
1439
1439
  XChangeDeviceKeyMapping.argtypes = [POINTER(Display), POINTER(XDevice), c_int, c_int, POINTER(KeySym), c_int]
1440
1440
 
1441
- XModifierKeymap = pyglet.libs.x11.xlib.XModifierKeymap
1441
+ XModifierKeymap = pyglet.libs.linux.x11.xlib.XModifierKeymap
1442
1442
  # /usr/include/X11/extensions/XInput.h:5899
1443
1443
  XGetDeviceModifierMapping = _lib.XGetDeviceModifierMapping
1444
1444
  XGetDeviceModifierMapping.restype = POINTER(XModifierKeymap)
@@ -1544,7 +1544,7 @@ XGetDeviceDontPropagateList = _lib.XGetDeviceDontPropagateList
1544
1544
  XGetDeviceDontPropagateList.restype = POINTER(XEventClass)
1545
1545
  XGetDeviceDontPropagateList.argtypes = [POINTER(Display), Window, POINTER(c_int)]
1546
1546
 
1547
- XEvent = pyglet.libs.x11.xlib.XEvent
1547
+ XEvent = pyglet.libs.linux.x11.xlib.XEvent
1548
1548
  # /usr/include/X11/extensions/XInput.h:6014
1549
1549
  XSendExtensionEvent = _lib.XSendExtensionEvent
1550
1550
  XSendExtensionEvent.restype = c_int
File without changes
@@ -3,7 +3,7 @@ from __future__ import annotations
3
3
  import warnings
4
4
  from ctypes import Structure, c_ushort, c_ulong, c_int, c_void_p, POINTER
5
5
  import pyglet.lib
6
- from pyglet.libs.x11.xlib import Visual
6
+ from pyglet.libs.linux.x11.xlib import Visual
7
7
 
8
8
  lib = None
9
9
  try:
File without changes
File without changes
@@ -0,0 +1,85 @@
1
+ from __future__ import annotations
2
+
3
+ import ctypes
4
+ from ctypes import c_char_p, c_size_t, c_void_p, POINTER
5
+
6
+ import pyglet
7
+
8
+ # Load the shaderc_shared.dll
9
+ lib_shaderc = pyglet.lib.load_library("shaderc_shared")
10
+
11
+ shaderc_shader_kind = ctypes.c_int32
12
+ shaderc_source_language_glsl = 0
13
+ shaderc_source_language_hlsl = 1
14
+
15
+ shaderc_vertex_shader = 0
16
+ shaderc_fragment_shader = 1
17
+ shaderc_compute_shader = 2
18
+ shaderc_geometry_shader = 3
19
+ shaderc_tess_control_shader = 4
20
+ shaderc_tess_evaluation_shader = 5
21
+
22
+ shaderc_optimization_level_zero = 0 # no optimization
23
+ shaderc_optimization_level_size = 1 # optimize towards reducing code size
24
+ shaderc_optimization_level_performance = 2 # optimize towards performance
25
+
26
+ class shaderc_compiler_t(c_void_p):
27
+ pass
28
+
29
+ class shaderc_compilation_result(c_void_p):
30
+ pass
31
+
32
+ class shaderc_compile_options(c_void_p):
33
+ pass
34
+
35
+ # Define types for function arguments and return values
36
+ shaderc_compiler_initialize = lib_shaderc.shaderc_compiler_initialize
37
+ shaderc_compiler_initialize.restype = shaderc_compiler_t
38
+ shaderc_compiler_initialize.argtypes = []
39
+
40
+ shaderc_compiler_release = lib_shaderc.shaderc_compiler_release
41
+ shaderc_compiler_release.restype = None
42
+ shaderc_compiler_release.argtypes = [shaderc_compiler_t]
43
+
44
+ shaderc_compile_into_spv = lib_shaderc.shaderc_compile_into_spv
45
+ shaderc_compile_into_spv.restype = shaderc_compilation_result
46
+ shaderc_compile_into_spv.argtypes = [shaderc_compiler_t, c_char_p, c_size_t, shaderc_shader_kind, c_char_p, c_char_p,
47
+ shaderc_compile_options]
48
+
49
+ shaderc_result_release = lib_shaderc.shaderc_result_release
50
+ shaderc_result_release.restype = None
51
+ shaderc_result_release.argtypes = [shaderc_compilation_result]
52
+
53
+ shaderc_result_get_bytes = lib_shaderc.shaderc_result_get_bytes
54
+ shaderc_result_get_bytes.restype = POINTER(ctypes.c_ubyte)
55
+ shaderc_result_get_bytes.argtypes = [c_void_p]
56
+
57
+ shaderc_result_get_length = lib_shaderc.shaderc_result_get_length
58
+ shaderc_result_get_length.restype = ctypes.c_size_t
59
+ shaderc_result_get_length.argtypes = [c_void_p]
60
+
61
+ shaderc_result_get_error_message = lib_shaderc.shaderc_result_get_error_message
62
+ shaderc_result_get_error_message.restype = c_char_p
63
+ shaderc_result_get_error_message.argtypes = [c_void_p]
64
+
65
+ shaderc_result_get_compilation_status = lib_shaderc.shaderc_result_get_compilation_status
66
+ shaderc_result_get_compilation_status.restype = shaderc_compilation_result
67
+ shaderc_result_get_compilation_status.argtypes = [shaderc_compilation_result]
68
+
69
+ # Options
70
+ shaderc_compile_options_initialize = lib_shaderc.shaderc_compile_options_initialize
71
+ shaderc_compile_options_initialize.restype = c_void_p
72
+ shaderc_compile_options_initialize.argtypes = []
73
+
74
+ shaderc_compile_options_set_target_spirv = lib_shaderc.shaderc_compile_options_set_target_spirv
75
+ shaderc_compile_options_set_target_spirv.argtypes = [shaderc_compile_options, ]
76
+ shaderc_compile_options_set_target_spirv.restype = None
77
+
78
+ shaderc_optimization_level = ctypes.c_int32
79
+ shaderc_compile_options_set_generate_debug_info = lib_shaderc.shaderc_compile_options_set_generate_debug_info
80
+ shaderc_compile_options_set_generate_debug_info.argtypes = [shaderc_compile_options]
81
+ shaderc_compile_options_set_generate_debug_info.restype = None
82
+
83
+ shaderc_compile_options_set_optimization_level = lib_shaderc.shaderc_compile_options_set_optimization_level
84
+ shaderc_compile_options_set_optimization_level.argtypes = [shaderc_compile_options, shaderc_optimization_level]
85
+ shaderc_compile_options_set_optimization_level.restype = None
@@ -0,0 +1,126 @@
1
+ from __future__ import annotations
2
+ import struct
3
+
4
+ import pyglet
5
+ from ctypes import POINTER, Structure, c_void_p, c_char_p, c_uint32, c_size_t, c_int, byref, c_int32
6
+
7
+ try:
8
+ lib = pyglet.lib.load_library("spirv-cross-c-shared")
9
+ except ImportError:
10
+ raise ImportError("spirv-cross-c-shared library not found.")
11
+
12
+ spvc_result = c_int
13
+ SPVC_SUCCESS = 0
14
+
15
+ # The SPIR-V is invalid. Should have been caught by validation ideally.
16
+ ERROR_INVALID_SPIRV = -1
17
+
18
+ # The SPIR-V might be valid or invalid, but SPIRV-Cross currently cannot correctly translate this to your target language.
19
+ ERROR_UNSUPPORTED_SPIRV = -2
20
+
21
+ # If for some reason we hit this, new or malloc failed.
22
+ ERROR_OUT_OF_MEMORY = -3
23
+
24
+ # Invalid API argument.
25
+ ERROR_INVALID_ARGUMENT = -4
26
+ ERROR_INTERNAL = -5
27
+
28
+ SPVC_ERROR_INT_MAX = 0x7fffffff
29
+
30
+
31
+ # The Parsed IR payload will be copied, and the handle can be reused to create other compiler instances.
32
+ SPVC_CAPTURE_MODE_COPY = 0
33
+
34
+ # The payload will now be owned by the compiler.
35
+ # parsed_ir should now be considered a dead blob and must not be used further.
36
+ # This is optimal for performance and should be the go-to option.
37
+ SPVC_CAPTURE_MODE_TAKE_OWNERSHIP = 1
38
+
39
+ spvc_backend = c_int
40
+ SPVC_BACKEND_NONE = 0
41
+ SPVC_BACKEND_GLSL = 1 # spirv_cross::CompilerGLSL
42
+ SPVC_BACKEND_HLSL = 2 #CompilerHLSL
43
+ SPVC_BACKEND_MSL = 3 # CompilerMSL
44
+ SPVC_BACKEND_CPP = 4 # CompilerCPP
45
+ SPVC_BACKEND_JSON = 5 # CompilerReflection
46
+ SPVC_BACKEND_INT_MAX = 0x7fffffff
47
+
48
+
49
+ # Structures (opaque to the c-library)
50
+ class spvc_context(c_void_p):
51
+ pass
52
+
53
+ class spvc_parsed_ir(c_void_p):
54
+ pass
55
+
56
+ class spvc_compiler(c_void_p):
57
+ pass
58
+
59
+ class spvc_resources(c_void_p):
60
+ pass
61
+
62
+ SpvExecutionModel = c_int
63
+
64
+ class spvc_entry_point(Structure):
65
+ _fields_ = [
66
+ ('execution_model', SpvExecutionModel),
67
+ ('name', c_char_p),
68
+ ]
69
+
70
+ SpvId = c_uint32
71
+
72
+ spvc_resource_type = c_int
73
+ spvc_type_id = SpvId
74
+ spvc_variable_id = SpvId # SPIRVariable
75
+ spvc_constant_id = SpvId # SPIRConstant
76
+
77
+ spvc_capture_mode = c_int
78
+
79
+ class spvc_reflected_resource(Structure):
80
+ _fields_ = [
81
+ ("id", spvc_variable_id),
82
+ ("type_id", spvc_type_id),
83
+ ("base_type_id", spvc_type_id),
84
+ ("name", c_char_p),
85
+ ]
86
+
87
+
88
+ spvc_context_create = lib.spvc_context_create
89
+ spvc_context_create.restype = spvc_result
90
+ spvc_context_create.argtypes = [POINTER(spvc_context)]
91
+
92
+ spvc_context_destroy = lib.spvc_context_destroy
93
+ spvc_context_destroy.restype = spvc_result
94
+ spvc_context_destroy.argtypes = [spvc_context]
95
+
96
+ spvc_context_release_allocations = lib.spvc_context_release_allocations
97
+ spvc_context_release_allocations.restype = None
98
+ spvc_context_release_allocations.argtypes = [spvc_context]
99
+
100
+ spvc_context_get_last_error_string = lib.spvc_context_get_last_error_string
101
+ spvc_context_get_last_error_string.restype = c_char_p
102
+ spvc_context_get_last_error_string.argtypes = [spvc_context]
103
+
104
+ spvc_context_parse_spirv = lib.spvc_context_parse_spirv
105
+ spvc_context_parse_spirv.restype = spvc_result
106
+ spvc_context_parse_spirv.argtypes = [spvc_context, POINTER(SpvId), c_size_t, POINTER(spvc_parsed_ir)]
107
+
108
+ spvc_context_create_compiler = lib.spvc_context_create_compiler
109
+ spvc_context_create_compiler.restype = spvc_result
110
+ spvc_context_create_compiler.argtypes = [spvc_context, spvc_backend, spvc_parsed_ir, spvc_capture_mode, POINTER(spvc_compiler)]
111
+
112
+ lib.spvc_compiler_create_shader_resources.restype = spvc_result
113
+ lib.spvc_compiler_create_shader_resources.argtypes = [spvc_compiler, POINTER(spvc_resources)]
114
+
115
+ lib.spvc_resources_get_resource_list_for_type.restype = spvc_result
116
+ lib.spvc_resources_get_resource_list_for_type.argtypes = [spvc_resources, spvc_resource_type, POINTER(POINTER(spvc_reflected_resource)), POINTER(c_size_t)]
117
+
118
+ lib.spvc_compiler_get_decoration.restype = c_uint32
119
+ lib.spvc_compiler_get_decoration.argtypes = [spvc_compiler, SpvId, c_int]
120
+
121
+ lib.spvc_compiler_get_name.restype = c_char_p
122
+ lib.spvc_compiler_get_name.argtypes = [spvc_compiler, c_uint32]
123
+
124
+ spvc_compiler_compile = lib.spvc_compiler_compile
125
+ spvc_compiler_compile.restype = spvc_result
126
+ spvc_compiler_compile.argtypes = [spvc_compiler, POINTER(c_char_p)]