enabled setting icon with SDL_image
authorBradley Bell <btb@icculus.org>
Fri, 28 Mar 2003 09:27:07 +0000 (09:27 +0000)
committerBradley Bell <btb@icculus.org>
Fri, 28 Mar 2003 09:27:07 +0000 (09:27 +0000)
ChangeLog
arch/ogl/sdlgl.c
arch/sdl/gr.c
configure.ac
include/d1x.xpm [new file with mode: 0644]
include/descent.xpm [new file with mode: 0644]

index eb44fd0..53309b3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2003-03-28  Bradley Bell  <btb@icculus.org>
+
+       * configure.ac, include/d1x.xpm, include/descent.xpm,
+       arch/ogl/sdlgl.c, arch/sdl/gr.c: enabled setting icon with
+       SDL_image
+
 2003-03-27  Bradley Bell  <btb@icculus.org>
 
        * main/text.h: fixed text references for hat directions
index 88b5b9c..d80eccc 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: sdlgl.c,v 1.5 2003-01-15 02:42:41 btb Exp $ */
+/* $Id: sdlgl.c,v 1.6 2003-03-28 09:27:07 btb Exp $ */
 /*
  *
  * Graphics functions for SDL-GL.
@@ -11,6 +11,9 @@
 #endif
 
 #include <SDL.h>
+#ifdef SDL_IMAGE
+#include <SDL_image.h>
+#endif
 
 #include "ogl_init.h"
 #include "vers_id.h"
@@ -36,6 +39,14 @@ int ogl_init_window(int x, int y){
                        ogl_smash_texture_list_internal();//if we are or were fullscreen, changing vid mode will invalidate current textures
        }
        SDL_WM_SetCaption(DESCENT_VERSION, "Descent II");
+
+#ifdef SDL_IMAGE
+       {
+#include "descent.xpm"
+               SDL_WM_SetIcon(IMG_ReadXPMFromArray(pixmap), NULL);
+       }
+#endif
+
         if (!SDL_SetVideoMode(x,y, 16, SDL_OPENGL | (ogl_fullscreen?SDL_FULLSCREEN:0))) {
            Error("Could not set %dx%dx16 opengl video mode\n",x,y);
         }
index 745f3db..7b1dd36 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: gr.c,v 1.10 2003-03-20 02:01:38 btb Exp $ */
+/* $Id: gr.c,v 1.11 2003-03-28 09:27:07 btb Exp $ */
 /*
  *
  * SDL video functions.
@@ -13,6 +13,9 @@
 #include <stdlib.h>
 #include <string.h>
 #include <SDL.h>
+#ifdef SDL_IMAGE
+#include <SDL_image.h>
+#endif
 
 #include "gr.h"
 #include "grdef.h"
@@ -99,6 +102,13 @@ int gr_set_mode(u_int32_t mode)
        SDL_WM_SetCaption(PACKAGE_STRING, "Descent II");
 //end addition -MM
 
+#ifdef SDL_IMAGE
+       {
+#include "descent.xpm"
+               SDL_WM_SetIcon(IMG_ReadXPMFromArray(pixmap), NULL);
+       }
+#endif
+
 //edited 10/05/98 by Matt Mueller - make fullscreen mode optional
          // changed by adb on 980913: added SDL_HWPALETTE (should be option?)
         // changed by someone on 980923 to add SDL_FULLSCREEN
index 40db4ee..4f0d129 100644 (file)
@@ -182,6 +182,11 @@ else
 
     AC_CHECK_HEADERS(netipx/ipx.h)
 
+  # Check for SDL_image
+       AC_CHECK_LIB(SDL_image, IMG_ReadXPMFromArray,
+               LIBS="-lSDL_image $LIBS"
+               AC_DEFINE(SDL_IMAGE,,[Define if you have the SDL_image library]))
+
   # Check for OpenGL
     AC_ARG_WITH(opengl,
         [  --with-opengl           Build OpenGL support ],,)
diff --git a/include/d1x.xpm b/include/d1x.xpm
new file mode 100644 (file)
index 0000000..ca4b262
--- /dev/null
@@ -0,0 +1,41 @@
+/* XPM */
+static char *pixmap[] = {
+/* width height ncols cpp */
+"32 32 3 2",
+  /* Colors */
+  "00 c #000000",
+  "01 c #FF0000",
+  ".. s None c None",
+  "................................................................",
+  "..............01................................01..............",
+  "..............0101............................0101..............",
+  "..............010101........................010101..............",
+  "..............01010101....................01010101..............",
+  "..............0101010101................0101010101..............",
+  "..............010101010101............010101010101..............",
+  "..............01010101010101........01010101010101..............",
+  "..............0101000101010101......01010101010001..............",
+  "..............010001010101010101......010101010100..............",
+  "..............00010101010101010101......010101010100............",
+  "..............0000010101010101010101......0101010000............",
+  "............00000000010101010100000001......0100000000..........",
+  "............0000..0000010101000000000001....0000..0000..........",
+  "................0000000000000000000000000000000000..............",
+  "................0000..0000000000000000000000..0000..............",
+  "..................0100000000000000000000000000..................",
+  "................0000000000000000000000000000000000..............",
+  "..............00000101000000000000000000000001010000............",
+  "............000000000101000000000000000000010100000000..........",
+  "..........000001000001010101....010101010101010000010000........",
+  "........0000010101010101010101....010101010101010101010000......",
+  "....00000101010101010101010101......01010101010101010101010000..",
+  "....0000..............................010101010101010101010000..",
+  "........................................010101010101010101......",
+  "..........................................0101010101010101......",
+  "............................................01010101010101......",
+  "..............................................010101010101......",
+  "................................................0101010101......",
+  "..................................................01010101......",
+  "....................................................010101......",
+  "................................................................",
+};
diff --git a/include/descent.xpm b/include/descent.xpm
new file mode 100644 (file)
index 0000000..e1c5acf
--- /dev/null
@@ -0,0 +1,45 @@
+/* XPM */
+static char *pixmap[] = {
+/* width height ncols cpp */
+"32 32 7 2",
+  /* Colors */
+  "00 c #000000",
+  "01 c #800000",
+  "02 c #C0C0C0",
+  "03 c #808080",
+  "04 c #FF0000",
+  "05 c #FFFFFF",
+  ".. s None c None",
+  "................................................................",
+  "................................................................",
+  "..........0303..........0301........0304..............03........",
+  "..........030303........040301....03030304........030303........",
+  "..........0303030303..0303030304010303030304..0303030303........",
+  "..........0303030303030303020303000303020303030303030303........",
+  "..........0303030303030303020303030303030303030303030303........",
+  "..........0303030303030303020303030303020303030303030303........",
+  "............0101000303030303030303030303030303010100............",
+  "..............01010303030303030303030303030303010101............",
+  "............0301010303030303030303030203030303010103............",
+  "..........03010101030303030300000003000303030301010103..........",
+  "........030101010101030300000000000000030303030301010103........",
+  "........020101010303030300000000000000000303020303010403........",
+  "......03010101040103030300000000000000000303..040401010103......",
+  "......010101030402..030300000000000000030303..050503010103......",
+  "....030101030304....030300030000000000030300..04040303010103....",
+  "....03010303..00....000303030000000000030302..04040303030103....",
+  "....030303..........0303030300000000030303..........03030303....",
+  "....030303..........0303030300000000030303............030303....",
+  "....0302............030303030303030303030303..........040103....",
+  "......04............030303030303030303030303............0103....",
+  "......04............030303030303030303030303............04......",
+  "....0401............030303030303030303030303............04......",
+  "....0000............0303030303030303030303..............04......",
+  "....................0303030303030303030303..............00......",
+  "......................030303030303030303........................",
+  "......................030303030303030303........................",
+  "......................0303030303030303..........................",
+  "................................................................",
+  "................................................................",
+  "................................................................",
+};