From: Tobias Gläßer Date: Mon, 26 Jul 2004 18:09:14 +0000 (+0000) Subject: Moved defines.h out of the library and back to src/. X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=28a78871d5b6d03c5267b9ef98c7082af5e41a29;p=supertux.git Moved defines.h out of the library and back to src/. Made Menu independend of global MouseCursor variable. SVN-Revision: 1625 --- diff --git a/lib/Makefile.am b/lib/Makefile.am index 8531ec93a..aa7ce72e2 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -31,8 +31,7 @@ libsupertuxmathdir = $(libsupertuxdir)/math libsupertuxspecialdir = $(libsupertuxdir)/special libsupertuxutilsdir = $(libsupertuxdir)/utils libsupertuxvideodir = $(libsupertuxdir)/video -libsupertuxapp_HEADERS =app/defines.h \ - app/setup.h \ +libsupertuxapp_HEADERS =app/setup.h \ app/gettext.h \ app/globals.h libsupertuxaudio_HEADERS =audio/musicref.h \ diff --git a/lib/app/defines.h b/lib/app/defines.h deleted file mode 100644 index 8d1e18459..000000000 --- a/lib/app/defines.h +++ /dev/null @@ -1,101 +0,0 @@ -// $Id$ -// -// SuperTux -// Copyright (C) 2000 Bill Kendrick -// Copyright (C) 2004 Tobias Glaesser -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -// 02111-1307, USA. - -#ifndef SUPERTUX_DEFINES_H -#define SUPERTUX_DEFINES_H 1 - -#include - -/* Version: */ - -#ifndef VERSION - #define VERSION "0.1.1" -#endif - -enum Direction { LEFT = 0, RIGHT = 1 }; - -/* Direction (keyboard/joystick) states: */ - -#define UP 0 -#define DOWN 1 - -/* Dying types: */ - -/* ---- NO 0 */ -enum DyingType { - DYING_NOT = 0, - DYING_SQUISHED = 1, - DYING_FALLING = 2 -}; - -/* Screen-related stuff */ -// +1 is needed because when tiles are wrapping around the screen there -// are two partial tiles on the screen -#define VISIBLE_TILES_X (25 +1) -#define VISIBLE_TILES_Y (19 +1) - -/* Speed constraints: */ - -#define MAX_WALK_XM 2.3 -#define MAX_RUN_XM 3.2 -#define MAX_YM 20.0 -#define MAX_JUMP_TIME 375 -#define MAX_LIVES 99 - -#define WALK_SPEED 1.0 -#define RUN_SPEED 1.5 -#define JUMP_SPEED 1.2 - -/* gameplay related defines */ - -#define START_LIVES 4 - -#define MAX_FIRE_BULLETS 2 -#define MAX_ICE_BULLETS 1 -#define FROZEN_TIME 3000 - -#define YM_FOR_JUMP 6.0 -#define WALK_ACCELERATION_X 0.03 -#define RUN_ACCELERATION_X 0.04 -#define KILL_BOUNCE_YM 8.0 - -#define SKID_XM 2.0 -#define SKID_TIME 200 - -/* Size constraints: */ - -#define X_OFFSCREEN_DISTANCE (screen->w/2) -#define Y_OFFSCREEN_DISTANCE (screen->h/2) - -/* Debugging */ - -#ifdef DEBUG - #define DEBUG_MSG( msg ) { \ - printf( msg ); printf("\n"); \ - } - #else - #define DEBUG_MSG( msg ) {} -#endif - -#define UNUSED_ARG(a) do {/* null */} while (&a == 0) - -#endif /*SUPERTUX_DEFINES_H*/ - diff --git a/lib/app/setup.cpp b/lib/app/setup.cpp index de2e2a9ca..b3c3641f9 100644 --- a/lib/app/setup.cpp +++ b/lib/app/setup.cpp @@ -42,7 +42,6 @@ #include #include "../app/globals.h" -#include "../app/defines.h" #include "../app/setup.h" #include "../video/screen.h" #include "../video/surface.h" @@ -775,8 +774,8 @@ void Setup::parseargs(int argc, char * argv[]) } else if (strcmp(argv[i], "--help") == 0) { /* Show help: */ - puts(_(" SuperTux " VERSION "\n" - " Please see the file \"README.txt\" for more details.\n")); + puts(_((" SuperTux " + package_version + "\n" + " Please see the file \"README.txt\" for more details.\n").c_str())); printf(_("Usage: %s [OPTIONS] FILENAME\n\n"), argv[0]); puts(_("Display Options:\n" " -f, --fullscreen Run in fullscreen mode.\n" diff --git a/lib/gui/menu.cpp b/lib/gui/menu.cpp index 941aa56bc..5e899a884 100644 --- a/lib/gui/menu.cpp +++ b/lib/gui/menu.cpp @@ -892,11 +892,13 @@ Menu::event(SDL_Event& event) y < pos_y + get_height()/2) { active_item = (y - (pos_y - get_height()/2)) / 24; - mouse_cursor->set_state(MC_LINK); + if(MouseCursor::current()) + MouseCursor::current()->set_state(MC_LINK); } else { - mouse_cursor->set_state(MC_NORMAL); + if(MouseCursor::current()) + MouseCursor::current()->set_state(MC_NORMAL); } } break; diff --git a/src/Makefile.am b/src/Makefile.am index be3b636f5..d1cfb86aa 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -5,14 +5,14 @@ supertux_CXXFLAGS = -DLOCALEDIR=\"$(localedir)\" supertux_LDADD = $(top_builddir)/lib/libsupertux.la @LIBINTL@ supertux_SOURCES = badguy.cpp badguy.h bitmask.cpp bitmask.h camera.cpp \ - camera.h collision.cpp collision.h door.cpp door.h intro.cpp intro.h \ - gameloop.cpp gameloop.h high_scores.cpp high_scores.h interactive_object.cpp \ - interactive_object.h level.cpp level.h level_subset.cpp level_subset.h leveleditor.cpp \ - leveleditor.h particlesystem.cpp particlesystem.h player.cpp player.h scene.cpp \ - scene.h special.cpp special.h supertux.cpp title.cpp title.h worldmap.cpp \ - worldmap.h tile.h tile.cpp tile_manager.h tile_manager.cpp resources.h \ - resources.cpp gameobjs.h gameobjs.cpp background.h background.cpp tilemap.h \ - tilemap.cpp serializable.h sector.cpp sector.h misc.h misc.cpp + camera.h collision.cpp collision.h door.cpp door.h intro.cpp intro.h \ + gameloop.cpp gameloop.h high_scores.cpp high_scores.h interactive_object.cpp \ + interactive_object.h level.cpp level.h level_subset.cpp level_subset.h leveleditor.cpp \ + leveleditor.h particlesystem.cpp particlesystem.h player.cpp player.h scene.cpp \ + scene.h special.cpp special.h supertux.cpp title.cpp title.h worldmap.cpp \ + worldmap.h tile.h tile.cpp tile_manager.h tile_manager.cpp resources.h \ + resources.cpp gameobjs.h gameobjs.cpp background.h background.cpp tilemap.h \ + tilemap.cpp serializable.h sector.cpp sector.h misc.h misc.cpp defines.h # EOF # INCLUDES = -I$(top_srcdir)/lib diff --git a/src/badguy.cpp b/src/badguy.cpp index b3ef65d1f..6ace8e3a3 100644 --- a/src/badguy.cpp +++ b/src/badguy.cpp @@ -24,7 +24,7 @@ #include #include "app/globals.h" -#include "app/defines.h" +#include "defines.h" #include "special/sprite_manager.h" #include "utils/lispwriter.h" #include "badguy.h" diff --git a/src/badguy.h b/src/badguy.h index 6a01e5eff..624d7ec60 100644 --- a/src/badguy.h +++ b/src/badguy.h @@ -29,7 +29,7 @@ #include "video/surface.h" #include "math/physic.h" #include "special/sprite.h" -#include "app/defines.h" +#include "defines.h" #include "special/moving_object.h" #include "collision.h" #include "serializable.h" diff --git a/src/camera.h b/src/camera.h index 5af777eae..bad7fdf2a 100644 --- a/src/camera.h +++ b/src/camera.h @@ -23,7 +23,7 @@ #include #include -#include "app/defines.h" +#include "defines.h" #include "math/vector.h" #include "special/game_object.h" #include "video/drawing_context.h" diff --git a/src/collision.cpp b/src/collision.cpp index 1620a2aba..716c05aa5 100644 --- a/src/collision.cpp +++ b/src/collision.cpp @@ -19,7 +19,7 @@ // 02111-1307, USA. #include -#include "app/defines.h" +#include "defines.h" #include "collision.h" #include "bitmask.h" #include "scene.h" diff --git a/src/defines.h b/src/defines.h new file mode 100644 index 000000000..8d1e18459 --- /dev/null +++ b/src/defines.h @@ -0,0 +1,101 @@ +// $Id$ +// +// SuperTux +// Copyright (C) 2000 Bill Kendrick +// Copyright (C) 2004 Tobias Glaesser +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +// 02111-1307, USA. + +#ifndef SUPERTUX_DEFINES_H +#define SUPERTUX_DEFINES_H 1 + +#include + +/* Version: */ + +#ifndef VERSION + #define VERSION "0.1.1" +#endif + +enum Direction { LEFT = 0, RIGHT = 1 }; + +/* Direction (keyboard/joystick) states: */ + +#define UP 0 +#define DOWN 1 + +/* Dying types: */ + +/* ---- NO 0 */ +enum DyingType { + DYING_NOT = 0, + DYING_SQUISHED = 1, + DYING_FALLING = 2 +}; + +/* Screen-related stuff */ +// +1 is needed because when tiles are wrapping around the screen there +// are two partial tiles on the screen +#define VISIBLE_TILES_X (25 +1) +#define VISIBLE_TILES_Y (19 +1) + +/* Speed constraints: */ + +#define MAX_WALK_XM 2.3 +#define MAX_RUN_XM 3.2 +#define MAX_YM 20.0 +#define MAX_JUMP_TIME 375 +#define MAX_LIVES 99 + +#define WALK_SPEED 1.0 +#define RUN_SPEED 1.5 +#define JUMP_SPEED 1.2 + +/* gameplay related defines */ + +#define START_LIVES 4 + +#define MAX_FIRE_BULLETS 2 +#define MAX_ICE_BULLETS 1 +#define FROZEN_TIME 3000 + +#define YM_FOR_JUMP 6.0 +#define WALK_ACCELERATION_X 0.03 +#define RUN_ACCELERATION_X 0.04 +#define KILL_BOUNCE_YM 8.0 + +#define SKID_XM 2.0 +#define SKID_TIME 200 + +/* Size constraints: */ + +#define X_OFFSCREEN_DISTANCE (screen->w/2) +#define Y_OFFSCREEN_DISTANCE (screen->h/2) + +/* Debugging */ + +#ifdef DEBUG + #define DEBUG_MSG( msg ) { \ + printf( msg ); printf("\n"); \ + } + #else + #define DEBUG_MSG( msg ) {} +#endif + +#define UNUSED_ARG(a) do {/* null */} while (&a == 0) + +#endif /*SUPERTUX_DEFINES_H*/ + diff --git a/src/gameloop.cpp b/src/gameloop.cpp index a5c17b787..1fa2f9318 100644 --- a/src/gameloop.cpp +++ b/src/gameloop.cpp @@ -36,7 +36,7 @@ #include #endif -#include "app/defines.h" +#include "defines.h" #include "app/globals.h" #include "gameloop.h" #include "video/screen.h" diff --git a/src/intro.cpp b/src/intro.cpp index a2a438a51..193763942 100644 --- a/src/intro.cpp +++ b/src/intro.cpp @@ -19,7 +19,7 @@ #include "intro.h" #include "app/globals.h" -#include "app/defines.h" +#include "defines.h" #include "video/font.h" #include "video/screen.h" #include "resources.h" diff --git a/src/leveleditor.cpp b/src/leveleditor.cpp index 49cfa354d..15b2d572c 100644 --- a/src/leveleditor.cpp +++ b/src/leveleditor.cpp @@ -34,7 +34,7 @@ #include "leveleditor.h" #include "video/screen.h" -#include "app/defines.h" +#include "defines.h" #include "app/globals.h" #include "app/setup.h" #include "sector.h" diff --git a/src/player.cpp b/src/player.cpp index d52d28ab9..84d2f023f 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -24,7 +24,7 @@ #include "gameloop.h" #include "app/globals.h" #include "player.h" -#include "app/defines.h" +#include "defines.h" #include "scene.h" #include "tile.h" #include "special/sprite.h" diff --git a/src/player.h b/src/player.h index ca8aa538b..6b1133e64 100644 --- a/src/player.h +++ b/src/player.h @@ -29,7 +29,7 @@ #include "collision.h" #include "special/moving_object.h" #include "math/physic.h" -#include "app/defines.h" +#include "defines.h" using namespace SuperTux; diff --git a/src/scene.cpp b/src/scene.cpp index 7c3561485..238039e90 100644 --- a/src/scene.cpp +++ b/src/scene.cpp @@ -20,7 +20,7 @@ #include #include "scene.h" -#include "app/defines.h" +#include "defines.h" PlayerStatus player_status; diff --git a/src/special.cpp b/src/special.cpp index 7762d2752..0b37359e9 100644 --- a/src/special.cpp +++ b/src/special.cpp @@ -22,7 +22,7 @@ #include "SDL.h" -#include "app/defines.h" +#include "defines.h" #include "special.h" #include "camera.h" #include "gameloop.h" diff --git a/src/supertux.cpp b/src/supertux.cpp index d089f0131..c29d7f3b7 100644 --- a/src/supertux.cpp +++ b/src/supertux.cpp @@ -24,7 +24,7 @@ #include #include "utils/exceptions.h" -#include "app/defines.h" +#include "defines.h" #include "app/globals.h" #include "app/setup.h" #include "intro.h" diff --git a/src/title.cpp b/src/title.cpp index 6410e01d0..a12c855fd 100644 --- a/src/title.cpp +++ b/src/title.cpp @@ -34,7 +34,7 @@ #include #endif -#include "app/defines.h" +#include "defines.h" #include "app/globals.h" #include "title.h" #include "video/screen.h"