Commits

illume  committed c65a322

Updated constants GL_SWAP_CONTROL,GL_ACCELERATED_VISUAL,BUTTON_X1,BUTTON_X2

Added pygame.key.get_repeat to see how holding keys down repeats. This is
the sister function of pygame.ket.set_repeat, and is a new SDL function.

  • Participants
  • Parent commits 6ff6f77

Comments (0)

Files changed (4)

 #
 #
 
+Feb 14, 2008
+    Updated constants GL_SWAP_CONTROL,GL_ACCELERATED_VISUAL,BUTTON_X1,BUTTON_X2
+
+    Added pygame.key.get_repeat to see how holding keys down repeats.  This is
+      the sister function of pygame.ket.set_repeat.
+
+    MacOSX, and Windows binaries now use latest SDL 1.2.13
 
 Feb 11, 2008
     An example of using pygame with no windowing system.  Useful for webserver

File src/constants.c

     DEC_CONST(GL_ACCUM_GREEN_SIZE);
     DEC_CONST(GL_ACCUM_BLUE_SIZE);
     DEC_CONST(GL_ACCUM_ALPHA_SIZE);
-#if SDL_VERSION_ATLEAST(1, 2, 10)
-    DEC_CONST(GL_SWAP_CONTROL);
-#endif
+
 #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);
     PyModule_AddIntConstant(module, "GL_MULTISAMPLESAMPLES", -1);
 #endif
 
+#if SDL_VERSION_ATLEAST(1, 2, 10)
+    DEC_CONST(GL_SWAP_CONTROL);
+    DEC_CONST(GL_ACCELERATED_VISUAL);
+#else
+    PyModule_AddIntConstant(module, "GL_SWAP_CONTROL", -1);
+    PyModule_AddIntConstant(module, "GL_ACCELERATED_VISUAL", -1);
+#endif
+
+
+#if SDL_VERSION_ATLEAST(1, 2, 13)
+    DEC_CONST(BUTTON_X1);
+    DEC_CONST(BUTTON_X2);
+#else
+    PyModule_AddIntConstant(module, "BUTTON_X1", -1);
+    PyModule_AddIntConstant(module, "BUTTON_X2", -1);
+#endif
+
+
+
+
     DEC_CONSTN(TIMER_RESOLUTION);
     
     DEC_CONSTN(AUDIO_U8);
     Py_RETURN_NONE;
 }
 
+
+
+static PyObject*
+key_get_repeat (PyObject* self, PyObject* args)
+{
+    int delay = 0, interval = 0;
+
+    VIDEO_INIT_CHECK ();
+#if SDL_VERSION_ATLEAST(1, 2, 10)
+    SDL_GetKeyRepeat (&delay, &interval);
+    return Py_BuildValue ("(ii)", delay, interval);
+#else
+    Py_RETURN_NONE;
+#endif
+}
+
+
+
+
+
+
+
+
+
 static PyObject*
 key_get_pressed (PyObject* self)
 {
 static PyMethodDef key_builtins[] =
 {
     { "set_repeat", key_set_repeat, METH_VARARGS, DOC_PYGAMEKEYSETREPEAT },
+    { "get_repeat", key_get_repeat, METH_NOARGS, DOC_PYGAMEKEYGETREPEAT },
     { "get_pressed", (PyCFunction) key_get_pressed, METH_NOARGS,
       DOC_PYGAMEKEYGETPRESSED },
     { "name", key_name, METH_VARARGS, DOC_PYGAMEKEYNAME },
 pygame.key.set_repeat(delay, interval): return None
 
 When the keyboard repeat is enabled, keys that are held down will generate
-multiple pygame.KEYDOWN events. The delay is the number if milliseconds before
+multiple pygame.KEYDOWN events. The delay is the number of milliseconds before
 the first repeated pygame.KEYDOWN will be sent. After that another
 pygame.KEYDOWN will be sent every interval milliseconds. If no arguments are
 passed the key repeat is disabled.
 <END>
 
 
+
+get_repeat
+see how held keys are repeated
+pygame.key.get_repeat(): return (delay, interval)
+
+When the keyboard repeat is enabled, keys that are held down will generate
+multiple pygame.KEYDOWN events. The delay is the number of milliseconds before
+the first repeated pygame.KEYDOWN will be sent. After that another
+pygame.KEYDOWN will be sent every interval milliseconds.
+
+When pygame is initialized the key repeat is disabled.
+
+New in pygame 1.8.
+<END>
+
+
+
+
 name
 get the name of a key identifier
 pygame.key.name(key): return string