Previous 199869 Revisions Next

r31896 Thursday 4th September, 2014 at 02:26:43 UTC by R. Belmont
SDL: reenable SDL_ttf for SDL2 builds (nw)
[src/osd/sdl]sdl.mak sdlmain.c

trunk/src/osd/sdl/sdl.mak
r31895r31896
5959# active development on sdlmame or SDL.
6060
6161# uncomment the next line to compile and link against SDL2.0
62# SDL_LIBVER = sdl2
62SDL_LIBVER = sdl2
6363
6464# uncomment the next line to use couriersud's multi-keyboard patch for SDL 2.1? (this API was removed prior to the 2.0 release)
6565# SDL2_MULTIAPI = 1
r31895r31896
558558LIBS += `pkg-config --libs fontconfig`
559559
560560ifeq ($(SDL_LIBVER),sdl2)
561#LIBS += -lSDL2_ttf
561LIBS += -lSDL2_ttf
562562else
563563LIBS += -lSDL_ttf
564564endif
trunk/src/osd/sdl/sdlmain.c
r31895r31896
1313#ifdef SDLMAME_UNIX
1414#if (!defined(SDLMAME_MACOSX)) && (!defined(SDLMAME_EMSCRIPTEN))
1515#if (SDLMAME_SDL2)
16//#include <SDL2/SDL_ttf.h>
16#include <SDL2/SDL_ttf.h>
1717#else
1818#include <SDL/SDL_ttf.h>
1919#endif
r31895r31896
291291   #ifdef SDLMAME_UNIX
292292   sdl_entered_debugger = 0;
293293   #if (!defined(SDLMAME_MACOSX)) && (!defined(SDLMAME_HAIKU)) && (!defined(SDLMAME_EMSCRIPTEN))
294#if !(SDLMAME_SDL2)
295294   if (TTF_Init() == -1)
296295   {
297296      printf("SDL_ttf failed: %s\n", TTF_GetError());
298297   }
299#endif
300298   FcInit();
301299   #endif
302300   #endif
r31895r31896
344342
345343   #ifdef SDLMAME_UNIX
346344   #if (!defined(SDLMAME_MACOSX)) && (!defined(SDLMAME_HAIKU)) && (!defined(SDLMAME_EMSCRIPTEN))
347#if !(SDLMAME_SDL2)
348345   TTF_Quit();
349#endif
350346   if (!sdl_entered_debugger)
351347   {
352348      FcFini();
r31895r31896
854850}
855851#else // UNIX but not OSX
856852
857#if !(SDLMAME_SDL2)
858853static TTF_Font * TTF_OpenFont_Magic(astring name, int fsize)
859854{
860855   emu_file file(OPEN_FLAG_READ);
r31895r31896
994989   return font;
995990}
996991#endif
997#endif
998992
999993//-------------------------------------------------
1000994//  font_open - attempt to "open" a handle to the
r31895r31896
1003997
1004998osd_font sdl_osd_interface::font_open(const char *_name, int &height)
1005999{
1006#if !(SDLMAME_SDL2)
10071000   TTF_Font *font = (TTF_Font *)NULL;
10081001   bool bakedstyles = false;
10091002   int style = 0;
r31895r31896
10751068   height = TTF_FontLineSkip(font);
10761069
10771070   return (osd_font)font;
1078#else
1079   return (osd_font)NULL;
1080#endif
10811071}
10821072
10831073//-------------------------------------------------
r31895r31896
10871077
10881078void sdl_osd_interface::font_close(osd_font font)
10891079{
1090#if !(SDLMAME_SDL2)
10911080   TTF_Font *ttffont;
10921081
10931082   ttffont = (TTF_Font *)font;
10941083
10951084   TTF_CloseFont(ttffont);
1096#endif
10971085}
10981086
10991087//-------------------------------------------------
r31895r31896
11061094
11071095bool sdl_osd_interface::font_get_bitmap(osd_font font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs)
11081096{
1109#if !(SDLMAME_SDL2)
11101097   TTF_Font *ttffont;
11111098   SDL_Surface *drawsurf;
11121099   SDL_Color fcol = { 0xff, 0xff, 0xff };
r31895r31896
11461133   }
11471134
11481135   return bitmap.valid();
1149#else
1150   return false;
1151#endif
11521136}
11531137#endif  // not OSX
11541138#else   // not UNIX

Previous 199869 Revisions Next


© 1997-2024 The MAME Team