/* pygame - Python Game Library Copyright (C) 2000-2001 Pete Shinners This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Pete Shinners pete@shinners.org */ #define NO_PYGAME_C_API #include "pygame.h" /* macros used to create each constant */ #define DEC_CONST(x) PyModule_AddIntConstant(module, #x, (int) SDL_##x); #define DEC_CONSTK(x) PyModule_AddIntConstant(module, #x, (int) SDL##x); #define DEC_CONSTN(x) PyModule_AddIntConstant(module, #x, (int) x); static PyMethodDef builtins[] = { {NULL} }; /*DOC*/ static char doc_pygame_constants_MODULE[] = /*DOC*/ "These constants are defined by SDL, and needed in pygame. Note\n" /*DOC*/ "that many of the flags for SDL are not needed in pygame, and are\n" /*DOC*/ "not included here. These constants are generally accessed from\n" /*DOC*/ "the pygame.locals module. This module is automatically placed in\n" /*DOC*/ "the pygame namespace, but you will usually want to place them\n" /*DOC*/ "directly into your module's namespace with the following command,\n" /*DOC*/ "'from pygame.locals import *'.\n" /*DOC*/ ; PYGAME_EXPORT void initconstants(void) { PyObject* module; module = Py_InitModule3("constants", builtins, doc_pygame_constants_MODULE); DEC_CONST(YV12_OVERLAY); DEC_CONST(IYUV_OVERLAY); DEC_CONST(YUY2_OVERLAY); DEC_CONST(UYVY_OVERLAY); DEC_CONST(YVYU_OVERLAY); DEC_CONST(SWSURFACE); DEC_CONST(HWSURFACE); DEC_CONST(RESIZABLE); DEC_CONST(ASYNCBLIT); DEC_CONST(OPENGL); DEC_CONST(OPENGLBLIT) DEC_CONST(ANYFORMAT); DEC_CONST(HWPALETTE); DEC_CONST(DOUBLEBUF); DEC_CONST(FULLSCREEN); DEC_CONST(HWACCEL); DEC_CONST(SRCCOLORKEY); DEC_CONST(RLEACCELOK); DEC_CONST(RLEACCEL); DEC_CONST(SRCALPHA); DEC_CONST(PREALLOC); DEC_CONST(NOFRAME); DEC_CONST(GL_RED_SIZE); DEC_CONST(GL_GREEN_SIZE); DEC_CONST(GL_BLUE_SIZE); DEC_CONST(GL_ALPHA_SIZE); DEC_CONST(GL_BUFFER_SIZE); DEC_CONST(GL_DOUBLEBUFFER); DEC_CONST(GL_DEPTH_SIZE); DEC_CONST(GL_STENCIL_SIZE); DEC_CONST(GL_ACCUM_RED_SIZE); DEC_CONST(GL_ACCUM_GREEN_SIZE); DEC_CONST(GL_ACCUM_BLUE_SIZE); DEC_CONST(GL_ACCUM_ALPHA_SIZE); #if SDL_VERSION_ATLEAST(1, 2, 5) DEC_CONST(GL_STEREO); #else PyModule_AddIntConstant(module, "GL_STEREO", -1); #endif #if SDL_VERSION_ATLEAST(1, 2, 6) DEC_CONST(GL_MULTISAMPLEBUFFERS); DEC_CONST(GL_MULTISAMPLESAMPLES); #else PyModule_AddIntConstant(module, "GL_MULTISAMPLEBUFFERS", -1); PyModule_AddIntConstant(module, "GL_MULTISAMPLESAMPLES", -1); #endif DEC_CONSTN(TIMER_RESOLUTION); DEC_CONSTN(AUDIO_U8); DEC_CONSTN(AUDIO_S8); DEC_CONSTN(AUDIO_U16LSB); DEC_CONSTN(AUDIO_S16LSB); DEC_CONSTN(AUDIO_U16MSB); DEC_CONSTN(AUDIO_S16MSB); DEC_CONSTN(AUDIO_U16); DEC_CONSTN(AUDIO_S16); DEC_CONSTN(AUDIO_U16SYS); DEC_CONSTN(AUDIO_S16SYS); DEC_CONST(NOEVENT); DEC_CONST(ACTIVEEVENT); DEC_CONST(KEYDOWN); DEC_CONST(KEYUP); DEC_CONST(MOUSEMOTION); DEC_CONST(MOUSEBUTTONDOWN); DEC_CONST(MOUSEBUTTONUP); DEC_CONST(JOYAXISMOTION); DEC_CONST(JOYBALLMOTION); DEC_CONST(JOYHATMOTION); DEC_CONST(JOYBUTTONDOWN); DEC_CONST(JOYBUTTONUP); DEC_CONST(VIDEORESIZE); DEC_CONST(VIDEOEXPOSE); DEC_CONST(QUIT); DEC_CONST(SYSWMEVENT); DEC_CONST(USEREVENT); DEC_CONST(NUMEVENTS); DEC_CONST(HAT_CENTERED); DEC_CONST(HAT_UP); DEC_CONST(HAT_RIGHTUP); DEC_CONST(HAT_RIGHT); DEC_CONST(HAT_RIGHTDOWN); DEC_CONST(HAT_DOWN); DEC_CONST(HAT_LEFTDOWN); DEC_CONST(HAT_LEFT); DEC_CONST(HAT_LEFTUP); DEC_CONSTK(K_UNKNOWN); DEC_CONSTK(K_FIRST); DEC_CONSTK(K_BACKSPACE); DEC_CONSTK(K_TAB); DEC_CONSTK(K_CLEAR); DEC_CONSTK(K_RETURN); DEC_CONSTK(K_PAUSE); DEC_CONSTK(K_ESCAPE); DEC_CONSTK(K_SPACE); DEC_CONSTK(K_EXCLAIM); DEC_CONSTK(K_QUOTEDBL); DEC_CONSTK(K_HASH); DEC_CONSTK(K_DOLLAR); DEC_CONSTK(K_AMPERSAND); DEC_CONSTK(K_QUOTE); DEC_CONSTK(K_LEFTPAREN); DEC_CONSTK(K_RIGHTPAREN); DEC_CONSTK(K_ASTERISK); DEC_CONSTK(K_PLUS); DEC_CONSTK(K_COMMA); DEC_CONSTK(K_MINUS); DEC_CONSTK(K_PERIOD); DEC_CONSTK(K_SLASH); DEC_CONSTK(K_0); DEC_CONSTK(K_1); DEC_CONSTK(K_2); DEC_CONSTK(K_3); DEC_CONSTK(K_4); DEC_CONSTK(K_5); DEC_CONSTK(K_6); DEC_CONSTK(K_7); DEC_CONSTK(K_8); DEC_CONSTK(K_9); DEC_CONSTK(K_COLON); DEC_CONSTK(K_SEMICOLON); DEC_CONSTK(K_LESS); DEC_CONSTK(K_EQUALS); DEC_CONSTK(K_GREATER); DEC_CONSTK(K_QUESTION); DEC_CONSTK(K_AT); DEC_CONSTK(K_LEFTBRACKET); DEC_CONSTK(K_BACKSLASH); DEC_CONSTK(K_RIGHTBRACKET); DEC_CONSTK(K_CARET); DEC_CONSTK(K_UNDERSCORE); DEC_CONSTK(K_BACKQUOTE); DEC_CONSTK(K_a); DEC_CONSTK(K_b); DEC_CONSTK(K_c); DEC_CONSTK(K_d); DEC_CONSTK(K_e); DEC_CONSTK(K_f); DEC_CONSTK(K_g); DEC_CONSTK(K_h); DEC_CONSTK(K_i); DEC_CONSTK(K_j); DEC_CONSTK(K_k); DEC_CONSTK(K_l); DEC_CONSTK(K_m); DEC_CONSTK(K_n); DEC_CONSTK(K_o); DEC_CONSTK(K_p); DEC_CONSTK(K_q); DEC_CONSTK(K_r); DEC_CONSTK(K_s); DEC_CONSTK(K_t); DEC_CONSTK(K_u); DEC_CONSTK(K_v); DEC_CONSTK(K_w); DEC_CONSTK(K_x); DEC_CONSTK(K_y); DEC_CONSTK(K_z); DEC_CONSTK(K_DELETE); DEC_CONSTK(K_KP0); DEC_CONSTK(K_KP1); DEC_CONSTK(K_KP2); DEC_CONSTK(K_KP3); DEC_CONSTK(K_KP4); DEC_CONSTK(K_KP5); DEC_CONSTK(K_KP6); DEC_CONSTK(K_KP7); DEC_CONSTK(K_KP8); DEC_CONSTK(K_KP9); DEC_CONSTK(K_KP_PERIOD); DEC_CONSTK(K_KP_DIVIDE); DEC_CONSTK(K_KP_MULTIPLY); DEC_CONSTK(K_KP_MINUS); DEC_CONSTK(K_KP_PLUS); DEC_CONSTK(K_KP_ENTER); DEC_CONSTK(K_KP_EQUALS); DEC_CONSTK(K_UP); DEC_CONSTK(K_DOWN); DEC_CONSTK(K_RIGHT); DEC_CONSTK(K_LEFT); DEC_CONSTK(K_INSERT); DEC_CONSTK(K_HOME); DEC_CONSTK(K_END); DEC_CONSTK(K_PAGEUP); DEC_CONSTK(K_PAGEDOWN); DEC_CONSTK(K_F1); DEC_CONSTK(K_F2); DEC_CONSTK(K_F3); DEC_CONSTK(K_F4); DEC_CONSTK(K_F5); DEC_CONSTK(K_F6); DEC_CONSTK(K_F7); DEC_CONSTK(K_F8); DEC_CONSTK(K_F9); DEC_CONSTK(K_F10); DEC_CONSTK(K_F11); DEC_CONSTK(K_F12); DEC_CONSTK(K_F13); DEC_CONSTK(K_F14); DEC_CONSTK(K_F15); DEC_CONSTK(K_NUMLOCK); DEC_CONSTK(K_CAPSLOCK); DEC_CONSTK(K_SCROLLOCK); DEC_CONSTK(K_RSHIFT); DEC_CONSTK(K_LSHIFT); DEC_CONSTK(K_RCTRL); DEC_CONSTK(K_LCTRL); DEC_CONSTK(K_RALT); DEC_CONSTK(K_LALT); DEC_CONSTK(K_RMETA); DEC_CONSTK(K_LMETA); DEC_CONSTK(K_LSUPER); DEC_CONSTK(K_RSUPER); DEC_CONSTK(K_MODE); DEC_CONSTK(K_HELP); DEC_CONSTK(K_PRINT); DEC_CONSTK(K_SYSREQ); DEC_CONSTK(K_BREAK); DEC_CONSTK(K_MENU); DEC_CONSTK(K_POWER); DEC_CONSTK(K_EURO); DEC_CONSTK(K_LAST); DEC_CONSTN(KMOD_NONE); DEC_CONSTN(KMOD_LSHIFT); DEC_CONSTN(KMOD_RSHIFT); DEC_CONSTN(KMOD_LCTRL); DEC_CONSTN(KMOD_RCTRL); DEC_CONSTN(KMOD_LALT); DEC_CONSTN(KMOD_RALT); DEC_CONSTN(KMOD_LMETA); DEC_CONSTN(KMOD_RMETA); DEC_CONSTN(KMOD_NUM); DEC_CONSTN(KMOD_CAPS); DEC_CONSTN(KMOD_MODE); DEC_CONSTN(KMOD_CTRL); DEC_CONSTN(KMOD_SHIFT); DEC_CONSTN(KMOD_ALT); DEC_CONSTN(KMOD_META); } #if 0 /*documentation only*/ /*DOC*/ static char doc_display[] = /*DOC*/ "pygame.constants.display (constants)\n" /*DOC*/ "The following constants are used by the display module and Surfaces\n" /*DOC*/ "\n" /*DOC*/ "HWSURFACE - surface in hardware video memory. (equal to 1)
\n" /*DOC*/ "RESIZABLE - display window is resizeable
\n" /*DOC*/ "ASYNCBLIT - surface blits happen asynchronously (threaded)
\n" /*DOC*/ "OPENGL - display surface will be controlled by opengl
\n" /*DOC*/ "HWPALETTE - display surface has animatable hardware palette\n" /*DOC*/ "entries
\n" /*DOC*/ "DOUBLEBUF - hardware display surface is page flippable
\n" /*DOC*/ "FULLSCREEN - display surface is fullscreen (nonwindowed)
\n" /*DOC*/ "RLEACCEL - compile for quick alpha blits, only set in alpha or\n" /*DOC*/ "colorkey funcs
\n" /*DOC*/ "NOFRAME - no window decorations
\n" /*DOC*/ ; /*DOC*/ static char doc_time[] = /*DOC*/ "pygame.constants.time (constants)\n" /*DOC*/ "These constants define the various time constants\n" /*DOC*/ "\n" /*DOC*/ "TIMER_RESOLUTION - minimum timer resolution in milliseconds
\n" /*DOC*/ ; /*DOC*/ static char doc_events[] = /*DOC*/ "pygame.constants.events (constants)\n" /*DOC*/ "These constants define the various event types\n" /*DOC*/ "\n" /*DOC*/ "NOEVENT - no event, represents an empty event list, equal to 0
\n" /*DOC*/ "ACTIVEEVENT - window has gain/lost mouse/keyboard/visiblity focus
\n" /*DOC*/ "KEYDOWN - keyboard button has been pressed (or down and repeating)
\n" /*DOC*/ "KEYUP - keyboard button has been released
\n" /*DOC*/ "MOUSEMOTION - mouse has moved
\n" /*DOC*/ "MOUSEBUTTONDOWN- mouse button has been pressed
\n" /*DOC*/ "MOUSEBUTTONUP - mouse button has been released
\n" /*DOC*/ "JOYAXISMOTION - an opened joystick axis has changed
\n" /*DOC*/ "JOYBALLMOTION - an opened joystick ball has moved
\n" /*DOC*/ "JOYHATMOTION - an opened joystick hat has moved
\n" /*DOC*/ "JOYBUTTONDOWN - an opened joystick button has been pressed
\n" /*DOC*/ "JOYBUTTONUP - an opened joystick button has been released
\n" /*DOC*/ "VIDEORESIZE - the display window has been resized by the user
\n" /*DOC*/ "QUIT - the user has requested the game to quit
\n" /*DOC*/ "SYSWMEVENT - currently unsupported, system dependant
\n" /*DOC*/ "USEREVENT - all user messages are this or higher
\n" /*DOC*/ "NUMEVENTS - all user messages must be lower than this, equal to 32
\n" /*DOC*/ ; /*DOC*/ static char doc_keyboard[] = /*DOC*/ "pygame.constants.keyboard (constants)\n" /*DOC*/ "These constants represent the keys on the keyboard.\n" /*DOC*/ "\n" /*DOC*/ "There are many keyboard constants, they are used to represent\n" /*DOC*/ "keys on the keyboard. The following is a list of all keyboard\n" /*DOC*/ "constants\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "\n" /*DOC*/ "
KeyASCIIASCII Common Name
K_BACKSPACE\bbackspace
K_TAB\ttab
K_CLEARclear
K_RETURN\rreturn
K_PAUSEpause
K_ESCAPE^[escape
K_SPACEspace
K_EXCLAIM!exclaim
K_QUOTEDBL\"quotedbl
K_HASH#hash
K_DOLLAR$dollar
K_AMPERSAND&ampersand
K_QUOTEquote
K_LEFTPAREN(left parenthesis
K_RIGHTPAREN)right parenthesis
K_ASTERISK*asterisk
K_PLUS+plus sign
K_COMMA,comma
K_MINUS-minus sign
K_PERIOD.period
K_SLASH/forward slash
K_000
K_111
K_222
K_333
K_444
K_555
K_666
K_777
K_888
K_999
K_COLON:colon
K_SEMICOLON;semicolon
K_LESS<less-than sign
K_EQUALS=equals sign
K_GREATER>greater-than sign
K_QUESTION?question mark
K_AT@at
K_LEFTBRACKET[left bracket
K_BACKSLASH\\backslash
K_RIGHTBRACKET]right bracket
K_CARET^caret
K_UNDERSCORE_underscore
K_BACKQUOTE`grave
K_aaa
K_bbb
K_ccc
K_ddd
K_eee
K_fff
K_ggg
K_hhh
K_iii
K_jjj
K_kkk
K_lll
K_mmm
K_nnn
K_ooo
K_ppp
K_qqq
K_rrr
K_sss
K_ttt
K_uuu
K_vvv
K_www
K_xxx
K_yyy
K_zzz
K_DELETEdelete
K_KP0keypad 0
K_KP1keypad 1
K_KP2keypad 2
K_KP3keypad 3
K_KP4keypad 4
K_KP5keypad 5
K_KP6keypad 6
K_KP7keypad 7
K_KP8keypad 8
K_KP9keypad 9
K_KP_PERIOD.keypad period
K_KP_DIVIDE/keypad divide
K_KP_MULTIPLY*keypad multiply
K_KP_MINUS-keypad minus
K_KP_PLUS+keypad plus
K_KP_ENTER\rkeypad enter
K_KP_EQUALS=keypad equals
K_UPup arrow
K_DOWNdown arrow
K_RIGHTright arrow
K_LEFTleft arrow
K_INSERTinsert
K_HOMEhome
K_ENDend
K_PAGEUPpage up
K_PAGEDOWNpage down
K_F1F1
K_F2F2
K_F3F3
K_F4F4
K_F5F5
K_F6F6
K_F7F7
K_F8F8
K_F9F9
K_F10F10
K_F11F11
K_F12F12
K_F13F13
K_F14F14
K_F15F15
K_NUMLOCKnumlock
K_CAPSLOCKcapslock
K_SCROLLOCKscrollock
K_RSHIFTright shift
K_LSHIFTleft shift
K_RCTRLright ctrl
K_LCTRLleft ctrl
K_RALTright alt
K_LALTleft alt
K_RMETAright meta
K_LMETAleft meta
K_LSUPERleft windows key
K_RSUPERright windows key
K_MODEmode shift
K_HELPhelp
K_PRINTprint-screen
K_SYSREQSysRq
K_BREAKbreak
K_MENUmenu
K_POWERpower
K_EUROeuro
\n" /*DOC*/ ; /*DOC*/ static char doc_modifiers[] = /*DOC*/ "pygame.constants.modifiers (constants)\n" /*DOC*/ "These constants represent the modifier keys on the keyboard.\n" /*DOC*/ "\n" /*DOC*/ "Their states are treated slightly differently than normal\n" /*DOC*/ "keyboard button states, and you can temporarily set their states.\n" /*DOC*/ "\n" /*DOC*/ "KMOD_NONE, KMOD_LSHIFT, KMOD_RSHIFT, KMOD_SHIFT, KMOD_CAPS,
\n" /*DOC*/ "KMOD_LCTRL, KMOD_RCTRL, KMOD_CTRL, KMOD_LALT, KMOD_RALT,
\n" /*DOC*/ "KMOD_ALT, KMOD_LMETA, KMOD_RMETA, KMOD_META, KMOD_NUM, KMOD_MODE
\n" /*DOC*/ ; #endif