diff --git a/library/include/dfhack-c/modules/Position_C.h b/library/include/dfhack-c/modules/Position_C.h index 665e400bf..2b60fa2e2 100644 --- a/library/include/dfhack-c/modules/Position_C.h +++ b/library/include/dfhack-c/modules/Position_C.h @@ -38,8 +38,12 @@ DFHACK_EXPORT int Position_setViewCoords(DFHackObject* pos, const int32_t x, con DFHACK_EXPORT int Position_getCursorCoords(DFHackObject* pos, int32_t* x, int32_t* y, int32_t* z); DFHACK_EXPORT int Position_setCursorCoords(DFHackObject* pos, const int32_t x, const int32_t y, const int32_t z); +DFHACK_EXPORT t_hotkey* Position_ReadHotkeys(DFHackObject* pos); + DFHACK_EXPORT int Position_getWindowSize(DFHackObject* pos, int32_t* width, int32_t* height); +DFHACK_EXPORT t_screen* Position_getScreenTiles(DFHackObject* pos, int32_t width, int32_t height); + #ifdef __cplusplus } #endif diff --git a/library/modules/Position_C.cpp b/library/modules/Position_C.cpp index 0144abdb3..a97a52a56 100644 --- a/library/modules/Position_C.cpp +++ b/library/modules/Position_C.cpp @@ -22,6 +22,7 @@ must not be misrepresented as being the original software. distribution. */ +#include "dfhack-c/DFTypes_C.h" #include "dfhack-c/modules/Position_C.h" #ifdef __cplusplus @@ -97,6 +98,28 @@ int Position_setCursorCoords(DFHackObject* pos, int32_t x, int32_t y, int32_t z) return -1; } +t_hotkey* Position_ReadHotkeys(DFHackObject* pos) +{ + if(pos != NULL) + { + t_hotkey* buf; + + (*alloc_t_hotkey_buffer_callback)(buf, NUM_HOTKEYS); + + if(buf != NULL) + { + if(((DFHack::Position*)pos)->ReadHotkeys(buf)) + return buf; + else + return NULL; + } + else + return NULL; + } + + return NULL; +} + int Position_getWindowSize(DFHackObject* pos, int32_t* width, int32_t* height) { if(pos != NULL) @@ -117,6 +140,26 @@ int Position_getWindowSize(DFHackObject* pos, int32_t* width, int32_t* height) return -1; } +t_screen* Position_getScreenTiles(DFHackObject* pos, int32_t width, int32_t height) +{ + if(pos != NULL) + { + t_screen* buf; + + (*alloc_t_screen_buffer_callback)(buf, width * height); + + if(buf == NULL) + return NULL; + + if(((DFHack::Position*)pos)->getScreenTiles(width, height, buf)) + return buf; + else + return NULL; + } + + return NULL; +} + #ifdef __cplusplus } #endif