Changeset - r18079:b942dd7f3de8
[Not reviewed]
master
0 3 0
rubidium - 13 years ago 2011-09-09 09:13:18
rubidium@openttd.org
(svn r22910) -Fix [FS#4617]: icon would (almost) never be shown for SDL builds
3 files changed with 19 insertions and 13 deletions:
0 comments (0 inline, 0 general)
Makefile.bundle.in
Show inline comments
 
@@ -61,6 +61,9 @@ ifdef OSXAPP
 
	$(Q)$(ROOT_DIR)/os/macosx/plistgen.sh                          "$(BUNDLE_DIR)/$(OSXAPP)" "$(REV)"
 
	$(Q)cp    "$(ROOT_DIR)/os/macosx/splash.png"                   "$(DATA_DIR)"
 
endif
 
ifeq ($(OS),UNIX)
 
	$(Q)cp "$(ROOT_DIR)/media/openttd.32.bmp" "$(DATA_DIR)/"
 
endif
 
	$(Q)cp "$(BIN_DIR)/$(TTD)"                "$(TTD_DIR)/"
 
	$(Q)cp "$(BIN_DIR)/ai/"compat_*.nut       "$(AI_DIR)/"
 
	$(Q)cp "$(BIN_DIR)/data/"*.grf            "$(DATA_DIR)/"
Makefile.src.in
Show inline comments
 
@@ -249,7 +249,10 @@ endif
 
	$(Q)$(WINDRES) -o $@ -I `basename $<` $<
 

	
 
$(BIN_DIR)/$(TTD): $(TTD)
 
	$(Q)cp $< $@
 
	$(Q)cp $(TTD) $(BIN_DIR)/$(TTD)
 
ifeq ($(OS), UNIX)
 
	$(Q)cp $(MEDIA_DIR)/openttd.32.bmp $(BIN_DIR)/data/
 
endif
 

	
 
$(TTD): $(OBJS) $(CONFIG_CACHE_LINKER)
 
	$(E) '$(STAGE) Linking $@'
src/video/sdl_v.cpp
Show inline comments
 
@@ -22,6 +22,7 @@
 
#include "../progress.h"
 
#include "../core/random_func.hpp"
 
#include "../core/math_func.hpp"
 
#include "../fileio_func.h"
 
#include "sdl_v.h"
 
#include <SDL.h>
 

	
 
@@ -203,10 +204,6 @@ static void GetAvailableVideoMode(uint *
 
	*h = _resolutions[best].height;
 
}
 

	
 
#ifndef ICON_DIR
 
#define ICON_DIR "media"
 
#endif
 

	
 
#ifdef WIN32
 
/* Let's redefine the LoadBMP macro with because we are dynamically
 
 * loading SDL and need to 'SDL_CALL' all functions */
 
@@ -226,15 +223,18 @@ static bool CreateMainSurface(uint w, ui
 

	
 
	if (bpp == 0) usererror("Can't use a blitter that blits 0 bpp for normal visuals");
 

	
 
	/* Give the application an icon */
 
	icon = SDL_CALL SDL_LoadBMP(ICON_DIR PATHSEP "openttd.32.bmp");
 
	if (icon != NULL) {
 
		/* Get the colourkey, which will be magenta */
 
		uint32 rgbmap = SDL_CALL SDL_MapRGB(icon->format, 255, 0, 255);
 
	char icon_path[MAX_PATH];
 
	if (FioFindFullPath(icon_path, lengthof(icon_path), BASESET_DIR, "openttd.32.bmp") != NULL) {
 
		/* Give the application an icon */
 
		icon = SDL_CALL SDL_LoadBMP(icon_path);
 
		if (icon != NULL) {
 
			/* Get the colourkey, which will be magenta */
 
			uint32 rgbmap = SDL_CALL SDL_MapRGB(icon->format, 255, 0, 255);
 

	
 
		SDL_CALL SDL_SetColorKey(icon, SDL_SRCCOLORKEY, rgbmap);
 
		SDL_CALL SDL_WM_SetIcon(icon, NULL);
 
		SDL_CALL SDL_FreeSurface(icon);
 
			SDL_CALL SDL_SetColorKey(icon, SDL_SRCCOLORKEY, rgbmap);
 
			SDL_CALL SDL_WM_SetIcon(icon, NULL);
 
			SDL_CALL SDL_FreeSurface(icon);
 
		}
 
	}
 

	
 
	/* DO NOT CHANGE TO HWSURFACE, IT DOES NOT WORK */
0 comments (0 inline, 0 general)