fixed keyrepeat api call
This commit is contained in:
parent
b4a3b12d3d
commit
295b384466
1
.gitignore
vendored
1
.gitignore
vendored
@ -8,3 +8,4 @@ build/stamps/*
|
|||||||
*.pyc
|
*.pyc
|
||||||
utils/*
|
utils/*
|
||||||
*.log
|
*.log
|
||||||
|
build/ext_*
|
BIN
build/powder
BIN
build/powder
Binary file not shown.
@ -3874,7 +3874,7 @@ char *console_ui(pixel *vid_buf,char error[255],char console_more) {
|
|||||||
currentcommand2->command = mystrdup(error);
|
currentcommand2->command = mystrdup(error);
|
||||||
last_command2 = currentcommand2;
|
last_command2 = currentcommand2;
|
||||||
|
|
||||||
SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
|
//SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
|
||||||
cc = 0;
|
cc = 0;
|
||||||
while(cc < 80){
|
while(cc < 80){
|
||||||
fillrect(old_buf, -1, -1+cc, XRES+BARSIZE, 2, 0, 0, 0, 160-(cc*2));
|
fillrect(old_buf, -1, -1+cc, XRES+BARSIZE, 2, 0, 0, 0, 160-(cc*2));
|
||||||
@ -3956,14 +3956,14 @@ char *console_ui(pixel *vid_buf,char error[255],char console_more) {
|
|||||||
currentcommand->command = mystrdup(ed.str);
|
currentcommand->command = mystrdup(ed.str);
|
||||||
last_command = currentcommand;
|
last_command = currentcommand;
|
||||||
free(old_buf);
|
free(old_buf);
|
||||||
SDL_EnableKeyRepeat(0, SDL_DEFAULT_REPEAT_INTERVAL);
|
//SDL_EnableKeyRepeat(0, SDL_DEFAULT_REPEAT_INTERVAL);
|
||||||
return currentcommand->command;
|
return currentcommand->command;
|
||||||
}
|
}
|
||||||
if (sdl_key==SDLK_ESCAPE || sdl_key==SDLK_BACKQUOTE)
|
if (sdl_key==SDLK_ESCAPE || sdl_key==SDLK_BACKQUOTE)
|
||||||
{
|
{
|
||||||
console_mode = 0;
|
console_mode = 0;
|
||||||
free(old_buf);
|
free(old_buf);
|
||||||
SDL_EnableKeyRepeat(0, SDL_DEFAULT_REPEAT_INTERVAL);
|
//SDL_EnableKeyRepeat(0, SDL_DEFAULT_REPEAT_INTERVAL);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if(sdl_key==SDLK_UP || sdl_key==SDLK_DOWN)
|
if(sdl_key==SDLK_UP || sdl_key==SDLK_DOWN)
|
||||||
@ -4000,7 +4000,7 @@ char *console_ui(pixel *vid_buf,char error[255],char console_more) {
|
|||||||
}
|
}
|
||||||
console_mode = 0;
|
console_mode = 0;
|
||||||
free(old_buf);
|
free(old_buf);
|
||||||
SDL_EnableKeyRepeat(0, SDL_DEFAULT_REPEAT_INTERVAL);
|
//SDL_EnableKeyRepeat(0, SDL_DEFAULT_REPEAT_INTERVAL);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
14
src/main.c
14
src/main.c
@ -1915,6 +1915,19 @@ emb_get_modifier(PyObject *self, PyObject *args)
|
|||||||
return Py_BuildValue("(iiiiii)",sdl_mod&KMOD_LCTRL,sdl_mod&KMOD_RCTRL,sdl_mod&KMOD_LALT,sdl_mod&KMOD_RALT,sdl_mod&KMOD_LSHIFT,sdl_mod&KMOD_RSHIFT);
|
return Py_BuildValue("(iiiiii)",sdl_mod&KMOD_LCTRL,sdl_mod&KMOD_RCTRL,sdl_mod&KMOD_LALT,sdl_mod&KMOD_RALT,sdl_mod&KMOD_LSHIFT,sdl_mod&KMOD_RSHIFT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
|
||||||
|
static PyObject*
|
||||||
|
emb_set_keyrepeat(PyObject *self, PyObject *args)
|
||||||
|
{
|
||||||
|
////SDL_EnableKeyRepeat(delay,interval)
|
||||||
|
int keydelay,keyinterval;
|
||||||
|
keydelay=SDL_DEFAULT_REPEAT_DELAY;
|
||||||
|
keyinterval=SDL_DEFAULT_REPEAT_INTERVAL;
|
||||||
|
if(!PyArg_ParseTuple(args, "|ii:set_keyrepeat",&keydelay,&keyinterval))
|
||||||
|
return NULL;
|
||||||
|
return Py_BuildValue("i",SDL_EnableKeyRepeat(keydelay,keyinterval));
|
||||||
|
}
|
||||||
|
|
||||||
static PyMethodDef EmbMethods[] = { //WARNING! don't forget to register your function here!
|
static PyMethodDef EmbMethods[] = { //WARNING! don't forget to register your function here!
|
||||||
{"create", (PyCFunction)emb_create, METH_VARARGS|METH_KEYWORDS, "create a particle."},
|
{"create", (PyCFunction)emb_create, METH_VARARGS|METH_KEYWORDS, "create a particle."},
|
||||||
{"log", (PyCFunction)emb_log, METH_VARARGS, "logs an error string to the console."},
|
{"log", (PyCFunction)emb_log, METH_VARARGS, "logs an error string to the console."},
|
||||||
@ -1950,6 +1963,7 @@ static PyMethodDef EmbMethods[] = { //WARNING! don't forget to register your fun
|
|||||||
{"shortcuts_disable", (PyCFunction)emb_shortcuts_disable, METH_VARARGS, "disable keyboard shortcuts"},
|
{"shortcuts_disable", (PyCFunction)emb_shortcuts_disable, METH_VARARGS, "disable keyboard shortcuts"},
|
||||||
{"shortcuts_enable", (PyCFunction)emb_shortcuts_enable, METH_VARARGS, "enable keyboard shortcuts"},
|
{"shortcuts_enable", (PyCFunction)emb_shortcuts_enable, METH_VARARGS, "enable keyboard shortcuts"},
|
||||||
{"get_modifier", (PyCFunction)emb_get_modifier, METH_VARARGS, "get pressed modifier keys"},
|
{"get_modifier", (PyCFunction)emb_get_modifier, METH_VARARGS, "get pressed modifier keys"},
|
||||||
|
{"set_keyrepeat", (PyCFunction)emb_set_keyrepeat, METH_VARARGS, "set key repeat rate."},
|
||||||
{NULL, NULL, 0, NULL}
|
{NULL, NULL, 0, NULL}
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user