diff options
| author | Alexander Gavrilov | 2012-08-19 20:00:10 +0400 |
|---|---|---|
| committer | Alexander Gavrilov | 2012-08-19 20:00:10 +0400 |
| commit | 38a07a4ca584e2cccc2c2814c35266ba33d692c8 (patch) | |
| tree | e0748a79f70ee29ed8ecf3cf46f9c0c5c9c54baf /library/LuaApi.cpp | |
| parent | cacb082416667ec4309d85e934068ded041d21b8 (diff) | |
| download | dfhack-38a07a4ca584e2cccc2c2814c35266ba33d692c8.tar.gz dfhack-38a07a4ca584e2cccc2c2814c35266ba33d692c8.tar.bz2 dfhack-38a07a4ca584e2cccc2c2814c35266ba33d692c8.tar.xz | |
Export the tile finder function to lua, and improve mouse event reporting.
Diffstat (limited to 'library/LuaApi.cpp')
| -rw-r--r-- | library/LuaApi.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/library/LuaApi.cpp b/library/LuaApi.cpp index 0f3ed935..112cc4fd 100644 --- a/library/LuaApi.cpp +++ b/library/LuaApi.cpp @@ -1075,6 +1075,7 @@ static const luaL_Reg dfhack_constructions_funcs[] = { /***** Screen module *****/ static const LuaWrapper::FunctionReg dfhack_screen_module[] = { + WRAPM(Screen, inGraphicsMode), WRAPM(Screen, clear), WRAPM(Screen, invalidate), { NULL, NULL } @@ -1133,6 +1134,25 @@ static int screen_fillRect(lua_State *L) return 1; } +static int screen_findGraphicsTile(lua_State *L) +{ + auto str = luaL_checkstring(L, 1); + int x = luaL_checkint(L, 2); + int y = luaL_checkint(L, 3); + int tile, tile_gs; + if (Screen::findGraphicsTile(str, x, y, &tile, &tile_gs)) + { + lua_pushinteger(L, tile); + lua_pushinteger(L, tile_gs); + return 2; + } + else + { + lua_pushnil(L); + return 1; + } +} + namespace { int screen_show(lua_State *L) @@ -1168,6 +1188,7 @@ static const luaL_Reg dfhack_screen_funcs[] = { { "paintTile", screen_paintTile }, { "paintString", screen_paintString }, { "fillRect", screen_fillRect }, + { "findGraphicsTile", screen_findGraphicsTile }, { "show", &Lua::CallWithCatchWrapper<screen_show> }, { "dismiss", screen_dismiss }, { "isDismissed", screen_isDismissed }, |
