[Tux4kids-commits] r624 - tuxtype/branches/tuxtype-1.5.17_soc1/src
sreyas-guest at alioth.debian.org
sreyas-guest at alioth.debian.org
Thu Aug 14 06:02:46 UTC 2008
Author: sreyas-guest
Date: 2008-08-14 06:02:45 +0000 (Thu, 14 Aug 2008)
New Revision: 624
Modified:
tuxtype/branches/tuxtype-1.5.17_soc1/src/alphabet.c
tuxtype/branches/tuxtype-1.5.17_soc1/src/practice.c
tuxtype/branches/tuxtype-1.5.17_soc1/src/titlescreen.c
Log:
Modified: tuxtype/branches/tuxtype-1.5.17_soc1/src/alphabet.c
===================================================================
--- tuxtype/branches/tuxtype-1.5.17_soc1/src/alphabet.c 2008-08-14 05:39:03 UTC (rev 623)
+++ tuxtype/branches/tuxtype-1.5.17_soc1/src/alphabet.c 2008-08-14 06:02:45 UTC (rev 624)
@@ -637,7 +637,6 @@
LOG("\nEntering BlackOutline_c()\n");
DEBUGCODE{ fprintf(stderr, "will attempt to render: %s\n", t); }
-printf("Test111:\n");
if (!t || !c)
{
@@ -651,38 +650,29 @@
fprintf(stderr, "BlackOutline_c(): empty string arg - must return to avoid segfault.");
return NULL;
}
-printf("Test2222:\n");
colour = SDL_Colour_to_SDLPango_Matrix(c);
/* Create the context */
context = SDLPango_CreateContext();
-printf("Test3333\n");
SDLPango_SetDpi(context, 125.0, 125.0);
-printf("Test4444\n");
/* Set the color */
SDLPango_SetDefaultColor(context, MATRIX_TRANSPARENT_BACK_BLACK_LETTER );
-printf("Test55555\n");
SDLPango_SetBaseDirection(context, SDLPANGO_DIRECTION_LTR);
-printf("Test66666\n");
/* Set text to context*/
SDLPango_SetMarkup(context, t, -1);
-printf("Test77777\n");
if (!context)
{
fprintf (stderr, "In BlackOutline_c(), could not create context for %s", t);
return NULL;
}
-printf("Test88888\n");
black_letters = SDLPango_CreateSurfaceDraw(context);
-printf("Test99999\n");
if (!black_letters)
{
fprintf (stderr, "Warning - BlackOutline_c() could not create image for %s\n", t);
SDLPango_FreeContext(context);
return NULL;
}
-printf("Test100000\n");
bg = SDL_CreateRGBSurface(SDL_SWSURFACE,
(black_letters->w) + 5,
(black_letters->h) + 5,
@@ -695,14 +685,11 @@
SDLPango_FreeContext(context);
return NULL;
}
-printf("Test1222222222\n");
/* Draw text on a existing surface*/
SDLPango_Draw(context, bg, 0, 0);
-printf("Test133333333:\n");
/* Use color key for eventual transparency:*/
color_key = SDL_MapRGB(bg->format, 10, 10, 10);
SDL_FillRect(bg, NULL, color_key);
-printf("Test1444444:\n");
/* Now draw black outline/shadow 2 pixels on each side: */
dstrect.w = black_letters->w;
dstrect.h = black_letters->h;
@@ -712,9 +699,7 @@
for (dstrect.x = 1; dstrect.x < 4; dstrect.x++)
for (dstrect.y = 1; dstrect.y < 3; dstrect.y++)
SDL_BlitSurface(black_letters , NULL, bg, &dstrect );
-printf("Test1555555555555\n");
SDL_FreeSurface(black_letters);
-printf("Test1666666666\n");
/* --- Put the color version of the text on top! --- */
SDLPango_SetDefaultColor(context, colour);
white_letters = SDLPango_CreateSurfaceDraw(context);
@@ -722,7 +707,6 @@
dstrect.y = 1;
SDL_BlitSurface(white_letters, NULL, bg, &dstrect);
SDL_FreeSurface(white_letters);
-printf("Test177777\n");
/********************Free SDL_Pango context************/
SDLPango_FreeContext(context);
@@ -731,7 +715,6 @@
out = SDL_DisplayFormatAlpha(bg);
SDL_FreeSurface(bg);
free(colour);
-printf("Test18888\n");
LOG("Leaving BlackOutline_c()\n\n");
return out;
Modified: tuxtype/branches/tuxtype-1.5.17_soc1/src/practice.c
===================================================================
--- tuxtype/branches/tuxtype-1.5.17_soc1/src/practice.c 2008-08-14 05:39:03 UTC (rev 623)
+++ tuxtype/branches/tuxtype-1.5.17_soc1/src/practice.c 2008-08-14 06:02:45 UTC (rev 624)
@@ -467,7 +467,9 @@
//c++;
dst.x=40;
dst.y=140;
- mydest.y+=40;
+ mydest.y=dst.y;
+ mydest.x=0;
+ mydest.h-=40;
next_line=1;
}
c++;
Modified: tuxtype/branches/tuxtype-1.5.17_soc1/src/titlescreen.c
===================================================================
--- tuxtype/branches/tuxtype-1.5.17_soc1/src/titlescreen.c 2008-08-14 05:39:03 UTC (rev 623)
+++ tuxtype/branches/tuxtype-1.5.17_soc1/src/titlescreen.c 2008-08-14 06:02:45 UTC (rev 624)
@@ -100,6 +100,10 @@
int key_menu = 1;
int old_key_menu = 5;
wchar_t phrase[128];
+ FILE *fp;
+ unsigned char fn[FNLEN];
+ int found = 0;
+ unsigned char str[1000];
if (settings.sys_sound)
@@ -108,10 +112,10 @@
settings.menu_music = 1;
}
-
+
/* FIXME phrase(s) should come from file */
- ConvertFromUTF8(phrase, "Now is the time for all good men to come to the aid of their country.");
+// ConvertFromUTF8(phrase, "Now is the time for all good men to come to the aid of their country.");
// ConvertFromUTF8(phrase, "To all that believe in his name he gave power to become children of God");
// wcscpy(phrase, "Now is the time for all good men to come to the aid of their country.");
@@ -644,10 +648,69 @@
if (menu_opt == FREETYPE)
{
unload_media();
- Phrases( phrase );
+ found=0;
+ if (!settings.use_english)
+ {
+ sprintf(fn , "%s/phrases.txt", settings.theme_data_path);
+ if (CheckFile(fn))
+ {
+ found = 1;
+ }
+ /* Now look in default path if desired or needed: */
+ if (!found)
+ {
+ sprintf(fn , "%s/words/words3.txt", settings.theme_data_path);
+ if (CheckFile(fn))
+ {
+ found = 1;
+ }
+ }
+ if (!found)
+ {
+ sprintf(fn , "%s/words/words2.txt", settings.theme_data_path);
+ if (CheckFile(fn))
+ {
+ found = 1;
+ }
+ }
+ if (!found)
+ {
+ sprintf(fn , "%s/words/words1.txt", settings.theme_data_path);
+ if (CheckFile(fn))
+ {
+ found = 1;
+ }
+ }
+ }
+ if (!found)
+ {
+ sprintf(fn , "%s/phrases.txt", settings.default_data_path);
+ if (CheckFile(fn))
+ {
+ found = 1;
+ }
+ }
+ if (!found)
+ {
+ fprintf(stderr, "LoadKeyboard(): Error finding file for keyboard setup!\n");
+ return 0;
+ }
+
+ fp=fopen(fn,"r");
+ do
+ {
+ fscanf( fp, "%[^\n]\n", str);
+ ConvertFromUTF8(phrase, str);
+ Phrases( phrase );
+ //Practice();
+ load_media();
+ redraw = 1;
+ } while (0);
+ fclose(fp);
+ //Phrases( phrase );
//Practice();
- load_media();
- redraw = 1;
+ //load_media();
+ //redraw = 1;
}
/* ------ End menu_opt processing ----------- */
More information about the Tux4kids-commits
mailing list