From ff9fa95f63fa20737cf0f5c3c238e626ddfbee57 Mon Sep 17 00:00:00 2001 From: Lionel Ulmer Date: Mon, 29 Apr 2002 16:01:31 +0000 Subject: Added Jeremy's nice icon to the SDL port of ScummVM using a custom hacky XPM loader :-) svn-id: r4137 --- scummvm.xpm | 118 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ sdl.cpp | 46 ++++++++++++++++++++++++ 2 files changed, 164 insertions(+) create mode 100644 scummvm.xpm diff --git a/scummvm.xpm b/scummvm.xpm new file mode 100644 index 0000000000..687cf3a41a --- /dev/null +++ b/scummvm.xpm @@ -0,0 +1,118 @@ +/* XPM */ +static char *scummvm_icon[] = { +/* columns rows colors chars-per-pixel */ +"32 32 80 1", +" c black", +". c #030a01", +"X c #051101", +"o c #071801", +"O c #081504", +"+ c #091c04", +"@ c #0c2404", +"# c #0e2108", +"$ c #0c2a02", +"% c #0e3702", +"& c #102c07", +"* c #132a0b", +"= c #113306", +"- c #14320a", +"; c #123b04", +": c #173a0b", +"> c #18350f", +", c #183c0c", +"< c #1c3d11", +"1 c #144205", +"2 c #164208", +"3 c #154b03", +"4 c #19440c", +"5 c #194a07", +"6 c #1a4b0a", +"7 c #1d4310", +"8 c #1e4910", +"9 c #155202", +"0 c #185405", +"q c #1d530c", +"w c #185c02", +"e c #1a6302", +"r c #1b6e00", +"t c #1e7401", +"y c #1e7a00", +"u c #214615", +"i c #214c12", +"p c #254a19", +"a c #20510f", +"s c #205a0e", +"d c #235513", +"f c #255a13", +"g c #2a571b", +"h c #285d16", +"j c #2b5d1a", +"k c #266312", +"l c #296315", +"z c #2c631a", +"x c #286913", +"c c #2e6c19", +"v c #207d01", +"b c #30651e", +"n c #306c1c", +"m c #34711f", +"M c #346c21", +"N c #367223", +"B c #397325", +"V c #208200", +"C c #228a00", +"Z c #259201", +"A c #269b00", +"S c #289d01", +"D c #27a000", +"F c #28a400", +"G c #2aab00", +"H c #2cb200", +"J c #2eba00", +"K c #30be00", +"L c #2fc100", +"P c #30c400", +"I c #32cc00", +"U c #34d300", +"Y c #36da00", +"T c #38df00", +"R c #37e000", +"E c #38e400", +"W c #3aec00", +"Q c #3cf400", +"! c #3efb00", +"~ c None", +/* pixels */ +"~~~~~~~~~~~~~~~~~~~~~!!!GGKKYE~~", +"~~~~~~~~~~~~~~~!!!!!!!!!!~~~~~~~", +"~~~~~~~~~~~~!!!!!!!!!Q!!!!!~~~~~", +"~~~~~~~~~~!!!!!!QTYUGAHR!!!!~~~~", +"~~~~~~~~~!!!!!!EC031;;;vIQ!!!~~~", +"~~~~~~~!!!!!WPSy;,4,d6:2eT!!!~~~", +"~~~~~~!!!!!ECq2=,dlzbi>f,ZQ!!~~~", +"~~~~~!!!!!Yv;dflhlzbMbgf4CQ!!~~~", +"~~~~~!!!!I9=>hhfq2#+uMza9JQ!~~~~", +"~~~~~!!!U3+-ld5eVw;X-cl4yUEQ~~~~", +"~~~~~!!QV+i,d5FITUG@dh65yUR~~~~~", +"~~~~~!!R3+hd2AYTRRU9@+@eHYR~~~~~", +"~~~~~!!H$:hawPIJGHIPV$eJYR~~~~~~", +"~~~~!!QVo,j,1ww55q0VPFGUTR~~~~~~", +"~~~~!!Qe+*dgdsskxxkqwHYRR~~~~~~~", +"~~~~!!QS$:dfs4$-xlcxsePEW~~~~~~~", +"~~~~~!!RV%;19e+O7mmnk0FWQ~~~~~~~", +"~~~~~!QEUHFJIUy.dnzc46CQ!~~~~~~~", +"~~~~~!!WRUIUYU3+lmNh,5CWQ~~~~~~~", +"~~~~!!!QQRYTUZ%dnbMd43GEQ~~~~~~~", +"~~~!!!!!QQWLt6lcBjb7qwPEE~~~~~~~", +"~~!!!!!QLDGw6dcBBMj42SYEW~~~~~~~", +"~~!!!QUA3224uMihd40GIYEQ~~~~~~~", +"~~!!Qe&@.*jMu #define MAX(a,b) (((a)<(b)) ? (b) : (a)) @@ -180,6 +182,8 @@ private: void get_320x200_image(byte *buf); static uint32 autosave(uint32); + + void setup_icon(); }; int Init_2xSaI (uint32 BitFormat); @@ -217,6 +221,9 @@ OSystem *OSystem_SDL::create(int gfx_mode, bool full_screen) { SDL_ShowCursor(SDL_DISABLE); SDL_SetTimer(5 * 60 * 1000, (SDL_TimerCallback) autosave); + /* Setup the icon */ + syst->setup_icon(); + /* Clean up on exit */ atexit(atexit_proc); @@ -1187,6 +1194,45 @@ void OSystem_SDL::update_cdrom() { } } +void OSystem_SDL::setup_icon() { + int w, h, ncols, nbytes, i; + unsigned int rgba[256], icon[32 * 32]; + + sscanf(scummvm_icon[0], "%d %d %d %d", &w, &h, &ncols, &nbytes); + if ((w != 32) || (h != 32) || (ncols > 255) || (nbytes > 1)) { + warning("Could not load the icon (%d %d %d %d)", w, h, ncols, nbytes); + return; + } + for (i = 0; i < ncols; i++) { + unsigned char code; + char color[32]; + unsigned int col; + sscanf(scummvm_icon[1 + i], "%c c %s", &code, color); + if (!strcmp(color, "None")) + col = 0x00000000; + else if (!strcmp(color, "black")) + col = 0xFF000000; + else if (color[0] == '#') { + sscanf(color + 1, "%06x", &col); + col |= 0xFF000000; + } else { + warning("Could not load the icon (%d %s - %s) ", code, color, scummvm_icon[1 + i]); + return; + } + + rgba[code] = col; + } + for (h = 0; h < 32; h++) { + char *line = scummvm_icon[1 + ncols + h]; + for (w = 0; w < 32; w++) { + icon[w + 32 * h] = rgba[line[w]]; + } + } + + SDL_Surface *sdl_surf = SDL_CreateRGBSurfaceFrom(icon, 32, 32, 32, 32 * 4, 0xFF0000, 0x00FF00, 0x0000FF, 0xFF000000); + SDL_WM_SetIcon(sdl_surf, NULL); +} + #ifdef USE_NULL_DRIVER /* NULL video driver */ -- cgit v1.2.3