added getters/setters for cursor/view coords, window size, and screen tiles added ReadHotkeys

develop
doomchild 2011-03-29 09:46:59 -05:00
parent cee5d176b9
commit e34831a354
2 changed files with 118 additions and 108 deletions

@ -36,6 +36,18 @@ extern "C" {
DFHACK_EXPORT int Gui_Start(DFHackObject* gui);
DFHACK_EXPORT int Gui_Finish(DFHackObject* gui);
DFHACK_EXPORT int Gui_getViewCoords(DFHackObject* gui, int32_t* x, int32_t* y, int32_t* z);
DFHACK_EXPORT int Gui_setViewCoords(DFHackObject* gui, int32_t x, int32_t y, int32_t z);
DFHACK_EXPORT int Gui_getCursorCoords(DFHackObject* gui, int32_t* x, int32_t* y, int32_t* z);
DFHACK_EXPORT int Gui_setCursorCoords(DFHackObject* gui, int32_t x, int32_t y, int32_t z);
DFHACK_EXPORT t_hotkey* Gui_ReadHotkeys(DFHackObject* gui);
DFHACK_EXPORT int Gui_getWindowSize(DFHackObject* gui, int32_t* width, int32_t* height);
DFHACK_EXPORT t_screen* Gui_getScreenTiles(DFHackObject* gui, int32_t width, int32_t height);
DFHACK_EXPORT int Gui_ReadViewScreen(DFHackObject* gui, t_viewscreen* viewscreen);
DFHACK_EXPORT int Gui_ReadMenuState(DFHackObject* gui, uint32_t* menuState);

@ -48,35 +48,13 @@ int Gui_Finish(DFHackObject* gui)
return -1;
}
int Gui_ReadViewScreen(DFHackObject* gui, t_viewscreen* viewscreen)
int Gui_getViewCoords(DFHackObject* gui, int32_t* x, int32_t* y, int32_t* z)
{
if(gui != NULL)
{
return ((DFHack::Gui*)gui)->ReadViewScreen(*viewscreen);
}
return -1;
}
int Gui_ReadMenuState(DFHackObject* gui, uint32_t* menuState)
{
if(gui != NULL)
{
*menuState = ((DFHack::Gui*)gui)->ReadMenuState();
return 1;
}
return -1;
}
int Gui_getViewCoords(DFHackObject* pos, int32_t* x, int32_t* y, int32_t* z)
{
if(pos != NULL)
{
int32_t tx, ty, tz;
if(((DFHack::Gui*)pos)->getViewCoords(tx, ty, tz))
if(((DFHack::Gui*)gui)->getViewCoords(tx, ty, tz))
{
*x = tx;
*y = ty;
@ -91,11 +69,11 @@ int Gui_getViewCoords(DFHackObject* pos, int32_t* x, int32_t* y, int32_t* z)
return -1;
}
int Gui_setViewCoords(DFHackObject* pos, int32_t x, int32_t y, int32_t z)
int Gui_setViewCoords(DFHackObject* gui, int32_t x, int32_t y, int32_t z)
{
if(pos != NULL)
if(gui != NULL)
{
if(((DFHack::Gui*)pos)->setViewCoords(x, y, z))
if(((DFHack::Gui*)gui)->setViewCoords(x, y, z))
return 1;
else
return 0;
@ -104,14 +82,13 @@ int Gui_setViewCoords(DFHackObject* pos, int32_t x, int32_t y, int32_t z)
return -1;
}
int Gui_getCursorCoords(DFHackObject* pos, int32_t* x, int32_t* y, int32_t* z)
int Gui_getCursorCoords(DFHackObject* gui, int32_t* x, int32_t* y, int32_t* z)
{
if(pos != NULL)
if(gui != NULL)
{
int32_t tx, ty, tz;
if(((DFHack::Gui*)pos)->getCursorCoords(tx, ty, tz))
if(((DFHack::Gui*)gui)->getCursorCoords(tx, ty, tz))
{
*x = tx;
*y = ty;
@ -126,11 +103,11 @@ int Gui_getCursorCoords(DFHackObject* pos, int32_t* x, int32_t* y, int32_t* z)
return -1;
}
int Gui_setCursorCoords(DFHackObject* pos, int32_t x, int32_t y, int32_t z)
int Gui_setCursorCoords(DFHackObject* gui, int32_t x, int32_t y, int32_t z)
{
if(pos != NULL)
if(gui != NULL)
{
if(((DFHack::Gui*)pos)->setCursorCoords(x, y, z))
if(((DFHack::Gui*)gui)->setCursorCoords(x, y, z))
return 1;
else
return 0;
@ -139,17 +116,17 @@ int Gui_setCursorCoords(DFHackObject* pos, int32_t x, int32_t y, int32_t z)
return -1;
}
t_hotkey* Gui_ReadHotkeys(DFHackObject* pos)
t_hotkey* Gui_ReadHotkeys(DFHackObject* gui)
{
if(pos != NULL)
if(gui != NULL)
{
t_hotkey* buf = NULL;
t_hotkey* buf;
(*alloc_hotkey_buffer_callback)(&buf, NUM_HOTKEYS);
(*alloc_t_hotkey_buffer_callback)(&buf, NUM_HOTKEYS);
if(buf != NULL)
{
if(((DFHack::Gui*)pos)->ReadHotkeys(buf))
if(((DFHack::Gui*)gui)->ReadHotkeys(buf))
return buf;
else
return NULL;
@ -161,13 +138,13 @@ t_hotkey* Gui_ReadHotkeys(DFHackObject* pos)
return NULL;
}
int Gui_getWindowSize(DFHackObject* pos, int32_t* width, int32_t* height)
int Gui_getWindowSize(DFHackObject* gui, int32_t* width, int32_t* height)
{
if(pos != NULL)
if(gui != NULL)
{
int32_t tw, th;
if(((DFHack::Gui*)pos)->getWindowSize(tw, th))
if(((DFHack::Gui*)gui)->getWindowSize(tw, th))
{
*width = tw;
*height = th;
@ -181,18 +158,18 @@ int Gui_getWindowSize(DFHackObject* pos, int32_t* width, int32_t* height)
return -1;
}
t_screen* Gui_getScreenTiles(DFHackObject* pos, int32_t width, int32_t height)
t_screen* Gui_getScreenTiles(DFHackObject* gui, int32_t width, int32_t height)
{
if(pos != NULL)
if(gui != NULL)
{
t_screen* buf = NULL;
t_screen* buf;
(*alloc_screen_buffer_callback)(&buf, width * height);
(*alloc_t_screen_buffer_callback)(&buf, width * height);
if(buf == NULL)
return NULL;
if(((DFHack::Gui*)pos)->getScreenTiles(width, height, buf))
if(((DFHack::Gui*)gui)->getScreenTiles(width, height, buf))
return buf;
else
return NULL;
@ -201,6 +178,27 @@ t_screen* Gui_getScreenTiles(DFHackObject* pos, int32_t width, int32_t height)
return NULL;
}
int Gui_ReadViewScreen(DFHackObject* gui, t_viewscreen* viewscreen)
{
if(gui != NULL)
{
return ((DFHack::Gui*)gui)->ReadViewScreen(*viewscreen);
}
return -1;
}
int Gui_ReadMenuState(DFHackObject* gui, uint32_t* menuState)
{
if(gui != NULL)
{
*menuState = ((DFHack::Gui*)gui)->ReadMenuState();
return 1;
}
return -1;
}
#ifdef __cplusplus
}