[Tux4kids-commits] r1321 - branches/commonification/tux4kids-common/trunk/src

Bolesław Kulbabiński bolekk-guest at alioth.debian.org
Sat Aug 1 18:49:30 UTC 2009


Author: bolekk-guest
Date: 2009-08-01 18:49:29 +0000 (Sat, 01 Aug 2009)
New Revision: 1321

Modified:
   branches/commonification/tux4kids-common/trunk/src/t4k-audio.c
   branches/commonification/tux4kids-common/trunk/src/t4k-loaders.c
   branches/commonification/tux4kids-common/trunk/src/t4k-menu.c
   branches/commonification/tux4kids-common/trunk/src/t4k-sdl.c
   branches/commonification/tux4kids-common/trunk/src/tux4kids-common.h
Log:
small changes in sound handlers

Modified: branches/commonification/tux4kids-common/trunk/src/t4k-audio.c
===================================================================
--- branches/commonification/tux4kids-common/trunk/src/t4k-audio.c	2009-08-01 15:31:37 UTC (rev 1320)
+++ branches/commonification/tux4kids-common/trunk/src/t4k-audio.c	2009-08-01 18:49:29 UTC (rev 1321)
@@ -26,17 +26,15 @@
 
 Mix_Music *default_music;
 
-void audioMusicUnload();
-
-void playsound(Mix_Chunk* sound)
+void PlaySound(Mix_Chunk* sound)
 {
- Mix_PlayChannel(-1, sound, 0);
+  Mix_PlayChannel(-1, sound, 0);
 }
 
 /* audioMusicLoad attempts to load and play the music file
  * Note: loops == -1 means forever
  */
-void audioMusicLoad(Mix_Music* music, int loops)
+void AudioMusicLoad(Mix_Music* music, int loops)
 {
   audioMusicUnload(); // make sure defaultMusic is clear
   default_music = music;
@@ -46,19 +44,24 @@
 /* audioMusicUnload attempts to unload any music data that was
  * loaded using the audioMusicLoad function
  */
-void audioMusicUnload()
+void AudioMusicUnload()
 {
   if(default_music)
     Mix_FreeMusic(default_music);
   default_music = NULL;
 }
 
+bool IsPlayingMusic()
+{
+  return (default_music != NULL);
+}
+
 /* audioMusicPlay attempts to play the passed music data.
  * if a music file was loaded using the audioMusicLoad
  * it will be stopped and unloaded
  * Note: loops == -1 means forever
  */
-void audioMusicPlay(Mix_Music *musicData, int loops)
+void AudioMusicPlay(Mix_Music *musicData, int loops)
 {
   audioMusicUnload();
   Mix_PlayMusic(musicData, loops);

Modified: branches/commonification/tux4kids-common/trunk/src/t4k-loaders.c
===================================================================
--- branches/commonification/tux4kids-common/trunk/src/t4k-loaders.c	2009-08-01 15:31:37 UTC (rev 1320)
+++ branches/commonification/tux4kids-common/trunk/src/t4k-loaders.c	2009-08-01 18:49:29 UTC (rev 1321)
@@ -23,6 +23,7 @@
 
 #include "tux4kids-common.h"
 #include "t4k-globals.h"
+#include "t4k-compiler.h"
 
 #ifdef HAVE_RSVG
 #include<librsvg/rsvg.h>

Modified: branches/commonification/tux4kids-common/trunk/src/t4k-menu.c
===================================================================
--- branches/commonification/tux4kids-common/trunk/src/t4k-menu.c	2009-08-01 15:31:37 UTC (rev 1320)
+++ branches/commonification/tux4kids-common/trunk/src/t4k-menu.c	2009-08-01 18:49:29 UTC (rev 1321)
@@ -13,6 +13,7 @@
 
 #include "tux4kids-common.h"
 #include "t4k-globals.h"
+#include "t4k-compiler.h"
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -105,7 +106,6 @@
 void            prerender_menu(MenuNode* menu);
 char*           find_longest_text(MenuNode* menu, int* length);
 void            set_font_size();
-void            prerender_all();
 
 
 /* initialization of menu module */
@@ -411,7 +411,7 @@
               if (inRect(menu->submenu[menu->first_entry + i]->button_rect, event.motion.x, event.motion.y))
               {
                 if(snd_hover)
-                  playsound(snd_hover);
+                  PlaySound(snd_hover);
                 loc = i;
                 break;   /* from for loop */
               }
@@ -424,7 +424,7 @@
               if(click_flag)
               {
                 if(snd_hover)
-                  playsound(snd_hover);
+                  PlaySound(snd_hover);
                 click_flag = 0;
               }
             }
@@ -436,7 +436,7 @@
               if(click_flag)
               {
                 if(snd_hover)
-                  playsound(snd_hover);
+                  PlaySound(snd_hover);
                 click_flag = 0;
               }
             }
@@ -447,7 +447,7 @@
               if(click_flag)
               {
                 if(snd_hover)
-                  playsound(snd_hover);
+                  PlaySound(snd_hover);
                 click_flag = 0;
               }
             }
@@ -467,7 +467,7 @@
               {
                 // Play sound if loc is being changed:
                 if(snd_click)
-                  playsound(snd_click);
+                  PlaySound(snd_click);
                 loc = i;
                 action = CLICK;
                 break;   /* from for loop */
@@ -479,7 +479,7 @@
                && menu->first_entry > 0)
             {
               if(snd_click)
-                playsound(snd_click);
+                PlaySound(snd_click);
               action = PAGEUP;
             }
 
