Commits

Anonymous committed b673e45

Added pygame constants

  • Participants
  • Parent commits a1df1cc
  • Branches ctypes-soc

Comments (0)

Files changed (2)

File pygame/constants.py

+#!/usr/bin/env python
+
+'''Constants defined by SDL, and needed in pygame.
+
+Note that many of the flags for SDL are not needed in pygame, and are not
+included here.  These constants are generally accessed from the
+`pygame.locals` module.  This module is automatically placed in the pygame
+namespace, but you will usually want to place them directly into your module's
+namespace with the following command::
+
+    from pygame.locals import *
+
+'''
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id$'
+
+import SDL.constants
+
+YV12_OVERLAY            = SDL.constants.SDL_YV12_OVERLAY
+IYUV_OVERLAY            = SDL.constants.SDL_IYUV_OVERLAY
+YUY2_OVERLAY            = SDL.constants.SDL_YUY2_OVERLAY
+UYVY_OVERLAY            = SDL.constants.SDL_UYVY_OVERLAY
+YVYU_OVERLAY            = SDL.constants.SDL_YVYU_OVERLAY
+
+SWSURFACE               = SDL.constants.SDL_SWSURFACE
+HWSURFACE               = SDL.constants.SDL_HWSURFACE
+RESIZABLE               = SDL.constants.SDL_RESIZABLE
+ASYNCBLIT               = SDL.constants.SDL_ASYNCBLIT
+OPENGL                  = SDL.constants.SDL_OPENGL
+OPENGLBLIT              = SDL.constants.SDL_OPENGLBLIT
+ANYFORMAT               = SDL.constants.SDL_ANYFORMAT
+HWPALETTE               = SDL.constants.SDL_HWPALETTE
+DOUBLEBUF               = SDL.constants.SDL_DOUBLEBUF
+FULLSCREEN              = SDL.constants.SDL_FULLSCREEN
+HWACCEL                 = SDL.constants.SDL_HWACCEL
+SRCCOLORKEY             = SDL.constants.SDL_SRCCOLORKEY
+RLEACCELOK              = SDL.constants.SDL_RLEACCELOK
+RLEACCEL                = SDL.constants.SDL_RLEACCEL
+SRCALPHA                = SDL.constants.SDL_SRCALPHA
+PREALLOC                = SDL.constants.SDL_PREALLOC
+NOFRAME                 = SDL.constants.SDL_NOFRAME
+
+GL_RED_SIZE             = SDL.constants.SDL_GL_RED_SIZE
+GL_GREEN_SIZE           = SDL.constants.SDL_GL_GREEN_SIZE
+GL_BLUE_SIZE            = SDL.constants.SDL_GL_BLUE_SIZE
+GL_ALPHA_SIZE           = SDL.constants.SDL_GL_ALPHA_SIZE
+GL_BUFFER_SIZE          = SDL.constants.SDL_GL_BUFFER_SIZE
+GL_DOUBLEBUFFER         = SDL.constants.SDL_GL_DOUBLEBUFFER
+GL_DEPTH_SIZE           = SDL.constants.SDL_GL_DEPTH_SIZE
+GL_STENCIL_SIZE         = SDL.constants.SDL_GL_STENCIL_SIZE
+GL_ACCUM_RED_SIZE       = SDL.constants.SDL_GL_ACCUM_RED_SIZE
+GL_ACCUM_GREEN_SIZE     = SDL.constants.SDL_GL_ACCUM_GREEN_SIZE
+GL_ACCUM_BLUE_SIZE      = SDL.constants.SDL_GL_ACCUM_BLUE_SIZE
+GL_ACCUM_ALPHA_SIZE     = SDL.constants.SDL_GL_ACCUM_ALPHA_SIZE
+GL_STEREO               = SDL.constants.SDL_GL_STEREO
+GL_MULTISAMPLEBUFFERS   = SDL.constants.SDL_GL_MULTISAMPLEBUFFERS
+GL_MULTISAMPLESAMPLES   = SDL.constants.SDL_GL_MULTISAMPLESAMPLES
+
+TIMER_RESOLUTION        = SDL.constants.TIMER_RESOLUTION
+
+AUDIO_U8                = SDL.constants.AUDIO_U8
+AUDIO_S8                = SDL.constants.AUDIO_S8
+AUDIO_U16LSB            = SDL.constants.AUDIO_U16LSB
+AUDIO_S16LSB            = SDL.constants.AUDIO_S16LSB
+AUDIO_U16MSB            = SDL.constants.AUDIO_U16MSB
+AUDIO_S16MSB            = SDL.constants.AUDIO_S16MSB
+AUDIO_U16               = SDL.constants.AUDIO_U16
+AUDIO_S16               = SDL.constants.AUDIO_S16
+AUDIO_U16SYS            = SDL.constants.AUDIO_U16SYS
+AUDIO_S16SYS            = SDL.constants.AUDIO_S16SYS
+
+NOEVENT                 = SDL.constants.SDL_NOEVENT
+ACTIVEEVENT             = SDL.constants.SDL_ACTIVEEVENT
+KEYDOWN                 = SDL.constants.SDL_KEYDOWN
+KEYUP                   = SDL.constants.SDL_KEYUP
+MOUSEMOTION             = SDL.constants.SDL_MOUSEMOTION
+MOUSEBUTTONDOWN         = SDL.constants.SDL_MOUSEBUTTONDOWN
+MOUSEBUTTONUP           = SDL.constants.SDL_MOUSEBUTTONUP
+JOYAXISMOTION           = SDL.constants.SDL_JOYAXISMOTION
+JOYBALLMOTION           = SDL.constants.SDL_JOYBALLMOTION
+JOYHATMOTION            = SDL.constants.SDL_JOYHATMOTION
+JOYBUTTONDOWN           = SDL.constants.SDL_JOYBUTTONDOWN
+JOYBUTTONUP             = SDL.constants.SDL_JOYBUTTONUP
+VIDEORESIZE             = SDL.constants.SDL_VIDEORESIZE
+VIDEOEXPOSE             = SDL.constants.SDL_VIDEOEXPOSE
+QUIT                    = SDL.constants.SDL_QUIT
+SYSWMEVENT              = SDL.constants.SDL_SYSWMEVENT
+USEREVENT               = SDL.constants.SDL_USEREVENT
+NUMEVENTS               = SDL.constants.SDL_NUMEVENTS
+
+HAT_CENTERED            = SDL.constants.SDL_HAT_CENTERED
+HAT_UP                  = SDL.constants.SDL_HAT_UP
+HAT_RIGHTUP             = SDL.constants.SDL_HAT_RIGHTUP
+HAT_RIGHT               = SDL.constants.SDL_HAT_RIGHT
+HAT_RIGHTDOWN           = SDL.constants.SDL_HAT_RIGHTDOWN
+HAT_DOWN                = SDL.constants.SDL_HAT_DOWN
+HAT_LEFTDOWN            = SDL.constants.SDL_HAT_LEFTDOWN
+HAT_LEFT                = SDL.constants.SDL_HAT_LEFT
+HAT_LEFTUP              = SDL.constants.SDL_HAT_LEFTUP
+
+#BEGIN GENERATED CONSTANTS; see support/make_pygame_keyconstants.py
+K_0                     = SDL.constants.SDLK_0
+K_1                     = SDL.constants.SDLK_1
+K_2                     = SDL.constants.SDLK_2
+K_3                     = SDL.constants.SDLK_3
+K_4                     = SDL.constants.SDLK_4
+K_5                     = SDL.constants.SDLK_5
+K_6                     = SDL.constants.SDLK_6
+K_7                     = SDL.constants.SDLK_7
+K_8                     = SDL.constants.SDLK_8
+K_9                     = SDL.constants.SDLK_9
+K_AMPERSAND             = SDL.constants.SDLK_AMPERSAND
+K_ASTERISK              = SDL.constants.SDLK_ASTERISK
+K_AT                    = SDL.constants.SDLK_AT
+K_BACKQUOTE             = SDL.constants.SDLK_BACKQUOTE
+K_BACKSLASH             = SDL.constants.SDLK_BACKSLASH
+K_BACKSPACE             = SDL.constants.SDLK_BACKSPACE
+K_BREAK                 = SDL.constants.SDLK_BREAK
+K_CAPSLOCK              = SDL.constants.SDLK_CAPSLOCK
+K_CARET                 = SDL.constants.SDLK_CARET
+K_CLEAR                 = SDL.constants.SDLK_CLEAR
+K_COLON                 = SDL.constants.SDLK_COLON
+K_COMMA                 = SDL.constants.SDLK_COMMA
+K_COMPOSE               = SDL.constants.SDLK_COMPOSE
+K_DELETE                = SDL.constants.SDLK_DELETE
+K_DOLLAR                = SDL.constants.SDLK_DOLLAR
+K_DOWN                  = SDL.constants.SDLK_DOWN
+K_END                   = SDL.constants.SDLK_END
+K_EQUALS                = SDL.constants.SDLK_EQUALS
+K_ESCAPE                = SDL.constants.SDLK_ESCAPE
+K_EURO                  = SDL.constants.SDLK_EURO
+K_EXCLAIM               = SDL.constants.SDLK_EXCLAIM
+K_F1                    = SDL.constants.SDLK_F1
+K_F10                   = SDL.constants.SDLK_F10
+K_F11                   = SDL.constants.SDLK_F11
+K_F12                   = SDL.constants.SDLK_F12
+K_F13                   = SDL.constants.SDLK_F13
+K_F14                   = SDL.constants.SDLK_F14
+K_F15                   = SDL.constants.SDLK_F15
+K_F2                    = SDL.constants.SDLK_F2
+K_F3                    = SDL.constants.SDLK_F3
+K_F4                    = SDL.constants.SDLK_F4
+K_F5                    = SDL.constants.SDLK_F5
+K_F6                    = SDL.constants.SDLK_F6
+K_F7                    = SDL.constants.SDLK_F7
+K_F8                    = SDL.constants.SDLK_F8
+K_F9                    = SDL.constants.SDLK_F9
+K_FIRST                 = SDL.constants.SDLK_FIRST
+K_GREATER               = SDL.constants.SDLK_GREATER
+K_HASH                  = SDL.constants.SDLK_HASH
+K_HELP                  = SDL.constants.SDLK_HELP
+K_HOME                  = SDL.constants.SDLK_HOME
+K_INSERT                = SDL.constants.SDLK_INSERT
+K_KP0                   = SDL.constants.SDLK_KP0
+K_KP1                   = SDL.constants.SDLK_KP1
+K_KP2                   = SDL.constants.SDLK_KP2
+K_KP3                   = SDL.constants.SDLK_KP3
+K_KP4                   = SDL.constants.SDLK_KP4
+K_KP5                   = SDL.constants.SDLK_KP5
+K_KP6                   = SDL.constants.SDLK_KP6
+K_KP7                   = SDL.constants.SDLK_KP7
+K_KP8                   = SDL.constants.SDLK_KP8
+K_KP9                   = SDL.constants.SDLK_KP9
+K_KP_DIVIDE             = SDL.constants.SDLK_KP_DIVIDE
+K_KP_ENTER              = SDL.constants.SDLK_KP_ENTER
+K_KP_EQUALS             = SDL.constants.SDLK_KP_EQUALS
+K_KP_MINUS              = SDL.constants.SDLK_KP_MINUS
+K_KP_MULTIPLY           = SDL.constants.SDLK_KP_MULTIPLY
+K_KP_PERIOD             = SDL.constants.SDLK_KP_PERIOD
+K_KP_PLUS               = SDL.constants.SDLK_KP_PLUS
+K_LALT                  = SDL.constants.SDLK_LALT
+K_LAST                  = SDL.constants.SDLK_LAST
+K_LCTRL                 = SDL.constants.SDLK_LCTRL
+K_LEFT                  = SDL.constants.SDLK_LEFT
+K_LEFTBRACKET           = SDL.constants.SDLK_LEFTBRACKET
+K_LEFTPAREN             = SDL.constants.SDLK_LEFTPAREN
+K_LESS                  = SDL.constants.SDLK_LESS
+K_LMETA                 = SDL.constants.SDLK_LMETA
+K_LSHIFT                = SDL.constants.SDLK_LSHIFT
+K_LSUPER                = SDL.constants.SDLK_LSUPER
+K_MENU                  = SDL.constants.SDLK_MENU
+K_MINUS                 = SDL.constants.SDLK_MINUS
+K_MODE                  = SDL.constants.SDLK_MODE
+K_NUMLOCK               = SDL.constants.SDLK_NUMLOCK
+K_PAGEDOWN              = SDL.constants.SDLK_PAGEDOWN
+K_PAGEUP                = SDL.constants.SDLK_PAGEUP
+K_PAUSE                 = SDL.constants.SDLK_PAUSE
+K_PERIOD                = SDL.constants.SDLK_PERIOD
+K_PLUS                  = SDL.constants.SDLK_PLUS
+K_POWER                 = SDL.constants.SDLK_POWER
+K_PRINT                 = SDL.constants.SDLK_PRINT
+K_QUESTION              = SDL.constants.SDLK_QUESTION
+K_QUOTE                 = SDL.constants.SDLK_QUOTE
+K_QUOTEDBL              = SDL.constants.SDLK_QUOTEDBL
+K_RALT                  = SDL.constants.SDLK_RALT
+K_RCTRL                 = SDL.constants.SDLK_RCTRL
+K_RETURN                = SDL.constants.SDLK_RETURN
+K_RIGHT                 = SDL.constants.SDLK_RIGHT
+K_RIGHTBRACKET          = SDL.constants.SDLK_RIGHTBRACKET
+K_RIGHTPAREN            = SDL.constants.SDLK_RIGHTPAREN
+K_RMETA                 = SDL.constants.SDLK_RMETA
+K_RSHIFT                = SDL.constants.SDLK_RSHIFT
+K_RSUPER                = SDL.constants.SDLK_RSUPER
+K_SCROLLOCK             = SDL.constants.SDLK_SCROLLOCK
+K_SEMICOLON             = SDL.constants.SDLK_SEMICOLON
+K_SLASH                 = SDL.constants.SDLK_SLASH
+K_SPACE                 = SDL.constants.SDLK_SPACE
+K_SYSREQ                = SDL.constants.SDLK_SYSREQ
+K_TAB                   = SDL.constants.SDLK_TAB
+K_UNDERSCORE            = SDL.constants.SDLK_UNDERSCORE
+K_UNDO                  = SDL.constants.SDLK_UNDO
+K_UNKNOWN               = SDL.constants.SDLK_UNKNOWN
+K_UP                    = SDL.constants.SDLK_UP
+K_WORLD_0               = SDL.constants.SDLK_WORLD_0
+K_WORLD_1               = SDL.constants.SDLK_WORLD_1
+K_WORLD_10              = SDL.constants.SDLK_WORLD_10
+K_WORLD_11              = SDL.constants.SDLK_WORLD_11
+K_WORLD_12              = SDL.constants.SDLK_WORLD_12
+K_WORLD_13              = SDL.constants.SDLK_WORLD_13
+K_WORLD_14              = SDL.constants.SDLK_WORLD_14
+K_WORLD_15              = SDL.constants.SDLK_WORLD_15
+K_WORLD_16              = SDL.constants.SDLK_WORLD_16
+K_WORLD_17              = SDL.constants.SDLK_WORLD_17
+K_WORLD_18              = SDL.constants.SDLK_WORLD_18
+K_WORLD_19              = SDL.constants.SDLK_WORLD_19
+K_WORLD_2               = SDL.constants.SDLK_WORLD_2
+K_WORLD_20              = SDL.constants.SDLK_WORLD_20
+K_WORLD_21              = SDL.constants.SDLK_WORLD_21
+K_WORLD_22              = SDL.constants.SDLK_WORLD_22
+K_WORLD_23              = SDL.constants.SDLK_WORLD_23
+K_WORLD_24              = SDL.constants.SDLK_WORLD_24
+K_WORLD_25              = SDL.constants.SDLK_WORLD_25
+K_WORLD_26              = SDL.constants.SDLK_WORLD_26
+K_WORLD_27              = SDL.constants.SDLK_WORLD_27
+K_WORLD_28              = SDL.constants.SDLK_WORLD_28
+K_WORLD_29              = SDL.constants.SDLK_WORLD_29
+K_WORLD_3               = SDL.constants.SDLK_WORLD_3
+K_WORLD_30              = SDL.constants.SDLK_WORLD_30
+K_WORLD_31              = SDL.constants.SDLK_WORLD_31
+K_WORLD_32              = SDL.constants.SDLK_WORLD_32
+K_WORLD_33              = SDL.constants.SDLK_WORLD_33
+K_WORLD_34              = SDL.constants.SDLK_WORLD_34
+K_WORLD_35              = SDL.constants.SDLK_WORLD_35
+K_WORLD_36              = SDL.constants.SDLK_WORLD_36
+K_WORLD_37              = SDL.constants.SDLK_WORLD_37
+K_WORLD_38              = SDL.constants.SDLK_WORLD_38
+K_WORLD_39              = SDL.constants.SDLK_WORLD_39
+K_WORLD_4               = SDL.constants.SDLK_WORLD_4
+K_WORLD_40              = SDL.constants.SDLK_WORLD_40
+K_WORLD_41              = SDL.constants.SDLK_WORLD_41
+K_WORLD_42              = SDL.constants.SDLK_WORLD_42
+K_WORLD_43              = SDL.constants.SDLK_WORLD_43
+K_WORLD_44              = SDL.constants.SDLK_WORLD_44
+K_WORLD_45              = SDL.constants.SDLK_WORLD_45
+K_WORLD_46              = SDL.constants.SDLK_WORLD_46
+K_WORLD_47              = SDL.constants.SDLK_WORLD_47
+K_WORLD_48              = SDL.constants.SDLK_WORLD_48
+K_WORLD_49              = SDL.constants.SDLK_WORLD_49
+K_WORLD_5               = SDL.constants.SDLK_WORLD_5
+K_WORLD_50              = SDL.constants.SDLK_WORLD_50
+K_WORLD_51              = SDL.constants.SDLK_WORLD_51
+K_WORLD_52              = SDL.constants.SDLK_WORLD_52
+K_WORLD_53              = SDL.constants.SDLK_WORLD_53
+K_WORLD_54              = SDL.constants.SDLK_WORLD_54
+K_WORLD_55              = SDL.constants.SDLK_WORLD_55
+K_WORLD_56              = SDL.constants.SDLK_WORLD_56
+K_WORLD_57              = SDL.constants.SDLK_WORLD_57
+K_WORLD_58              = SDL.constants.SDLK_WORLD_58
+K_WORLD_59              = SDL.constants.SDLK_WORLD_59
+K_WORLD_6               = SDL.constants.SDLK_WORLD_6
+K_WORLD_60              = SDL.constants.SDLK_WORLD_60
+K_WORLD_61              = SDL.constants.SDLK_WORLD_61
+K_WORLD_62              = SDL.constants.SDLK_WORLD_62
+K_WORLD_63              = SDL.constants.SDLK_WORLD_63
+K_WORLD_64              = SDL.constants.SDLK_WORLD_64
+K_WORLD_65              = SDL.constants.SDLK_WORLD_65
+K_WORLD_66              = SDL.constants.SDLK_WORLD_66
+K_WORLD_67              = SDL.constants.SDLK_WORLD_67
+K_WORLD_68              = SDL.constants.SDLK_WORLD_68
+K_WORLD_69              = SDL.constants.SDLK_WORLD_69
+K_WORLD_7               = SDL.constants.SDLK_WORLD_7
+K_WORLD_70              = SDL.constants.SDLK_WORLD_70
+K_WORLD_71              = SDL.constants.SDLK_WORLD_71
+K_WORLD_72              = SDL.constants.SDLK_WORLD_72
+K_WORLD_73              = SDL.constants.SDLK_WORLD_73
+K_WORLD_74              = SDL.constants.SDLK_WORLD_74
+K_WORLD_75              = SDL.constants.SDLK_WORLD_75
+K_WORLD_76              = SDL.constants.SDLK_WORLD_76
+K_WORLD_77              = SDL.constants.SDLK_WORLD_77
+K_WORLD_78              = SDL.constants.SDLK_WORLD_78
+K_WORLD_79              = SDL.constants.SDLK_WORLD_79
+K_WORLD_8               = SDL.constants.SDLK_WORLD_8
+K_WORLD_80              = SDL.constants.SDLK_WORLD_80
+K_WORLD_81              = SDL.constants.SDLK_WORLD_81
+K_WORLD_82              = SDL.constants.SDLK_WORLD_82
+K_WORLD_83              = SDL.constants.SDLK_WORLD_83
+K_WORLD_84              = SDL.constants.SDLK_WORLD_84
+K_WORLD_85              = SDL.constants.SDLK_WORLD_85
+K_WORLD_86              = SDL.constants.SDLK_WORLD_86
+K_WORLD_87              = SDL.constants.SDLK_WORLD_87
+K_WORLD_88              = SDL.constants.SDLK_WORLD_88
+K_WORLD_89              = SDL.constants.SDLK_WORLD_89
+K_WORLD_9               = SDL.constants.SDLK_WORLD_9
+K_WORLD_90              = SDL.constants.SDLK_WORLD_90
+K_WORLD_91              = SDL.constants.SDLK_WORLD_91
+K_WORLD_92              = SDL.constants.SDLK_WORLD_92
+K_WORLD_93              = SDL.constants.SDLK_WORLD_93
+K_WORLD_94              = SDL.constants.SDLK_WORLD_94
+K_WORLD_95              = SDL.constants.SDLK_WORLD_95
+K_a                     = SDL.constants.SDLK_a
+K_b                     = SDL.constants.SDLK_b
+K_c                     = SDL.constants.SDLK_c
+K_d                     = SDL.constants.SDLK_d
+K_e                     = SDL.constants.SDLK_e
+K_f                     = SDL.constants.SDLK_f
+K_g                     = SDL.constants.SDLK_g
+K_h                     = SDL.constants.SDLK_h
+K_i                     = SDL.constants.SDLK_i
+K_j                     = SDL.constants.SDLK_j
+K_k                     = SDL.constants.SDLK_k
+K_l                     = SDL.constants.SDLK_l
+K_m                     = SDL.constants.SDLK_m
+K_n                     = SDL.constants.SDLK_n
+K_o                     = SDL.constants.SDLK_o
+K_p                     = SDL.constants.SDLK_p
+K_q                     = SDL.constants.SDLK_q
+K_r                     = SDL.constants.SDLK_r
+K_s                     = SDL.constants.SDLK_s
+K_t                     = SDL.constants.SDLK_t
+K_u                     = SDL.constants.SDLK_u
+K_v                     = SDL.constants.SDLK_v
+K_w                     = SDL.constants.SDLK_w
+K_x                     = SDL.constants.SDLK_x
+K_y                     = SDL.constants.SDLK_y
+K_z                     = SDL.constants.SDLK_z
+#END GENERATED CONSTANTS
+

