Move take-screenshot: mainloop.cpp -> framebuffer.cpp

This commit is contained in:
Ilari Liusvaara 2011-09-17 11:33:35 +03:00
parent e203b4f492
commit a396b9c39f
2 changed files with 11 additions and 9 deletions

View file

@ -1,6 +1,8 @@
#include "framebuffer.hpp" #include "framebuffer.hpp"
#include "lua.hpp" #include "lua.hpp"
#include "command.hpp"
#include "window.hpp" #include "window.hpp"
#include "misc.hpp"
#include "render.hpp" #include "render.hpp"
lcscreen framebuffer; lcscreen framebuffer;
@ -89,6 +91,15 @@ namespace
target[i] = 0x1F; target[i] = 0x1F;
draw_special_screen(target, rl_corrupt); draw_special_screen(target, rl_corrupt);
} }
function_ptr_command take_screenshot("take-screenshot", "Takes a screenshot",
"Syntax: take-screenshot <file>\nSaves screenshot to PNG file <file>\n",
[](const std::string& args) throw(std::bad_alloc, std::runtime_error) {
if(args == "")
throw std::runtime_error("Filename required");
framebuffer.save_png(args);
messages << "Saved PNG screenshot" << std::endl;
});
} }
screen main_screen; screen main_screen;

View file

@ -689,15 +689,6 @@ namespace
while(1); while(1);
}); });
function_ptr_command take_screenshot("take-screenshot", "Takes a screenshot",
"Syntax: take-screenshot <file>\nSaves screenshot to PNG file <file>\n",
[](const std::string& args) throw(std::bad_alloc, std::runtime_error) {
if(args == "")
throw std::runtime_error("Filename required");
framebuffer.save_png(args);
messages << "Saved PNG screenshot" << std::endl;
});
function_ptr_command mouse_button_handler("mouse_button", "no description available", "No help available\n", function_ptr_command mouse_button_handler("mouse_button", "no description available", "No help available\n",
[](const std::string& args) throw(std::bad_alloc, std::runtime_error) { [](const std::string& args) throw(std::bad_alloc, std::runtime_error) {
tokensplitter t(args); tokensplitter t(args);