@@ -488,7 +488,7 @@
                && menu->first_entry + items < menu->submenu_size)
             {
               if(snd_click)
-                playsound(snd_click);
+                PlaySound(snd_click);
               action = PAGEDOWN;
             }
 
@@ -496,7 +496,7 @@
             else if (inRect(stop_rect, event.button.x, event.button.y ))
             {
               if(snd_click)
-                playsound(snd_click);
+                PlaySound(snd_click);
               action = STOP_ESC;
             }
 
@@ -519,7 +519,7 @@
               case SDLK_KP_ENTER:
               {
                 if(snd_click)
-                  playsound(snd_click);
+                  PlaySound(snd_click);
                 action = CLICK;
                 break;
               }
@@ -529,7 +529,7 @@
               case SDLK_PAGEUP:
               {
                 if(snd_click)
-                  playsound(snd_click);
+                  PlaySound(snd_click);
                 if (menu->first_entry > 0)
                   action = PAGEUP;
                 break;
@@ -540,7 +540,7 @@
               case SDLK_PAGEDOWN:
               {
                 if(snd_click)
-                  playsound(snd_click);
+                  PlaySound(snd_click);
                 if (menu->first_entry + items < menu->submenu_size)
                   action = PAGEDOWN;
                 break;
@@ -550,7 +550,7 @@
               case SDLK_UP:
               {
                 if(snd_hover)
-                  playsound(snd_hover);
+                  PlaySound(snd_hover);
                 if (loc > 0)
                   loc--;
                 else if (menu->submenu_size <= menu->entries_per_screen) 
@@ -566,7 +566,7 @@
               case SDLK_DOWN:
               {
                 if(snd_hover)
-                  playsound(snd_hover);
+                  PlaySound(snd_hover);
                 if (loc + 1 < min(menu->submenu_size, menu->entries_per_screen))
                   loc++;
                 else if (menu->submenu_size <= menu->entries_per_screen) 
@@ -588,20 +588,18 @@
               }
 
               /* Toggle menu music: */
-/*              case SDLK_F11:
+              case SDLK_F11:
               {
-                if (Opts_GetGlobalOpt(MENU_MUSIC))
+                if(IsPlayingMusic())
                 {
-                  audioMusicUnload( );
-                  Opts_SetGlobalOpt(MENU_MUSIC, 0);
+                  AudioMusicUnload();
                 }
-                else
+                else if(menu_music)
                 {
-                  Opts_SetGlobalOpt(MENU_MUSIC, 1);
-                  audioMusicLoad("tuxi.ogg", -1);
+                  AudioMusicLoad(menu_music, -1);
                 }
                 break;
-              }*/
+              }
 
               default:
               {
@@ -645,7 +643,7 @@
           case RESIZED:
             RenderTitleScreen();
             menu->first_entry = 0;
-            prerender_all();
+            PrerenderAll();
             stop = true;
             break;
 

Modified: branches/commonification/tux4kids-common/trunk/src/t4k-sdl.c
===================================================================
--- branches/commonification/tux4kids-common/trunk/src/t4k-sdl.c	2009-08-01 15:31:37 UTC (rev 1320)
+++ branches/commonification/tux4kids-common/trunk/src/t4k-sdl.c	2009-08-01 18:49:29 UTC (rev 1321)
@@ -17,6 +17,14 @@
 
 static SDL_Surface* screen = NULL;
 
+/* window size */
+int win_res_x = 640;
+int win_res_y = 480;
+
+/* full screen size (set in initialize_SDL() ) */
+int fs_res_x = 0;
+int fs_res_y = 0;
+
 char* font_name;
 
 void SetFontName(char* fname)
@@ -461,7 +469,6 @@
   }
 }
 
-#if 0
 /* change window size (works only in windowed mode) */
 void ChangeWindowSize(int new_res_x, int new_res_y)
 {
@@ -523,7 +530,7 @@
     SDL_UpdateRect(screen, 0, 0, 0, 0);
   }
 }
-#endif
+
 /*
 Block application until SDL receives an appropriate event. Events can be
 a single or OR'd combination of event masks. 

Modified: branches/commonification/tux4kids-common/trunk/src/tux4kids-common.h
===================================================================
--- branches/commonification/tux4kids-common/trunk/src/tux4kids-common.h	2009-08-01 15:31:37 UTC (rev 1320)
+++ branches/commonification/tux4kids-common/trunk/src/tux4kids-common.h	2009-08-01 18:49:29 UTC (rev 1321)
@@ -13,6 +13,7 @@
 #define TUX4KIDS_COMMON_H
 
 #include "SDL.h"
+#include "SDL_image.h"
 #include "SDL_mixer.h"
 
 #if SDL_BYTEORDER == SDL_BIG_ENDIAN
@@ -27,6 +28,8 @@
 #define amask 0xff000000
 #endif
 
+#define _(String) gettext (String)
+
 typedef enum { false, true } bool;
 
 #define MAX_SPRITE_FRAMES 10
@@ -111,5 +114,12 @@
 Mix_Chunk*      LoadSound(char* datafile);
 Mix_Music*      LoadMusic(char *datafile);
 
+/* from tk4-loaders.c */
 
+void            PlaySound(Mix_Chunk* sound);
+void            AudioMusicLoad(Mix_Music* music, int loops);
+void            AudioMusicUnload();
+bool            IsPlayingMusic();
+void            AudioMusicPlay(Mix_Music *musicData, int loops);
+
 #endif




More information about the Tux4kids-commits mailing list