[Tux4kids-commits] r666 - tuxtype/branches/soc-sreyas/src
sreyas-guest at alioth.debian.org
sreyas-guest at alioth.debian.org
Fri Aug 22 13:01:00 UTC 2008
Author: sreyas-guest
Date: 2008-08-22 13:00:59 +0000 (Fri, 22 Aug 2008)
New Revision: 666
Modified:
tuxtype/branches/soc-sreyas/src/alphabet.c
tuxtype/branches/soc-sreyas/src/funcs.h
tuxtype/branches/soc-sreyas/src/main.c
Log:
Modified: tuxtype/branches/soc-sreyas/src/alphabet.c
===================================================================
--- tuxtype/branches/soc-sreyas/src/alphabet.c 2008-08-22 06:42:03 UTC (rev 665)
+++ tuxtype/branches/soc-sreyas/src/alphabet.c 2008-08-22 13:00:59 UTC (rev 666)
@@ -416,6 +416,9 @@
#ifndef WIN32
#ifndef MACOSX
+/* Create a context which contains Pango objects.*/
+SDLPango_Context* context = NULL;
+
/*Convert SDL_Colour to SDLPango_Matrix*/
SDLPango_Matrix* SDL_Colour_to_SDLPango_Matrix(const SDL_Color *cl)
@@ -435,9 +438,21 @@
return colour;
}
+void init_context()
+{
+ /* Create the context */
+ if((context = SDLPango_CreateContext_GivenFontDesc(settings.theme_font_name))==NULL)
+ context = SDLPango_CreateContext();
+ SDLPango_SetBaseDirection(context, SDLPANGO_DIRECTION_LTR);
+ SDLPango_SetDpi(context, 125.0, 125.0);
+}
+void free_Context()
+{
+ if(context != NULL)
+ SDLPango_FreeContext(context);
+ context = NULL;
+}
-
-
/* This version basically uses the SDLPango lib instead of */
/* TTF_RenderUTF*_Blended() to properly render Indic text. */
SDL_Surface* BlackOutline_SDLPango(const unsigned char* t, const TTF_Font* font, const SDL_Color* c)
@@ -450,8 +465,6 @@
Uint32 color_key;
/* To covert SDL_Colour to SDLPango_Matrix */
SDLPango_Matrix* colour = NULL;
- /* Create a context which contains Pango objects.*/
- SDLPango_Context* context = NULL;
LOG("\nEntering BlackOutline_SDLPango()\n");
DEBUGCODE{ fprintf(stderr, "will attempt to render: %s\n", t); }
@@ -471,12 +484,9 @@
colour = SDL_Colour_to_SDLPango_Matrix(c);
- /* Create the context */
- context = SDLPango_CreateContext();
- SDLPango_SetDpi(context, 125.0, 125.0);
+
/* Set the color */
SDLPango_SetDefaultColor(context, MATRIX_TRANSPARENT_BACK_BLACK_LETTER );
- SDLPango_SetBaseDirection(context, SDLPANGO_DIRECTION_LTR);
/* Set text to context */
SDLPango_SetMarkup(context, t, -1);
Modified: tuxtype/branches/soc-sreyas/src/funcs.h
===================================================================
--- tuxtype/branches/soc-sreyas/src/funcs.h 2008-08-22 06:42:03 UTC (rev 665)
+++ tuxtype/branches/soc-sreyas/src/funcs.h 2008-08-22 13:00:59 UTC (rev 666)
@@ -31,6 +31,7 @@
#ifndef WIN32
SDL_Surface* BlackOutline_SDLPango(const unsigned char* t, const TTF_Font* font, const SDL_Color* c);
+void init_context();
#endif
/* (still in alphabet.c:) */
@@ -58,6 +59,7 @@
void savekeyboard(void);
wchar_t GetLastKey(void);
SDL_Surface* BlackOutline_w(wchar_t* t, const TTF_Font* font, const SDL_Color* c, int size);
+void free_Context();
//void UseAlphabet(void);
Modified: tuxtype/branches/soc-sreyas/src/main.c
===================================================================
--- tuxtype/branches/soc-sreyas/src/main.c 2008-08-22 06:42:03 UTC (rev 665)
+++ tuxtype/branches/soc-sreyas/src/main.c 2008-08-22 13:00:59 UTC (rev 666)
@@ -133,6 +133,7 @@
LibInit(lib_flags); /* calls SDL_Init(), TTF_Init(), some other settings */
GraphicsInit(video_flags); /* calls SDL_SetVideoMode(), a few others */
+ init_context();
if (settings.sys_sound)
{
@@ -153,6 +154,7 @@
/* Release heap: */
Cleanup();
+ free_Context();
LOG( "---GAME DONE, EXIT---- Thank you.\n" );
More information about the Tux4kids-commits
mailing list