[Tux4kids-commits] r926 - tuxtype/trunk/src
dbruce-guest at alioth.debian.org
dbruce-guest at alioth.debian.org
Thu Mar 5 13:21:28 UTC 2009
Author: dbruce-guest
Date: 2009-03-05 13:21:28 +0000 (Thu, 05 Mar 2009)
New Revision: 926
Modified:
tuxtype/trunk/src/SDL_extras.c
tuxtype/trunk/src/playgame.c
tuxtype/trunk/src/setup.c
tuxtype/trunk/src/titlescreen.c
Log:
cleanup of some init code, also removed mouse warping
Modified: tuxtype/trunk/src/SDL_extras.c
===================================================================
--- tuxtype/trunk/src/SDL_extras.c 2009-03-05 12:34:14 UTC (rev 925)
+++ tuxtype/trunk/src/SDL_extras.c 2009-03-05 13:21:28 UTC (rev 926)
@@ -615,8 +615,8 @@
/* or we initialize SDL_ttf: */
int Setup_SDL_Text(void)
{
+
#ifdef HAVE_LIBSDL_PANGO
-
LOG("Setup_SDL_Text() - using SDL_Pango\n");
SDLPango_Init();
@@ -625,8 +625,6 @@
fprintf(stderr, "\nError: I could not set SDL_Pango context\n");
return 0;
}
- return 1;
-
#else
/* using SDL_ttf: */
LOG("Setup_SDL_Text() - using SDL_ttf\n");
@@ -636,8 +634,11 @@
fprintf(stderr, "\nError: I could not initialize SDL_ttf\n");
return 0;
}
+#endif
+
+ SDL_EnableKeyRepeat(0, SDL_DEFAULT_REPEAT_INTERVAL);
+ SDL_EnableUNICODE(1);
return 1;
-#endif
}
Modified: tuxtype/trunk/src/playgame.c
===================================================================
--- tuxtype/trunk/src/playgame.c 2009-03-05 12:34:14 UTC (rev 925)
+++ tuxtype/trunk/src/playgame.c 2009-03-05 13:21:28 UTC (rev 926)
@@ -142,7 +142,6 @@
fprintf(stderr, "->Entering PlayCascade(): level=%i\n", diflevel);
}
- SDL_WarpMouse(screen->w / 2, screen->h / 2);
SDL_ShowCursor(0);
// SNOW_init();
Modified: tuxtype/trunk/src/setup.c
===================================================================
--- tuxtype/trunk/src/setup.c 2009-03-05 12:34:14 UTC (rev 925)
+++ tuxtype/trunk/src/setup.c 2009-03-05 13:21:28 UTC (rev 926)
@@ -121,14 +121,8 @@
SDL_SetClipRect(screen, NULL); // Let's set the appropriate clip rect -- JA: is neccessary???
- LOG( "SDL_ShowCursor(0):\n" );
- SDL_ShowCursor(0); // no cursor please
- LOG( "SDL_WM_SetCaption(\"Tux Typing\", PACKAGE);\n" );
-
- SDL_WM_SetCaption("Tux Typing", "tuxtype"); // Set window manager stuff
-
/* --- setup color we use --- */
black.r = 0x00; black.g = 0x00; black.b = 0x00;
gray.r = 0x80; gray.g = 0x80; gray.b = 0x80;
@@ -162,20 +156,21 @@
void LibInit(Uint32 lib_flags)
{
LOG( "LibInit():\n-About to init SDL Library\n" );
- /* FIXME this looks wrong - if SDL_Init() fails, we try other subsystem??? */
- if (SDL_Init(lib_flags) < 0)
- /* FIXME this looks wrong - if no sys_sound, we don't init video??? */
+
+ /* Initialize video: */
+ if (SDL_Init(SDL_INIT_VIDEO) < 0)
+ {
+ fprintf(stderr, "Couldn't initialize SDL: %s\n",
+ SDL_GetError());
+ exit(2);
+ }
+ /* Initialize audio if desired: */
if (settings.sys_sound)
{
- if (SDL_Init(SDL_INIT_VIDEO) < 0)
+ if (SDL_InitSubSystem(SDL_INIT_AUDIO) < 0)
{
- fprintf(stderr, "Couldn't initialize SDL: %s\n",
- SDL_GetError());
- exit(2);
- }
- else
- {
- LOG( "Couldn't initialize SDL Sound\n" );
+ fprintf(stderr, "Couldn't initialize SDL Sound: %s\n",
+ SDL_GetError());
settings.sys_sound = 0;
}
}
@@ -206,13 +201,10 @@
}
// atexit(TTF_Quit);
- SDL_EnableKeyRepeat( 0, SDL_DEFAULT_REPEAT_INTERVAL );
- /* Need this to get Unicode values from keysyms: */
- SDL_EnableUNICODE(1);
-
LOG( "LibInit():END\n" );
}
+
/* Load the settings from a file... make sure to update SaveSettings if you change
* what can be saved/loaded
*/
Modified: tuxtype/trunk/src/titlescreen.c
===================================================================
--- tuxtype/trunk/src/titlescreen.c 2009-03-05 12:34:14 UTC (rev 925)
+++ tuxtype/trunk/src/titlescreen.c 2009-03-05 13:21:28 UTC (rev 926)
@@ -241,10 +241,6 @@
LOG( "Tux and Title are in place now\n" );
- /* Move mouse to top button: */
- cursor.x = menu_button[1].x + (menu_button[1].w / 2);
- cursor.y = menu_button[1].y + (3 * menu_button[1].h / 4);
- SDL_WarpMouse(cursor.x, cursor.y);
SDL_WM_GrabInput(SDL_GRAB_OFF);
@@ -442,17 +438,8 @@
- /* --- warp mouse to follow keyboard input --- */
- if (old_key_menu != key_menu)
- {
- cursor.x = menu_button[key_menu].x + (menu_button[key_menu].w / 2);
- cursor.y = menu_button[key_menu].y + (3 * menu_button[key_menu].h / 4);
- SDL_WarpMouse(cursor.x, cursor.y);
- }
-
-
/* --- do menu processing --- */
More information about the Tux4kids-commits
mailing list