[Tux4kids-commits] r594 - in tuxmath/branches/factroids: . data/images/factroids data/images/sprites src
fongog-guest at alioth.debian.org
fongog-guest at alioth.debian.org
Thu Aug 7 23:43:23 UTC 2008
Author: fongog-guest
Date: 2008-08-07 23:43:22 +0000 (Thu, 07 Aug 2008)
New Revision: 594
Removed:
tuxmath/branches/factroids/data/images/factroids/ship02.png
tuxmath/branches/factroids/data/images/factroids/ship03.png
tuxmath/branches/factroids/data/images/factroids/ship04.png
tuxmath/branches/factroids/data/images/factroids/ship05.png
tuxmath/branches/factroids/data/images/factroids/ship06.png
tuxmath/branches/factroids/data/images/factroids/ship07.png
tuxmath/branches/factroids/data/images/factroids/ship08.png
tuxmath/branches/factroids/data/images/factroids/ship09.png
tuxmath/branches/factroids/data/images/factroids/ship10.png
tuxmath/branches/factroids/data/images/factroids/ship11.png
tuxmath/branches/factroids/data/images/factroids/ship12.png
Modified:
tuxmath/branches/factroids/configure
tuxmath/branches/factroids/configure.ac
tuxmath/branches/factroids/data/images/factroids/Makefile
tuxmath/branches/factroids/data/images/factroids/Makefile.am
tuxmath/branches/factroids/data/images/factroids/Makefile.in
tuxmath/branches/factroids/data/images/factroids/ship01.png
tuxmath/branches/factroids/data/images/sprites/Makefile
tuxmath/branches/factroids/notesblurb
tuxmath/branches/factroids/src/factroids.c
tuxmath/branches/factroids/src/fileops.c
tuxmath/branches/factroids/src/fileops.h
Log:
Add: Added the software rotation for the asteroids and the tuxship. Now the tuxship can change his angle by 8 deg...
To reatch this I included the SDL_gfx library!
Modified: tuxmath/branches/factroids/configure
===================================================================
--- tuxmath/branches/factroids/configure 2008-08-07 15:17:03 UTC (rev 593)
+++ tuxmath/branches/factroids/configure 2008-08-07 23:43:22 UTC (rev 594)
@@ -13992,7 +13992,77 @@
fi
+{ echo "$as_me:$LINENO: checking for rotozoomSurface in -lSDL_gfx" >&5
+echo $ECHO_N "checking for rotozoomSurface in -lSDL_gfx... $ECHO_C" >&6; }
+if test "${ac_cv_lib_SDL_gfx_rotozoomSurface+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lSDL_gfx $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char rotozoomSurface ();
+int
+main ()
+{
+return rotozoomSurface ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext &&
+ $as_test_x conftest$ac_exeext; then
+ ac_cv_lib_SDL_gfx_rotozoomSurface=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_lib_SDL_gfx_rotozoomSurface=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_SDL_gfx_rotozoomSurface" >&5
+echo "${ECHO_T}$ac_cv_lib_SDL_gfx_rotozoomSurface" >&6; }
+if test $ac_cv_lib_SDL_gfx_rotozoomSurface = yes; then
+ LIBS="$LIBS -lSDL_gfx"
+else
+ { { echo "$as_me:$LINENO: error: SDL_gfx not found! http://www.ferzkopp.net/joomla/content/view/19/14/" >&5
+echo "$as_me: error: SDL_gfx not found! http://www.ferzkopp.net/joomla/content/view/19/14/" >&2;}
+ { (exit 1); exit 1; }; }
+
+fi
+
+
have_sdlpango=no
# Check whether --enable-sdlpango was given.
if test "${enable_sdlpango+set}" = set; then
Modified: tuxmath/branches/factroids/configure.ac
===================================================================
--- tuxmath/branches/factroids/configure.ac 2008-08-07 15:17:03 UTC (rev 593)
+++ tuxmath/branches/factroids/configure.ac 2008-08-07 23:43:22 UTC (rev 594)
@@ -96,6 +96,12 @@
[AC_MSG_ERROR([SDL_ttf not found! http://www.libsdl.org/projects/SDL_ttf])]
)
+dnl Check for SDL_gfx:
+AC_CHECK_LIB([SDL_gfx],
+ [rotozoomSurface],
+ LIBS="$LIBS -lSDL_gfx",
+ [AC_MSG_ERROR([SDL_gfx not found! http://www.ferzkopp.net/joomla/content/view/19/14/])]
+)
dnl sdlpango support
have_sdlpango=no
Modified: tuxmath/branches/factroids/data/images/factroids/Makefile
===================================================================
--- tuxmath/branches/factroids/data/images/factroids/Makefile 2008-08-07 15:17:03 UTC (rev 593)
+++ tuxmath/branches/factroids/data/images/factroids/Makefile 2008-08-07 23:43:22 UTC (rev 594)
@@ -123,7 +123,7 @@
LIBMULTITHREAD = -lpthread
LIBOBJS =
LIBPTH =
-LIBS = -L/usr/lib -lSDL -lSDL_image -lSDL_mixer -lSDL_ttf
+LIBS = -L/usr/lib -lSDL -lSDL_image -lSDL_mixer -lSDL_ttf -lSDL_gfx
LIBTHREAD =
LTLIBICONV =
LTLIBINTL =
@@ -224,27 +224,16 @@
cometsdir = $(pkgdatadir)/images/factroids
dist_comets_DATA = asteroid1.png \
galaxy2.png \
- ship02.png \
- ship06.png \
- ship10.png \
star1.jpg \
star4.png \
asteroid2.png \
gbstars.png \
- ship03.png \
- ship07.png \
- ship11.png \
star1.png \
star5.png \
asteroid3.png \
- ship04.png \
- ship08.png \
- ship12.png \
star2.png \
galaxy1.png \
ship01.png \
- ship05.png \
- ship09.png \
ship.png \
star3.png \
factoroids.png \
Modified: tuxmath/branches/factroids/data/images/factroids/Makefile.am
===================================================================
--- tuxmath/branches/factroids/data/images/factroids/Makefile.am 2008-08-07 15:17:03 UTC (rev 593)
+++ tuxmath/branches/factroids/data/images/factroids/Makefile.am 2008-08-07 23:43:22 UTC (rev 594)
@@ -5,27 +5,16 @@
dist_comets_DATA = asteroid1.png \
galaxy2.png \
- ship02.png \
- ship06.png \
- ship10.png \
star1.jpg \
star4.png \
asteroid2.png \
gbstars.png \
- ship03.png \
- ship07.png \
- ship11.png \
star1.png \
star5.png \
asteroid3.png \
- ship04.png \
- ship08.png \
- ship12.png \
star2.png \
galaxy1.png \
ship01.png \
- ship05.png \
- ship09.png \
ship.png \
star3.png \
factoroids.png \
Modified: tuxmath/branches/factroids/data/images/factroids/Makefile.in
===================================================================
--- tuxmath/branches/factroids/data/images/factroids/Makefile.in 2008-08-07 15:17:03 UTC (rev 593)
+++ tuxmath/branches/factroids/data/images/factroids/Makefile.in 2008-08-07 23:43:22 UTC (rev 594)
@@ -224,27 +224,16 @@
cometsdir = $(pkgdatadir)/images/factroids
dist_comets_DATA = asteroid1.png \
galaxy2.png \
- ship02.png \
- ship06.png \
- ship10.png \
star1.jpg \
star4.png \
asteroid2.png \
gbstars.png \
- ship03.png \
- ship07.png \
- ship11.png \
star1.png \
star5.png \
asteroid3.png \
- ship04.png \
- ship08.png \
- ship12.png \
star2.png \
galaxy1.png \
ship01.png \
- ship05.png \
- ship09.png \
ship.png \
star3.png \
factoroids.png \
Modified: tuxmath/branches/factroids/data/images/factroids/ship01.png
===================================================================
(Binary files differ)
Deleted: tuxmath/branches/factroids/data/images/factroids/ship02.png
===================================================================
(Binary files differ)
Deleted: tuxmath/branches/factroids/data/images/factroids/ship03.png
===================================================================
(Binary files differ)
Deleted: tuxmath/branches/factroids/data/images/factroids/ship04.png
===================================================================
(Binary files differ)
Deleted: tuxmath/branches/factroids/data/images/factroids/ship05.png
===================================================================
(Binary files differ)
Deleted: tuxmath/branches/factroids/data/images/factroids/ship06.png
===================================================================
(Binary files differ)
Deleted: tuxmath/branches/factroids/data/images/factroids/ship07.png
===================================================================
(Binary files differ)
Deleted: tuxmath/branches/factroids/data/images/factroids/ship08.png
===================================================================
(Binary files differ)
Deleted: tuxmath/branches/factroids/data/images/factroids/ship09.png
===================================================================
(Binary files differ)
Deleted: tuxmath/branches/factroids/data/images/factroids/ship10.png
===================================================================
(Binary files differ)
Deleted: tuxmath/branches/factroids/data/images/factroids/ship11.png
===================================================================
(Binary files differ)
Deleted: tuxmath/branches/factroids/data/images/factroids/ship12.png
===================================================================
(Binary files differ)
Modified: tuxmath/branches/factroids/data/images/sprites/Makefile
===================================================================
--- tuxmath/branches/factroids/data/images/sprites/Makefile 2008-08-07 15:17:03 UTC (rev 593)
+++ tuxmath/branches/factroids/data/images/sprites/Makefile 2008-08-07 23:43:22 UTC (rev 594)
@@ -123,7 +123,7 @@
LIBMULTITHREAD = -lpthread
LIBOBJS =
LIBPTH =
-LIBS = -L/usr/lib -lSDL -lSDL_image -lSDL_mixer -lSDL_ttf
+LIBS = -L/usr/lib -lSDL -lSDL_image -lSDL_mixer -lSDL_ttf -lSDL_gfx
LIBTHREAD =
LTLIBICONV =
LTLIBINTL =
Modified: tuxmath/branches/factroids/notesblurb
===================================================================
--- tuxmath/branches/factroids/notesblurb 2008-08-07 15:17:03 UTC (rev 593)
+++ tuxmath/branches/factroids/notesblurb 2008-08-07 23:43:22 UTC (rev 594)
@@ -1,3 +1,3 @@
Source tar.gz archive for TuxMath 1.6.2, including the Andika font. Suitable for installation on Unix-style systems using a simple "./configure; make; make install". This now includes MacOSX as long as you have the needed libs (tested on MacOS 10.5 "Leopard").
-Build requires the *-dev files for SDL, SDL_image, SDL_mixer, and SDL_ttf. GNU Gettext is no longer required for installation. All of these should be easily available in most GNU-Linux distributions. The GNU Autotools are not needed to build from this package.
\ No newline at end of file
+Build requires the *-dev files for SDL, SDL_image, SDL_mixer, SDL_gfx and SDL_ttf. GNU Gettext is no longer required for installation. All of these should be easily available in most GNU-Linux distributions. The GNU Autotools are not needed to build from this package.
\ No newline at end of file
Modified: tuxmath/branches/factroids/src/factroids.c
===================================================================
--- tuxmath/branches/factroids/src/factroids.c 2008-08-07 15:17:03 UTC (rev 593)
+++ tuxmath/branches/factroids/src/factroids.c 2008-08-07 23:43:22 UTC (rev 594)
@@ -27,7 +27,7 @@
#include "SDL_mixer.h"
#endif
#include "SDL_image.h"
-
+#include "SDL_rotozoom.h"
#include "game.h"
#include "fileops.h"
@@ -45,6 +45,8 @@
#define NUM_TUXSHIPS 2
#define NUM_SPRITES 11
#define TUXSHIP_LIVES 3
+#define DEG_PER_ROTATION 2
+#define NUM_OF_ROTO_IMGS 360/DEG_PER_ROTATION
#define DEG_TO_RAD 0.0174532925
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
@@ -74,8 +76,7 @@
int fact_number;
int isprime;
int a, b; /* a / b */
- MC_FlashCard flashcard;
- Uint32 time_started;
+ int count;
} asteroid_type;
@@ -86,6 +87,7 @@
int centerx, centery;
int angle;
int hurt, hurt_count;
+ int count;
} tuxship_type;
typedef struct FF_laser_type{
@@ -141,8 +143,9 @@
static int escape_received;
//SDL Variables
-static SDL_Surface *bg; //The background
-
+static SDL_Surface* IMG_tuxship[NUM_OF_ROTO_IMGS];
+static SDL_Surface* IMG_asteroids1[NUM_OF_ROTO_IMGS];
+static SDL_Surface* IMG_asteroids2[NUM_OF_ROTO_IMGS];
static SDL_Rect bgSrc, bgScreen2, bgScreen;
// Game type
@@ -356,6 +359,37 @@
SDL_Surface *tmp;
SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0, 0, 0));
SDL_Flip(screen);
+
+ for(i=0; i<NUM_OF_ROTO_IMGS; i=i++)
+ {
+ //rotozoomSurface (SDL_Surface *src, double angle, double zoom, int smooth);
+ IMG_tuxship[i] = rotozoomSurface(images[IMG_SHIP01], i*DEG_PER_ROTATION, 1, 1);
+
+ if (IMG_tuxship[i] == NULL)
+ {
+ fprintf(stderr,
+ "\nError: I couldn't load a graphics file\n");
+ return 0;
+ }
+
+ IMG_asteroids1[i] = rotozoomSurface(images[IMG_ASTEROID1], i*DEG_PER_ROTATION, 1, 1);
+
+ if (IMG_tuxship[i] == NULL)
+ {
+ fprintf(stderr,
+ "\nError: I couldn't load a graphics file\n");
+ return 0;
+ }
+
+ IMG_asteroids2[i] = rotozoomSurface(images[IMG_ASTEROID2], i*DEG_PER_ROTATION, 1, 1);
+
+ if (IMG_tuxship[i] == NULL)
+ {
+ fprintf(stderr, "\nError: I couldn't load a graphics file\n");
+ return 0;
+ }
+ }
+
bkg_h=(images[BG_STARS]->h)>>1;
bgSrc.y=((images[BG_STARS]->h)>>1)-bkg_h;
bgSrc.x=0;
@@ -372,8 +406,8 @@
// Allocate memory
asteroid = NULL; // set in case allocation fails partway through
+ asteroid = (asteroid_type *) malloc(MAX_ASTEROIDS * sizeof(asteroid_type));
- asteroid = (asteroid_type *) malloc(MAX_ASTEROIDS * sizeof(asteroid_type));
if (asteroid == NULL) {
printf("Allocation of asteroids failed");
return 0;
@@ -420,6 +454,7 @@
_("Use the arrow keys to turn or go forward. Aim at an asteroid,"),
_("type one of its factors, and press space or return..."),
_("If you're right, it will split into its factors. Rocks with prime numbers are destroyed!"));
+ SDL_BlitSurface(IMG_asteroids1[3],NULL,screen,&rect);
}
else if (FF_game==FRACTIONS_GAME)
{
@@ -451,8 +486,8 @@
/****************** Ship center... ******************/
- tuxship.centerx=((images[IMG_SHIP01]->w)/2)+tuxship.x;
- tuxship.centery=((images[IMG_SHIP01]->h)/2)+tuxship.y;
+ tuxship.centerx=((IMG_tuxship[tuxship.angle/DEG_PER_ROTATION]->w)/2)+(tuxship.x - (IMG_tuxship[tuxship.angle/DEG_PER_ROTATION]->w/2));
+ tuxship.centery=((IMG_tuxship[tuxship.angle/DEG_PER_ROTATION]->h)/2)+(tuxship.y - (IMG_tuxship[tuxship.angle/DEG_PER_ROTATION]->h/2));
/******************* Ship live *********************/
@@ -466,13 +501,13 @@
if (right_pressed)
{
- tuxship.angle=tuxship.angle - 30;
+ tuxship.angle=tuxship.angle - DEG_PER_ROTATION*4;
if (tuxship.angle < 0)
tuxship.angle = tuxship.angle + 360;
}
else if (left_pressed)
{
- tuxship.angle=tuxship.angle + 30;
+ tuxship.angle=tuxship.angle + DEG_PER_ROTATION*4;
if (tuxship.angle >= 360)
tuxship.angle = tuxship.angle - 360;
}
@@ -640,26 +675,28 @@
}
}
/*************** Draw Ship ******************/
- dest.x=tuxship.x;
- dest.y=tuxship.y;
- if(!tuxship.hurt || (tuxship.hurt && tuxship.hurt_count%2==0))
- for(i=0;i<12;i++)
- if((i*30<=tuxship.angle) && (tuxship.angle<((i*30)+30)))
- SDL_BlitSurface(images[IMG_SHIP01+i], NULL, screen, &dest);
-
+
+ if(!tuxship.hurt || (tuxship.hurt && tuxship.hurt_count%2==0)){
+ dest.x = (tuxship.x - (IMG_tuxship[tuxship.angle/DEG_PER_ROTATION]->w/2));
+ dest.y = (tuxship.y - (IMG_tuxship[tuxship.angle/DEG_PER_ROTATION]->h/2));
+ dest.w = IMG_tuxship[tuxship.angle/DEG_PER_ROTATION]->w;
+ dest.h = IMG_tuxship[tuxship.angle/DEG_PER_ROTATION]->h;
+
+ SDL_BlitSurface(IMG_tuxship[tuxship.angle/DEG_PER_ROTATION], NULL, screen, &dest);
+ }
/************* Draw Asteroids ***************/
for(i=0; i<MAX_ASTEROIDS; i++){
if(asteroid[i].alive>0){
dest.x=asteroid[i].x;
dest.y=asteroid[i].y;
if(asteroid[i].size==0){
- SDL_BlitSurface(images[IMG_ASTEROID1], NULL, screen, &dest);
+ SDL_BlitSurface(IMG_asteroids1[asteroid[i].angle/DEG_PER_ROTATION], NULL, screen, &dest);
}
if(asteroid[i].size==1){
- SDL_BlitSurface(images[IMG_ASTEROID2], NULL, screen, &dest);
+ SDL_BlitSurface(IMG_asteroids2[asteroid[i].angle/DEG_PER_ROTATION], NULL, screen, &dest);
}
if(asteroid[i].size==2){
- SDL_BlitSurface(images[IMG_ASTEROID2], NULL, screen, &dest);
+ SDL_BlitSurface(IMG_asteroids2[asteroid[i].angle/DEG_PER_ROTATION], NULL, screen, &dest);
}
if(FF_game==FACTOROIDS_GAME)
{
@@ -846,7 +883,7 @@
FF_add_asteroid(x,y,
xvel,yvel,
rand()%2,
- 0, 3,
+ rand()%360, rand()%3,
(rand()%(31+(wave*wave))),
0, 0,
1);
@@ -855,7 +892,7 @@
FF_add_asteroid(x,y,
xvel,yvel,
rand()%2,
- 0, 3,
+ rand()%360, rand()%3,
0,
(rand()%(31+(wave*2))), (rand()%(80+(wave*wave))),
1);
@@ -1387,13 +1424,18 @@
if(asteroid[i].size>0){
/* Break the rock into two smaller ones! */
if(num!=0){
+
+
+//static int FF_add_asteroid(int x, int y, int xspeed, int yspeed, int size, int angle, int
+// angle_speed, int fact_number, int a, int b, int new_wave
+
if(FF_game==FACTOROIDS_GAME){
FF_add_asteroid(asteroid[i].x,
asteroid[i].y,
((asteroid[i].xspeed + xspeed) / 2),
(asteroid[i].yspeed + yspeed),
0,
- 0, 0, (int)(asteroid[i].fact_number/num),
+ rand()%360, rand()%3, (int)(asteroid[i].fact_number/num),
0, 0,
0);
@@ -1402,7 +1444,7 @@
(asteroid[i].xspeed + xspeed),
((asteroid[i].yspeed + yspeed) / 2),
0,
- 0, 0, num,
+ rand()%360, rand()%3, num,
0, 0,
0);
}
@@ -1412,7 +1454,7 @@
((asteroid[i].xspeed + xspeed) / 2),
(asteroid[i].yspeed + yspeed),
0,
- 0, 0, 0,
+ rand()%360, rand()%3, 0,
(int)(asteroid[i].a/num), (int)(asteroid[i].b/num),
0);
@@ -1421,7 +1463,7 @@
(asteroid[i].xspeed + xspeed),
((asteroid[i].yspeed + yspeed) / 2),
0,
- 0, 0, 0,
+ rand()%360, rand()%3, 0,
(int)(asteroid[i].b/num), (int)(asteroid[i].a/num),
0);
}
Modified: tuxmath/branches/factroids/src/fileops.c
===================================================================
--- tuxmath/branches/factroids/src/fileops.c 2008-08-07 15:17:03 UTC (rev 593)
+++ tuxmath/branches/factroids/src/fileops.c 2008-08-07 23:43:22 UTC (rev 594)
@@ -2994,17 +2994,6 @@
DATA_PREFIX "/images/factroids/asteroid2.png",
DATA_PREFIX "/images/factroids/asteroid3.png",
DATA_PREFIX "/images/factroids/ship01.png",
- DATA_PREFIX "/images/factroids/ship02.png",
- DATA_PREFIX "/images/factroids/ship03.png",
- DATA_PREFIX "/images/factroids/ship04.png",
- DATA_PREFIX "/images/factroids/ship05.png",
- DATA_PREFIX "/images/factroids/ship06.png",
- DATA_PREFIX "/images/factroids/ship07.png",
- DATA_PREFIX "/images/factroids/ship08.png",
- DATA_PREFIX "/images/factroids/ship09.png",
- DATA_PREFIX "/images/factroids/ship10.png",
- DATA_PREFIX "/images/factroids/ship11.png",
- DATA_PREFIX "/images/factroids/ship12.png",
DATA_PREFIX "/images/factroids/factoroids.png",
DATA_PREFIX "/images/factroids/factors.png",
DATA_PREFIX "/images/factroids/tux.png"
Modified: tuxmath/branches/factroids/src/fileops.h
===================================================================
--- tuxmath/branches/factroids/src/fileops.h 2008-08-07 15:17:03 UTC (rev 593)
+++ tuxmath/branches/factroids/src/fileops.h 2008-08-07 23:43:22 UTC (rev 594)
@@ -190,17 +190,6 @@
IMG_ASTEROID2,
IMG_ASTEROID3,
IMG_SHIP01,
- IMG_SHIP02,
- IMG_SHIP03,
- IMG_SHIP04,
- IMG_SHIP05,
- IMG_SHIP06,
- IMG_SHIP07,
- IMG_SHIP08,
- IMG_SHIP09,
- IMG_SHIP10,
- IMG_SHIP11,
- IMG_SHIP12,
IMG_FACTOROIDS,
IMG_FACTORS,
IMG_TUX_LITTLE,
More information about the Tux4kids-commits
mailing list