493
bool WLApplication::handle_key(const SDL_Keycode& keycode, int modifiers) {
494
const bool ctrl = (modifiers & KMOD_LCTRL) || (modifiers & KMOD_RCTRL);
504
// Takes a screenshot.
506
if (g_fs->disk_space() < MINIMUM_DISK_SPACE) {
507
log("Omitting screenshot because diskspace is lower than %luMB\n",
508
MINIMUM_DISK_SPACE / (1000 * 1000));
511
g_fs->ensure_directory_exists(SCREENSHOT_DIR);
512
for (uint32_t nr = 0; nr < 10000; ++nr) {
513
const std::string filename = (boost::format(SCREENSHOT_DIR "/shot%04u.png") % nr).str();
514
if (g_fs->file_exists(filename)) {
517
g_gr->screenshot(filename);
525
bool value = !g_gr->fullscreen();
526
g_gr->set_fullscreen(value);
527
g_options.pull_section("global").set_bool("fullscreen", value);
493
bool WLApplication::handle_key(bool down, const SDL_Keycode& keycode, int modifiers) {
495
const bool ctrl = (modifiers & KMOD_LCTRL) || (modifiers & KMOD_RCTRL);
505
// Takes a screenshot.
507
if (g_fs->disk_space() < MINIMUM_DISK_SPACE) {
508
log("Omitting screenshot because diskspace is lower than %luMB\n",
509
MINIMUM_DISK_SPACE / (1000 * 1000));
512
g_fs->ensure_directory_exists(SCREENSHOT_DIR);
513
for (uint32_t nr = 0; nr < 10000; ++nr) {
514
const std::string filename = (boost::format(SCREENSHOT_DIR "/shot%04u.png") % nr).str();
515
if (g_fs->file_exists(filename)) {
518
g_gr->screenshot(filename);
526
bool value = !g_gr->fullscreen();
527
g_gr->set_fullscreen(value);
528
g_options.pull_section("global").set_bool("fullscreen", value);
540
542
while (poll_event(ev)) {
541
543
switch (ev.type) {
542
545
case SDL_KEYDOWN: {
543
546
bool handled = false;
544
547
if (cb && cb->key) {
545
548
handled = cb->key(ev.type == SDL_KEYDOWN, ev.key.keysym);
548
handle_key(ev.key.keysym.sym, ev.key.keysym.mod);
551
handle_key(ev.type == SDL_KEYDOWN, ev.key.keysym.sym, ev.key.keysym.mod);