comparison pytouhou/lib/sdl.pxd @ 418:63f59be04a54

Replace Pyglet with SDL2 for window creation and events; disables framerate control/display and sound.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Tue, 16 Jul 2013 21:07:15 +0200
parents
children 1c92721f8e49
comparison
equal deleted inserted replaced
417:efae61ad6efe 418:63f59be04a54
1 # -*- encoding: utf-8 -*-
2 ##
3 ## Copyright (C) 2013 Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
4 ##
5 ## This program is free software; you can redistribute it and/or modify
6 ## it under the terms of the GNU General Public License as published
7 ## by the Free Software Foundation; version 3 only.
8 ##
9 ## This program is distributed in the hope that it will be useful,
10 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
11 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 ## GNU General Public License for more details.
13 ##
14
15 cdef extern from "SDL.h":
16 ctypedef unsigned int Uint32
17 ctypedef unsigned short Uint16
18 ctypedef unsigned char Uint8
19
20 int SDL_INIT_VIDEO
21
22 int SDL_Init(Uint32 flags)
23 void SDL_Quit()
24
25
26 cdef extern from "SDL_error.h":
27 const char *SDL_GetError()
28
29
30 cdef extern from "SDL_video.h":
31 ctypedef enum SDL_GLattr:
32 SDL_GL_CONTEXT_MAJOR_VERSION
33 SDL_GL_CONTEXT_MINOR_VERSION
34 SDL_GL_DOUBLEBUFFER
35 SDL_GL_DEPTH_SIZE
36
37 ctypedef enum SDL_WindowFlags:
38 SDL_WINDOWPOS_CENTERED
39 SDL_WINDOW_OPENGL
40 SDL_WINDOW_SHOWN
41
42 ctypedef struct SDL_Window:
43 pass
44
45 ctypedef void *SDL_GLContext
46
47 int SDL_GL_SetAttribute(SDL_GLattr attr, int value)
48 SDL_Window *SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags)
49 SDL_GLContext SDL_GL_CreateContext(SDL_Window *window)
50 void SDL_GL_SwapWindow(SDL_Window *window)
51 void SDL_GL_DeleteContext(SDL_GLContext context)
52 void SDL_DestroyWindow(SDL_Window *window)
53
54
55 cdef extern from "SDL_scancode.h":
56 ctypedef enum SDL_Scancode:
57 SDL_SCANCODE_Z
58 SDL_SCANCODE_X
59 SDL_SCANCODE_LSHIFT
60 SDL_SCANCODE_UP
61 SDL_SCANCODE_DOWN
62 SDL_SCANCODE_LEFT
63 SDL_SCANCODE_RIGHT
64 SDL_SCANCODE_LCTRL
65 SDL_SCANCODE_ESCAPE
66
67
68 cdef extern from "SDL_events.h":
69 ctypedef enum SDL_EventType:
70 SDL_KEYDOWN
71 SDL_QUIT
72
73 ctypedef struct SDL_Keysym:
74 SDL_Scancode scancode
75
76 ctypedef struct SDL_KeyboardEvent:
77 Uint32 type
78 SDL_Keysym keysym
79
80 ctypedef union SDL_Event:
81 Uint32 type
82 SDL_KeyboardEvent key
83
84 int SDL_PollEvent(SDL_Event *event)
85
86
87 cdef extern from "SDL_keyboard.h":
88 const Uint8 *SDL_GetKeyboardState(int *numkeys)