[Tux4kids-commits] r1024 - in tuxtype/branches/gsoc-sarah: . doc src
Sarah Frisk
fou_fou-guest at alioth.debian.org
Wed Jun 10 22:57:14 UTC 2009
Author: fou_fou-guest
Date: 2009-06-10 22:57:13 +0000 (Wed, 10 Jun 2009)
New Revision: 1024
Modified:
tuxtype/branches/gsoc-sarah/doc/ChangeLog
tuxtype/branches/gsoc-sarah/src/Makefile.am
tuxtype/branches/gsoc-sarah/src/SDL_extras.c
tuxtype/branches/gsoc-sarah/src/globals.h
tuxtype/branches/gsoc-sarah/src/loaders.c
tuxtype/branches/gsoc-sarah/src/pause.c
tuxtype/branches/gsoc-sarah/src/scripting.c
tuxtype/branches/gsoc-sarah/src/scripting.h
tuxtype/branches/gsoc-sarah/src/setup.c
tuxtype/branches/gsoc-sarah/src/titlescreen.c
tuxtype/branches/gsoc-sarah/tuxtype.desktop
Log:
Merged trunk changes into my branch
Modified: tuxtype/branches/gsoc-sarah/doc/ChangeLog
===================================================================
--- tuxtype/branches/gsoc-sarah/doc/ChangeLog 2009-06-10 16:17:50 UTC (rev 1023)
+++ tuxtype/branches/gsoc-sarah/doc/ChangeLog 2009-06-10 22:57:13 UTC (rev 1024)
@@ -1,3 +1,16 @@
+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
+ located under /var) and sysconfdir (program-wide settings, generally located
+ under /etc) to autotools build system. Also updated the game_option_type struct
+ to have a field for the shared modifiable data - var_data_path. This is the
+ intended location for shared custom word lists, high scores, and so forth.
+
23 Mar 2009 (svn.debian.org/tux4kids - revision 945)
[ David Bruce <davidstuartbruce at gmail.com> ]
- Code organization - TransWipe() and all of the blitting queue functions
Modified: tuxtype/branches/gsoc-sarah/src/Makefile.am
===================================================================
--- tuxtype/branches/gsoc-sarah/src/Makefile.am 2009-06-10 16:17:50 UTC (rev 1023)
+++ tuxtype/branches/gsoc-sarah/src/Makefile.am 2009-06-10 22:57:13 UTC (rev 1024)
@@ -1,11 +1,40 @@
## Process with Automake to create Makefile.in
+# Support for gettext:
+datadir = @datadir@
+localstatedir = @localstatedir@
+sysconfdir = @sysconfdir@
+localedir = $(datadir)/locale
+pkglocalstatedir = $(localstatedir)/$(PACKAGE)
+pkgsysconfdir = $(sysconfdir)/$(PACKAGE)
+## These variables are used at run-time to locate files because they will
+## not be in unix-type locations on Windows systems. The reason not to just
+## change the parent variable (e.g. pkgdatadir) under Windows is that the
+## packaging for Windows involves a temporary DESTDIR "make install", after
+## which the files get copied into the NSIS installer. We never run
+## "make install" on the Windows machine itself.
+
+if BUILD_MINGW32
+ DATA_PREFIX=@MINGW32_PACKAGE_DATA_DIR@
+ VAR_PREFIX=@MINGW32_PACKAGE_VAR_DIR@
+ CONF_PREFIX=@MINGW32_PACKAGE_CONF_DIR@
+else
+ DATA_PREFIX=${pkgdatadir}
+ VAR_PREFIX=${pkglocalstatedir}
+ CONF_PREFIX=${pkgsysconfdir}
+endif
+
+
ACLOCAL_AMFLAGS = -I m4
# Is the following line obsolete?
#DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@
-AM_CFLAGS=-Wall -g -DDATA_PREFIX=\"${DATA_PREFIX}\" -DDEBUG \
+AM_CFLAGS=-Wall -g \
+ -DDATA_PREFIX=\"$(DATA_PREFIX)\" \
+ -DVAR_PREFIX=\"$(VAR_PREFIX)\" \
+ -DCONF_PREFIX=\"$(CONF_PREFIX)\" \
+ -DDEBUG \
-DVERSION=\"@NAME_VERSION@\" -D$(SOUND)SOUND
AM_CPPFLAGS = -DLOCALEDIR=\"$(localedir)\" \
@@ -20,22 +49,7 @@
bin_PROGRAMS = tuxtype
endif
-## These variables are used at run-time to locate files because they will
-## not be in unix-type locations on Windows systems. The reason not to just
-## change the parent variable (e.g. pkgdatadir) under Windows is that the
-## packaging for Windows involves a temporary DESTDIR "make install", after
-## which the files get copied into the NSIS installer. We never run
-## "make install" on the Windows machine itself.
-if BUILD_MINGW32
- DATA_PREFIX=@MINGW32_PACKAGE_DATA_DIR@
- VAR_PREFIX=@MINGW32_PACKAGE_VAR_DIR@
- CONF_PREFIX=@MINGW32_PACKAGE_CONF_DIR@
-else
- DATA_PREFIX=${pkgdatadir}
- VAR_PREFIX=$(pkglocalstatedir)
- CONF_PREFIX=$(pkgsysconfdir)
-endif
Modified: tuxtype/branches/gsoc-sarah/src/SDL_extras.c
===================================================================
--- tuxtype/branches/gsoc-sarah/src/SDL_extras.c 2009-06-10 16:17:50 UTC (rev 1023)
+++ tuxtype/branches/gsoc-sarah/src/SDL_extras.c 2009-06-10 22:57:13 UTC (rev 1024)
@@ -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/branches/gsoc-sarah/src/globals.h
===================================================================
--- tuxtype/branches/gsoc-sarah/src/globals.h 2009-06-10 16:17:50 UTC (rev 1023)
+++ tuxtype/branches/gsoc-sarah/src/globals.h 2009-06-10 22:57:13 UTC (rev 1024)
@@ -15,7 +15,11 @@
* (at your option) any later version. *
* *
***************************************************************************/
+#ifndef GLOBALS_H
+#define GLOBALS_H
+#include "config.h"
+
#define to_upper(c) (((c) >= 'a' && (c) <= 'z') ? (c) -32 : (c))
#define COL2RGB( col ) SDL_MapRGB( screen->format, col->r, col->g, col->b )
@@ -30,17 +34,12 @@
#define DATA_PREFIX "./data"
#endif
-#ifndef __GLOBALS_H__
-#define __GLOBALS_H__
-
-
-#include "config.h"
-
// Translation stuff (now works for Mac and Win too!):
#include "gettext.h"
#include <locale.h>
#include <iconv.h>
+
#define _(String) gettext (String)
#define gettext_noop(String) String
#define N_(String) gettext_noop (String)
@@ -66,20 +65,18 @@
#include "SDL_mixer.h"
/* NOTE only SDL_extras.c/.h now knows about SDL_ttf or SDL_Pango. */
-#endif // __GLOBALS_H__
-
-
#define MIN(x,y) ((x) < (y) ? (x) : (y))
#define MAX(x,y) ((x) > (y) ? (x) : (y))
/* Goal is to have all global settings here */
/* (renamed from 'settings' to match tuxmath) */
typedef struct game_option_type{
- char default_data_path[FNLEN];
- char theme_data_path[FNLEN];
- char user_settings_path[FNLEN];
- char global_settings_path[FNLEN];
+ char default_data_path[FNLEN]; // for static read-only data
+ char theme_data_path[FNLEN]; // read-only data for current theme
+ char var_data_path[FNLEN]; // for modifiable shared data (custom word lists, etc.)
+ char user_settings_path[FNLEN]; // per-user settings (under /home)
+ char global_settings_path[FNLEN]; // settings for all users (under /etc)
char theme_name[FNLEN];
char lang[FNLEN];
char theme_font_name[FNLEN];
@@ -223,4 +220,5 @@
NUM_WIPES
};
+#endif
Modified: tuxtype/branches/gsoc-sarah/src/loaders.c
===================================================================
--- tuxtype/branches/gsoc-sarah/src/loaders.c 2009-06-10 16:17:50 UTC (rev 1023)
+++ tuxtype/branches/gsoc-sarah/src/loaders.c 2009-06-10 22:57:13 UTC (rev 1024)
@@ -236,12 +236,16 @@
/* change extension into .svg */
char* dotpos = strrchr(datafile, '.');
- strncpy(svgfn, datafile, dotpos - datafile);
- svgfn[dotpos - datafile] = '\0';
- strcat(svgfn, ".svg");
+ if (dotpos) //will be NULL if '.' not found:
+ {
+ strncpy(svgfn, datafile, dotpos - datafile);
+ svgfn[dotpos - datafile] = '\0';
+ strcat(svgfn, ".svg");
- /* try to load an SVG equivalent */
- tmp_pic = LoadSVGOfDimensions(svgfn, 0, 0);
+ /* try to load an SVG equivalent */
+ fprintf(stderr, "svgfn = %s\n", svgfn);
+ tmp_pic = LoadSVGOfDimensions(svgfn, 0, 0);
+ }
#endif
if(tmp_pic == NULL)
Modified: tuxtype/branches/gsoc-sarah/src/pause.c
===================================================================
--- tuxtype/branches/gsoc-sarah/src/pause.c 2009-06-10 16:17:50 UTC (rev 1023)
+++ tuxtype/branches/gsoc-sarah/src/pause.c 2009-06-10 22:57:13 UTC (rev 1024)
@@ -28,7 +28,6 @@
/* Local function prototypes: */
-//static void darkenscreen(void);
static void draw_vols(int sfx, int mus);
static void pause_draw(void);
static void pause_load_media(void);
@@ -275,7 +274,7 @@
if (settings.sys_sound)
{
- t = BlackOutline(gettext("Sound Effects Volume"), pause_font_size1, &white);
+ t = BlackOutline(_("Sound Effects Volume"), pause_font_size1, &white);
if (t)
{
s.y = screen->h/2 - 80;
Modified: tuxtype/branches/gsoc-sarah/src/scripting.c
===================================================================
--- tuxtype/branches/gsoc-sarah/src/scripting.c 2009-06-10 16:17:50 UTC (rev 1023)
+++ tuxtype/branches/gsoc-sarah/src/scripting.c 2009-06-10 22:57:13 UTC (rev 1024)
@@ -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/branches/gsoc-sarah/src/scripting.h
===================================================================
--- tuxtype/branches/gsoc-sarah/src/scripting.h 2009-06-10 16:17:50 UTC (rev 1023)
+++ tuxtype/branches/gsoc-sarah/src/scripting.h 2009-06-10 22:57:13 UTC (rev 1024)
@@ -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/branches/gsoc-sarah/src/setup.c
===================================================================
--- tuxtype/branches/gsoc-sarah/src/setup.c 2009-06-10 16:17:50 UTC (rev 1023)
+++ tuxtype/branches/gsoc-sarah/src/setup.c 2009-06-10 22:57:13 UTC (rev 1024)
@@ -454,6 +454,36 @@
fprintf(stderr, "default_data_path: '%s'\n", settings.default_data_path);
fprintf(stderr, "theme_data_path: '%s'\n\n", settings.theme_data_path);
}
+
+ /* Now check for VAR_PREFIX (for modifiable data shared by all users, */
+ /* such as custom word lists, high scores, etc: */
+ /* This will generally be /var/lib/tuxtype (distro-provided pkg) */
+ /* or /usr/local/etc/tuxtype (locally-built and installed pkg) */
+ if (CheckFile(VAR_PREFIX))
+ {
+ strncpy(settings.var_data_path, VAR_PREFIX, FNLEN - 1);
+ DEBUGCODE {fprintf(stderr, "path '%s' found, copy to settings.var_data_path\n", VAR_PREFIX);}
+ }
+ else
+ {
+ fprintf(stderr, "Error - VAR_PREFIX = '%s' not found!\n", VAR_PREFIX);
+ return 0;
+ }
+
+ /* Now check for CONF_PREFIX (for program wide settings that apply to all users). */
+ /* This would typically be /etc/tuxtype if tuxtype is installed by a distro pkg, */
+ /* or /usr/local/etc/tuxtype if the package is built locally */
+ if (CheckFile(VAR_PREFIX))
+ {
+ strncpy(settings.var_data_path, VAR_PREFIX, FNLEN - 1);
+ DEBUGCODE {fprintf(stderr, "path '%s' found, copy to settings.var_data_path\n", VAR_PREFIX);}
+ }
+ else
+ {
+ fprintf(stderr, "Error - VAR_PREFIX = '%s' not found!\n", VAR_PREFIX);
+ return 0;
+ }
+
return 1;
}
Modified: tuxtype/branches/gsoc-sarah/src/titlescreen.c
===================================================================
--- tuxtype/branches/gsoc-sarah/src/titlescreen.c 2009-06-10 16:17:50 UTC (rev 1023)
+++ tuxtype/branches/gsoc-sarah/src/titlescreen.c 2009-06-10 22:57:13 UTC (rev 1024)
@@ -625,18 +625,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;
}
@@ -974,7 +975,6 @@
static void unload_menu(void)
{
int i,j;
- printf("enter unload_menu()\n");
for (i = 1; i <= TITLE_MENU_ITEMS; i++)
{
@@ -1116,7 +1116,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);
Modified: tuxtype/branches/gsoc-sarah/tuxtype.desktop
===================================================================
--- tuxtype/branches/gsoc-sarah/tuxtype.desktop 2009-06-10 16:17:50 UTC (rev 1023)
+++ tuxtype/branches/gsoc-sarah/tuxtype.desktop 2009-06-10 22:57:13 UTC (rev 1024)
@@ -3,7 +3,7 @@
GenericName=Educational typing game
GenericName[ru]=Игра для детей
GenericName[tr]=Daktilo Öğretmeni
-GenericName[fr]=Jeu pour les enfants
+GenericName[fr]=Jeu de dactylographie
Comment=Educational typing tutor game starring Tux
Comment[de]=Tastatur-Lernspielprogramm mit Tux
Comment[ru]=Kлавиатурный тренажер с пингвином в главной роли
@@ -15,3 +15,4 @@
Type=Application
StartupNotify=true
Categories=Education;
+X-Ubuntu-Gettext-Domain=tuxtype
\ No newline at end of file
More information about the Tux4kids-commits
mailing list