File support/make_pygame_keyconstants.py

+#!/usr/bin/env python
+
+'''
+Usage: python support/make_pygame_keyconstants.py
+
+'''
+
+__docformat__ = 'restructuredtext'
+__version__ = '$Id$'
+
+import sys
+
+import SDL.constants
+
+BEGIN_TAG = '#BEGIN GENERATED CONSTANTS'
+END_TAG = '#END GENERATED CONSTANTS'
+
+def make_pygame_keyconstants(source_file):
+    lines = pre_lines = []
+    post_lines = []
+    for line in open(source_file).readlines():
+        if line[:len(END_TAG)] == END_TAG:
+            lines = post_lines
+        if lines != None:
+            lines.append(line)
+        if line[:len(BEGIN_TAG)] == BEGIN_TAG:
+            lines = None
+
+    if lines == pre_lines:
+        raise Exception, '%s does not have begin tag' % source_file
+    elif lines == None:
+        raise Exception, '%s does not have end tag' % source_file
+        
+    for constant in dir(SDL.constants):
+        if constant[:5] == 'SDLK_':
+            line = '%-24s= SDL.constants.%s\n' % (constant[3:], constant)
+            pre_lines.append(line)
+
+    file = open(source_file, 'w')
+    for line in pre_lines + post_lines:
+        file.write(line)
+
+if __name__ == '__main__':
+    if len(sys.argv) != 1:
+        print __doc__
+    else:
+        make_pygame_keyconstants('pygame/constants.py')