[Tux4kids-commits] r1443 - branches/commonification/tuxtype/trunk/src
Bolesław Kulbabiński
bolekk-guest at alioth.debian.org
Sun Aug 16 15:18:44 UTC 2009
Author: bolekk-guest
Date: 2009-08-16 15:18:44 +0000 (Sun, 16 Aug 2009)
New Revision: 1443
Modified:
branches/commonification/tuxtype/trunk/src/laser.c
branches/commonification/tuxtype/trunk/src/playgame.c
branches/commonification/tuxtype/trunk/src/titlescreen.c
Log:
small fixes in tuxtype
Modified: branches/commonification/tuxtype/trunk/src/laser.c
===================================================================
--- branches/commonification/tuxtype/trunk/src/laser.c 2009-08-16 12:38:31 UTC (rev 1442)
+++ branches/commonification/tuxtype/trunk/src/laser.c 2009-08-16 15:18:44 UTC (rev 1443)
@@ -162,12 +162,13 @@
} else if (event.type == SDL_KEYDOWN) {
key = event.key.keysym.sym;
- if (key == SDLK_F10)
- {
- SwitchScreenMode();
- calc_city_pos();
- recalc_comet_pos();
- }
+ if (key == SDLK_F10)
+ {
+ SwitchScreenMode();
+ laser_load_data();
+ calc_city_pos();
+ recalc_comet_pos();
+ }
if (key == SDLK_F11)
SDL_SaveBMP( screen, screenshot_filename);
Modified: branches/commonification/tuxtype/trunk/src/playgame.c
===================================================================
--- branches/commonification/tuxtype/trunk/src/playgame.c 2009-08-16 12:38:31 UTC (rev 1442)
+++ branches/commonification/tuxtype/trunk/src/playgame.c 2009-08-16 15:18:44 UTC (rev 1443)
@@ -29,6 +29,7 @@
static int tux_max_width; // the max width of the images of tux
static int number_max_w; // the max width of a number image
+static const char* screenshot_filename = "screenshot.bmp";
//static SDL_Surface* background = NULL;
static SDL_Surface* level[NUM_LEVELS] = {NULL};
@@ -280,7 +281,7 @@
if (event.type == SDL_KEYDOWN)
{
if (event.key.keysym.sym == SDLK_F11)
- SDL_SaveBMP(screen, "screenshot.bmp");
+ SDL_SaveBMP(screen, screenshot_filename);
if (event.key.keysym.sym == SDLK_F6)
{
Modified: branches/commonification/tuxtype/trunk/src/titlescreen.c
===================================================================
--- branches/commonification/tuxtype/trunk/src/titlescreen.c 2009-08-16 12:38:31 UTC (rev 1442)
+++ branches/commonification/tuxtype/trunk/src/titlescreen.c 2009-08-16 15:18:44 UTC (rev 1443)
@@ -54,15 +54,17 @@
enum { MENU_MAIN, MENU_LESSONS, MENU_LOGIN };
-/*TODO: move these constants into a config file
- (together with menu.c constants ? ) */
-const float title_pos[4] = {0.0, 0.0, 0.3, 0.25};
-const float tux_pos[4] = {0.0, 0.6, 0.3, 0.4};
-const char* standby_path = "/images/status/standby.svg";
-const char* title_path = "/images/title1.svg";
-const char* egg_path = "/images/title/egg.svg";
-const char* tux_path = "/images/tux";
-char* menu_music_path = "/sounds/tuxi.ogg";
+/*NOTE: move these constants into a config file ? */
+const float title_pos[4] = {0.0, 0.0, 0.3, 0.25};
+const float tux_pos[4] = {0.0, 0.6, 0.3, 0.4};
+const float speaker_pos[4] = {0.9, 0.0, 0.05, 0.05};
+const char* standby_path = "/images/status/standby.svg";
+const char* title_path = "/images/title1.svg";
+const char* egg_path = "/images/title/egg.svg";
+const char* tux_path = "/images/tux";
+const char* speaker_on_path = "/images/sound.svg";
+const char* speaker_off_path = "/images/nosound.svg";
+char* menu_music_path = "/sounds/tuxi.ogg";
char* full_menu_music_path;
/* beak coordinates relative to tux rect */
const float beak_pos[4] = {0.36, 0.21, 0.27, 0.14};
@@ -80,6 +82,7 @@
logo_rect,
tux_rect,
title_rect,
+ speaker_rect,
cursor;
@@ -231,19 +234,14 @@
}
}
- /* Pick speaker graphic according to whether music is on: */
-/* if ( settings.menu_music )
- SDL_BlitSurface(speaker, NULL, screen, &spkrdest);
- else
- SDL_BlitSurface(speakeroff, NULL, screen, &spkrdest);
-*/
- /* Start playing menu music if desired: */
+ /* Start playing menu music if desired: */
LOG( "Tux and Title are in place now\n" );
SDL_WM_GrabInput(SDL_GRAB_OFF);
+ AudioMusicLoad(full_menu_music_path, -1);
- AudioMusicLoad(full_menu_music_path, -1);
+ /* run menu loop */
run_main_menu();
free(full_menu_music_path);
@@ -268,7 +266,13 @@
SDL_BlitSurface(CurrentBkgd(), NULL, screen, &bkg_rect);
SDL_BlitSurface(Tux->frame[0], NULL, screen, &tux_rect);
SDL_BlitSurface(title, NULL, screen, &title_rect);
- //SDL_UpdateRect(screen, 0, 0, 0, 0);
+ /* Pick speaker graphic according to whether music is on: */
+ if (IsPlayingMusic())
+ SDL_BlitSurface(speaker, NULL, GetScreen(), &speaker_rect);
+ else
+ SDL_BlitSurface(speakeroff, NULL, GetScreen(), &speaker_rect);
+
+ //SDL_UpdateRect(screen, 0, 0, 0, 0);
DEBUGMSG(debug_titlescreen, "Leaving DrawTitleScreen()\n");
}
@@ -333,6 +337,28 @@
return 0;
}
+ /* speaker icon */
+ SetRect(&speaker_rect, speaker_pos);
+
+ path = GetSpriteFullPath(speaker_on_path);
+ speaker = LoadImageOfBoundingBox(path, IMG_ALPHA, speaker_rect.w, speaker_rect.h);
+ if(path)
+ free(path);
+
+ path = GetSpriteFullPath(speaker_off_path);
+ speakeroff = LoadImageOfBoundingBox(path, IMG_ALPHA, speaker_rect.w, speaker_rect.h);
+ if(path)
+ free(path);
+
+ if(speaker && speakeroff)
+ {
+ speaker_rect.w = speaker->clip_rect.w;
+ speaker_rect.h = speaker->clip_rect.h;
+ }
+ else
+ DEBUGMSG(debug_titlescreen, "RenderTitleScreen(): Failed to load speaker icons.\n");
+
+
curr_res_x = screen->w;
curr_res_y = screen->h;
@@ -347,6 +373,27 @@
return 1 if events require full redraw */
int HandleTitleScreenEvents(SDL_Event* evt)
{
+ /* Toggle menu music: */
+ switch(evt->type)
+ {
+ case SDL_KEYDOWN:
+ {
+ switch (evt->key.keysym.sym)
+ {
+ case SDLK_F11:
+ {
+ /* return 1 so the screen will be redrawn and appropriate speaker will be visible */
+ return 1;
+ }
+
+ default:
+ {
+ break;
+ }
+ }
+ }
+ }
+
return 0;
}
More information about the Tux4kids-commits
mailing list