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
|
|
@ -378,6 +378,14 @@ std::shared_ptr<gui::Frame> GUI::getActiveFrame() const {
|
|||
return activeFrame;
|
||||
}
|
||||
|
||||
std::shared_ptr<gui::Frame> GUI::getFrame(const std::string& id) {
|
||||
const auto& found = frames.find(id);
|
||||
if (found == frames.end()) {
|
||||
return nullptr;
|
||||
}
|
||||
return found->second;
|
||||
}
|
||||
|
||||
void GUI::remove(UINode* node) noexcept {
|
||||
container->remove(node);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -137,6 +137,8 @@ namespace gui {
|
|||
|
||||
std::shared_ptr<Frame> getActiveFrame() const;
|
||||
|
||||
std::shared_ptr<Frame> getFrame(const std::string& id);
|
||||
|
||||
/// @brief Remove node from the main container
|
||||
void remove(UINode* node) noexcept;
|
||||
|
||||
|
|
|
|||
|
|
@ -66,3 +66,10 @@ const std::string& gui::Frame::getOutputTexture() const {
|
|||
const std::string& gui::Frame::getFrameId() const {
|
||||
return frameId;
|
||||
}
|
||||
|
||||
std::unique_ptr<ImageData> gui::Frame::takeScreenshot() const {
|
||||
if (fbo == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
return fbo->readData();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
class Framebuffer;
|
||||
class UiDocument;
|
||||
class ImageData;
|
||||
|
||||
namespace gui {
|
||||
class Frame final : public Container {
|
||||
|
|
@ -18,6 +19,8 @@ namespace gui {
|
|||
const std::string& getOutputTexture() const;
|
||||
|
||||
const std::string& getFrameId() const;
|
||||
|
||||
std::unique_ptr<ImageData> takeScreenshot() const;
|
||||
private:
|
||||
std::string frameId;
|
||||
std::unique_ptr<Framebuffer> fbo;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue