Mercurial > touhou
comparison pytouhou/lib/_sdl.pxd @ 455:6864a38b2413
Make pytouhou.lib.sdl cimportable, and convert pytouhou.ui.window.* to extension types.
| author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
|---|---|
| date | Mon, 02 Sep 2013 22:16:38 +0200 |
| parents | pytouhou/lib/sdl.pxd@2a352118c55a |
| children | cae1ae9de430 |
comparison
equal
deleted
inserted
replaced
| 454:a502887557ac | 455:6864a38b2413 |
|---|---|
| 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" nogil: | |
| 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 IF UNAME_SYSNAME == "Windows": | |
| 27 cdef extern from "SDL_main.h" nogil: | |
| 28 void SDL_SetMainReady() | |
| 29 | |
| 30 | |
| 31 cdef extern from "SDL_error.h" nogil: | |
| 32 const char *SDL_GetError() | |
| 33 | |
| 34 | |
| 35 cdef extern from "SDL_video.h" nogil: | |
| 36 ctypedef enum SDL_GLattr: | |
| 37 SDL_GL_CONTEXT_MAJOR_VERSION | |
| 38 SDL_GL_CONTEXT_MINOR_VERSION | |
| 39 SDL_GL_DOUBLEBUFFER | |
| 40 SDL_GL_DEPTH_SIZE | |
| 41 | |
| 42 ctypedef enum SDL_WindowFlags: | |
| 43 SDL_WINDOWPOS_CENTERED | |
| 44 SDL_WINDOW_OPENGL | |
| 45 SDL_WINDOW_SHOWN | |
| 46 | |
| 47 ctypedef struct SDL_Window: | |
| 48 pass | |
| 49 | |
| 50 ctypedef void *SDL_GLContext | |
| 51 | |
| 52 int SDL_GL_SetAttribute(SDL_GLattr attr, int value) | |
| 53 SDL_Window *SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags) | |
| 54 SDL_GLContext SDL_GL_CreateContext(SDL_Window *window) | |
| 55 void SDL_GL_SwapWindow(SDL_Window *window) | |
| 56 void SDL_GL_DeleteContext(SDL_GLContext context) | |
| 57 void SDL_DestroyWindow(SDL_Window *window) | |
| 58 | |
| 59 void SDL_SetWindowSize(SDL_Window *window, int w, int h) | |
| 60 | |
| 61 | |
| 62 cdef extern from "SDL_scancode.h" nogil: | |
| 63 ctypedef enum SDL_Scancode: | |
| 64 SDL_SCANCODE_Z | |
| 65 SDL_SCANCODE_X | |
| 66 SDL_SCANCODE_LSHIFT | |
| 67 SDL_SCANCODE_UP | |
| 68 SDL_SCANCODE_DOWN | |
| 69 SDL_SCANCODE_LEFT | |
| 70 SDL_SCANCODE_RIGHT | |
| 71 SDL_SCANCODE_LCTRL | |
| 72 SDL_SCANCODE_ESCAPE | |
| 73 | |
| 74 | |
| 75 cdef extern from "SDL_events.h" nogil: | |
| 76 ctypedef enum SDL_EventType: | |
| 77 SDL_KEYDOWN | |
| 78 SDL_QUIT | |
| 79 | |
| 80 ctypedef struct SDL_Keysym: | |
| 81 SDL_Scancode scancode | |
| 82 | |
| 83 ctypedef struct SDL_KeyboardEvent: | |
| 84 Uint32 type | |
| 85 SDL_Keysym keysym | |
| 86 | |
| 87 ctypedef union SDL_Event: | |
| 88 Uint32 type | |
| 89 SDL_KeyboardEvent key | |
| 90 | |
| 91 int SDL_PollEvent(SDL_Event *event) | |
| 92 | |
| 93 | |
| 94 cdef extern from "SDL_keyboard.h" nogil: | |
| 95 const Uint8 *SDL_GetKeyboardState(int *numkeys) | |
| 96 | |
| 97 | |
| 98 cdef extern from "SDL_timer.h" nogil: | |
| 99 Uint32 SDL_GetTicks() | |
| 100 void SDL_Delay(Uint32 ms) | |
| 101 | |
| 102 | |
| 103 cdef extern from "SDL_rect.h" nogil: | |
| 104 ctypedef struct SDL_Rect: | |
| 105 int x, y | |
| 106 int w, h | |
| 107 | |
| 108 | |
| 109 cdef extern from "SDL_surface.h" nogil: | |
| 110 ctypedef struct SDL_Surface: | |
| 111 int w, h | |
| 112 unsigned char *pixels | |
| 113 | |
| 114 void SDL_FreeSurface(SDL_Surface *surface) | |
| 115 int SDL_BlitSurface(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect) | |
| 116 SDL_Surface *SDL_CreateRGBSurface(Uint32 flags, int width, int height, int depth, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask) | |
| 117 | |
| 118 | |
| 119 cdef extern from "SDL_rwops.h" nogil: | |
| 120 ctypedef struct SDL_RWops: | |
| 121 pass | |
| 122 | |
| 123 SDL_RWops *SDL_RWFromConstMem(const void *mem, int size) | |
| 124 int SDL_RWclose(SDL_RWops *context) | |
| 125 | |
| 126 | |
| 127 cdef extern from "SDL_image.h" nogil: | |
| 128 int IMG_INIT_PNG | |
| 129 | |
| 130 int IMG_Init(int flags) | |
| 131 void IMG_Quit() | |
| 132 SDL_Surface *IMG_LoadPNG_RW(SDL_RWops *src) | |
| 133 | |
| 134 | |
| 135 cdef extern from "SDL_mixer.h" nogil: | |
| 136 ctypedef enum: | |
| 137 MIX_DEFAULT_FORMAT | |
| 138 | |
| 139 ctypedef struct Mix_Music: | |
| 140 pass | |
| 141 | |
| 142 ctypedef struct Mix_Chunk: | |
| 143 pass | |
| 144 | |
| 145 int Mix_Init(int flags) | |
| 146 void Mix_Quit() | |
| 147 | |
| 148 int Mix_OpenAudio(int frequency, Uint16 format_, int channels, int chunksize) | |
| 149 void Mix_CloseAudio() | |
| 150 | |
| 151 int Mix_AllocateChannels(int numchans) | |
| 152 | |
| 153 Mix_Music *Mix_LoadMUS(const char *filename) | |
| 154 Mix_Chunk *Mix_LoadWAV_RW(SDL_RWops *src, int freesrc) | |
| 155 | |
| 156 void Mix_FreeMusic(Mix_Music *music) | |
| 157 void Mix_FreeChunk(Mix_Chunk *chunk) | |
| 158 | |
| 159 int Mix_PlayMusic(Mix_Music *music, int loops) | |
| 160 #int Mix_SetLoopPoints(Mix_Music *music, double start, double end) | |
| 161 | |
| 162 int Mix_Volume(int channel, int volume) | |
| 163 int Mix_VolumeChunk(Mix_Chunk *chunk, int volume) | |
| 164 int Mix_VolumeMusic(int volume) | |
| 165 | |
| 166 int Mix_PlayChannel(int channel, Mix_Chunk *chunk, int loops) |
