LDtk import support

This commit is contained in:
John McCardle 2026-02-07 11:30:32 -05:00
commit de7778b147
24 changed files with 26203 additions and 0 deletions

View file

@ -40,6 +40,8 @@
#include "tiled/PyTileSetFile.h" // Tiled tileset loading
#include "tiled/PyTileMapFile.h" // Tiled tilemap loading
#include "tiled/PyWangSet.h" // Wang auto-tile sets
#include "ldtk/PyLdtkProject.h" // LDtk project loading
#include "ldtk/PyAutoRuleSet.h" // LDtk auto-rule sets
#include "McRogueFaceVersion.h"
#include "GameEngine.h"
// ImGui is only available for SFML builds
@ -494,6 +496,10 @@ PyObject* PyInit_mcrfpy()
&mcrfpydef::PyTileMapFileType,
&mcrfpydef::PyWangSetType,
/*LDtk project loading*/
&mcrfpydef::PyLdtkProjectType,
&mcrfpydef::PyAutoRuleSetType,
nullptr};
// Types that are used internally but NOT exported to module namespace (#189)
@ -575,6 +581,12 @@ PyObject* PyInit_mcrfpy()
mcrfpydef::PyWangSetType.tp_methods = PyWangSet::methods;
mcrfpydef::PyWangSetType.tp_getset = PyWangSet::getsetters;
// LDtk types
mcrfpydef::PyLdtkProjectType.tp_methods = PyLdtkProject::methods;
mcrfpydef::PyLdtkProjectType.tp_getset = PyLdtkProject::getsetters;
mcrfpydef::PyAutoRuleSetType.tp_methods = PyAutoRuleSet::methods;
mcrfpydef::PyAutoRuleSetType.tp_getset = PyAutoRuleSet::getsetters;
// Set up weakref support for all types that need it
PyTimerType.tp_weaklistoffset = offsetof(PyTimerObject, weakreflist);
PyUIFrameType.tp_weaklistoffset = offsetof(PyUIFrameObject, weakreflist);