diff -ur ScummVM-cvs20020801/scummvm/sdl.cpp ScummVM-cvs20020801+hack/scummvm/sdl.cpp
old
|
new
|
|
196 | 196 | |
197 | 197 | void setup_icon(); |
198 | 198 | void kbd_mouse(); |
| 199 | |
| 200 | void save_screenshot(); |
199 | 201 | }; |
200 | 202 | |
201 | 203 | void atexit_proc() { |
… |
… |
|
817 | 819 | return 0; |
818 | 820 | return key; |
819 | 821 | } |
820 | | |
| 822 | |
| 823 | void OSystem_SDL::save_screenshot() |
| 824 | { |
| 825 | char filename[13]; |
| 826 | bool can_save = false; |
| 827 | int i; |
| 828 | |
| 829 | for (i = 0; i <= 9999; i++) { |
| 830 | FILE *tmpfile; |
| 831 | |
| 832 | sprintf(filename, "scr%04d.bmp", i); |
| 833 | tmpfile = fopen(filename, "rb"); |
| 834 | if (tmpfile == NULL) { |
| 835 | can_save = true; |
| 836 | break; |
| 837 | } |
| 838 | fclose(tmpfile); |
| 839 | } |
| 840 | |
| 841 | if (can_save) |
| 842 | { |
| 843 | if (SDL_SaveBMP(sdl_hwscreen, filename) == 0) |
| 844 | debug(1, "Screenshot saved as '%s'", filename); |
| 845 | else |
| 846 | debug(1, "Could not save screenshot: %s", SDL_GetError()); |
| 847 | } else |
| 848 | warning("Could not make filename for screenshot!"); |
| 849 | } |
| 850 | |
821 | 851 | bool OSystem_SDL::poll_event(Event *event) { |
822 | 852 | SDL_Event ev; |
823 | 853 | kbd_mouse(); |
… |
… |
|
835 | 865 | event->kbd.flags = b; |
836 | 866 | |
837 | 867 | /* internal keypress? */ |
| 868 | if (b == KBD_ALT && ev.key.keysym.sym=='s') { |
| 869 | save_screenshot(); |
| 870 | break; |
| 871 | } |
| 872 | |
838 | 873 | if (b == KBD_ALT && ev.key.keysym.sym==SDLK_RETURN) { |
839 | 874 | property(PROP_TOGGLE_FULLSCREEN, NULL); |
840 | 875 | break; |