diff -ur ScummVM-cvs20030810/scummvm/backends/sdl/sdl-common.cpp ScummVM-cvs20030810+hack/scummvm/backends/sdl/sdl-common.cpp
old
|
new
|
|
554 | 554 | break; |
555 | 555 | } |
556 | 556 | |
| 557 | if (b == KBD_ALT && ev.key.keysym.sym == 's') { |
| 558 | char filename[20]; |
| 559 | |
| 560 | for (int n = 0;; n++) { |
| 561 | SDL_RWops *file; |
| 562 | |
| 563 | sprintf(filename, "scummvm%05d.bmp", n); |
| 564 | file = SDL_RWFromFile(filename, "r"); |
| 565 | if (!file) |
| 566 | break; |
| 567 | SDL_RWclose(file); |
| 568 | } |
| 569 | if (save_screenshot(filename)) |
| 570 | printf("Saved '%s'\n", filename); |
| 571 | else |
| 572 | printf("Could not save screenshot!\n"); |
| 573 | break; |
| 574 | } |
| 575 | |
557 | 576 | #ifdef MACOSX |
558 | 577 | // On Macintosh', Cmd-Q quits |
559 | 578 | if ((ev.key.keysym.mod & KMOD_META) && ev.key.keysym.sym=='q') { |
diff -ur ScummVM-cvs20030810/scummvm/backends/sdl/sdl-common.h ScummVM-cvs20030810+hack/scummvm/backends/sdl/sdl-common.h
old
|
new
|
|
225 | 225 | virtual void load_gfx_mode() = 0; |
226 | 226 | virtual void unload_gfx_mode() = 0; |
227 | 227 | |
| 228 | virtual bool save_screenshot(const char *filename) = 0; |
| 229 | |
228 | 230 | void setup_icon(); |
229 | 231 | void kbd_mouse(); |
230 | 232 | void init_joystick() { _joystick = SDL_JoystickOpen(0); } |
diff -ur ScummVM-cvs20030810/scummvm/backends/sdl/sdl.cpp ScummVM-cvs20030810+hack/scummvm/backends/sdl/sdl.cpp
old
|
new
|
|
42 | 42 | |
43 | 43 | virtual void load_gfx_mode(); |
44 | 44 | virtual void unload_gfx_mode(); |
| 45 | virtual bool save_screenshot(const char *filename); |
45 | 46 | void hotswap_gfx_mode(); |
46 | 47 | }; |
47 | 48 | |
… |
… |
|
376 | 377 | return OSystem_SDL_Common::property(param, value); |
377 | 378 | } |
378 | 379 | |
| 380 | bool OSystem_SDL::save_screenshot(const char *filename) { |
| 381 | assert(_hwscreen != NULL); |
| 382 | |
| 383 | StackLock lock(_graphicsMutex, this); // Lock the mutex until this function ends |
| 384 | SDL_SaveBMP(_hwscreen, filename); |
| 385 | return true; |
| 386 | } |
diff -ur ScummVM-cvs20030810/scummvm/backends/sdl/sdl_gl.cpp ScummVM-cvs20030810+hack/scummvm/backends/sdl/sdl_gl.cpp
old
|
new
|
|
64 | 64 | |
65 | 65 | virtual void load_gfx_mode(); |
66 | 66 | virtual void unload_gfx_mode(); |
| 67 | virtual bool save_screenshot(const char *filename); |
67 | 68 | void hotswap_gfx_mode(); |
68 | 69 | }; |
69 | 70 | |
… |
… |
|
668 | 669 | |
669 | 670 | return OSystem_SDL_Common::property(param, value); |
670 | 671 | } |
| 672 | |
| 673 | bool OSystem_SDL_OpenGL::save_screenshot(const char *filename) { |
| 674 | // FIXME: I don't know how to do this yet. |
| 675 | if (_usingOpenGL) |
| 676 | return false; |
| 677 | |
| 678 | StackLock lock(_graphicsMutex, this); // Lock the mutex until this function ends |
| 679 | |
| 680 | assert(_hwscreen != NULL); |
| 681 | SDL_SaveBMP(_hwscreen, filename); |
| 682 | return true; |
| 683 | } |