[Tux4kids-commits] r1604 - in branches/commonification/t4kcommon/trunk: . src

David Bruce dbruce-guest at alioth.debian.org
Sat Oct 24 14:39:33 UTC 2009


Author: dbruce-guest
Date: 2009-10-24 14:39:33 +0000 (Sat, 24 Oct 2009)
New Revision: 1604

Added:
   branches/commonification/t4kcommon/trunk/src/t4k-common.h
Removed:
   branches/commonification/t4kcommon/trunk/src/t4kcommon.h
Modified:
   branches/commonification/t4kcommon/trunk/Makefile.am
   branches/commonification/t4kcommon/trunk/configure.ac
   branches/commonification/t4kcommon/trunk/src/Makefile.am
   branches/commonification/t4kcommon/trunk/src/t4k-audio.c
   branches/commonification/t4kcommon/trunk/src/t4k-loaders.c
   branches/commonification/t4kcommon/trunk/src/t4k-main.c
   branches/commonification/t4kcommon/trunk/src/t4k-menu.c
   branches/commonification/t4kcommon/trunk/src/t4k-pixels.c
   branches/commonification/t4kcommon/trunk/src/t4k-sdl.c
Log:
1. fixed autotools build to build libt4kcommon as shared lib
2. renamed t4kcommon.h to t4k-common.h for consistency

Modified: branches/commonification/t4kcommon/trunk/Makefile.am
===================================================================
--- branches/commonification/t4kcommon/trunk/Makefile.am	2009-10-24 14:38:53 UTC (rev 1603)
+++ branches/commonification/t4kcommon/trunk/Makefile.am	2009-10-24 14:39:33 UTC (rev 1604)
@@ -3,7 +3,7 @@
 
 SUBDIRS = data \
 	po	\
-	t4kcommon
+	src
 
 EXTRA_DIST = CMakeLists.txt
 

Modified: branches/commonification/t4kcommon/trunk/configure.ac
===================================================================
--- branches/commonification/t4kcommon/trunk/configure.ac	2009-10-24 14:38:53 UTC (rev 1603)
+++ branches/commonification/t4kcommon/trunk/configure.ac	2009-10-24 14:39:33 UTC (rev 1604)
@@ -2,7 +2,7 @@
 # Process this file with autoconf to produce a configure script.
 
 AC_INIT([Tux4Kids-Common],[0.0.1],[tuxmath-devel at lists.sourceforge.net],[t4kcommon])
-AC_CONFIG_SRCDIR([t4kcommon/t4k-audio.c])
+AC_CONFIG_SRCDIR([src/t4k-audio.c])
 AC_CONFIG_MACRO_DIR([m4])
 
 AC_PREREQ([2.63])
@@ -197,5 +197,5 @@
                  data/images/Makefile
                  data/images/menu/Makefile
                  po/Makefile.in
-                 t4kcommon/Makefile])
+                 src/Makefile])
 AC_OUTPUT

Modified: branches/commonification/t4kcommon/trunk/src/Makefile.am
===================================================================
--- branches/commonification/t4kcommon/trunk/src/Makefile.am	2009-10-24 14:38:53 UTC (rev 1603)
+++ branches/commonification/t4kcommon/trunk/src/Makefile.am	2009-10-24 14:39:33 UTC (rev 1604)
@@ -1,6 +1,14 @@
-## Makefile.am for tux4kids-common/t4kcommon
+## Makefile.am for t4kcommon/trunk/src
 ## Process with Automake to create Makefile.in
 
+AM_CFLAGS=-Wall -g -DCOMMON_DATA_PREFIX=\"${COMMON_DATA_PREFIX}\" -DDEBUG
+
+if BUILD_MINGW32
+  COMMON_DATA_PREFIX=@MINGW32_PACKAGE_DATA_DIR@
+else
+  COMMON_DATA_PREFIX=${pkgdatadir}
+endif
+
 lib_LTLIBRARIES = libt4kcommon.la
 
 libt4kcommon_la_SOURCES = \
@@ -13,4 +21,4 @@
 	t4k-pixels.c	\
 	t4k-sdl.c
 
-include_HEADERS = tux4kids-common.h
+include_HEADERS = t4k-common.h

Modified: branches/commonification/t4kcommon/trunk/src/t4k-audio.c
===================================================================
--- branches/commonification/t4kcommon/trunk/src/t4k-audio.c	2009-10-24 14:38:53 UTC (rev 1603)
+++ branches/commonification/t4kcommon/trunk/src/t4k-audio.c	2009-10-24 14:39:33 UTC (rev 1604)
@@ -21,7 +21,7 @@
 ***************************************************************************/
 
 
