annotate pytouhou/lib/sdl.pxd @ 620:e5361b74b9ad

Remove 3d scaling code for matrix, as it isn’t used anywhere in the codebase.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Wed, 01 Apr 2015 02:28:54 +0200
parents a6af3ff86612
children 80687f258001
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
418
63f59be04a54 Replace Pyglet with SDL2 for window creation and events; disables framerate control/display and sound.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
1 # -*- encoding: utf-8 -*-
63f59be04a54 Replace Pyglet with SDL2 for window creation and events; disables framerate control/display and sound.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
2 ##
63f59be04a54 Replace Pyglet with SDL2 for window creation and events; disables framerate control/display and sound.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
3 ## Copyright (C) 2013 Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
63f59be04a54 Replace Pyglet with SDL2 for window creation and events; disables framerate control/display and sound.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
4 ##
63f59be04a54 Replace Pyglet with SDL2 for window creation and events; disables framerate control/display and sound.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
5 ## This program is free software; you can redistribute it and/or modify
63f59be04a54 Replace Pyglet with SDL2 for window creation and events; disables framerate control/display and sound.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
6 ## it under the terms of the GNU General Public License as published
63f59be04a54 Replace Pyglet with SDL2 for window creation and events; disables framerate control/display and sound.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
7 ## by the Free Software Foundation; version 3 only.
63f59be04a54 Replace Pyglet with SDL2 for window creation and events; disables framerate control/display and sound.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
8 ##
63f59be04a54 Replace Pyglet with SDL2 for window creation and events; disables framerate control/display and sound.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
9 ## This program is distributed in the hope that it will be useful,
63f59be04a54 Replace Pyglet with SDL2 for window creation and events; disables framerate control/display and sound.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
10 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
63f59be04a54 Replace Pyglet with SDL2 for window creation and events; disables framerate control/display and sound.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
11 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
63f59be04a54 Replace Pyglet with SDL2 for window creation and events; disables framerate control/display and sound.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
12 ## GNU General Public License for more details.
63f59be04a54 Replace Pyglet with SDL2 for window creation and events; disables framerate control/display and sound.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
13 ##
63f59be04a54 Replace Pyglet with SDL2 for window creation and events; disables framerate control/display and sound.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
14
607
9dbc234ea087 Actually compile under 3.x feature level.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 592
diff changeset
15 from ._sdl cimport *
418
63f59be04a54 Replace Pyglet with SDL2 for window creation and events; disables framerate control/display and sound.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
16
63f59be04a54 Replace Pyglet with SDL2 for window creation and events; disables framerate control/display and sound.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
17
455
6864a38b2413 Make pytouhou.lib.sdl cimportable, and convert pytouhou.ui.window.* to extension types.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 450
diff changeset
18 cdef SDL_GLattr GL_CONTEXT_MAJOR_VERSION
6864a38b2413 Make pytouhou.lib.sdl cimportable, and convert pytouhou.ui.window.* to extension types.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 450
diff changeset
19 cdef SDL_GLattr GL_CONTEXT_MINOR_VERSION
556
c34b23e29d16 Make the OpenGL flavor and version options work.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 538
diff changeset
20 cdef SDL_GLattr GL_CONTEXT_PROFILE_MASK
455
6864a38b2413 Make pytouhou.lib.sdl cimportable, and convert pytouhou.ui.window.* to extension types.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 450
diff changeset
21 cdef SDL_GLattr GL_DOUBLEBUFFER
612
73f134f84c7f Request a RGB888 context, since SDL2’s default of RGB332 sucks.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 607
diff changeset
22 cdef SDL_GLattr GL_RED_SIZE
73f134f84c7f Request a RGB888 context, since SDL2’s default of RGB332 sucks.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 607
diff changeset
23 cdef SDL_GLattr GL_GREEN_SIZE
73f134f84c7f Request a RGB888 context, since SDL2’s default of RGB332 sucks.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 607
diff changeset
24 cdef SDL_GLattr GL_BLUE_SIZE
455
6864a38b2413 Make pytouhou.lib.sdl cimportable, and convert pytouhou.ui.window.* to extension types.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 450
diff changeset
25 cdef SDL_GLattr GL_DEPTH_SIZE
6864a38b2413 Make pytouhou.lib.sdl cimportable, and convert pytouhou.ui.window.* to extension types.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 450
diff changeset
26
556
c34b23e29d16 Make the OpenGL flavor and version options work.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 538
diff changeset
27 cdef SDL_GLprofile GL_CONTEXT_PROFILE_CORE
c34b23e29d16 Make the OpenGL flavor and version options work.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 538
diff changeset
28 cdef SDL_GLprofile GL_CONTEXT_PROFILE_COMPATIBILITY
c34b23e29d16 Make the OpenGL flavor and version options work.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 538
diff changeset
29 cdef SDL_GLprofile GL_CONTEXT_PROFILE_ES
c34b23e29d16 Make the OpenGL flavor and version options work.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 538
diff changeset
30
455
6864a38b2413 Make pytouhou.lib.sdl cimportable, and convert pytouhou.ui.window.* to extension types.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 450
diff changeset
31 cdef SDL_WindowFlags WINDOWPOS_CENTERED
6864a38b2413 Make pytouhou.lib.sdl cimportable, and convert pytouhou.ui.window.* to extension types.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 450
diff changeset
32 cdef SDL_WindowFlags WINDOW_OPENGL
6864a38b2413 Make pytouhou.lib.sdl cimportable, and convert pytouhou.ui.window.* to extension types.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 450
diff changeset
33 cdef SDL_WindowFlags WINDOW_SHOWN
464
36bc577b2392 Make the window resizable, and scale its content correctly.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 460
diff changeset
34 cdef SDL_WindowFlags WINDOW_RESIZABLE
418
63f59be04a54 Replace Pyglet with SDL2 for window creation and events; disables framerate control/display and sound.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
35
455
6864a38b2413 Make pytouhou.lib.sdl cimportable, and convert pytouhou.ui.window.* to extension types.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 450
diff changeset
36 #TODO: should be SDL_Scancode, but Cython doesn’t allow enum for array indexing.
6864a38b2413 Make pytouhou.lib.sdl cimportable, and convert pytouhou.ui.window.* to extension types.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 450
diff changeset
37 cdef long SCANCODE_Z
6864a38b2413 Make pytouhou.lib.sdl cimportable, and convert pytouhou.ui.window.* to extension types.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 450
diff changeset
38 cdef long SCANCODE_X
592
19d930f9e3f0 Add the screenshot feature, using P or Home like the original game.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 590
diff changeset
39 cdef long SCANCODE_P
455
6864a38b2413 Make pytouhou.lib.sdl cimportable, and convert pytouhou.ui.window.* to extension types.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 450
diff changeset
40 cdef long SCANCODE_LSHIFT
6864a38b2413 Make pytouhou.lib.sdl cimportable, and convert pytouhou.ui.window.* to extension types.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 450
diff changeset
41 cdef long SCANCODE_UP
6864a38b2413 Make pytouhou.lib.sdl cimportable, and convert pytouhou.ui.window.* to extension types.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 450
diff changeset
42 cdef long SCANCODE_DOWN
6864a38b2413 Make pytouhou.lib.sdl cimportable, and convert pytouhou.ui.window.* to extension types.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 450
diff changeset
43 cdef long SCANCODE_LEFT
6864a38b2413 Make pytouhou.lib.sdl cimportable, and convert pytouhou.ui.window.* to extension types.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 450
diff changeset
44 cdef long SCANCODE_RIGHT
6864a38b2413 Make pytouhou.lib.sdl cimportable, and convert pytouhou.ui.window.* to extension types.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 450
diff changeset
45 cdef long SCANCODE_LCTRL
6864a38b2413 Make pytouhou.lib.sdl cimportable, and convert pytouhou.ui.window.* to extension types.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 450
diff changeset
46 cdef long SCANCODE_ESCAPE
592
19d930f9e3f0 Add the screenshot feature, using P or Home like the original game.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 590
diff changeset
47 cdef long SCANCODE_HOME
418
63f59be04a54 Replace Pyglet with SDL2 for window creation and events; disables framerate control/display and sound.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
48
464
36bc577b2392 Make the window resizable, and scale its content correctly.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 460
diff changeset
49 cdef SDL_WindowEventID WINDOWEVENT_RESIZED
36bc577b2392 Make the window resizable, and scale its content correctly.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 460
diff changeset
50
455
6864a38b2413 Make pytouhou.lib.sdl cimportable, and convert pytouhou.ui.window.* to extension types.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 450
diff changeset
51 cdef SDL_EventType KEYDOWN
6864a38b2413 Make pytouhou.lib.sdl cimportable, and convert pytouhou.ui.window.* to extension types.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 450
diff changeset
52 cdef SDL_EventType QUIT
464
36bc577b2392 Make the window resizable, and scale its content correctly.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 460
diff changeset
53 cdef SDL_EventType WINDOWEVENT
418
63f59be04a54 Replace Pyglet with SDL2 for window creation and events; disables framerate control/display and sound.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
54
538
1abb6f7db8cc Don’t retrieve the keyboard_state pointer at each frame.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 531
diff changeset
55 cdef const Uint8 *keyboard_state
1abb6f7db8cc Don’t retrieve the keyboard_state pointer at each frame.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 531
diff changeset
56
418
63f59be04a54 Replace Pyglet with SDL2 for window creation and events; disables framerate control/display and sound.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
57
455
6864a38b2413 Make pytouhou.lib.sdl cimportable, and convert pytouhou.ui.window.* to extension types.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 450
diff changeset
58 cdef class Window:
6864a38b2413 Make pytouhou.lib.sdl cimportable, and convert pytouhou.ui.window.* to extension types.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 450
diff changeset
59 cdef SDL_Window *window
6864a38b2413 Make pytouhou.lib.sdl cimportable, and convert pytouhou.ui.window.* to extension types.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 450
diff changeset
60 cdef SDL_GLContext context
512
b39ad30c6620 Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 491
diff changeset
61 cdef SDL_Renderer *renderer
455
6864a38b2413 Make pytouhou.lib.sdl cimportable, and convert pytouhou.ui.window.* to extension types.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 450
diff changeset
62
616
4ce3ef053a25 Remove every case where an exception could be silently eaten by a cdef function.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 612
diff changeset
63 cdef bint gl_create_context(self) except True
512
b39ad30c6620 Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 491
diff changeset
64 cdef void present(self) nogil
455
6864a38b2413 Make pytouhou.lib.sdl cimportable, and convert pytouhou.ui.window.* to extension types.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 450
diff changeset
65 cdef void set_window_size(self, int width, int height) nogil
418
63f59be04a54 Replace Pyglet with SDL2 for window creation and events; disables framerate control/display and sound.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
66
512
b39ad30c6620 Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 491
diff changeset
67 # The following functions are there for the pure SDL backend.
616
4ce3ef053a25 Remove every case where an exception could be silently eaten by a cdef function.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 612
diff changeset
68 cdef bint create_renderer(self, Uint32 flags) except True
4ce3ef053a25 Remove every case where an exception could be silently eaten by a cdef function.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 612
diff changeset
69 cdef bint render_clear(self) except True
4ce3ef053a25 Remove every case where an exception could be silently eaten by a cdef function.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 612
diff changeset
70 cdef bint render_copy(self, Texture texture, Rect srcrect, Rect dstrect) except True
4ce3ef053a25 Remove every case where an exception could be silently eaten by a cdef function.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 612
diff changeset
71 cdef bint render_copy_ex(self, Texture texture, Rect srcrect, Rect dstrect, double angle, bint flip) except True
4ce3ef053a25 Remove every case where an exception could be silently eaten by a cdef function.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 612
diff changeset
72 cdef bint render_set_clip_rect(self, Rect rect) except True
4ce3ef053a25 Remove every case where an exception could be silently eaten by a cdef function.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 612
diff changeset
73 cdef bint render_set_viewport(self, Rect rect) except True
512
b39ad30c6620 Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 491
diff changeset
74 cdef Texture create_texture_from_surface(self, Surface surface)
b39ad30c6620 Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 491
diff changeset
75
b39ad30c6620 Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 491
diff changeset
76
b39ad30c6620 Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 491
diff changeset
77 cdef class Texture:
b39ad30c6620 Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 491
diff changeset
78 cdef SDL_Texture *texture
b39ad30c6620 Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 491
diff changeset
79
b39ad30c6620 Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 491
diff changeset
80 cpdef set_color_mod(self, Uint8 r, Uint8 g, Uint8 b)
b39ad30c6620 Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 491
diff changeset
81 cpdef set_alpha_mod(self, Uint8 alpha)
b39ad30c6620 Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 491
diff changeset
82 cpdef set_blend_mode(self, SDL_BlendMode blend_mode)
b39ad30c6620 Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 491
diff changeset
83
b39ad30c6620 Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 491
diff changeset
84
b39ad30c6620 Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 491
diff changeset
85 cdef class Rect:
b39ad30c6620 Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 491
diff changeset
86 cdef SDL_Rect rect
b39ad30c6620 Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 491
diff changeset
87
b39ad30c6620 Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 491
diff changeset
88
b39ad30c6620 Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 491
diff changeset
89 cdef class Color:
b39ad30c6620 Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 491
diff changeset
90 cdef SDL_Color color
b39ad30c6620 Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 491
diff changeset
91
418
63f59be04a54 Replace Pyglet with SDL2 for window creation and events; disables framerate control/display and sound.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
92
455
6864a38b2413 Make pytouhou.lib.sdl cimportable, and convert pytouhou.ui.window.* to extension types.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 450
diff changeset
93 cdef class Surface:
6864a38b2413 Make pytouhou.lib.sdl cimportable, and convert pytouhou.ui.window.* to extension types.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 450
diff changeset
94 cdef SDL_Surface *surface
418
63f59be04a54 Replace Pyglet with SDL2 for window creation and events; disables framerate control/display and sound.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
95
617
a6af3ff86612 Change all “void except *” function into “bint except True”, to prevent PyErr_Occurred() from being called at each call.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 616
diff changeset
96 cdef bint blit(self, Surface other) except True
455
6864a38b2413 Make pytouhou.lib.sdl cimportable, and convert pytouhou.ui.window.* to extension types.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 450
diff changeset
97 cdef void set_alpha(self, Surface alpha_surface) nogil
418
63f59be04a54 Replace Pyglet with SDL2 for window creation and events; disables framerate control/display and sound.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
98
63f59be04a54 Replace Pyglet with SDL2 for window creation and events; disables framerate control/display and sound.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
99
455
6864a38b2413 Make pytouhou.lib.sdl cimportable, and convert pytouhou.ui.window.* to extension types.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 450
diff changeset
100 cdef class Music:
6864a38b2413 Make pytouhou.lib.sdl cimportable, and convert pytouhou.ui.window.* to extension types.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 450
diff changeset
101 cdef Mix_Music *music
419
1c92721f8e49 Re-implement frame control
Thibaut Girka <thib@sitedethib.com>
parents: 418
diff changeset
102
455
6864a38b2413 Make pytouhou.lib.sdl cimportable, and convert pytouhou.ui.window.* to extension types.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 450
diff changeset
103 cdef void play(self, int loops) nogil
6864a38b2413 Make pytouhou.lib.sdl cimportable, and convert pytouhou.ui.window.* to extension types.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 450
diff changeset
104 cdef void set_loop_points(self, double start, double end) nogil
420
3a7b36324611 Replace Pyglet’s image loader with our SDL2_image-based one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 419
diff changeset
105
3a7b36324611 Replace Pyglet’s image loader with our SDL2_image-based one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 419
diff changeset
106
455
6864a38b2413 Make pytouhou.lib.sdl cimportable, and convert pytouhou.ui.window.* to extension types.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 450
diff changeset
107 cdef class Chunk:
6864a38b2413 Make pytouhou.lib.sdl cimportable, and convert pytouhou.ui.window.* to extension types.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 450
diff changeset
108 cdef Mix_Chunk *chunk
420
3a7b36324611 Replace Pyglet’s image loader with our SDL2_image-based one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 419
diff changeset
109
455
6864a38b2413 Make pytouhou.lib.sdl cimportable, and convert pytouhou.ui.window.* to extension types.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 450
diff changeset
110 cdef void play(self, int channel, int loops) nogil
6864a38b2413 Make pytouhou.lib.sdl cimportable, and convert pytouhou.ui.window.* to extension types.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 450
diff changeset
111 cdef void set_volume(self, float volume) nogil
420
3a7b36324611 Replace Pyglet’s image loader with our SDL2_image-based one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 419
diff changeset
112
3a7b36324611 Replace Pyglet’s image loader with our SDL2_image-based one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 419
diff changeset
113
456
cae1ae9de430 Add native text support, MSG instructions 3 and 8, and text at the beginning of a stage.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 455
diff changeset
114 cdef class Font:
cae1ae9de430 Add native text support, MSG instructions 3 and 8, and text at the beginning of a stage.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 455
diff changeset
115 cdef TTF_Font *font
cae1ae9de430 Add native text support, MSG instructions 3 and 8, and text at the beginning of a stage.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 455
diff changeset
116
cae1ae9de430 Add native text support, MSG instructions 3 and 8, and text at the beginning of a stage.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 455
diff changeset
117 cdef Surface render(self, unicode text)
cae1ae9de430 Add native text support, MSG instructions 3 and 8, and text at the beginning of a stage.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 455
diff changeset
118
cae1ae9de430 Add native text support, MSG instructions 3 and 8, and text at the beginning of a stage.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 455
diff changeset
119
617
a6af3ff86612 Change all “void except *” function into “bint except True”, to prevent PyErr_Occurred() from being called at each call.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 616
diff changeset
120 cdef bint init(Uint32 flags) except True
a6af3ff86612 Change all “void except *” function into “bint except True”, to prevent PyErr_Occurred() from being called at each call.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 616
diff changeset
121 cdef bint img_init(int flags) except True
a6af3ff86612 Change all “void except *” function into “bint except True”, to prevent PyErr_Occurred() from being called at each call.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 616
diff changeset
122 cdef bint mix_init(int flags) except True
a6af3ff86612 Change all “void except *” function into “bint except True”, to prevent PyErr_Occurred() from being called at each call.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 616
diff changeset
123 cdef bint ttf_init() except True
a6af3ff86612 Change all “void except *” function into “bint except True”, to prevent PyErr_Occurred() from being called at each call.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 616
diff changeset
124 cdef bint gl_set_attribute(SDL_GLattr attr, int value) except True
a6af3ff86612 Change all “void except *” function into “bint except True”, to prevent PyErr_Occurred() from being called at each call.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 616
diff changeset
125 cdef bint gl_set_swap_interval(int interval) except True
455
6864a38b2413 Make pytouhou.lib.sdl cimportable, and convert pytouhou.ui.window.* to extension types.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 450
diff changeset
126 cdef list poll_events()
6864a38b2413 Make pytouhou.lib.sdl cimportable, and convert pytouhou.ui.window.* to extension types.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 450
diff changeset
127 cdef Surface load_png(file_)
6864a38b2413 Make pytouhou.lib.sdl cimportable, and convert pytouhou.ui.window.* to extension types.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 450
diff changeset
128 cdef Surface create_rgb_surface(int width, int height, int depth, Uint32 rmask=*, Uint32 gmask=*, Uint32 bmask=*, Uint32 amask=*)
617
a6af3ff86612 Change all “void except *” function into “bint except True”, to prevent PyErr_Occurred() from being called at each call.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 616
diff changeset
129 cdef bint mix_open_audio(int frequency, Uint16 format_, int channels, int chunksize) except True
a6af3ff86612 Change all “void except *” function into “bint except True”, to prevent PyErr_Occurred() from being called at each call.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 616
diff changeset
130 cdef bint mix_allocate_channels(int numchans) except True
455
6864a38b2413 Make pytouhou.lib.sdl cimportable, and convert pytouhou.ui.window.* to extension types.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 450
diff changeset
131 cdef int mix_volume(int channel, float volume) nogil
6864a38b2413 Make pytouhou.lib.sdl cimportable, and convert pytouhou.ui.window.* to extension types.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 450
diff changeset
132 cdef int mix_volume_music(float volume) nogil
590
e15672733c93 Switch to Python 3.x instead of 2.7.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 589
diff changeset
133 cdef Music load_music(str filename)
455
6864a38b2413 Make pytouhou.lib.sdl cimportable, and convert pytouhou.ui.window.* to extension types.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 450
diff changeset
134 cdef Chunk load_chunk(file_)
6864a38b2413 Make pytouhou.lib.sdl cimportable, and convert pytouhou.ui.window.* to extension types.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 450
diff changeset
135 cdef Uint32 get_ticks() nogil
6864a38b2413 Make pytouhou.lib.sdl cimportable, and convert pytouhou.ui.window.* to extension types.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 450
diff changeset
136 cdef void delay(Uint32 ms) nogil
616
4ce3ef053a25 Remove every case where an exception could be silently eaten by a cdef function.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 612
diff changeset
137 cpdef bint show_simple_message_box(unicode message) except True