annotate pytouhou/lib/_sdl.pxd @ 761:f506ad5c9b17

formats: Replace unwrap() with proper io::Error.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Wed, 06 Jan 2021 01:47:06 +0100
parents 80687f258001
children
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
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
15 cdef extern from "SDL.h" 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
16 ctypedef unsigned int Uint32
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 ctypedef unsigned short Uint16
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
18 ctypedef unsigned char Uint8
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
19
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
20 int SDL_INIT_VIDEO
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
21
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
22 int SDL_Init(Uint32 flags)
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
23 void SDL_Quit()
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
24
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
25
450
2a352118c55a Add back Windows support, using GLEW for OpenGL.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 422
diff changeset
26 IF UNAME_SYSNAME == "Windows":
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
27 cdef extern from "SDL_main.h" nogil:
450
2a352118c55a Add back Windows support, using GLEW for OpenGL.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 422
diff changeset
28 void SDL_SetMainReady()
2a352118c55a Add back Windows support, using GLEW for OpenGL.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 422
diff changeset
29
2a352118c55a Add back Windows support, using GLEW for OpenGL.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 422
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 extern from "SDL_error.h" 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
32 const char *SDL_GetError()
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
33
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
34
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
35 cdef extern from "SDL_video.h" 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
36 ctypedef enum SDL_GLattr:
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
37 SDL_GL_CONTEXT_MAJOR_VERSION
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
38 SDL_GL_CONTEXT_MINOR_VERSION
556
c34b23e29d16 Make the OpenGL flavor and version options work.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 531
diff changeset
39 SDL_GL_CONTEXT_PROFILE_MASK
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
40 SDL_GL_DOUBLEBUFFER
612
73f134f84c7f Request a RGB888 context, since SDL2’s default of RGB332 sucks.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 592
diff changeset
41 SDL_GL_RED_SIZE
73f134f84c7f Request a RGB888 context, since SDL2’s default of RGB332 sucks.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 592
diff changeset
42 SDL_GL_GREEN_SIZE
73f134f84c7f Request a RGB888 context, since SDL2’s default of RGB332 sucks.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 592
diff changeset
43 SDL_GL_BLUE_SIZE
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
44 SDL_GL_DEPTH_SIZE
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
45
556
c34b23e29d16 Make the OpenGL flavor and version options work.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 531
diff changeset
46 ctypedef enum SDL_GLprofile:
c34b23e29d16 Make the OpenGL flavor and version options work.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 531
diff changeset
47 SDL_GL_CONTEXT_PROFILE_CORE
c34b23e29d16 Make the OpenGL flavor and version options work.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 531
diff changeset
48 SDL_GL_CONTEXT_PROFILE_COMPATIBILITY
c34b23e29d16 Make the OpenGL flavor and version options work.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 531
diff changeset
49 SDL_GL_CONTEXT_PROFILE_ES
c34b23e29d16 Make the OpenGL flavor and version options work.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 531
diff changeset
50
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
51 ctypedef enum SDL_WindowFlags:
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
52 SDL_WINDOWPOS_CENTERED
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
53 SDL_WINDOW_OPENGL
464
36bc577b2392 Make the window resizable, and scale its content correctly.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 456
diff changeset
54 SDL_WINDOW_RESIZABLE
635
80687f258001 Make sdl.Window inherit from gui.Window, so we can swap implementations.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 612
diff changeset
55 SDL_WINDOW_FULLSCREEN_DESKTOP
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
56
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 ctypedef struct SDL_Window:
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
58 pass
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
59
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
60 ctypedef void *SDL_GLContext
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
61
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
62 int SDL_GL_SetAttribute(SDL_GLattr attr, int value)
589
0768122da817 Add a frameskip option, and use swap interval to implement it.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 556
diff changeset
63 int SDL_GL_SetSwapInterval(int interval)
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
64 SDL_Window *SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags)
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
65 SDL_GLContext SDL_GL_CreateContext(SDL_Window *window)
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 void SDL_GL_SwapWindow(SDL_Window *window)
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
67 void SDL_GL_DeleteContext(SDL_GLContext context)
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
68 void SDL_DestroyWindow(SDL_Window *window)
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
69
422
52829ebe2561 Refactor window management in its own class.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 421
diff changeset
70 void SDL_SetWindowSize(SDL_Window *window, int w, int h)
635
80687f258001 Make sdl.Window inherit from gui.Window, so we can swap implementations.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 612
diff changeset
71 int SDL_SetWindowFullscreen(SDL_Window *window, Uint32 flags)
422
52829ebe2561 Refactor window management in its own class.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 421
diff changeset
72
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
73
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
74 cdef extern from "SDL_scancode.h" 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
75 ctypedef enum SDL_Scancode:
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
76 SDL_SCANCODE_Z
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
77 SDL_SCANCODE_X
592
19d930f9e3f0 Add the screenshot feature, using P or Home like the original game.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 589
diff changeset
78 SDL_SCANCODE_P
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
79 SDL_SCANCODE_LSHIFT
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
80 SDL_SCANCODE_UP
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
81 SDL_SCANCODE_DOWN
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
82 SDL_SCANCODE_LEFT
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
83 SDL_SCANCODE_RIGHT
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
84 SDL_SCANCODE_LCTRL
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
85 SDL_SCANCODE_ESCAPE
592
19d930f9e3f0 Add the screenshot feature, using P or Home like the original game.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 589
diff changeset
86 SDL_SCANCODE_HOME
635
80687f258001 Make sdl.Window inherit from gui.Window, so we can swap implementations.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 612
diff changeset
87 SDL_SCANCODE_RETURN
80687f258001 Make sdl.Window inherit from gui.Window, so we can swap implementations.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 612
diff changeset
88 SDL_SCANCODE_F11
80687f258001 Make sdl.Window inherit from gui.Window, so we can swap implementations.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 612
diff changeset
89
80687f258001 Make sdl.Window inherit from gui.Window, so we can swap implementations.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 612
diff changeset
90
80687f258001 Make sdl.Window inherit from gui.Window, so we can swap implementations.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 612
diff changeset
91 cdef extern from "SDL_keycode.h" nogil:
80687f258001 Make sdl.Window inherit from gui.Window, so we can swap implementations.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 612
diff changeset
92 ctypedef enum SDL_Keymod:
80687f258001 Make sdl.Window inherit from gui.Window, so we can swap implementations.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 612
diff changeset
93 KMOD_ALT
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
94
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
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
96 cdef extern from "SDL_events.h" 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
97 ctypedef enum SDL_EventType:
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 SDL_KEYDOWN
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 SDL_QUIT
464
36bc577b2392 Make the window resizable, and scale its content correctly.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 456
diff changeset
100 SDL_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
101
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
102 ctypedef struct SDL_Keysym:
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
103 SDL_Scancode scancode
635
80687f258001 Make sdl.Window inherit from gui.Window, so we can swap implementations.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 612
diff changeset
104 Uint16 mod
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
105
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
106 ctypedef struct SDL_KeyboardEvent:
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
107 Uint32 type
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
108 SDL_Keysym keysym
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
109
464
36bc577b2392 Make the window resizable, and scale its content correctly.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 456
diff changeset
110 ctypedef enum SDL_WindowEventID:
36bc577b2392 Make the window resizable, and scale its content correctly.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 456
diff changeset
111 SDL_WINDOWEVENT_RESIZED
36bc577b2392 Make the window resizable, and scale its content correctly.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 456
diff changeset
112
36bc577b2392 Make the window resizable, and scale its content correctly.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 456
diff changeset
113 ctypedef struct SDL_WindowEvent:
36bc577b2392 Make the window resizable, and scale its content correctly.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 456
diff changeset
114 Uint32 type
36bc577b2392 Make the window resizable, and scale its content correctly.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 456
diff changeset
115 SDL_WindowEventID event
36bc577b2392 Make the window resizable, and scale its content correctly.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 456
diff changeset
116 int data1
36bc577b2392 Make the window resizable, and scale its content correctly.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 456
diff changeset
117 int data2
36bc577b2392 Make the window resizable, and scale its content correctly.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 456
diff changeset
118
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
119 ctypedef union SDL_Event:
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
120 Uint32 type
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
121 SDL_KeyboardEvent key
464
36bc577b2392 Make the window resizable, and scale its content correctly.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 456
diff changeset
122 SDL_WindowEvent window
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
123
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
124 int SDL_PollEvent(SDL_Event *event)
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
125
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
126
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
127 cdef extern from "SDL_keyboard.h" 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
128 const Uint8 *SDL_GetKeyboardState(int *numkeys)
419
1c92721f8e49 Re-implement frame control
Thibaut Girka <thib@sitedethib.com>
parents: 418
diff changeset
129
1c92721f8e49 Re-implement frame control
Thibaut Girka <thib@sitedethib.com>
parents: 418
diff changeset
130
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 extern from "SDL_timer.h" nogil:
419
1c92721f8e49 Re-implement frame control
Thibaut Girka <thib@sitedethib.com>
parents: 418
diff changeset
132 Uint32 SDL_GetTicks()
1c92721f8e49 Re-implement frame control
Thibaut Girka <thib@sitedethib.com>
parents: 418
diff changeset
133 void SDL_Delay(Uint32 ms)
420
3a7b36324611 Replace Pyglet’s image loader with our SDL2_image-based one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 419
diff changeset
134
3a7b36324611 Replace Pyglet’s image loader with our SDL2_image-based one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 419
diff changeset
135
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
136 cdef extern from "SDL_rect.h" nogil:
420
3a7b36324611 Replace Pyglet’s image loader with our SDL2_image-based one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 419
diff changeset
137 ctypedef struct SDL_Rect:
3a7b36324611 Replace Pyglet’s image loader with our SDL2_image-based one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 419
diff changeset
138 int x, y
3a7b36324611 Replace Pyglet’s image loader with our SDL2_image-based one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 419
diff changeset
139 int w, h
3a7b36324611 Replace Pyglet’s image loader with our SDL2_image-based one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 419
diff changeset
140
3a7b36324611 Replace Pyglet’s image loader with our SDL2_image-based one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 419
diff changeset
141
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
142 cdef extern from "SDL_surface.h" nogil:
420
3a7b36324611 Replace Pyglet’s image loader with our SDL2_image-based one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 419
diff changeset
143 ctypedef struct SDL_Surface:
3a7b36324611 Replace Pyglet’s image loader with our SDL2_image-based one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 419
diff changeset
144 int w, h
3a7b36324611 Replace Pyglet’s image loader with our SDL2_image-based one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 419
diff changeset
145 unsigned char *pixels
3a7b36324611 Replace Pyglet’s image loader with our SDL2_image-based one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 419
diff changeset
146
3a7b36324611 Replace Pyglet’s image loader with our SDL2_image-based one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 419
diff changeset
147 void SDL_FreeSurface(SDL_Surface *surface)
3a7b36324611 Replace Pyglet’s image loader with our SDL2_image-based one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 419
diff changeset
148 int SDL_BlitSurface(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect)
3a7b36324611 Replace Pyglet’s image loader with our SDL2_image-based one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 419
diff changeset
149 SDL_Surface *SDL_CreateRGBSurface(Uint32 flags, int width, int height, int depth, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask)
3a7b36324611 Replace Pyglet’s image loader with our SDL2_image-based one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 419
diff changeset
150
3a7b36324611 Replace Pyglet’s image loader with our SDL2_image-based one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 419
diff changeset
151
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
152 cdef extern from "SDL_rwops.h" nogil:
420
3a7b36324611 Replace Pyglet’s image loader with our SDL2_image-based one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 419
diff changeset
153 ctypedef struct SDL_RWops:
3a7b36324611 Replace Pyglet’s image loader with our SDL2_image-based one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 419
diff changeset
154 pass
3a7b36324611 Replace Pyglet’s image loader with our SDL2_image-based one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 419
diff changeset
155
3a7b36324611 Replace Pyglet’s image loader with our SDL2_image-based one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 419
diff changeset
156 SDL_RWops *SDL_RWFromConstMem(const void *mem, int size)
3a7b36324611 Replace Pyglet’s image loader with our SDL2_image-based one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 419
diff changeset
157 int SDL_RWclose(SDL_RWops *context)
3a7b36324611 Replace Pyglet’s image loader with our SDL2_image-based one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 419
diff changeset
158
3a7b36324611 Replace Pyglet’s image loader with our SDL2_image-based one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 419
diff changeset
159
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
160 cdef extern from "SDL_image.h" nogil:
420
3a7b36324611 Replace Pyglet’s image loader with our SDL2_image-based one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 419
diff changeset
161 int IMG_INIT_PNG
3a7b36324611 Replace Pyglet’s image loader with our SDL2_image-based one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 419
diff changeset
162
3a7b36324611 Replace Pyglet’s image loader with our SDL2_image-based one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 419
diff changeset
163 int IMG_Init(int flags)
3a7b36324611 Replace Pyglet’s image loader with our SDL2_image-based one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 419
diff changeset
164 void IMG_Quit()
3a7b36324611 Replace Pyglet’s image loader with our SDL2_image-based one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 419
diff changeset
165 SDL_Surface *IMG_LoadPNG_RW(SDL_RWops *src)
421
b1248bab2d0f Add back music and SFX playback using SDL_mixer instead of pyglet, and add FLAC and Vorbis support.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 420
diff changeset
166
b1248bab2d0f Add back music and SFX playback using SDL_mixer instead of pyglet, and add FLAC and Vorbis support.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 420
diff changeset
167
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
168 cdef extern from "SDL_mixer.h" nogil:
421
b1248bab2d0f Add back music and SFX playback using SDL_mixer instead of pyglet, and add FLAC and Vorbis support.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 420
diff changeset
169 ctypedef enum:
b1248bab2d0f Add back music and SFX playback using SDL_mixer instead of pyglet, and add FLAC and Vorbis support.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 420
diff changeset
170 MIX_DEFAULT_FORMAT
b1248bab2d0f Add back music and SFX playback using SDL_mixer instead of pyglet, and add FLAC and Vorbis support.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 420
diff changeset
171
b1248bab2d0f Add back music and SFX playback using SDL_mixer instead of pyglet, and add FLAC and Vorbis support.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 420
diff changeset
172 ctypedef struct Mix_Music:
b1248bab2d0f Add back music and SFX playback using SDL_mixer instead of pyglet, and add FLAC and Vorbis support.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 420
diff changeset
173 pass
b1248bab2d0f Add back music and SFX playback using SDL_mixer instead of pyglet, and add FLAC and Vorbis support.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 420
diff changeset
174
b1248bab2d0f Add back music and SFX playback using SDL_mixer instead of pyglet, and add FLAC and Vorbis support.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 420
diff changeset
175 ctypedef struct Mix_Chunk:
b1248bab2d0f Add back music and SFX playback using SDL_mixer instead of pyglet, and add FLAC and Vorbis support.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 420
diff changeset
176 pass
b1248bab2d0f Add back music and SFX playback using SDL_mixer instead of pyglet, and add FLAC and Vorbis support.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 420
diff changeset
177
b1248bab2d0f Add back music and SFX playback using SDL_mixer instead of pyglet, and add FLAC and Vorbis support.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 420
diff changeset
178 int Mix_Init(int flags)
b1248bab2d0f Add back music and SFX playback using SDL_mixer instead of pyglet, and add FLAC and Vorbis support.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 420
diff changeset
179 void Mix_Quit()
b1248bab2d0f Add back music and SFX playback using SDL_mixer instead of pyglet, and add FLAC and Vorbis support.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 420
diff changeset
180
b1248bab2d0f Add back music and SFX playback using SDL_mixer instead of pyglet, and add FLAC and Vorbis support.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 420
diff changeset
181 int Mix_OpenAudio(int frequency, Uint16 format_, int channels, int chunksize)
b1248bab2d0f Add back music and SFX playback using SDL_mixer instead of pyglet, and add FLAC and Vorbis support.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 420
diff changeset
182 void Mix_CloseAudio()
b1248bab2d0f Add back music and SFX playback using SDL_mixer instead of pyglet, and add FLAC and Vorbis support.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 420
diff changeset
183
b1248bab2d0f Add back music and SFX playback using SDL_mixer instead of pyglet, and add FLAC and Vorbis support.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 420
diff changeset
184 int Mix_AllocateChannels(int numchans)
b1248bab2d0f Add back music and SFX playback using SDL_mixer instead of pyglet, and add FLAC and Vorbis support.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 420
diff changeset
185
b1248bab2d0f Add back music and SFX playback using SDL_mixer instead of pyglet, and add FLAC and Vorbis support.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 420
diff changeset
186 Mix_Music *Mix_LoadMUS(const char *filename)
b1248bab2d0f Add back music and SFX playback using SDL_mixer instead of pyglet, and add FLAC and Vorbis support.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 420
diff changeset
187 Mix_Chunk *Mix_LoadWAV_RW(SDL_RWops *src, int freesrc)
b1248bab2d0f Add back music and SFX playback using SDL_mixer instead of pyglet, and add FLAC and Vorbis support.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 420
diff changeset
188
b1248bab2d0f Add back music and SFX playback using SDL_mixer instead of pyglet, and add FLAC and Vorbis support.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 420
diff changeset
189 void Mix_FreeMusic(Mix_Music *music)
b1248bab2d0f Add back music and SFX playback using SDL_mixer instead of pyglet, and add FLAC and Vorbis support.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 420
diff changeset
190 void Mix_FreeChunk(Mix_Chunk *chunk)
b1248bab2d0f Add back music and SFX playback using SDL_mixer instead of pyglet, and add FLAC and Vorbis support.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 420
diff changeset
191
b1248bab2d0f Add back music and SFX playback using SDL_mixer instead of pyglet, and add FLAC and Vorbis support.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 420
diff changeset
192 int Mix_PlayMusic(Mix_Music *music, int loops)
b1248bab2d0f Add back music and SFX playback using SDL_mixer instead of pyglet, and add FLAC and Vorbis support.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 420
diff changeset
193 #int Mix_SetLoopPoints(Mix_Music *music, double start, double end)
b1248bab2d0f Add back music and SFX playback using SDL_mixer instead of pyglet, and add FLAC and Vorbis support.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 420
diff changeset
194
b1248bab2d0f Add back music and SFX playback using SDL_mixer instead of pyglet, and add FLAC and Vorbis support.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 420
diff changeset
195 int Mix_Volume(int channel, int volume)
b1248bab2d0f Add back music and SFX playback using SDL_mixer instead of pyglet, and add FLAC and Vorbis support.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 420
diff changeset
196 int Mix_VolumeChunk(Mix_Chunk *chunk, int volume)
b1248bab2d0f Add back music and SFX playback using SDL_mixer instead of pyglet, and add FLAC and Vorbis support.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 420
diff changeset
197 int Mix_VolumeMusic(int volume)
b1248bab2d0f Add back music and SFX playback using SDL_mixer instead of pyglet, and add FLAC and Vorbis support.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 420
diff changeset
198
b1248bab2d0f Add back music and SFX playback using SDL_mixer instead of pyglet, and add FLAC and Vorbis support.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 420
diff changeset
199 int Mix_PlayChannel(int channel, Mix_Chunk *chunk, int loops)
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
200
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
201
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
202 cdef extern from "SDL_pixels.h" nogil:
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
203 ctypedef struct SDL_Color:
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
204 Uint8 r, g, b, a
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
205
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
206
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
207 cdef extern from "SDL_ttf.h" nogil:
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
208 ctypedef struct TTF_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
209 pass
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
210
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
211 int TTF_Init()
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
212 void TTF_Quit()
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
213 TTF_Font *TTF_OpenFont(const char *filename, int ptsize)
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
214 void TTF_CloseFont(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
215 SDL_Surface *TTF_RenderUTF8_Blended(TTF_Font *font, const char *text, SDL_Color fg)
512
b39ad30c6620 Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 464
diff changeset
216
b39ad30c6620 Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 464
diff changeset
217
531
a7dc55ad9380 Display important messages in popups, instead of the terminal.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 512
diff changeset
218 cdef extern from "SDL_messagebox.h" nogil:
a7dc55ad9380 Display important messages in popups, instead of the terminal.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 512
diff changeset
219 int SDL_ShowSimpleMessageBox(Uint32 flags, const char *title, const char *message, SDL_Window *window)
a7dc55ad9380 Display important messages in popups, instead of the terminal.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 512
diff changeset
220
a7dc55ad9380 Display important messages in popups, instead of the terminal.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 512
diff changeset
221
512
b39ad30c6620 Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 464
diff changeset
222 cdef extern from "SDL_blendmode.h" nogil:
b39ad30c6620 Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 464
diff changeset
223 ctypedef enum SDL_BlendMode:
b39ad30c6620 Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 464
diff changeset
224 SDL_BLENDMODE_NONE
b39ad30c6620 Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 464
diff changeset
225 SDL_BLENDMODE_BLEND
b39ad30c6620 Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 464
diff changeset
226 SDL_BLENDMODE_ADD
b39ad30c6620 Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 464
diff changeset
227 SDL_BLENDMODE_MOD
b39ad30c6620 Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 464
diff changeset
228
b39ad30c6620 Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 464
diff changeset
229
b39ad30c6620 Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 464
diff changeset
230 cdef extern from "SDL_render.h" nogil:
b39ad30c6620 Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 464
diff changeset
231 ctypedef struct SDL_Renderer:
b39ad30c6620 Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 464
diff changeset
232 pass
b39ad30c6620 Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 464
diff changeset
233
b39ad30c6620 Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 464
diff changeset
234 ctypedef struct SDL_Texture:
b39ad30c6620 Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 464
diff changeset
235 pass
b39ad30c6620 Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 464
diff changeset
236
b39ad30c6620 Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 464
diff changeset
237 ctypedef struct SDL_Point:
b39ad30c6620 Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 464
diff changeset
238 pass
b39ad30c6620 Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 464
diff changeset
239
b39ad30c6620 Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 464
diff changeset
240 SDL_Renderer *SDL_CreateRenderer(SDL_Window *window, int index, Uint32 flags)
b39ad30c6620 Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 464
diff changeset
241 void SDL_RenderPresent(SDL_Renderer *renderer)
b39ad30c6620 Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 464
diff changeset
242 int SDL_RenderClear(SDL_Renderer *renderer)
b39ad30c6620 Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 464
diff changeset
243 SDL_Texture *SDL_CreateTextureFromSurface(SDL_Renderer *renderer, SDL_Surface *surface)
b39ad30c6620 Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 464
diff changeset
244 int SDL_RenderCopy(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *srcrect, const SDL_Rect *dstrect)
b39ad30c6620 Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 464
diff changeset
245 int SDL_RenderCopyEx(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *srcrect, const SDL_Rect *dstrect, double angle, const SDL_Point *center, bint flip)
b39ad30c6620 Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 464
diff changeset
246 int SDL_RenderSetClipRect(SDL_Renderer *renderer, const SDL_Rect *rect)
b39ad30c6620 Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 464
diff changeset
247 int SDL_RenderSetViewport(SDL_Renderer *renderer, const SDL_Rect *rect)
b39ad30c6620 Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 464
diff changeset
248
b39ad30c6620 Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 464
diff changeset
249 int SDL_SetTextureColorMod(SDL_Texture *texture, Uint8 r, Uint8 g, Uint8 b)
b39ad30c6620 Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 464
diff changeset
250 int SDL_SetTextureAlphaMod(SDL_Texture *texture, Uint8 alpha)
b39ad30c6620 Add a pure SDL backend.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 464
diff changeset
251 int SDL_SetTextureBlendMode(SDL_Texture *texture, SDL_BlendMode blend_mode)