-#include "t4kcommon.h"
+#include "t4k-common.h"
 #include "t4k-globals.h"
 
 static Mix_Music *default_music = NULL;

Copied: branches/commonification/t4kcommon/trunk/src/t4k-common.h (from rev 1603, branches/commonification/t4kcommon/trunk/src/t4kcommon.h)
===================================================================
--- branches/commonification/t4kcommon/trunk/src/t4k-common.h	                        (rev 0)
+++ branches/commonification/t4kcommon/trunk/src/t4k-common.h	2009-10-24 14:39:33 UTC (rev 1604)
@@ -0,0 +1,170 @@
+/*
+  tux4kids-common
+
+  Library of common functions used in Tux4Kids games.
+
+  Part of "Tux4Kids" Project
+  http://www.tux4kids.com/
+
+  Copyright: See COPYING file that comes with this distribution.
+*/
+
+#ifndef TUX4KIDS_COMMON_H
+#define TUX4KIDS_COMMON_H
+
+#include "SDL.h"
+#include "SDL_image.h"
+#include "SDL_mixer.h"
+
+#if SDL_BYTEORDER == SDL_BIG_ENDIAN
+#define rmask 0xff000000
+#define gmask 0x00ff0000
+#define bmask 0x0000ff00
+#define amask 0x000000ff
+#else
+#define rmask 0x000000ff
+#define gmask 0x0000ff00
+#define bmask 0x00ff0000
+#define amask 0xff000000
+#endif
+
+#define _(String) gettext (String)
+
+typedef enum { false, true } bool;
+
+extern const int debug_loaders;
+extern const int debug_menu;
+extern const int debug_menu_parser;
+extern const int debug_sdl;
+extern const int debug_all;
+
+/* FIXME: global vars such as screen should be hidden when all games
+   are using only getters (such as GetScreen() ) */
+extern SDL_Surface* screen;
+
+#define MAX_SPRITE_FRAMES 15
+
+typedef struct {
+  SDL_Surface *frame[MAX_SPRITE_FRAMES];
+  SDL_Surface *default_img;
+  int num_frames;
+  int cur;
+} sprite;
+
+/* from t4k-main.c */
+void            InitT4KCommon(int debug_flags);
+
+/* from tk4-menu.c */
+
+/* special values used by RunMenu. RUN_MAIN_MENU is a special
+   activity that can be used in .xml menu structures but should not
+   be declared in activities' lists.
+   RunMenu returning QUIT indicates that user decided to quit application while
+   running the menu. Returning STOP indicates that user pressed stop button. */
+enum { RUN_MAIN_MENU = -3, QUIT = -2, STOP = -1 };
+
+extern SDL_Rect menu_rect, stop_rect, prev_rect, next_rect;
+extern SDL_Surface *stop_button, *prev_arrow, *next_arrow, *prev_gray, *next_gray;
+
+void            SetActivitiesList(int num, char** acts);
+void            SetMenuSounds(char* mus_path, Mix_Chunk* click, Mix_Chunk* hover);
+void            SetImagePathPrefix(char* pref);
+
+void            CreateOneLevelMenu(int index, int items, char** item_names, char** sprite_names, char* title, char* trailer);
+int             RunMenu(int index, bool return_choice, void (*draw_background)(), int (*handle_event)(SDL_Event*), void (*handle_animations)(), int (*handle_activity)(int, int));
+void            PrerenderMenu(int index);
+void            PrerenderAll();
+void            LoadMenu(int index, const char* file_name);
+void            UnloadMenus(void);
+
+/* from tk4-sdl.c */
+
+/* For TransWipe(): */
+enum
+{
+  WIPE_BLINDS_VERT,
+  WIPE_BLINDS_HORIZ,
+  WIPE_BLINDS_BOX,
+  RANDOM_WIPE,
+  NUM_WIPES
+};
+
+//TODO most of these functions are documented...somewhere. That should end up
+//in this header eventually
+SDL_Surface*    GetScreen();
+void            DrawButton(SDL_Rect* target_rect, int radius, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
+void            DrawButtonOn(SDL_Surface* target, SDL_Rect* target_rect, int radius, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
+SDL_Surface*    CreateButton(int w, int h, int radius, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
+void            RoundCorners(SDL_Surface* s, Uint16 radius);
+
+SDL_Surface*    Flip(SDL_Surface *in, int x, int y);
+SDL_Surface*    Blend(SDL_Surface *S1, SDL_Surface *S2, float gamma);
+
+void            FreeSurfaceArray(SDL_Surface** surfs, int length);
+int             inRect(SDL_Rect r, int x, int y);
+void            SetRect(SDL_Rect* rect, const float* pos);
+void            UpdateRect(SDL_Surface* surf, SDL_Rect* rect);
+
+void            DarkenScreen(Uint8 bits);
+void            ChangeWindowSize(int new_res_x, int new_res_y);
+void            SwitchScreenMode(void);
+
+SDL_EventType   WaitForEvent(SDL_EventMask events);
+SDL_Surface*    zoom(SDL_Surface* src, int new_w, int new_h);
+
+int             TransWipe(const SDL_Surface* newbkg, int type, int segments, int duration);
+void            InitBlitQueue(void);
+void            ResetBlitQueue(void);
+int             AddRect(SDL_Rect* src, SDL_Rect* dst);
+int             DrawSprite(sprite* gfx, int x, int y);
+int             DrawObject(SDL_Surface* surf, int x, int y);
+void            UpdateScreen(int* frame);
+int             EraseSprite(sprite* img, SDL_Surface* curr_bkgd, int x, int y);
+int             EraseObject(SDL_Surface* surf, SDL_Surface* curr_bkgd, int x, int y);
+
+
+/* from tk4-loaders.c */
+#define IMG_REGULAR         0x01
+#define IMG_COLORKEY        0x02
+#define IMG_ALPHA           0x04
+#define IMG_MODES           0x07
+
+#define IMG_NOT_REQUIRED    0x10
+#define IMG_NO_PNG_FALLBACK 0x20
+
+
+int             CheckFile(const char* file);
+/**
+ * Add a path to search for data (in addition to t4kcommon's install path and 
+ * the root directory) This affects how LoadImage and friends are able to
+ * find files.
+ */
+void            AddDataPrefix(const char* path);
+
+SDL_Surface*    LoadImage(const char* file_name, int mode);
+SDL_Surface*    LoadScaledImage(const char* file_name, int mode, int width, int height);
+SDL_Surface*    LoadImageOfBoundingBox(const char* file_name, int mode, int max_width, int max_height);
+
+SDL_Surface*    LoadBkgd(const char* file_name, int width, int height);
+
+sprite*         LoadSprite(const char* name, int mode);
+sprite*         LoadScaledSprite(const char* name, int mode, int width, int height);
+sprite*         LoadSpriteOfBoundingBox(const char* name, int mode, int max_width, int max_height);
+sprite*         FlipSprite(sprite* in, int X, int Y);
+void            FreeSprite(sprite* gfx);
+void            NextFrame(sprite* s);
+
+Mix_Chunk*      LoadSound(char* datafile);
+Mix_Music*      LoadMusic(char *datafile);
+
+/* from tk4-loaders.c */
+
+void            PlaySound(Mix_Chunk* sound);
+void            PlaySoundLoop(Mix_Chunk* sound, int loops);
+void            AudioHaltChannel( int channel );
+void            AudioMusicLoad(char* music_path, int loops);
+void            AudioMusicUnload();
+bool            IsPlayingMusic();
+void            AudioMusicPlay(Mix_Music *musicData, int loops);
+
+#endif

Modified: branches/commonification/t4kcommon/trunk/src/t4k-loaders.c
===================================================================
--- branches/commonification/t4kcommon/trunk/src/t4k-loaders.c	2009-10-24 14:38:53 UTC (rev 1603)
+++ branches/commonification/t4kcommon/trunk/src/t4k-loaders.c	2009-10-24 14:39:33 UTC (rev 1604)
@@ -21,7 +21,7 @@
   Copyright: See COPYING file that comes with this distribution.
 */
 
-#include "t4kcommon.h"
+#include "t4k-common.h"
 #include "t4k-globals.h"
 #include "t4k-compiler.h"
 

Modified: branches/commonification/t4kcommon/trunk/src/t4k-main.c
===================================================================
--- branches/commonification/t4kcommon/trunk/src/t4k-main.c	2009-10-24 14:38:53 UTC (rev 1603)
+++ branches/commonification/t4kcommon/trunk/src/t4k-main.c	2009-10-24 14:39:33 UTC (rev 1604)
@@ -11,7 +11,7 @@
   Copyright: See COPYING file that comes with this distribution.
 */
 
-#include "t4kcommon.h"
+#include "t4k-common.h"
 #include "t4k-globals.h"
 
 int debug_status;

Modified: branches/commonification/t4kcommon/trunk/src/t4k-menu.c
===================================================================
--- branches/commonification/t4kcommon/trunk/src/t4k-menu.c	2009-10-24 14:38:53 UTC (rev 1603)
+++ branches/commonification/t4kcommon/trunk/src/t4k-menu.c	2009-10-24 14:39:33 UTC (rev 1604)
@@ -11,7 +11,7 @@
   Copyright: See COPYING file that comes with this distribution.
 */
 
-#include "t4kcommon.h"
+#include "t4k-common.h"
 #include "t4k-globals.h"
 #include "t4k-compiler.h"
 

Modified: branches/commonification/t4kcommon/trunk/src/t4k-pixels.c
===================================================================
--- branches/commonification/t4kcommon/trunk/src/t4k-pixels.c	2009-10-24 14:38:53 UTC (rev 1603)
+++ branches/commonification/t4kcommon/trunk/src/t4k-pixels.c	2009-10-24 14:39:33 UTC (rev 1604)
@@ -27,7 +27,7 @@
   $Id: pixels.c,v 1.3 2006/08/27 21:00:55 wkendrick Exp $
 */
 
-#include "t4kcommon.h"
+#include "t4k-common.h"
 #include "t4k-globals.h"
 #include "t4k-compiler.h"
 

Modified: branches/commonification/t4kcommon/trunk/src/t4k-sdl.c
===================================================================
--- branches/commonification/t4kcommon/trunk/src/t4k-sdl.c	2009-10-24 14:38:53 UTC (rev 1603)
+++ branches/commonification/t4kcommon/trunk/src/t4k-sdl.c	2009-10-24 14:39:33 UTC (rev 1604)
@@ -12,7 +12,7 @@
 
 #include <math.h>
 
-#include "t4kcommon.h"
+#include "t4k-common.h"
 #include "t4k-globals.h"
 
 SDL_Surface* screen = NULL;

Deleted: branches/commonification/t4kcommon/trunk/src/t4kcommon.h
===================================================================
--- branches/commonification/t4kcommon/trunk/src/t4kcommon.h	2009-10-24 14:38:53 UTC (rev 1603)
+++ branches/commonification/t4kcommon/trunk/src/t4kcommon.h	2009-10-24 14:39:33 UTC (rev 1604)
@@ -1,170 +0,0 @@
-/*
-  tux4kids-common
-
-  Library of common functions used in Tux4Kids games.
-
-  Part of "Tux4Kids" Project
-  http://www.tux4kids.com/
-
-  Copyright: See COPYING file that comes with this distribution.
-*/
-
-#ifndef TUX4KIDS_COMMON_H
-#define TUX4KIDS_COMMON_H
-
-#include "SDL.h"
-#include "SDL_image.h"
-#include "SDL_mixer.h"
-
-#if SDL_BYTEORDER == SDL_BIG_ENDIAN
-#define rmask 0xff000000
-#define gmask 0x00ff0000
-#define bmask 0x0000ff00
-#define amask 0x000000ff
-#else
-#define rmask 0x000000ff
-#define gmask 0x0000ff00
-#define bmask 0x00ff0000
-#define amask 0xff000000
-#endif
-
-#define _(String) gettext (String)
-
-typedef enum { false, true } bool;
-
-extern const int debug_loaders;
-extern const int debug_menu;
-extern const int debug_menu_parser;
-extern const int debug_sdl;
-extern const int debug_all;
-
-/* FIXME: global vars such as screen should be hidden when all games
-   are using only getters (such as GetScreen() ) */
-extern SDL_Surface* screen;
-
-#define MAX_SPRITE_FRAMES 15
-
-typedef struct {
-  SDL_Surface *frame[MAX_SPRITE_FRAMES];
-  SDL_Surface *default_img;
-  int num_frames;
-  int cur;
-} sprite;
-
-/* from t4k-main.c */
-void            InitT4KCommon(int debug_flags);
-
-/* from tk4-menu.c */
-
-/* special values used by RunMenu. RUN_MAIN_MENU is a special
-   activity that can be used in .xml menu structures but should not
-   be declared in activities' lists.
-   RunMenu returning QUIT indicates that user decided to quit application while
-   running the menu. Returning STOP indicates that user pressed stop button. */
-enum { RUN_MAIN_MENU = -3, QUIT = -2, STOP = -1 };
-
-extern SDL_Rect menu_rect, stop_rect, prev_rect, next_rect;
-extern SDL_Surface *stop_button, *prev_arrow, *next_arrow, *prev_gray, *next_gray;
-
-void            SetActivitiesList(int num, char** acts);
-void            SetMenuSounds(char* mus_path, Mix_Chunk* click, Mix_Chunk* hover);
-void            SetImagePathPrefix(char* pref);
-
-void            CreateOneLevelMenu(int index, int items, char** item_names, char** sprite_names, char* title, char* trailer);
-int             RunMenu(int index, bool return_choice, void (*draw_background)(), int (*handle_event)(SDL_Event*), void (*handle_animations)(), int (*handle_activity)(int, int));
-void            PrerenderMenu(int index);
-void            PrerenderAll();
-void            LoadMenu(int index, const char* file_name);
-void            UnloadMenus(void);
-
-/* from tk4-sdl.c */
-
-/* For TransWipe(): */
-enum
-{
-  WIPE_BLINDS_VERT,
-  WIPE_BLINDS_HORIZ,
-  WIPE_BLINDS_BOX,
-  RANDOM_WIPE,
-  NUM_WIPES
-};
-
-//TODO most of these functions are documented...somewhere. That should end up
-//in this header eventually
-SDL_Surface*    GetScreen();
-void            DrawButton(SDL_Rect* target_rect, int radius, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
-void            DrawButtonOn(SDL_Surface* target, SDL_Rect* target_rect, int radius, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
-SDL_Surface*    CreateButton(int w, int h, int radius, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
-void            RoundCorners(SDL_Surface* s, Uint16 radius);
-
-SDL_Surface*    Flip(SDL_Surface *in, int x, int y);
-SDL_Surface*    Blend(SDL_Surface *S1, SDL_Surface *S2, float gamma);
-
-void            FreeSurfaceArray(SDL_Surface** surfs, int length);
-int             inRect(SDL_Rect r, int x, int y);
-void            SetRect(SDL_Rect* rect, const float* pos);
-void            UpdateRect(SDL_Surface* surf, SDL_Rect* rect);
-
-void            DarkenScreen(Uint8 bits);
-void            ChangeWindowSize(int new_res_x, int new_res_y);
-void            SwitchScreenMode(void);
-
-SDL_EventType   WaitForEvent(SDL_EventMask events);
-SDL_Surface*    zoom(SDL_Surface* src, int new_w, int new_h);
-
-int             TransWipe(const SDL_Surface* newbkg, int type, int segments, int duration);
-void            InitBlitQueue(void);
-void            ResetBlitQueue(void);
-int             AddRect(SDL_Rect* src, SDL_Rect* dst);
-int             DrawSprite(sprite* gfx, int x, int y);
-int             DrawObject(SDL_Surface* surf, int x, int y);
-void            UpdateScreen(int* frame);
-int             EraseSprite(sprite* img, SDL_Surface* curr_bkgd, int x, int y);
-int             EraseObject(SDL_Surface* surf, SDL_Surface* curr_bkgd, int x, int y);
-
-
-/* from tk4-loaders.c */
-#define IMG_REGULAR         0x01
-#define IMG_COLORKEY        0x02
-#define IMG_ALPHA           0x04
-#define IMG_MODES           0x07
-
-#define IMG_NOT_REQUIRED    0x10
-#define IMG_NO_PNG_FALLBACK 0x20
-
-
-int             CheckFile(const char* file);
-/**
- * Add a path to search for data (in addition to t4kcommon's install path and 
- * the root directory) This affects how LoadImage and friends are able to
- * find files.
- */
-void            AddDataPrefix(const char* path);
-
-SDL_Surface*    LoadImage(const char* file_name, int mode);
-SDL_Surface*    LoadScaledImage(const char* file_name, int mode, int width, int height);
-SDL_Surface*    LoadImageOfBoundingBox(const char* file_name, int mode, int max_width, int max_height);
-
-SDL_Surface*    LoadBkgd(const char* file_name, int width, int height);
-
-sprite*         LoadSprite(const char* name, int mode);
-sprite*         LoadScaledSprite(const char* name, int mode, int width, int height);
-sprite*         LoadSpriteOfBoundingBox(const char* name, int mode, int max_width, int max_height);
-sprite*         FlipSprite(sprite* in, int X, int Y);
-void            FreeSprite(sprite* gfx);
-void            NextFrame(sprite* s);
-
-Mix_Chunk*      LoadSound(char* datafile);
-Mix_Music*      LoadMusic(char *datafile);
-
-/* from tk4-loaders.c */
-
-void            PlaySound(Mix_Chunk* sound);
-void            PlaySoundLoop(Mix_Chunk* sound, int loops);
-void            AudioHaltChannel( int channel );
-void            AudioMusicLoad(char* music_path, int loops);
-void            AudioMusicUnload();
-bool            IsPlayingMusic();
-void            AudioMusicPlay(Mix_Music *musicData, int loops);
-
-#endif




More information about the Tux4kids-commits mailing list