Exit functionality via game engine, because sys.exit was making a mess
This commit is contained in:
parent
db548c9183
commit
e8240cb380
|
@ -34,7 +34,7 @@ static PyMethodDef mcrfpyMethods[] = {
|
|||
|
||||
{"setTimer", McRFPy_API::_setTimer, METH_VARARGS, "setTimer(name:str, callable:object, interval:int) - callable will be called with args (runtime:float) every `interval` milliseconds"},
|
||||
{"delTimer", McRFPy_API::_delTimer, METH_VARARGS, "delTimer(name:str) - stop calling the timer labelled with `name`"},
|
||||
|
||||
{"exit", McRFPy_API::_exit, METH_VARARGS, "exit() - close down the game engine"},
|
||||
{NULL, NULL, 0, NULL}
|
||||
};
|
||||
|
||||
|
@ -471,3 +471,9 @@ PyObject* McRFPy_API::_delTimer(PyObject* self, PyObject* args) {
|
|||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
|
||||
PyObject* McRFPy_API::_exit(PyObject* self, PyObject* args) {
|
||||
game->quit();
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
|
|
|
@ -79,6 +79,8 @@ public:
|
|||
static PyObject* _setTimer(PyObject*, PyObject*);
|
||||
static PyObject* _delTimer(PyObject*, PyObject*);
|
||||
|
||||
static PyObject* _exit(PyObject*, PyObject*);
|
||||
|
||||
// accept keyboard input from scene
|
||||
static sf::Vector2i cursor_position;
|
||||
static void player_input(int, int);
|
||||
|
|
Loading…
Reference in New Issue