From: kazer_ Date: Wed, 13 Feb 2008 16:01:10 +0000 (+0000) Subject: Fix:SDL:Fixes image codec problems, thanks Matt Callow for the patch X-Git-Tag: navit-0.5.0.5194svn~4290 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3d911fc4dbc7719ade536691787a356ee3cef9a1;p=profile%2Fivi%2Fnavit.git Fix:SDL:Fixes image codec problems, thanks Matt Callow for the patch git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk@861 ffa7fe5e-494d-0410-b361-a75ebd5db220 --- diff --git a/navit/configure.in b/navit/configure.in index 1fa0755..16ba7e8 100644 --- a/navit/configure.in +++ b/navit/configure.in @@ -246,14 +246,7 @@ if test x"$cegui" = xyes ], $OPENGL_LIBS) CEGUI_LIBS="-lCEGUIBase -lCEGUIOpenGLRenderer -lCEGUIFalagardWRBase" - # The following are optionnal, but we need to link against them if cegui was built with them - libssilly="$OPENGL_LIBS -lpng" - AC_CHECK_LIB(CEGUISILLYImageCodec, createImageCodec, - [CEGUI_LIBS="$CEGUI_LIBS -lCEGUISILLYImageCodec"], - [echo "CEGUISILLYImageCodec not found/not working, disabled."], - $libssilly - ) - + # The following are optional, but we need to link against them if cegui was built with them AC_CHECK_LIB(CEGUIXercesParser, main, [CEGUI_LIBS="$CEGUI_LIBS -lCEGUIXercesParser"], [echo "CEGUIXercesParser not found/not working, disabled."], @@ -279,19 +272,35 @@ if test x"$cegui" = xyes ) AC_CHECK_LIB(CEGUIDevILImageCodec, main, - [CEGUI_LIBS="$CEGUI_LIBS -lCEGUIDevILImageCodec"], + [ + CEGUI_LIBS="$CEGUI_LIBS -lCEGUIDevILImageCodec" + AC_DEFINE([HAVE_LIBCEGUIDEVILIMAGECODEC],[1],Define to 1 to use DevIL codec) + ], [echo "CEGUIDevILImageCodec not found/not working, disabled."], $OPENGL_LIBS ) AC_CHECK_LIB(CEGUITGAImageCodec, createImageCodec, - [CEGUI_LIBS="$CEGUI_LIBS -lCEGUITGAImageCodec"], + [ + CEGUI_LIBS="$CEGUI_LIBS -lCEGUITGAImageCodec" + AC_DEFINE(HAVE_LIBCEGUITGAIMAGECODEC,[1],Define to 1 to use the TGA codec) + ], [echo "GUITGAImageCodec not found/not working, disabled."], $OPENGL_LIBS ) + libssilly="$OPENGL_LIBS -lpng" + AC_CHECK_LIB(CEGUISILLYImageCodec, createImageCodec, + [ + CEGUI_LIBS="$CEGUI_LIBS -lCEGUISILLYImageCodec" + AC_DEFINE([HAVE_LIBCEGUISILLYIMAGECODEC],[1],Define to 1 to use SILLY codec) + ], + [echo "CEGUISILLYImageCodec not found/not working, disabled."], + $libssilly + ) + # Restore the libs LIBS="$libstemp" - echo "LIBS : $CEGUI_LIBS" + echo "CEGUI_LIBS : $CEGUI_LIBS" fi AC_SUBST(CEGUI_CFLAGS) diff --git a/navit/src/attr_def.h b/navit/src/attr_def.h index a1538ae..98771df 100644 --- a/navit/src/attr_def.h +++ b/navit/src/attr_def.h @@ -74,6 +74,7 @@ ATTR(view_mode) ATTR(tilt) ATTR(media_window_title) ATTR(media_cmd) +ATTR(image_codec) /* poi */ ATTR(icon) ATTR(info_html) diff --git a/navit/src/gui/sdl/gui_sdl_window.cpp b/navit/src/gui/sdl/gui_sdl_window.cpp index be30ee1..65fe6d0 100644 --- a/navit/src/gui/sdl/gui_sdl_window.cpp +++ b/navit/src/gui/sdl/gui_sdl_window.cpp @@ -505,7 +505,7 @@ bool MoveCamera(const CEGUI::EventArgs& event){ -static void init_sdlgui(char * skin_layout,int fullscreen,int tilt) +static void init_sdlgui(char * skin_layout,int fullscreen,int tilt, char *image_codec_name) { SDL_Surface * screen; // atexit (SDL_Quit); @@ -560,15 +560,29 @@ static void init_sdlgui(char * skin_layout,int fullscreen,int tilt) try { - dbg(0, "Forcing silly image codec\n"); - CEGUI::OpenGLRenderer::setDefaultImageCodecName("SILLYImageCodec"); + using namespace CEGUI; + if (image_codec_name) { + dbg(0, "Using image codec: %s from config\n", image_codec_name); + } else { +#if defined (HAVE_LIBCEGUISILLYIMAGECODEC) + image_codec_name = "SILLYImageCodec"; +#elif defined(HAVE_LIBCEGUIDEVILIMAGECODEC) + image_codec_name = "DevILImageCodec"; +#elif defined (HAVE_LIBCEGUITGAIMAGECODEC) + image_codec_name = "TGAImageCodec"; +#else + fprintf (stderr, "No default image codec available. Try setting image_codec in your config\n"); + exit (1); +#endif + dbg(0, "Using default image codec: %s\n", image_codec_name); + } + CEGUI::OpenGLRenderer::setDefaultImageCodecName(image_codec_name); + CEGUI::System::setDefaultXMLParserName(CEGUI::String("TinyXMLParser")); dbg(0, "Using %s as the default CEGUI XML Parser\n", CEGUI::System::getDefaultXMLParserName().c_str()); renderer = new CEGUI::OpenGLRenderer(0,XRES,YRES); new CEGUI::System(renderer); - - using namespace CEGUI; - + SDL_ShowCursor(SDL_ENABLE); SDL_EnableUNICODE(1); SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); @@ -868,12 +882,16 @@ gui_sdl_new(struct navit *nav, struct gui_methods *meth, struct attr **attrs) // strcpy(media_cmd_setting->u.str,media_window_title); } + struct attr *image_codec_setting=attr_search(attrs, NULL, attr_image_codec); + char *image_codec_name=NULL; + if (image_codec_setting) + image_codec_name=image_codec_setting->u.str; struct attr *skin_setting=attr_search(attrs, NULL, attr_skin); if(skin_setting){ - init_sdlgui(skin_setting->u.str,fullscreen,tilt); + init_sdlgui(skin_setting->u.str,fullscreen,tilt, image_codec_name); } else { g_warning("Warning, no skin set for in navit.xml. Using default one"); - init_sdlgui("TaharezLook",fullscreen,tilt); + init_sdlgui("TaharezLook",fullscreen,tilt, image_codec_name); }