Skip to content

Commit

Permalink
Set a window icon.
Browse files Browse the repository at this point in the history
lib/framework/wz2100icon.h created from the 32x32 icon from
icons/warzone2100.ico by the Gimp's C code export.

Closes #2465.
  • Loading branch information
cybersphinx committed Jan 30, 2011
1 parent 276fa53 commit ac792c6
Show file tree
Hide file tree
Showing 3 changed files with 185 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/framework/Makefile.am
Expand Up @@ -63,6 +63,7 @@ noinst_HEADERS = \
gettext.h \
macros.h \
SDL_framerate.h \
wz2100icon.h \
wzglobal.h

libframework_a_SOURCES = \
Expand Down
15 changes: 15 additions & 0 deletions lib/framework/frame.c
Expand Up @@ -40,6 +40,7 @@
#include "physfs_ext.h"

#include "cursors.h"
#include "wz2100icon.h"

static const enum CURSOR_TYPE cursor_type =
CURSOR_32;
Expand Down Expand Up @@ -225,12 +226,26 @@ bool frameInitialise(
bool fullScreen, // Whether to start full screen or windowed
bool vsync) // If to sync to vblank or not
{
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
uint32_t rmask = 0xff000000;
uint32_t gmask = 0x00ff0000;
uint32_t bmask = 0x0000ff00;
uint32_t amask = 0x000000ff;
#else
uint32_t rmask = 0x000000ff;
uint32_t gmask = 0x0000ff00;
uint32_t bmask = 0x00ff0000;
uint32_t amask = 0xff000000;
#endif

if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) != 0)
{
debug( LOG_ERROR, "Error: Could not initialise SDL (%s).\n", SDL_GetError() );
return false;
}

SDL_WM_SetIcon(SDL_CreateRGBSurfaceFrom((void*)wz2100icon.pixel_data, wz2100icon.width, wz2100icon.height, wz2100icon.bytes_per_pixel * 8,
wz2100icon.width * wz2100icon.bytes_per_pixel, rmask, gmask, bmask, amask), NULL);
SDL_WM_SetCaption(pWindowName, NULL);

/* Initialise the trig stuff */
Expand Down
169 changes: 169 additions & 0 deletions lib/framework/wz2100icon.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ac792c6

Please sign in to comment.