[CSM] add screenshot api lua (#5674)

* [CSM] add screenshot api lua
master
Vincent Glize 2017-04-29 09:16:06 +02:00 committed by Loïc Blot
parent b662a4577d
commit 19960e26c6
4 changed files with 14 additions and 0 deletions

View File

@ -703,6 +703,8 @@ Call these functions only at load time!
* `minetest.get_protocol_version()`
* Returns the protocol version of the server.
* Might not be accurate at start up as the client might not be connected to the server yet, in that case it will return 0.
* `minetest.take_screenshot()`
* Take a screenshot.
### Misc.
* `minetest.parse_json(string[, nullvalue])`: returns something

View File

@ -509,6 +509,8 @@ public:
void showGameFog(const bool show = true);
void showGameDebug(const bool show = true);
IrrlichtDevice *getDevice() const { return m_device; }
private:
// Virtual methods from con::PeerHandler

View File

@ -241,6 +241,13 @@ int ModApiClient::l_get_protocol_version(lua_State *L)
return 1;
}
int ModApiClient::l_take_screenshot(lua_State *L)
{
Client *client = getClient(L);
client->makeScreenshot(client->getDevice());
return 0;
}
void ModApiClient::Initialize(lua_State *L, int top)
{
API_FCT(get_current_modname);
@ -259,4 +266,5 @@ void ModApiClient::Initialize(lua_State *L, int top)
API_FCT(sound_play);
API_FCT(sound_stop);
API_FCT(get_protocol_version);
API_FCT(take_screenshot);
}

View File

@ -72,6 +72,8 @@ private:
// get_protocol_version()
static int l_get_protocol_version(lua_State *L);
static int l_take_screenshot(lua_State *L);
public:
static void Initialize(lua_State *L, int top);
};