annotate pytouhou/lib/sdl.pxd @ 450:2a352118c55a

Add back Windows support, using GLEW for OpenGL.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Fri, 30 Aug 2013 18:21:07 +0200
parents 52829ebe2561
children 6864a38b2413
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
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
15 cdef extern from "SDL.h":
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":
2a352118c55a Add back Windows support, using GLEW for OpenGL.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 422
diff changeset
27 cdef extern from "SDL_main.h":
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
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
31 cdef extern from "SDL_error.h":
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
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 cdef extern from "SDL_video.h":
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
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
39 SDL_GL_DOUBLEBUFFER
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_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
41
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
42 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
43 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
44 SDL_WINDOW_OPENGL
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 SDL_WINDOW_SHOWN
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
46
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
47 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
48 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
49
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
50 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
51
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 int SDL_GL_SetAttribute(SDL_GLattr attr, int value)
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 *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
54 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
55 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
56 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
57 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
58
422
52829ebe2561 Refactor window management in its own class.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 421
diff changeset
59 void SDL_SetWindowSize(SDL_Window *window, int w, int h)
52829ebe2561 Refactor window management in its own class.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 421
diff changeset
60
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
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 cdef extern from "SDL_scancode.h":
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
63 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
64 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
65 SDL_SCANCODE_X
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 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
67 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
68 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
69 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
70 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
71 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
72 SDL_SCANCODE_ESCAPE
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
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
74
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 cdef extern from "SDL_events.h":
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 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
77 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
78 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
79
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 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
81 SDL_Scancode 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
82
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 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
84 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
85 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
86
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
87 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
88 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
89 SDL_KeyboardEvent key
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
90
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
91 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
92
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
93
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 cdef extern from "SDL_keyboard.h":
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 const Uint8 *SDL_GetKeyboardState(int *numkeys)
419
1c92721f8e49 Re-implement frame control
Thibaut Girka <thib@sitedethib.com>
parents: 418
diff changeset
96
1c92721f8e49 Re-implement frame control
Thibaut Girka <thib@sitedethib.com>
parents: 418
diff changeset
97
1c92721f8e49 Re-implement frame control
Thibaut Girka <thib@sitedethib.com>
parents: 418
diff changeset
98 cdef extern from "SDL_timer.h":
1c92721f8e49 Re-implement frame control
Thibaut Girka <thib@sitedethib.com>
parents: 418
diff changeset
99 Uint32 SDL_GetTicks()
1c92721f8e49 Re-implement frame control
Thibaut Girka <thib@sitedethib.com>
parents: 418
diff changeset
100 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
101
3a7b36324611 Replace Pyglet’s image loader with our SDL2_image-based one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 419
diff changeset
102
3a7b36324611 Replace Pyglet’s image loader with our SDL2_image-based one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 419
diff changeset
103 cdef extern from "SDL_rect.h":
3a7b36324611 Replace Pyglet’s image loader with our SDL2_image-based one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 419
diff changeset
104 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
105 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
106 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
107
3a7b36324611 Replace Pyglet’s image loader with our SDL2_image-based one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 419
diff changeset
108
3a7b36324611 Replace Pyglet’s image loader with our SDL2_image-based one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 419
diff changeset
109 cdef extern from "SDL_surface.h":
3a7b36324611 Replace Pyglet’s image loader with our SDL2_image-based one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 419
diff changeset
110 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
111 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
112 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
113
3a7b36324611 Replace Pyglet’s image loader with our SDL2_image-based one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 419
diff changeset
114 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
115 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
116 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
117
3a7b36324611 Replace Pyglet’s image loader with our SDL2_image-based one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 419
diff changeset
118
3a7b36324611 Replace Pyglet’s image loader with our SDL2_image-based one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 419
diff changeset
119 cdef extern from "SDL_rwops.h":
3a7b36324611 Replace Pyglet’s image loader with our SDL2_image-based one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 419
diff changeset
120 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
121 pass
3a7b36324611 Replace Pyglet’s image loader with our SDL2_image-based one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 419
diff changeset
122
3a7b36324611 Replace Pyglet’s image loader with our SDL2_image-based one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 419
diff changeset
123 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
124 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
125
3a7b36324611 Replace Pyglet’s image loader with our SDL2_image-based one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 419
diff changeset
126
3a7b36324611 Replace Pyglet’s image loader with our SDL2_image-based one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 419
diff changeset
127 cdef extern from "SDL_image.h":
3a7b36324611 Replace Pyglet’s image loader with our SDL2_image-based one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 419
diff changeset
128 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
129
3a7b36324611 Replace Pyglet’s image loader with our SDL2_image-based one.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 419
diff changeset
130 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
131 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
132 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
133
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
134
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
135 cdef extern from "SDL_mixer.h":
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
136 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
137 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
138
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
139 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
140 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
141
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
142 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
143 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
144
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
145 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
146 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
147
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
148 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
149 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
150
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
151 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
152
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
153 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
154 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
155
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
156 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
157 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
158
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
159 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
160 #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
161
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
162 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
163 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
164 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
165
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 int Mix_PlayChannel(int channel, Mix_Chunk *chunk, int loops)