[Tux4kids-commits] r1017 - in tuxtype/trunk: data/scripts doc src
David Bruce
dbruce-guest at alioth.debian.org
Tue Jun 9 01:51:51 UTC 2009
Author: dbruce-guest
Date: 2009-06-09 01:51:49 +0000 (Tue, 09 Jun 2009)
New Revision: 1017
Modified:
tuxtype/trunk/data/scripts/Lesson_1.xml
tuxtype/trunk/doc/ChangeLog
tuxtype/trunk/src/SDL_extras.c
tuxtype/trunk/src/scripting.c
tuxtype/trunk/src/scripting.h
tuxtype/trunk/src/titlescreen.c
Log:
Scripting - fix of bug in scripting.c run_script() where font size left
at zero.
- also kept menu from displaying invalid or inappropriate scripts
Modified: tuxtype/trunk/data/scripts/Lesson_1.xml
===================================================================
--- tuxtype/trunk/data/scripts/Lesson_1.xml 2009-06-08 19:06:28 UTC (rev 1016)
+++ tuxtype/trunk/data/scripts/Lesson_1.xml 2009-06-09 01:51:49 UTC (rev 1017)
@@ -1,5 +1,5 @@
<script title="Test Lesson" bgcolor="#3f4f1f">
- <page title="Introduction to Eample Lesson">
+ <page title="Introduction to Example Lesson">
<text align="center">The Lesson that follows is only an example</text>
<text align="center">lesson to help you to see how to write lessons.</text>
<text align="center">To start writing your own lessons, edit the file,</text>
Modified: tuxtype/trunk/doc/ChangeLog
===================================================================
--- tuxtype/trunk/doc/ChangeLog 2009-06-08 19:06:28 UTC (rev 1016)
+++ tuxtype/trunk/doc/ChangeLog 2009-06-09 01:51:49 UTC (rev 1017)
@@ -1,3 +1,8 @@
+08 Jun 2009 (svn.debian.org/tux4kids - revision 1017)
+[ David Bruce <davidstuartbruce at gmail.com> ]
+ - Scripting - fix of bug in scripting.c run_script() where font size left
+ at zero.
+
06 Jun 2009 (svn.debian.org/tux4kids - revision 1013)
[ David Bruce <davidstuartbruce at gmail.com> ]
- Paths - added support for localstatedir (shared modifiable data, generally
Modified: tuxtype/trunk/src/SDL_extras.c
===================================================================
--- tuxtype/trunk/src/SDL_extras.c 2009-06-08 19:06:28 UTC (rev 1016)
+++ tuxtype/trunk/src/SDL_extras.c 2009-06-09 01:51:49 UTC (rev 1017)
@@ -1547,12 +1547,16 @@
/* try to find font in default data dir: */
sprintf(fn, "%s/fonts/%s", settings.default_data_path, font_name);
- DEBUGCODE { fprintf(stderr, "LoadFont(): looking for %s using data paths\n", fn); }
+ DEBUGCODE { fprintf(stderr, "load_font(): looking for %s using bundled data paths\n", fn); }
/* try to load the font, if successful, return font*/
loaded_font = TTF_OpenFont(fn, font_size);
if (loaded_font != NULL)
+ {
+ DEBUGCODE { fprintf(stderr, "load_font(): found bundled font: %s\n", fn); }
return loaded_font;
+ }
+
/* HACK hard-coded for Debian (and current exact font names): */
@@ -1582,13 +1586,15 @@
- DEBUGCODE { fprintf(stderr, "LoadFont(): looking for %s\n in OS' font path\n", fn); }
+ DEBUGCODE { fprintf(stderr, "load_font(): looking for %s\n in OS' font path\n", fn); }
/* try to load the font, if successful, return font*/
loaded_font = TTF_OpenFont(fn, font_size);
if (loaded_font != NULL)
+ {
+ DEBUGCODE { fprintf(stderr, "load_font(): found font in OS' location: %s\n", fn); }
return loaded_font;
-
+ }
/* We could not find desired font. If we were looking for something other */
/* than default (Andika) font, print warning and try to load default font: */
if (strncmp(font_name, DEFAULT_FONT_NAME, FNLEN ) != 0)
Modified: tuxtype/trunk/src/scripting.c
===================================================================
--- tuxtype/trunk/src/scripting.c 2009-06-08 19:06:28 UTC (rev 1016)
+++ tuxtype/trunk/src/scripting.c 2009-06-09 01:51:49 UTC (rev 1017)
@@ -117,7 +117,8 @@
run_script();
}
-
+/* NOTE - confusing function name - this is the function that allows the user */
+/* to select a lesson from the menu. */
int TestLesson(void)
{
SDL_Surface* titles[MAX_LESSONS] = {NULL};
@@ -191,6 +192,10 @@
if (strlen(script_file->d_name) < 5)
continue;
+ /* Don't show project info file: */
+ if (strcmp(script_file->d_name, "projectInfo.xml") == 0)
+ continue;
+
if (strcmp(&script_file->d_name[strlen(script_file->d_name) - 4],".xml"))
continue;
@@ -1038,18 +1043,15 @@
case itemTEXT:
{
-// TTF_Font* myFont;
SDL_Surface* img;
SDL_Color* col;
int shown, toshow; // used to wrap text
char tmp[FNLEN]; // used to hold temp text for wrapping
- /* --- create font & render text --- */
-// if (curItem->size > 0)
-// myFont = LoadFont(settings.theme_font_name, (int)curItem->size);
-// else
-// myFont = LoadFont(settings.theme_font_name, 24); // default size is 24
+ /* Sanity check - use default font size if size not specified: */
+ if ((curItem->size < 8) || (curItem->size > 80))
+ curItem->size = DEFAULT_SCRIPT_FONT_SIZE; //currently 24
if (curItem->color)
col = curItem->color;
Modified: tuxtype/trunk/src/scripting.h
===================================================================
--- tuxtype/trunk/src/scripting.h 2009-06-08 19:06:28 UTC (rev 1016)
+++ tuxtype/trunk/src/scripting.h 2009-06-09 01:51:49 UTC (rev 1017)
@@ -19,6 +19,8 @@
#include "globals.h"
#include "funcs.h"
+static const int DEFAULT_SCRIPT_FONT_SIZE = 24;
+
enum { itemTEXT, itemIMG, itemWAV, itemPRAC, itemWFIN, itemWFCH };
/* linked list of elements for a page */
Modified: tuxtype/trunk/src/titlescreen.c
===================================================================
--- tuxtype/trunk/src/titlescreen.c 2009-06-08 19:06:28 UTC (rev 1016)
+++ tuxtype/trunk/src/titlescreen.c 2009-06-09 01:51:49 UTC (rev 1017)
@@ -624,18 +624,19 @@
if (menu_opt == INSTRUCT)
{
- unload_media();
+// unload_media();
+ not_implemented();
- switch (sub_menu)
- {
- case CASCADE: InstructCascade(); break;
- case LASER: InstructLaser(); break;
- }
+// switch (sub_menu)
+// {
+// case CASCADE: InstructCascade(); break;
+// case LASER: InstructLaser(); break;
+// }
- load_media();
+// load_media();
- if (settings.menu_music)
- MusicLoad( "tuxi.ogg", -1 );
+// if (settings.menu_music)
+// MusicLoad( "tuxi.ogg", -1 );
redraw = 1;
}
@@ -973,7 +974,6 @@
static void unload_menu(void)
{
int i,j;
- printf("enter unload_menu()\n");
for (i = 1; i <= TITLE_MENU_ITEMS; i++)
{
@@ -1115,7 +1115,7 @@
s1 = BlackOutline( gettext_noop("Work In Progress!"), DEFAULT_MENU_FONT_SIZE, &white);
s2 = BlackOutline( gettext_noop("This feature is not ready yet"), DEFAULT_MENU_FONT_SIZE, &white);
s3 = BlackOutline( gettext_noop("Discuss the future of TuxTyping at"), DEFAULT_MENU_FONT_SIZE, &white);
- s4 = BlackOutline( "http://tuxtype.sf.net/forums", DEFAULT_MENU_FONT_SIZE, &white);
+ s4 = BlackOutline( "http://tux4kids.alioth.debian.org/", DEFAULT_MENU_FONT_SIZE, &white);
tux = LoadSprite("tux/tux-egypt", IMG_ALPHA);
More information about the Tux4kids-commits
mailing list