mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-07 12:01:50 +00:00
add 'frame' argument to gui.screenshot
This commit is contained in:
parent
5ae4c1b27b
commit
69edfc8c8a
7 changed files with 41 additions and 1 deletions
|
|
@ -1223,7 +1223,17 @@ static int l_screenshot(lua::State* L) {
|
|||
if (engine->isHeadless()) {
|
||||
return 0;
|
||||
}
|
||||
auto image = engine->getWindow().takeScreenshot();
|
||||
std::unique_ptr<ImageData> image;
|
||||
if (lua::isstring(L, 1)) {
|
||||
auto& gui = engine->getGUI();
|
||||
auto frame = gui.getFrame(lua::require_string(L, 1));
|
||||
if (frame == nullptr) {
|
||||
return 0;
|
||||
}
|
||||
image = frame->takeScreenshot();
|
||||
} else {
|
||||
image = engine->getWindow().takeScreenshot();
|
||||
}
|
||||
return lua::newuserdata<lua::LuaCanvas>(L, nullptr, std::move(image));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue