Add gui.screenshot Lua function.
This commit is contained in:
parent
cb4daf66e6
commit
fb93a4e888
2 changed files with 26 additions and 0 deletions
17
lua/screenshot.cpp
Normal file
17
lua/screenshot.cpp
Normal file
|
@ -0,0 +1,17 @@
|
|||
#include "lua-int.hpp"
|
||||
#include "framebuffer.hpp"
|
||||
|
||||
namespace
|
||||
{
|
||||
function_ptr_luafun lua_gui_screenshot("gui.screenshot", [](lua_State* LS, const std::string& fname) -> int {
|
||||
std::string fn = get_string_argument(LS, 1, fname.c_str());
|
||||
try {
|
||||
framebuffer.save_png(fn);
|
||||
return 0;
|
||||
} catch(std::exception& e) {
|
||||
lua_pushstring(LS, e.what());
|
||||
lua_error(LS);
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
}
|
|
@ -1964,6 +1964,15 @@ Request subframe updates (calling on_paint() on subframes) to happen (on=true)
|
|||
Can be used anywhere.
|
||||
\end_layout
|
||||
|
||||
\begin_layout Subsubsection
|
||||
gui.screenshot(string filename)
|
||||
\end_layout
|
||||
|
||||
\begin_layout Standard
|
||||
Write PNG screenshot of the current frame (no drawings) to specified file.
|
||||
Can be used anywhere.s
|
||||
\end_layout
|
||||
|
||||
\begin_layout Subsection
|
||||
table input
|
||||
\end_layout
|
||||
|
|
Loading…
Add table
Reference in a new issue