mcrfpy.Mouse: a new class built for symmetry with mcrfpy.Keyboard. Closes #186
This commit is contained in:
parent
b0b17f4633
commit
75127ac9d1
4 changed files with 286 additions and 0 deletions
|
|
@ -14,6 +14,7 @@
|
|||
#include "PySound.h"
|
||||
#include "PyMusic.h"
|
||||
#include "PyKeyboard.h"
|
||||
#include "PyMouse.h"
|
||||
#include "McRogueFaceVersion.h"
|
||||
#include "GameEngine.h"
|
||||
#include "ImGuiConsole.h"
|
||||
|
|
@ -341,6 +342,9 @@ PyObject* PyInit_mcrfpy()
|
|||
/*keyboard state (#160)*/
|
||||
&PyKeyboardType,
|
||||
|
||||
/*mouse state (#186)*/
|
||||
&PyMouseType,
|
||||
|
||||
nullptr};
|
||||
|
||||
// Types that are used internally but NOT exported to module namespace (#189)
|
||||
|
|
@ -415,6 +419,12 @@ PyObject* PyInit_mcrfpy()
|
|||
PyModule_AddObject(m, "keyboard", keyboard_instance);
|
||||
}
|
||||
|
||||
// Add mouse singleton (#186)
|
||||
PyObject* mouse_instance = PyObject_CallObject((PyObject*)&PyMouseType, NULL);
|
||||
if (mouse_instance) {
|
||||
PyModule_AddObject(m, "mouse", mouse_instance);
|
||||
}
|
||||
|
||||
// Add window singleton (#184)
|
||||
// Use tp_alloc directly to bypass tp_new which blocks user instantiation
|
||||
PyObject* window_instance = PyWindowType.tp_alloc(&PyWindowType, 0);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue