balder-cvs Mailing List for Balder (Page 3)
Status: Beta
Brought to you by:
holomorph
You can subscribe to this list here.
2006 |
Jan
|
Feb
(58) |
Mar
(196) |
Apr
(16) |
May
(17) |
Jun
(34) |
Jul
|
Aug
(4) |
Sep
(31) |
Oct
(43) |
Nov
(18) |
Dec
(11) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(4) |
Aug
(7) |
Sep
|
Oct
(14) |
Nov
(11) |
Dec
(9) |
2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(13) |
Jun
(5) |
Jul
(21) |
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
2016 |
Jan
|
Feb
|
Mar
|
Apr
(2) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <col...@us...> - 2007-12-03 19:38:49
|
Revision: 91 http://balder.svn.sourceforge.net/balder/?rev=91&view=rev Author: colalord Date: 2007-12-03 11:38:51 -0800 (Mon, 03 Dec 2007) Log Message: ----------- 3 Dec-2007 - Reuben moved all of the widgets in the /menu/ dir to /menu/widgets/ Modified Paths: -------------- Balder2D-Win.cbp history.txt include/menu/gamesetup.h include/menu/mainmenu.h include/menu/menu.h include/menu/options.h include/menu/playersetup.h include/menu/soundvideo.h include/menu/submenu.h src/menu/gamesetup.cpp src/menu/mainmenu.cpp src/menu/menu.cpp src/menu/options.cpp src/menu/playersetup.cpp src/menu/soundvideo.cpp src/menu/submenu.cpp Added Paths: ----------- include/menu/widgets/ include/menu/widgets/ailistmodel.h include/menu/widgets/animation.h include/menu/widgets/maplistmodel.h include/menu/widgets/numberfield.h include/menu/widgets/samplemap.h include/menu/widgets/sampleprobe.h include/menu/widgets/skinnedbutton.h include/menu/widgets/skinnedcheckbox.h src/menu/widgets/ src/menu/widgets/ailistmodel.cpp src/menu/widgets/animation.cpp src/menu/widgets/maplistmodel.cpp src/menu/widgets/numberfield.cpp src/menu/widgets/samplemap.cpp src/menu/widgets/sampleprobe.cpp src/menu/widgets/skinnedbutton.cpp src/menu/widgets/skinnedcheckbox.cpp Removed Paths: ------------- include/menu/ailistmodel.h include/menu/animationwidget.h include/menu/maplistmodel.h include/menu/numberfield.h include/menu/samplemapwidget.h include/menu/sampleprobewidget.h include/menu/skinnedbuttonwidget.h include/menu/widgetskinnedcheckbox.h src/menu/ailistmodel.cpp src/menu/animationwidget.cpp src/menu/maplistmodel.cpp src/menu/numberfield.cpp src/menu/samplemapwidget.cpp src/menu/sampleprobewidget.cpp src/menu/skinnedbuttonwidget.cpp src/menu/widgetskinnedcheckbox.cpp Modified: Balder2D-Win.cbp =================================================================== --- Balder2D-Win.cbp 2007-12-02 02:18:34 UTC (rev 90) +++ Balder2D-Win.cbp 2007-12-03 19:38:51 UTC (rev 91) @@ -56,21 +56,21 @@ <Unit filename="include\input.h" /> <Unit filename="include\log.h" /> <Unit filename="include\mapparser.h" /> - <Unit filename="include\menu\ailistmodel.h" /> - <Unit filename="include\menu\animationwidget.h" /> <Unit filename="include\menu\gamesetup.h" /> <Unit filename="include\menu\mainmenu.h" /> - <Unit filename="include\menu\maplistmodel.h" /> <Unit filename="include\menu\menu.h" /> - <Unit filename="include\menu\numberfield.h" /> <Unit filename="include\menu\options.h" /> <Unit filename="include\menu\playersetup.h" /> - <Unit filename="include\menu\samplemapwidget.h" /> - <Unit filename="include\menu\sampleprobewidget.h" /> - <Unit filename="include\menu\skinnedbuttonwidget.h" /> <Unit filename="include\menu\soundvideo.h" /> <Unit filename="include\menu\submenu.h" /> - <Unit filename="include\menu\widgetskinnedcheckbox.h" /> + <Unit filename="include\menu\widgets\ailistmodel.h" /> + <Unit filename="include\menu\widgets\animation.h" /> + <Unit filename="include\menu\widgets\maplistmodel.h" /> + <Unit filename="include\menu\widgets\numberfield.h" /> + <Unit filename="include\menu\widgets\samplemap.h" /> + <Unit filename="include\menu\widgets\sampleprobe.h" /> + <Unit filename="include\menu\widgets\skinnedbutton.h" /> + <Unit filename="include\menu\widgets\skinnedcheckbox.h" /> <Unit filename="include\player.h" /> <Unit filename="include\powerup.h" /> <Unit filename="include\powerupfactory.h" /> @@ -97,21 +97,21 @@ <Unit filename="src\log.cpp" /> <Unit filename="src\main.cpp" /> <Unit filename="src\mapparser.cpp" /> - <Unit filename="src\menu\ailistmodel.cpp" /> - <Unit filename="src\menu\animationwidget.cpp" /> <Unit filename="src\menu\gamesetup.cpp" /> <Unit filename="src\menu\mainmenu.cpp" /> - <Unit filename="src\menu\maplistmodel.cpp" /> <Unit filename="src\menu\menu.cpp" /> - <Unit filename="src\menu\numberfield.cpp" /> <Unit filename="src\menu\options.cpp" /> <Unit filename="src\menu\playersetup.cpp" /> - <Unit filename="src\menu\samplemapwidget.cpp" /> - <Unit filename="src\menu\sampleprobewidget.cpp" /> - <Unit filename="src\menu\skinnedbuttonwidget.cpp" /> <Unit filename="src\menu\soundvideo.cpp" /> <Unit filename="src\menu\submenu.cpp" /> - <Unit filename="src\menu\widgetskinnedcheckbox.cpp" /> + <Unit filename="src\menu\widgets\ailistmodel.cpp" /> + <Unit filename="src\menu\widgets\animation.cpp" /> + <Unit filename="src\menu\widgets\maplistmodel.cpp" /> + <Unit filename="src\menu\widgets\numberfield.cpp" /> + <Unit filename="src\menu\widgets\samplemap.cpp" /> + <Unit filename="src\menu\widgets\sampleprobe.cpp" /> + <Unit filename="src\menu\widgets\skinnedbutton.cpp" /> + <Unit filename="src\menu\widgets\skinnedcheckbox.cpp" /> <Unit filename="src\player.cpp" /> <Unit filename="src\powerup.cpp" /> <Unit filename="src\powerupfactory.cpp" /> Modified: history.txt =================================================================== --- history.txt 2007-12-02 02:18:34 UTC (rev 90) +++ history.txt 2007-12-03 19:38:51 UTC (rev 91) @@ -3,6 +3,9 @@ History entries are in reverse chronological order (newest entries first). +3 Dec-2007 + - Reuben moved all of the widgets in the /menu/ dir to /menu/widgets/ + 1 Dec-2007 - Bjorn fixed the bug where AI selection box and color sliders didn't work because refreshKeys() was being called first thing in the action handler and setting them Deleted: include/menu/ailistmodel.h =================================================================== --- include/menu/ailistmodel.h 2007-12-02 02:18:34 UTC (rev 90) +++ include/menu/ailistmodel.h 2007-12-03 19:38:51 UTC (rev 91) @@ -1,43 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2005 by Bjorn Hansen * - * hol...@us... * - * * - * 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 AILISTMODEL_H -#define AILISTMODEL_H - -#include <guichan/listmodel.hpp> -#include <vector> - -namespace Balder { - -class AIListModel : public gcn::ListModel{ -public: - - AIListModel(); - virtual ~AIListModel(); - virtual int getNumberOfElements () {return numScripts;} - virtual std::string getElementAt (int i) {return scriptnames[i];} - int FindScriptIndex(std::string scriptname); -private: - void FindScripts(); - int numScripts; - std::vector<std::string> scriptnames; -}; -} -#endif // AILISTMODEL_H Deleted: include/menu/animationwidget.h =================================================================== --- include/menu/animationwidget.h 2007-12-02 02:18:34 UTC (rev 90) +++ include/menu/animationwidget.h 2007-12-03 19:38:51 UTC (rev 91) @@ -1,81 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006 by Bjorn Hansen * - * hol...@us... * - * * - * 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 BALDERANIMATIONWIDGET_H -#define BALDERANIMATIONWIDGET_H - -#include <guichan/image.hpp> -#include <guichan/widget.hpp> -#include "../balder2dtypes.h" - -namespace Balder -{ - /** - * An Icon for displaying an animated image. - */ - class AnimationWidget: public gcn::Widget - { - public: - // Constructor and Destructor. - AnimationWidget(std::string, bool, bool, bool, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int); - ~AnimationWidget(); - - // Controls whether or not there is a base frame in the animation background. - void setAnimationHasBaseFrame(bool aHBF) { animationHasBaseFrame = aHBF; } - const bool getAnimationHasBaseFrame() { return animationHasBaseFrame; } - - // Controls loop feature for playback. - void setAnimationLooped(bool aL) { animationLooped = aL; } - const bool getAnimationLooped() { return animationLooped; } - - // Playback control. - const bool getAnimationPlaying() { return animationPlaying; } // Chacks to see if animation is currently playing. - void Play(); // Starts to play animation from frameCurrent. - void Stop() { animationPlaying = false; } // Stops playing animation at frameCurrent. - void Restart(); // Resets frameCurrent to frameStart and then starts playing animation. - - // Animates next frame if playing. - void Animate(); - - // Inherited from gcn::Widget - virtual void draw(gcn::Graphics* graphics); - - private: - // Animation Variables. - SDL_Surface* animationFrameStrip; - std::string animationFileName; - bool animationHasBaseFrame; - bool animationLooped; - bool animationPlaying; - unsigned int animationStripLocation; - - // Frame Variables. - unsigned int frameWidth; - unsigned int frameHeight; - unsigned int frameBase; - unsigned int frameStart; - unsigned int frameQuantity; - unsigned int frameInterval; - unsigned int frameCurrent; - Uint32 frameTimer; - }; -} - -#endif // BALDERANIMATIONWIDGET_H Modified: include/menu/gamesetup.h =================================================================== --- include/menu/gamesetup.h 2007-12-02 02:18:34 UTC (rev 90) +++ include/menu/gamesetup.h 2007-12-03 19:38:51 UTC (rev 91) @@ -25,10 +25,10 @@ namespace Balder { -class SampleMapWidget; +class SampleMap; class MapListModel; -class SkinnedButtonWidget; -class WidgetSkinnedCheckBox; +class SkinnedButton; +class SkinnedCheckBox; class GameSetupMenu:public SubMenu { @@ -37,16 +37,16 @@ virtual ~GameSetupMenu(); void action(const gcn::ActionEvent& action); private: - SkinnedButtonWidget* backButton; - SampleMapWidget* sampleMap; + SkinnedButton* backButton; + SampleMap* sampleMap; gcn::Label* mapnameLabel; MapListModel* maplistModel; gcn::DropDown* mapDropDown; gcn::ScrollArea* mapScrollArea; gcn::ListBox* mapListBox; - WidgetSkinnedCheckBox* scoreLimitSelector; - WidgetSkinnedCheckBox* timeLimitSelector; - WidgetSkinnedCheckBox* lifeLimitSelector; + SkinnedCheckBox* scoreLimitSelector; + SkinnedCheckBox* timeLimitSelector; + SkinnedCheckBox* lifeLimitSelector; NumberField* scoreLimitValue; NumberField* timeLimitValue; NumberField* lifeLimitValue; Modified: include/menu/mainmenu.h =================================================================== --- include/menu/mainmenu.h 2007-12-02 02:18:34 UTC (rev 90) +++ include/menu/mainmenu.h 2007-12-03 19:38:51 UTC (rev 91) @@ -36,9 +36,9 @@ private: Menu* system; SubMenu* optionsMenu; - SkinnedButtonWidget* startButton; - SkinnedButtonWidget* optionsButton; - SkinnedButtonWidget* quitButton; + SkinnedButton* startButton; + SkinnedButton* optionsButton; + SkinnedButton* quitButton; gcn::Label* versionLabel; }; } Deleted: include/menu/maplistmodel.h =================================================================== --- include/menu/maplistmodel.h 2007-12-02 02:18:34 UTC (rev 90) +++ include/menu/maplistmodel.h 2007-12-03 19:38:51 UTC (rev 91) @@ -1,43 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2005 by Bjorn Hansen * - * hol...@us... * - * * - * 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 MAPLISTMODEL_H -#define MAPLISTMODEL_H - -#include <guichan/listmodel.hpp> -#include <vector> - -namespace Balder { - -class MapListModel : public gcn::ListModel{ -public: - - MapListModel(); - virtual ~MapListModel(); - virtual int getNumberOfElements () {return numMaps;} - virtual std::string getElementAt (int i) {return mapnames[i];} - int FindMapIndex(std::string mapname); -private: - void FindMaps(); - int numMaps; - std::vector<std::string> mapnames; -}; -} -#endif // MAPLISTMODEL_H Modified: include/menu/menu.h =================================================================== --- include/menu/menu.h 2007-12-02 02:18:34 UTC (rev 90) +++ include/menu/menu.h 2007-12-03 19:38:51 UTC (rev 91) @@ -23,8 +23,8 @@ #include <guichan.hpp> #include <guichan/sdl.hpp> -#include "menu/animationwidget.h" -#include "numberfield.h" +#include "menu/widgets/animation.h" +#include "menu/widgets/numberfield.h" namespace Balder { @@ -60,8 +60,8 @@ gcn::ImageFont* font; // A font gcn::Container* topContainer; // A top container // stuff that goes in the top container - AnimationWidget* pulseAnimation; // to display background anitmation - AnimationWidget* twinkleAnimation; // to display background anitmation + Animation* pulseAnimation; // to display background anitmation + Animation* twinkleAnimation; // to display background anitmation gcn::Icon* headerIcon; // to show a title image gcn::Image* headerImage; // the image to use gcn::Icon* backgroundIcon; Deleted: include/menu/numberfield.h =================================================================== --- include/menu/numberfield.h 2007-12-02 02:18:34 UTC (rev 90) +++ include/menu/numberfield.h 2007-12-03 19:38:51 UTC (rev 91) @@ -1,39 +0,0 @@ -// -// C++ Interface: numberfield -// -// Description: -// -// -// Author: Bjorn Hansen <Hol...@us...>, (C) 2005 -// -// Copyright: See COPYING file that comes with this distribution -// -// -#ifndef BALDERNUMBERFIELD_H -#define BALDERNUMBERFIELD_H - -#include <guichan/widgets/textfield.hpp> - -namespace Balder { - -/** -a text field that only accepts numerical input - -@author Bjorn Hansen -*/ -class NumberField : public gcn::TextField -{ -public: - NumberField(int n, int maxDigits = 3); - virtual void mousePressed(gcn::MouseEvent &e); - virtual void keyPress (const gcn::Key &key); - virtual void draw(gcn::Graphics*); - int getValue(); - void setValue(int n); -private: - int digits; -}; - -} - -#endif Modified: include/menu/options.h =================================================================== --- include/menu/options.h 2007-12-02 02:18:34 UTC (rev 90) +++ include/menu/options.h 2007-12-03 19:38:51 UTC (rev 91) @@ -36,14 +36,14 @@ SubMenu* gameSetupMenu; SubMenu* playerSetupMenu; SubMenu* soundVideoMenu; - SkinnedButtonWidget* backButton; - SkinnedButtonWidget* gameSetupButton; - SkinnedButtonWidget* soundVideoButton; - SkinnedButtonWidget* playersButton; + SkinnedButton* backButton; + SkinnedButton* gameSetupButton; + SkinnedButton* soundVideoButton; + SkinnedButton* playersButton; gcn::Label* numPlayersLabel; // to display current number of local players int numPlayers; - SkinnedButtonWidget* morePlayersButton; - SkinnedButtonWidget* lessPlayersButton; + SkinnedButton* morePlayersButton; + SkinnedButton* lessPlayersButton; }; } #endif // OPTIONSMENU_H Modified: include/menu/playersetup.h =================================================================== --- include/menu/playersetup.h 2007-12-02 02:18:34 UTC (rev 90) +++ include/menu/playersetup.h 2007-12-03 19:38:51 UTC (rev 91) @@ -26,8 +26,8 @@ namespace Balder { class AIListModel; - class SampleProbeWidget; - class SkinnedButtonWidget; + class SampleProbe; + class SkinnedButton; class PlayerSetupMenu:public SubMenu, public gcn::KeyListener { @@ -38,20 +38,20 @@ void keyPressed(gcn::KeyEvent &keyEvent); private: void RefreshKeys(); - SkinnedButtonWidget* backButton; - SkinnedButtonWidget* nextPlayerButton; - SkinnedButtonWidget* prevPlayerButton; + SkinnedButton* backButton; + SkinnedButton* nextPlayerButton; + SkinnedButton* prevPlayerButton; gcn::Label* currentPlayerLabel; int currentPlayer; bool bindNextKey; const char* actionToBind; - SkinnedButtonWidget* setRotateRightButton; + SkinnedButton* setRotateRightButton; gcn::Label* rotateRightLabel; - SkinnedButtonWidget* setRotateLeftButton; + SkinnedButton* setRotateLeftButton; gcn::Label* rotateLeftLabel; - SkinnedButtonWidget* setStickPushButton; + SkinnedButton* setStickPushButton; gcn::Label* stickPushLabel; - SkinnedButtonWidget* setFireButton; + SkinnedButton* setFireButton; gcn::Label* fireLabel; gcn::Label* aiLabel; AIListModel* ailistModel; @@ -67,7 +67,7 @@ gcn::Image* blueImage; gcn::Icon* blueIcon; gcn::Slider* blueSlider; - SampleProbeWidget* sampleProbe; + SampleProbe* sampleProbe; int colorTop; int colorLeft; Deleted: include/menu/samplemapwidget.h =================================================================== --- include/menu/samplemapwidget.h 2007-12-02 02:18:34 UTC (rev 90) +++ include/menu/samplemapwidget.h 2007-12-03 19:38:51 UTC (rev 91) @@ -1,53 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006 by Bjorn Hansen * - * hol...@us... * - * * - * 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 BALDERSAMPLEMAPWIDGET_H -#define BALDERSAMPLEMAPWIDGET_H - -#include <guichan/widget.hpp> -#include "../balder2dtypes.h" - -namespace Balder -{ - /* - * An Icon for displaying a sample of the map. - */ - class SampleMapWidget: public gcn::Widget - { - public: - /* - * Constructor. - * - * @param image an Image to display. - */ - SampleMapWidget(std::string iniMapName, unsigned int X, unsigned int Y, unsigned int W, unsigned int H); - ~SampleMapWidget(); - - void setSampleMap(std::string name); - - // Inherited from Widget - virtual void draw(gcn::Graphics* graphics); - - private: - SDL_Surface* map; - }; -} - -#endif // BALDERSAMPLEMAPWIDGET_H Deleted: include/menu/sampleprobewidget.h =================================================================== --- include/menu/sampleprobewidget.h 2007-12-02 02:18:34 UTC (rev 90) +++ include/menu/sampleprobewidget.h 2007-12-03 19:38:51 UTC (rev 91) @@ -1,63 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006 by Bjorn Hansen * - * hol...@us... * - * * - * 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 BALDERSAMPLEPROBEWIDGET_H -#define BALDERSAMPLEPROBEWIDGET_H - -#include <guichan/image.hpp> -#include <guichan/widget.hpp> -#include "../balder2dtypes.h" - -namespace Balder -{ -// This is the interval (in milliseconds) in between frames for the sample probe -const int SAMPLEPROBE_FRAME_INTERVAL = 50; - - /** - * An Icon for displaying an animated sample probe. - */ - class SampleProbeWidget: public gcn::Widget - { - public: - /** - * Constructor. - * - * @param image an Image to display. - */ - SampleProbeWidget(); - - - // Inherited from Widget - - virtual void draw(gcn::Graphics* graphics); - - virtual void drawBorder(gcn::Graphics* graphics); - - void setProbeColor(probe_color c) { probeColor = c;} - - private: - gcn::Image* probeSpriteImage; - probe_color probeColor; - unsigned int probeFrame; - Uint32 frameTimer; - }; -} - -#endif // BALDERSAMPLEPROBEWIDGET_H Deleted: include/menu/skinnedbuttonwidget.h =================================================================== --- include/menu/skinnedbuttonwidget.h 2007-12-02 02:18:34 UTC (rev 90) +++ include/menu/skinnedbuttonwidget.h 2007-12-03 19:38:51 UTC (rev 91) @@ -1,58 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006 by Bjorn Hansen * - * hol...@us... * - * * - * 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 BALDERSKINNEDBUTTONWIDGET_H -#define BALDERSKINNEDBUTTONWIDGET_H - -#define buttonUp 0 -#define buttonDown 1 -#define widgetFocused 2 - -#include <guichan/widgets/button.hpp> -#include "../balder2dtypes.h" - -namespace Balder -{ - /** - * An Icon for displaying an animated image. - */ - class SkinnedButtonWidget: public gcn::Button - { - public: - // Constructor and Destructor. - SkinnedButtonWidget(std::string, std::string, unsigned int = 0); - ~SkinnedButtonWidget(); - - // Inherited from gcn::Widget - virtual void draw(gcn::Graphics* graphics); - virtual void drawBorder(gcn::Graphics* graphics); - - private: - // Skin Variables. - SDL_Surface* skinFrameStrip; - std::string skinFileName; - unsigned int skinStripLocation; - - // Button Variables. - unsigned int buttonState; - }; -} - -#endif // BALDERSKINNEDBUTTONWIDGET_H Modified: include/menu/soundvideo.h =================================================================== --- include/menu/soundvideo.h 2007-12-02 02:18:34 UTC (rev 90) +++ include/menu/soundvideo.h 2007-12-03 19:38:51 UTC (rev 91) @@ -25,7 +25,7 @@ namespace Balder { -class WidgetSkinnedCheckBox; +class SkinnedCheckBox; class SoundVideoMenu:public SubMenu { @@ -34,10 +34,10 @@ virtual ~SoundVideoMenu(); void action(const gcn::ActionEvent& action); private: - SkinnedButtonWidget* backButton; - WidgetSkinnedCheckBox* fullScreenCheckbox; - WidgetSkinnedCheckBox* soundCheckbox; - WidgetSkinnedCheckBox* musicCheckbox; + SkinnedButton* backButton; + SkinnedCheckBox* fullScreenCheckbox; + SkinnedCheckBox* soundCheckbox; + SkinnedCheckBox* musicCheckbox; gcn::Label* fxVolumeLabel; gcn::Label* musicVolumeLabel; gcn::Slider* fxVolumeSlider; Modified: include/menu/submenu.h =================================================================== --- include/menu/submenu.h 2007-12-02 02:18:34 UTC (rev 90) +++ include/menu/submenu.h 2007-12-03 19:38:51 UTC (rev 91) @@ -23,9 +23,9 @@ #include <guichan.hpp> #include <guichan/sdl.hpp> -#include "animationwidget.h" -#include "numberfield.h" -#include "skinnedbuttonwidget.h" +#include "menu/widgets/animation.h" +#include "menu/widgets/numberfield.h" +#include "menu/widgets/skinnedbutton.h" namespace Balder { @@ -55,7 +55,7 @@ virtual void action(const std::string& action){} - AnimationWidget* animationPageBackground; + Animation* animationPageBackground; }; } Added: include/menu/widgets/ailistmodel.h =================================================================== --- include/menu/widgets/ailistmodel.h (rev 0) +++ include/menu/widgets/ailistmodel.h 2007-12-03 19:38:51 UTC (rev 91) @@ -0,0 +1,43 @@ +/*************************************************************************** + * Copyright (C) 2005 by Bjorn Hansen * + * hol...@us... * + * * + * 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 AILISTMODEL_H +#define AILISTMODEL_H + +#include <guichan/listmodel.hpp> +#include <vector> + +namespace Balder { + +class AIListModel : public gcn::ListModel{ +public: + + AIListModel(); + virtual ~AIListModel(); + virtual int getNumberOfElements () {return numScripts;} + virtual std::string getElementAt (int i) {return scriptnames[i];} + int FindScriptIndex(std::string scriptname); +private: + void FindScripts(); + int numScripts; + std::vector<std::string> scriptnames; +}; +} +#endif // AILISTMODEL_H Added: include/menu/widgets/animation.h =================================================================== --- include/menu/widgets/animation.h (rev 0) +++ include/menu/widgets/animation.h 2007-12-03 19:38:51 UTC (rev 91) @@ -0,0 +1,81 @@ +/*************************************************************************** + * Copyright (C) 2006 by Bjorn Hansen * + * hol...@us... * + * * + * 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 BALDERANIMATION_H +#define BALDERANIMATION_H + +#include <guichan/image.hpp> +#include <guichan/widget.hpp> +#include "../../balder2dtypes.h" + +namespace Balder +{ + /** + * An Icon for displaying an animated image. + */ + class Animation: public gcn::Widget + { + public: + // Constructor and Destructor. + Animation(std::string, bool, bool, bool, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int); + ~Animation(); + + // Controls whether or not there is a base frame in the animation background. + void setAnimationHasBaseFrame(bool aHBF) { animationHasBaseFrame = aHBF; } + const bool getAnimationHasBaseFrame() { return animationHasBaseFrame; } + + // Controls loop feature for playback. + void setAnimationLooped(bool aL) { animationLooped = aL; } + const bool getAnimationLooped() { return animationLooped; } + + // Playback control. + const bool getAnimationPlaying() { return animationPlaying; } // Chacks to see if animation is currently playing. + void Play(); // Starts to play animation from frameCurrent. + void Stop() { animationPlaying = false; } // Stops playing animation at frameCurrent. + void Restart(); // Resets frameCurrent to frameStart and then starts playing animation. + + // Animates next frame if playing. + void Animate(); + + // Inherited from gcn::Widget + virtual void draw(gcn::Graphics* graphics); + + private: + // Animation Variables. + SDL_Surface* animationFrameStrip; + std::string animationFileName; + bool animationHasBaseFrame; + bool animationLooped; + bool animationPlaying; + unsigned int animationStripLocation; + + // Frame Variables. + unsigned int frameWidth; + unsigned int frameHeight; + unsigned int frameBase; + unsigned int frameStart; + unsigned int frameQuantity; + unsigned int frameInterval; + unsigned int frameCurrent; + Uint32 frameTimer; + }; +} + +#endif // BALDERANIMATION_H Added: include/menu/widgets/maplistmodel.h =================================================================== --- include/menu/widgets/maplistmodel.h (rev 0) +++ include/menu/widgets/maplistmodel.h 2007-12-03 19:38:51 UTC (rev 91) @@ -0,0 +1,43 @@ +/*************************************************************************** + * Copyright (C) 2005 by Bjorn Hansen * + * hol...@us... * + * * + * 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 MAPLISTMODEL_H +#define MAPLISTMODEL_H + +#include <guichan/listmodel.hpp> +#include <vector> + +namespace Balder { + +class MapListModel : public gcn::ListModel{ +public: + + MapListModel(); + virtual ~MapListModel(); + virtual int getNumberOfElements () {return numMaps;} + virtual std::string getElementAt (int i) {return mapnames[i];} + int FindMapIndex(std::string mapname); +private: + void FindMaps(); + int numMaps; + std::vector<std::string> mapnames; +}; +} +#endif // MAPLISTMODEL_H Added: include/menu/widgets/numberfield.h =================================================================== --- include/menu/widgets/numberfield.h (rev 0) +++ include/menu/widgets/numberfield.h 2007-12-03 19:38:51 UTC (rev 91) @@ -0,0 +1,43 @@ +/*************************************************************************** + * Copyright (C) 2005 by Bjorn Hansen * + * hol...@us... * + * * + * 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 BALDERNUMBERFIELD_H +#define BALDERNUMBERFIELD_H + +#include <guichan/widgets/textfield.hpp> + +namespace Balder { + +class NumberField : public gcn::TextField +{ +public: + NumberField(int n, int maxDigits = 3); + virtual void mousePressed(gcn::MouseEvent &e); + virtual void keyPress (const gcn::Key &key); + virtual void draw(gcn::Graphics*); + int getValue(); + void setValue(int n); +private: + int digits; +}; + +} + +#endif Added: include/menu/widgets/samplemap.h =================================================================== --- include/menu/widgets/samplemap.h (rev 0) +++ include/menu/widgets/samplemap.h 2007-12-03 19:38:51 UTC (rev 91) @@ -0,0 +1,53 @@ +/*************************************************************************** + * Copyright (C) 2006 by Bjorn Hansen * + * hol...@us... * + * * + * 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 BALDERSAMPLEMAP_H +#define BALDERSAMPLEMAP_H + +#include <guichan/widget.hpp> +#include "../../balder2dtypes.h" + +namespace Balder +{ + /* + * An Icon for displaying a sample of the map. + */ + class SampleMap: public gcn::Widget + { + public: + /* + * Constructor. + * + * @param image an Image to display. + */ + SampleMap(std::string iniMapName, unsigned int X, unsigned int Y, unsigned int W, unsigned int H); + ~SampleMap(); + + void setSampleMap(std::string name); + + // Inherited from Widget + virtual void draw(gcn::Graphics* graphics); + + private: + SDL_Surface* map; + }; +} + +#endif // BALDERSAMPLEMAP_H Added: include/menu/widgets/sampleprobe.h =================================================================== --- include/menu/widgets/sampleprobe.h (rev 0) +++ include/menu/widgets/sampleprobe.h 2007-12-03 19:38:51 UTC (rev 91) @@ -0,0 +1,63 @@ +/*************************************************************************** + * Copyright (C) 2006 by Bjorn Hansen * + * hol...@us... * + * * + * 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 BALDERSAMPLEPROBE_H +#define BALDERSAMPLEPROBE_H + +#include <guichan/image.hpp> +#include <guichan/widget.hpp> +#include "../../balder2dtypes.h" + +namespace Balder +{ +// This is the interval (in milliseconds) in between frames for the sample probe +const int SAMPLEPROBE_FRAME_INTERVAL = 50; + + /** + * An Icon for displaying an animated sample probe. + */ + class SampleProbe: public gcn::Widget + { + public: + /** + * Constructor. + * + * @param image an Image to display. + */ + SampleProbe(); + + + // Inherited from Widget + + virtual void draw(gcn::Graphics* graphics); + + virtual void drawBorder(gcn::Graphics* graphics); + + void setProbeColor(probe_color c) { probeColor = c;} + + private: + gcn::Image* probeSpriteImage; + probe_color probeColor; + unsigned int probeFrame; + Uint32 frameTimer; + }; +} + +#endif // BALDERSAMPLEPROBEWIDGET_H Added: include/menu/widgets/skinnedbutton.h =================================================================== --- include/menu/widgets/skinnedbutton.h (rev 0) +++ include/menu/widgets/skinnedbutton.h 2007-12-03 19:38:51 UTC (rev 91) @@ -0,0 +1,58 @@ +/*************************************************************************** + * Copyright (C) 2006 by Bjorn Hansen * + * hol...@us... * + * * + * 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 BALDERSKINNEDBUTTON_H +#define BALDERSKINNEDBUTTON_H + +#define buttonUp 0 +#define buttonDown 1 +#define widgetFocused 2 + +#include <guichan/widgets/button.hpp> +#include "../../balder2dtypes.h" + +namespace Balder +{ + /** + * An Icon for displaying an animated image. + */ + class SkinnedButton: public gcn::Button + { + public: + // Constructor and Destructor. + SkinnedButton(std::string, std::string, unsigned int = 0); + ~SkinnedButton(); + + // Inherited from gcn::Widget + virtual void draw(gcn::Graphics* graphics); + virtual void drawBorder(gcn::Graphics* graphics); + + private: + // Skin Variables. + SDL_Surface* skinFrameStrip; + std::string skinFileName; + unsigned int skinStripLocation; + + // Button Variables. + unsigned int buttonState; + }; +} + +#endif // BALDERSKINNEDBUTTON_H Added: include/menu/widgets/skinnedcheckbox.h =================================================================== --- include/menu/widgets/skinnedcheckbox.h (rev 0) +++ include/menu/widgets/skinnedcheckbox.h 2007-12-03 19:38:51 UTC (rev 91) @@ -0,0 +1,63 @@ +/*************************************************************************** + * Copyright (C) 2006 by Bjorn Hansen * + * hol...@us... * + * * + * 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 BALDERSKINNEDCHECKBOX_H +#define BALDERSKINNEDCHECKBOX_H + +#define checkboxUnChecked 0 +#define checkboxChecked 1 +#define widgetFocused 2 + +#include <guichan/widgets/checkbox.hpp> +#include "../../balder2dtypes.h" + +namespace Balder +{ + /** + * A check box with a skin applied to it's surface. + */ + class SkinnedCheckBox: public gcn::CheckBox + { + public: + // Constructor and Destructor. + SkinnedCheckBox(std::string, std::string, unsigned int = 0, bool = false); + ~SkinnedCheckBox(); + + // Inherited from gcn::Widget + virtual void draw(gcn::Graphics* graphics); + virtual void drawBorder(gcn::Graphics* graphics); + + // CheckBox control functions + void setSizeXY(int newSizeXY) {checkboxSizeXY = newSizeXY;}; + int getSizeXY() {return checkboxSizeXY;}; + + private: + // Skin Variables. + SDL_Surface* skinFrameStrip; + std::string skinFileName; + unsigned int skinStripLocation; + + // Button Variables. + unsigned int checkboxState; + unsigned int checkboxSizeXY; + }; +} + +#endif // BALDERSKINNEDCHECKBOX_H Deleted: include/menu/widgetskinnedcheckbox.h =================================================================== --- include/menu/widgetskinnedcheckbox.h 2007-12-02 02:18:34 UTC (rev 90) +++ include/menu/widgetskinnedcheckbox.h 2007-12-03 19:38:51 UTC (rev 91) @@ -1,63 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006 by Bjorn Hansen * - * hol...@us... * - * * - * 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 BALDERWIDGETSKINNEDCHECKBOX_H -#define BALDERWIDGETSKINNEDCHECKBOX_H - -#define checkboxUnChecked 0 -#define checkboxChecked 1 -#define widgetFocused 2 - -#include <guichan/widgets/checkbox.hpp> -#include "../balder2dtypes.h" - -namespace Balder -{ - /** - * A check box with a skin applied to it's surface. - */ - class WidgetSkinnedCheckBox: public gcn::CheckBox - { - public: - // Constructor and Destructor. - WidgetSkinnedCheckBox(std::string, std::string, unsigned int = 0, bool = false); - ~WidgetSkinnedCheckBox(); - - // Inherited from gcn::Widget - virtual void draw(gcn::Graphics* graphics); - virtual void drawBorder(gcn::Graphics* graphics); - - // CheckBox control functions - void setSizeXY(int newSizeXY) {checkboxSizeXY = newSizeXY;}; - int getSizeXY() {return checkboxSizeXY;}; - - private: - // Skin Variables. - SDL_Surface* skinFrameStrip; - std::string skinFileName; - unsigned int skinStripLocation; - - // Button Variables. - unsigned int checkboxState; - unsigned int checkboxSizeXY; - }; -} - -#endif // BALDERWIDGETSKINNEDCHECKBOX_H Deleted: src/menu/ailistmodel.cpp =================================================================== --- src/menu/ailistmodel.cpp 2007-12-02 02:18:34 UTC (rev 90) +++ src/menu/ailistmodel.cpp 2007-12-03 19:38:51 UTC (rev 91) @@ -1,62 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2005 by Bjorn Hansen * - * hol...@us... * - * * - * 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. * - ***************************************************************************/ - -#include "menu/ailistmodel.h" -#include <physfs.h> - -using namespace Balder; - -AIListModel::AIListModel(): numScripts(0) -{ - FindScripts(); -} -AIListModel::~AIListModel() -{} - -void AIListModel::FindScripts() -{ - std::string script_dir("scripts/"); - // always show Human option as it disables any ai scripting so that a user may play. - scriptnames.push_back("Human"); - ++numScripts; - char **files = PHYSFS_enumerateFiles("scripts/"); - char **i; - std::string script; - for (i = files; *i != NULL; i++){ - script = *i; - if (!PHYSFS_isDirectory((script_dir+script).c_str()) && !script.compare(script.size()-3, 3, ".py")){ - scriptnames.push_back(script.substr(0,script.size()-3)); - ++numScripts; - } - } - PHYSFS_freeList(files); -} - - -/*! - \fn Balder::AIListModel::FindScriptIndex(std::string scriptname) - */ -int Balder::AIListModel::FindScriptIndex(std::string scriptname) -{ - for (int i = 0; i < numScripts; ++i) { - if (!scriptname.compare(scriptnames[i])) return i; - } - return 0; -} Deleted: src/menu/animationwidget.cpp =================================================================== --- src/menu/animationwidget.cpp 2007-12-02 02:18:34 UTC (rev 90) +++ src/menu/animationwidget.cpp 2007-12-03 19:38:51 UTC (rev 91) @@ -1,123 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006 by Bjorn Hansen * - * hol...@us... * - * * - * 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. * - ***************************************************************************/ - -#include <guichan/rectangle.hpp> -#include <guichan/sdl/sdlgraphics.hpp> -#include <SDL/SDL.h> -#include <SDL/SDL_image.h> -#include "menu/animationwidget.h" -#include "imageloader.h" -using namespace Balder; - -AnimationWidget::AnimationWidget(std::string aFileName, bool aHasBaseFrame, - bool aLooped, bool aPlaying, unsigned int aStripLocation, - unsigned int fWidth, unsigned int fHeight, unsigned int fBase, - unsigned int fStart, unsigned int fQuantity, unsigned int fInterval) -{ - // Load Animation. - animationFileName = aFileName; - animationHasBaseFrame = aHasBaseFrame; - animationLooped = aLooped; - animationPlaying = aPlaying; - animationStripLocation = aStripLocation; - frameWidth = fWidth; - frameHeight = fHeight; - frameBase = fBase; - frameStart = fStart; - frameQuantity = fQuantity; - frameInterval = fInterval; - frameCurrent = 0; - - // Load Animation Frame Strip from File. - animationFrameStrip = ImageLoader::LoadImage(animationFileName.c_str()); - if (animationFrameStrip == 0) { - throw "could not load animation!"; - } - - // Set widget deminsions based... [truncated message content] |
From: <hol...@us...> - 2007-12-02 02:18:28
|
Revision: 90 http://balder.svn.sourceforge.net/balder/?rev=90&view=rev Author: holomorph Date: 2007-12-01 18:18:34 -0800 (Sat, 01 Dec 2007) Log Message: ----------- fixed ai dropdown and color sliders so they can be changed Modified Paths: -------------- history.txt src/menu/playersetup.cpp Modified: history.txt =================================================================== --- history.txt 2007-11-30 21:12:27 UTC (rev 89) +++ history.txt 2007-12-02 02:18:34 UTC (rev 90) @@ -3,7 +3,12 @@ History entries are in reverse chronological order (newest entries first). -19 Nov-2007 +1 Dec-2007 + - Bjorn fixed the bug where AI selection box and color sliders didn't work because + refreshKeys() was being called first thing in the action handler and setting them + right back where they were before, thus they could not get changed. + +30 Nov-2007 - Reuben replaced all standard gcn::checkbox objects in the menu system with WidgetSkinnedCheckBox. - Reuben add frame size controls to WidgetSkinnedCheckBox. Modified: src/menu/playersetup.cpp =================================================================== --- src/menu/playersetup.cpp 2007-11-30 21:12:27 UTC (rev 89) +++ src/menu/playersetup.cpp 2007-12-02 02:18:34 UTC (rev 90) @@ -172,8 +172,6 @@ void PlayerSetupMenu::action(const gcn::ActionEvent& action) { bindNextKey = false; // so key binding gets cancelled when non-bind actions are called. - RefreshKeys(); - // Player options menu events.********************************************** if (action.getId() == "nextPlayer") { if (currentPlayer < ConfigManager::GetNumPlayers()) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <col...@us...> - 2007-11-30 21:12:22
|
Revision: 89 http://balder.svn.sourceforge.net/balder/?rev=89&view=rev Author: colalord Date: 2007-11-30 13:12:27 -0800 (Fri, 30 Nov 2007) Log Message: ----------- 19 Nov-2007 - Reuben replaced all standard gcn::checkbox objects in the menu system with WidgetSkinnedCheckBox. Modified Paths: -------------- history.txt include/menu/gamesetup.h include/menu/soundvideo.h src/menu/gamesetup.cpp src/menu/soundvideo.cpp Modified: history.txt =================================================================== --- history.txt 2007-11-30 20:35:39 UTC (rev 88) +++ history.txt 2007-11-30 21:12:27 UTC (rev 89) @@ -4,6 +4,8 @@ History entries are in reverse chronological order (newest entries first). 19 Nov-2007 + - Reuben replaced all standard gcn::checkbox objects in the menu system + with WidgetSkinnedCheckBox. - Reuben add frame size controls to WidgetSkinnedCheckBox. - Reuben add widgetskinnedcheckbox.cpp/h and menuskin.png Modified: include/menu/gamesetup.h =================================================================== --- include/menu/gamesetup.h 2007-11-30 20:35:39 UTC (rev 88) +++ include/menu/gamesetup.h 2007-11-30 21:12:27 UTC (rev 89) @@ -45,8 +45,8 @@ gcn::ScrollArea* mapScrollArea; gcn::ListBox* mapListBox; WidgetSkinnedCheckBox* scoreLimitSelector; - gcn::CheckBox* timeLimitSelector; - gcn::CheckBox* lifeLimitSelector; + WidgetSkinnedCheckBox* timeLimitSelector; + WidgetSkinnedCheckBox* lifeLimitSelector; NumberField* scoreLimitValue; NumberField* timeLimitValue; NumberField* lifeLimitValue; Modified: include/menu/soundvideo.h =================================================================== --- include/menu/soundvideo.h 2007-11-30 20:35:39 UTC (rev 88) +++ include/menu/soundvideo.h 2007-11-30 21:12:27 UTC (rev 89) @@ -25,6 +25,7 @@ namespace Balder { +class WidgetSkinnedCheckBox; class SoundVideoMenu:public SubMenu { @@ -34,9 +35,9 @@ void action(const gcn::ActionEvent& action); private: SkinnedButtonWidget* backButton; - gcn::CheckBox* fullScreenCheckbox; - gcn::CheckBox* soundCheckbox; - gcn::CheckBox* musicCheckbox; + WidgetSkinnedCheckBox* fullScreenCheckbox; + WidgetSkinnedCheckBox* soundCheckbox; + WidgetSkinnedCheckBox* musicCheckbox; gcn::Label* fxVolumeLabel; gcn::Label* musicVolumeLabel; gcn::Slider* fxVolumeSlider; Modified: src/menu/gamesetup.cpp =================================================================== --- src/menu/gamesetup.cpp 2007-11-30 20:35:39 UTC (rev 88) +++ src/menu/gamesetup.cpp 2007-11-30 21:12:27 UTC (rev 89) @@ -52,10 +52,10 @@ scoreLimitSelector = new WidgetSkinnedCheckBox("Maximum Score", "menu/menuskin.png", 0, score > 0); scoreLimitSelector->setActionEventId("toggleScoreLimit"); scoreLimitSelector->addActionListener(this); - timeLimitSelector = new gcn::CheckBox("Time (minutes)", time > 0); + timeLimitSelector = new WidgetSkinnedCheckBox("Time (minutes)", "menu/menuskin.png", 0, score > 0); timeLimitSelector->setActionEventId("toggleTimeLimit"); timeLimitSelector->addActionListener(this); - lifeLimitSelector = new gcn::CheckBox("Limited Lives", life > 0); + lifeLimitSelector = new WidgetSkinnedCheckBox("Limited Lives", "menu/menuskin.png", 0, score > 0); lifeLimitSelector->setActionEventId("toggleLifeLimit"); lifeLimitSelector->addActionListener(this); scoreLimitValue = new NumberField(score); Modified: src/menu/soundvideo.cpp =================================================================== --- src/menu/soundvideo.cpp 2007-11-30 20:35:39 UTC (rev 88) +++ src/menu/soundvideo.cpp 2007-11-30 21:12:27 UTC (rev 89) @@ -18,7 +18,8 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#include "menu/soundvideo.h" +#include "menu/soundvideo.h" +#include "menu/widgetskinnedcheckbox.h" #include "configmanager.h" #include "soundmanager.h" @@ -31,16 +32,15 @@ backButton->setActionEventId("back"); backButton->addActionListener(this); - fullScreenCheckbox = new gcn::CheckBox("Fullscreen (in game only)", - ConfigManager::GetIntValue("Video", "fullscreen")); + fullScreenCheckbox = new WidgetSkinnedCheckBox("Fullscreen (in game only)", "menu/menuskin.png", 0, ConfigManager::GetIntValue("Video", "fullscreen")); fullScreenCheckbox->setActionEventId("toggleFullscreen"); fullScreenCheckbox->addActionListener(this); - soundCheckbox = new gcn::CheckBox("Sound", ConfigManager::GetIntValue("Sound", "sound")); + soundCheckbox = new WidgetSkinnedCheckBox("Sound", "menu/menuskin.png", 0, ConfigManager::GetIntValue("Sound", "sound")); soundCheckbox->setActionEventId("toggleSound"); soundCheckbox->addActionListener(this); - musicCheckbox = new gcn::CheckBox("Music", ConfigManager::GetIntValue("Sound", "music")); + musicCheckbox = new WidgetSkinnedCheckBox("Music", "menu/menuskin.png", 0, ConfigManager::GetIntValue("Sound", "music")); musicCheckbox->setActionEventId("toggleMusic"); musicCheckbox->addActionListener(this); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <col...@us...> - 2007-11-30 20:35:34
|
Revision: 88 http://balder.svn.sourceforge.net/balder/?rev=88&view=rev Author: colalord Date: 2007-11-30 12:35:39 -0800 (Fri, 30 Nov 2007) Log Message: ----------- 19 Nov-2007 - Reuben add frame size controls to WidgetSkinnedCheckBox. Modified Paths: -------------- history.txt include/menu/widgetskinnedcheckbox.h src/menu/gamesetup.cpp src/menu/widgetskinnedcheckbox.cpp Modified: history.txt =================================================================== --- history.txt 2007-11-30 20:16:26 UTC (rev 87) +++ history.txt 2007-11-30 20:35:39 UTC (rev 88) @@ -4,6 +4,7 @@ History entries are in reverse chronological order (newest entries first). 19 Nov-2007 + - Reuben add frame size controls to WidgetSkinnedCheckBox. - Reuben add widgetskinnedcheckbox.cpp/h and menuskin.png 19 Nov-2007 Modified: include/menu/widgetskinnedcheckbox.h =================================================================== --- include/menu/widgetskinnedcheckbox.h 2007-11-30 20:16:26 UTC (rev 87) +++ include/menu/widgetskinnedcheckbox.h 2007-11-30 20:35:39 UTC (rev 88) @@ -43,6 +43,10 @@ // Inherited from gcn::Widget virtual void draw(gcn::Graphics* graphics); virtual void drawBorder(gcn::Graphics* graphics); + + // CheckBox control functions + void setSizeXY(int newSizeXY) {checkboxSizeXY = newSizeXY;}; + int getSizeXY() {return checkboxSizeXY;}; private: // Skin Variables. @@ -51,7 +55,8 @@ unsigned int skinStripLocation; // Button Variables. - unsigned int checkboxState; + unsigned int checkboxState; + unsigned int checkboxSizeXY; }; } Modified: src/menu/gamesetup.cpp =================================================================== --- src/menu/gamesetup.cpp 2007-11-30 20:16:26 UTC (rev 87) +++ src/menu/gamesetup.cpp 2007-11-30 20:35:39 UTC (rev 88) @@ -50,8 +50,7 @@ int time = ConfigManager::GetIntValue("GameSetup", "TimeLimit"); int life = ConfigManager::GetIntValue("GameSetup", "LifeLimit"); scoreLimitSelector = new WidgetSkinnedCheckBox("Maximum Score", "menu/menuskin.png", 0, score > 0); - scoreLimitSelector->setHeight(32); - scoreLimitSelector->setActionEventId("toggleScoreLimit"); + scoreLimitSelector->setActionEventId("toggleScoreLimit"); scoreLimitSelector->addActionListener(this); timeLimitSelector = new gcn::CheckBox("Time (minutes)", time > 0); timeLimitSelector->setActionEventId("toggleTimeLimit"); Modified: src/menu/widgetskinnedcheckbox.cpp =================================================================== --- src/menu/widgetskinnedcheckbox.cpp 2007-11-30 20:16:26 UTC (rev 87) +++ src/menu/widgetskinnedcheckbox.cpp 2007-11-30 20:35:39 UTC (rev 88) @@ -31,6 +31,7 @@ gcn::CheckBox(cbC, cbS), skinFileName(sFN), skinStripLocation(sSL), checkboxState(cbS) { setBorderSize(0); + checkboxSizeXY = 32; // Load Skin Frame Strip from File. skinFrameStrip = ImageLoader::LoadImage(skinFileName.c_str()); @@ -67,14 +68,14 @@ } // draw widget onto menu screen at widget location. - SDL_Rect rectSrc = {checkboxState*getHeight(), skinStripLocation, getHeight(), getHeight()}; + SDL_Rect rectSrc = {checkboxState*checkboxSizeXY, skinStripLocation, checkboxSizeXY, checkboxSizeXY}; SDL_Rect rectDest = {x, y, /*width is ignored*/0, /*height is ignored*/0}; SDL_BlitSurface(skinFrameStrip, &rectSrc, screen, &rectDest); // Need to draw caption label to the right of the checkbox. // Align label to the right of the checkbox. - int textX = getHeight() + 5; - int textY = getHeight() / 2 - getFont()->getHeight() / 2; + int textX = checkboxSizeXY + 5; + int textY = checkboxSizeXY / 2 - getFont()->getHeight() / 2; graphics->setFont(getFont()); graphics->drawText(getCaption(), textX, textY, gcn::Graphics::LEFT); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <col...@us...> - 2007-11-30 20:16:26
|
Revision: 87 http://balder.svn.sourceforge.net/balder/?rev=87&view=rev Author: colalord Date: 2007-11-30 12:16:26 -0800 (Fri, 30 Nov 2007) Log Message: ----------- 19 Nov-2007 - Reuben add widgetskinnedcheckbox.cpp/h and menuskin.png Modified Paths: -------------- Balder2D-Win-README.txt Balder2D-Win.cbp history.txt include/menu/gamesetup.h src/menu/gamesetup.cpp Added Paths: ----------- bin/menu/menuskin.png include/menu/widgetskinnedcheckbox.h src/menu/widgetskinnedcheckbox.cpp Modified: Balder2D-Win-README.txt =================================================================== --- Balder2D-Win-README.txt 2007-11-19 19:07:56 UTC (rev 86) +++ Balder2D-Win-README.txt 2007-11-30 20:16:26 UTC (rev 87) @@ -128,22 +128,14 @@ 14. There is no DLL file for this library. ================================================================================== -Building & Installing Boost Libraries --------------------------------------- - 1. For a complete description on how to install Boost go to: http://www.boost.org/more/getting_started.html - 2. or continue here by downloading "boost_1_33_1.zip" or later from: http://sourceforge.net/project/showfiles.php?group_id=7586&package_id=8041 - 3. Download "boost-jam-3.1.11-1-ntx86.zip" or later from: http://sourceforge.net/project/showfiles.php?group_id=7586&package_id=72941 - 4. Extract all of the files to "C:\tmp\". - 5. Run the MSYS shell. - 6. Type: cd /c/tmp/boost-jam-3.1.11-1-ntx86 - 7. Type (copying "bjam.exe" to the MSYS %PATH% directory): cp bjam.exe /usr/local/bin/ - 8. Type: cd /c/tmp/boost_1_33_1/ - 9. Type: bjam.exe -sTOOLS=mingw boost_filesystem - 10. MSYS will start building the Boost File System libraries. - 11. Type: cp bin/boost/libs/filesystem/build/libboost_filesystem.lib/mingw/release/libboost_filesystem-mgw-1_33_1.lib /usr/local/lib/ - 12. Type: cp boost /usr/local/include/ -r - 13. There is no DLL file for this library. +Building & Installing PhysFS Libraries +--------------------------------------- + 1. CMakeCache.txt + line 137: CMAKE_USE_RELATIVE_PATHS:BOOL=ON + 2. platforms/windows.c + rem out lines 334 - 340 + ================================================================================== Installing Guichan Libraries ----------------------------- Modified: Balder2D-Win.cbp =================================================================== --- Balder2D-Win.cbp 2007-11-19 19:07:56 UTC (rev 86) +++ Balder2D-Win.cbp 2007-11-30 20:16:26 UTC (rev 87) @@ -70,6 +70,7 @@ <Unit filename="include\menu\skinnedbuttonwidget.h" /> <Unit filename="include\menu\soundvideo.h" /> <Unit filename="include\menu\submenu.h" /> + <Unit filename="include\menu\widgetskinnedcheckbox.h" /> <Unit filename="include\player.h" /> <Unit filename="include\powerup.h" /> <Unit filename="include\powerupfactory.h" /> @@ -110,6 +111,7 @@ <Unit filename="src\menu\skinnedbuttonwidget.cpp" /> <Unit filename="src\menu\soundvideo.cpp" /> <Unit filename="src\menu\submenu.cpp" /> + <Unit filename="src\menu\widgetskinnedcheckbox.cpp" /> <Unit filename="src\player.cpp" /> <Unit filename="src\powerup.cpp" /> <Unit filename="src\powerupfactory.cpp" /> Added: bin/menu/menuskin.png =================================================================== (Binary files differ) Property changes on: bin/menu/menuskin.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: history.txt =================================================================== --- history.txt 2007-11-19 19:07:56 UTC (rev 86) +++ history.txt 2007-11-30 20:16:26 UTC (rev 87) @@ -4,6 +4,9 @@ History entries are in reverse chronological order (newest entries first). 19 Nov-2007 + - Reuben add widgetskinnedcheckbox.cpp/h and menuskin.png + +19 Nov-2007 - Reuben removed ending slashes from the python search paths because they cause an issue with python when it goes to import modules. Modified: include/menu/gamesetup.h =================================================================== --- include/menu/gamesetup.h 2007-11-19 19:07:56 UTC (rev 86) +++ include/menu/gamesetup.h 2007-11-30 20:16:26 UTC (rev 87) @@ -27,7 +27,8 @@ { class SampleMapWidget; class MapListModel; -class SkinnedButtonWidget; +class SkinnedButtonWidget; +class WidgetSkinnedCheckBox; class GameSetupMenu:public SubMenu { @@ -43,7 +44,7 @@ gcn::DropDown* mapDropDown; gcn::ScrollArea* mapScrollArea; gcn::ListBox* mapListBox; - gcn::CheckBox* scoreLimitSelector; + WidgetSkinnedCheckBox* scoreLimitSelector; gcn::CheckBox* timeLimitSelector; gcn::CheckBox* lifeLimitSelector; NumberField* scoreLimitValue; Added: include/menu/widgetskinnedcheckbox.h =================================================================== --- include/menu/widgetskinnedcheckbox.h (rev 0) +++ include/menu/widgetskinnedcheckbox.h 2007-11-30 20:16:26 UTC (rev 87) @@ -0,0 +1,58 @@ +/*************************************************************************** + * Copyright (C) 2006 by Bjorn Hansen * + * hol...@us... * + * * + * 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 BALDERWIDGETSKINNEDCHECKBOX_H +#define BALDERWIDGETSKINNEDCHECKBOX_H + +#define checkboxUnChecked 0 +#define checkboxChecked 1 +#define widgetFocused 2 + +#include <guichan/widgets/checkbox.hpp> +#include "../balder2dtypes.h" + +namespace Balder +{ + /** + * A check box with a skin applied to it's surface. + */ + class WidgetSkinnedCheckBox: public gcn::CheckBox + { + public: + // Constructor and Destructor. + WidgetSkinnedCheckBox(std::string, std::string, unsigned int = 0, bool = false); + ~WidgetSkinnedCheckBox(); + + // Inherited from gcn::Widget + virtual void draw(gcn::Graphics* graphics); + virtual void drawBorder(gcn::Graphics* graphics); + + private: + // Skin Variables. + SDL_Surface* skinFrameStrip; + std::string skinFileName; + unsigned int skinStripLocation; + + // Button Variables. + unsigned int checkboxState; + }; +} + +#endif // BALDERWIDGETSKINNEDCHECKBOX_H Modified: src/menu/gamesetup.cpp =================================================================== --- src/menu/gamesetup.cpp 2007-11-19 19:07:56 UTC (rev 86) +++ src/menu/gamesetup.cpp 2007-11-30 20:16:26 UTC (rev 87) @@ -20,7 +20,8 @@ #include "menu/gamesetup.h" #include "configmanager.h" -#include "menu/samplemapwidget.h" +#include "menu/samplemapwidget.h" +#include "menu/widgetskinnedcheckbox.h" #include "menu/maplistmodel.h" using namespace Balder; @@ -48,9 +49,10 @@ int score = ConfigManager::GetIntValue("GameSetup", "ScoreLimit"); int time = ConfigManager::GetIntValue("GameSetup", "TimeLimit"); int life = ConfigManager::GetIntValue("GameSetup", "LifeLimit"); - scoreLimitSelector = new gcn::CheckBox("Maximum Score", score > 0); + scoreLimitSelector = new WidgetSkinnedCheckBox("Maximum Score", "menu/menuskin.png", 0, score > 0); + scoreLimitSelector->setHeight(32); scoreLimitSelector->setActionEventId("toggleScoreLimit"); - scoreLimitSelector->addActionListener(this); + scoreLimitSelector->addActionListener(this); timeLimitSelector = new gcn::CheckBox("Time (minutes)", time > 0); timeLimitSelector->setActionEventId("toggleTimeLimit"); timeLimitSelector->addActionListener(this); Added: src/menu/widgetskinnedcheckbox.cpp =================================================================== --- src/menu/widgetskinnedcheckbox.cpp (rev 0) +++ src/menu/widgetskinnedcheckbox.cpp 2007-11-30 20:16:26 UTC (rev 87) @@ -0,0 +1,86 @@ +/*************************************************************************** + * Copyright (C) 2006 by Bjorn Hansen * + * hol...@us... * + * * + * 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. * + ***************************************************************************/ + +#include <guichan/exception.hpp> +#include <guichan/sdl/sdlgraphics.hpp> +#include <guichan/font.hpp> +#include <SDL/SDL.h> +#include <SDL/SDL_image.h> +#include "menu/widgetskinnedcheckbox.h" +#include "imageloader.h" +using namespace Balder; + +WidgetSkinnedCheckBox::WidgetSkinnedCheckBox(std::string cbC, std::string sFN, unsigned int sSL, bool cbS): + gcn::CheckBox(cbC, cbS), skinFileName(sFN), skinStripLocation(sSL), checkboxState(cbS) +{ + setBorderSize(0); + + // Load Skin Frame Strip from File. + skinFrameStrip = ImageLoader::LoadImage(skinFileName.c_str()); + if (skinFrameStrip == 0) { + throw "could not load checkbox skin!"; + } +} + +WidgetSkinnedCheckBox::~WidgetSkinnedCheckBox() +{ + if (skinFrameStrip != 0) { + SDL_FreeSurface(skinFrameStrip); + } +} + +void WidgetSkinnedCheckBox::draw(gcn::Graphics* graphics) +{ + // get screen that the menu is drawn on. + SDL_Surface *screen = dynamic_cast<gcn::SDLGraphics*>(graphics)->getTarget(); + + // get location of the widget on the menu screen. + int x,y; + gcn::Widget::getAbsolutePosition(x,y); + + if (!isMarked()) { + checkboxState = checkboxUnChecked; + } + else { + checkboxState = checkboxChecked; + } + + if (isFocused()) { + checkboxState += widgetFocused; + } + + // draw widget onto menu screen at widget location. + SDL_Rect rectSrc = {checkboxState*getHeight(), skinStripLocation, getHeight(), getHeight()}; + SDL_Rect rectDest = {x, y, /*width is ignored*/0, /*height is ignored*/0}; + SDL_BlitSurface(skinFrameStrip, &rectSrc, screen, &rectDest); + + // Need to draw caption label to the right of the checkbox. + // Align label to the right of the checkbox. + int textX = getHeight() + 5; + int textY = getHeight() / 2 - getFont()->getHeight() / 2; + + graphics->setFont(getFont()); + graphics->drawText(getCaption(), textX, textY, gcn::Graphics::LEFT); +} + +void WidgetSkinnedCheckBox::drawBorder(gcn::Graphics* graphics) +{ + // Borders are not drawn for skinned buttons. +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <col...@us...> - 2007-11-19 19:07:58
|
Revision: 86 http://balder.svn.sourceforge.net/balder/?rev=86&view=rev Author: colalord Date: 2007-11-19 11:07:56 -0800 (Mon, 19 Nov 2007) Log Message: ----------- 19 Nov-2007 - Reuben removed ending slashes from the python search paths because they cause an issue with python when it goes to import modules. Modified Paths: -------------- history.txt src/artificialcontroller.cpp Modified: history.txt =================================================================== --- history.txt 2007-11-19 06:42:31 UTC (rev 85) +++ history.txt 2007-11-19 19:07:56 UTC (rev 86) @@ -3,8 +3,12 @@ History entries are in reverse chronological order (newest entries first). +19 Nov-2007 + - Reuben removed ending slashes from the python search paths because they + cause an issue with python when it goes to import modules. + 18 Nov-2007 - Bjorn fixed bug in windows script paths by using raw python strings so that + - Bjorn fixed bug in windows script paths by using raw python strings so that single backslash characters are not interpreted as escape characters. 08 Nov-2007 Modified: src/artificialcontroller.cpp =================================================================== --- src/artificialcontroller.cpp 2007-11-19 06:42:31 UTC (rev 85) +++ src/artificialcontroller.cpp 2007-11-19 19:07:56 UTC (rev 86) @@ -57,8 +57,8 @@ //Iterate through the list: for(std::list<std::string>::iterator iter = searchpath.begin(); iter != searchpath.end(); ++iter) { - Log::output("Setting script search path: " + *iter + "/scripts/"); - std::string command = "sys.path.append(r'" + *iter + "/scripts/')\n"; + Log::output("Setting script search path: " + *iter + "/scripts"); + std::string command = "sys.path.append(r'" + *iter + "/scripts')\n"; PyRun_SimpleString(command.c_str()); } PyObject *balder_module = Py_InitModule("balder", BalderAIMethods); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hol...@us...> - 2007-11-19 06:42:31
|
Revision: 85 http://balder.svn.sourceforge.net/balder/?rev=85&view=rev Author: holomorph Date: 2007-11-18 22:42:31 -0800 (Sun, 18 Nov 2007) Log Message: ----------- fixed windows ai scripts not loading bug Modified Paths: -------------- history.txt src/artificialcontroller.cpp src/filepathmanager.cpp Modified: history.txt =================================================================== --- history.txt 2007-11-08 23:24:53 UTC (rev 84) +++ history.txt 2007-11-19 06:42:31 UTC (rev 85) @@ -3,6 +3,10 @@ History entries are in reverse chronological order (newest entries first). +18 Nov-2007 + Bjorn fixed bug in windows script paths by using raw python strings so that + single backslash characters are not interpreted as escape characters. + 08 Nov-2007 -Reuben cleaned up some temporary log points. @@ -13,11 +17,11 @@ 05 Nov-2007 - Reuben removed Boost FS lib flags from Balder2D-Win.cbp. - Reuben added some more temp log points. - + 24 Oct-2007 - Reuben added filepathmanager.cpp/h to Balder2D-Win.cbp project file. - Reuben added some log file check points for tracking an AI bug. - + 24 Oct-2007 - Bjorn fixed the bug where life, time, and score limits were not set unless the option was toggled via the checkbox. Modified: src/artificialcontroller.cpp =================================================================== --- src/artificialcontroller.cpp 2007-11-08 23:24:53 UTC (rev 84) +++ src/artificialcontroller.cpp 2007-11-19 06:42:31 UTC (rev 85) @@ -58,7 +58,7 @@ for(std::list<std::string>::iterator iter = searchpath.begin(); iter != searchpath.end(); ++iter) { Log::output("Setting script search path: " + *iter + "/scripts/"); - std::string command = "sys.path.append('" + *iter + "/scripts/')\n"; + std::string command = "sys.path.append(r'" + *iter + "/scripts/')\n"; PyRun_SimpleString(command.c_str()); } PyObject *balder_module = Py_InitModule("balder", BalderAIMethods); Modified: src/filepathmanager.cpp =================================================================== --- src/filepathmanager.cpp 2007-11-08 23:24:53 UTC (rev 84) +++ src/filepathmanager.cpp 2007-11-19 06:42:31 UTC (rev 85) @@ -75,7 +75,7 @@ const char *dir = "balder2d"; string str(userdir); - str.append(dirsep).append(dir); + str.append(dir); if (!PHYSFS_setWriteDir(str.c_str())) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <col...@us...> - 2007-11-08 23:26:20
|
Revision: 84 http://balder.svn.sourceforge.net/balder/?rev=84&view=rev Author: colalord Date: 2007-11-08 15:24:53 -0800 (Thu, 08 Nov 2007) Log Message: ----------- 08 Nov-2007 -Reuben cleaned up some temporary log points. Modified Paths: -------------- history.txt src/main.cpp src/menu/maplistmodel.cpp Modified: history.txt =================================================================== --- history.txt 2007-11-07 00:43:33 UTC (rev 83) +++ history.txt 2007-11-08 23:24:53 UTC (rev 84) @@ -3,6 +3,9 @@ History entries are in reverse chronological order (newest entries first). +08 Nov-2007 + -Reuben cleaned up some temporary log points. + 06 Nov-2007 - Reuben renamed the Windows installation instructions to Balder2D-Win-README.txt. Modified: src/main.cpp =================================================================== --- src/main.cpp 2007-11-07 00:43:33 UTC (rev 83) +++ src/main.cpp 2007-11-08 23:24:53 UTC (rev 84) @@ -172,6 +172,7 @@ } // oops, looks like the user doesn't want to play anymore :( // clean up the rest of the crap we created + Log::output("Cleaning up Menu system..."); delete menu; delete render; delete sound; Modified: src/menu/maplistmodel.cpp =================================================================== --- src/menu/maplistmodel.cpp 2007-11-07 00:43:33 UTC (rev 83) +++ src/menu/maplistmodel.cpp 2007-11-08 23:24:53 UTC (rev 84) @@ -32,14 +32,11 @@ {} bool find_file( const std::string map_dir, const std::string & file_name) -{ - Log::output("Comparing in dir: " + map_dir); +{ char **files = PHYSFS_enumerateFiles(map_dir.c_str()); char **i; for (i = files; *i != NULL; i++){ std::string f = *i; - Log::output("Comparing found file: " + f); - Log::output("with desired file: " + file_name); if (file_name == f) { PHYSFS_freeList(files); return true; @@ -55,16 +52,14 @@ char **files = PHYSFS_enumerateFiles(map_dir.c_str()); char **i; std::string mapname; + Log::output("Importing map list..."); for (i = files; *i != NULL; i++){ - mapname = *i; - Log::output("Loading next map name: " + mapname); - if (PHYSFS_isDirectory((map_dir+mapname).c_str())){ - Log::output("Found map directory."); + mapname = *i; + if (PHYSFS_isDirectory((map_dir+mapname).c_str())){ // lets try to check that this directory really contains a map if (find_file(map_dir+mapname, "maptags.xml") && find_file(map_dir+mapname, "geometry.png") && find_file(map_dir+mapname, "background.png") ) { - Log::output("Adding map to map list: " + mapname); mapnames.push_back(mapname); ++numMaps; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <col...@us...> - 2007-11-07 00:43:29
|
Revision: 83 http://balder.svn.sourceforge.net/balder/?rev=83&view=rev Author: colalord Date: 2007-11-06 16:43:33 -0800 (Tue, 06 Nov 2007) Log Message: ----------- Modified Paths: -------------- Balder2D-Win.cbp Modified: Balder2D-Win.cbp =================================================================== --- Balder2D-Win.cbp 2007-11-07 00:43:00 UTC (rev 82) +++ Balder2D-Win.cbp 2007-11-07 00:43:33 UTC (rev 83) @@ -38,7 +38,6 @@ <Add library="SDL" /> <Add library="SDL_image" /> <Add library="SDL_mixer" /> - <Add library="C:\msys\1.0\local\lib\libboost_filesystem-mgw-1_33_1.lib" /> <Add library="Python25" /> <Add library="physfs" /> <Add directory="C:\MinGW\lib" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <col...@us...> - 2007-11-07 00:43:01
|
Revision: 82 http://balder.svn.sourceforge.net/balder/?rev=82&view=rev Author: colalord Date: 2007-11-06 16:43:00 -0800 (Tue, 06 Nov 2007) Log Message: ----------- 06 Nov-2007 - Reuben renamed the Windows installation instructions to Balder2D-Win-README.txt. Modified Paths: -------------- history.txt Added Paths: ----------- Balder2D-Win-README.txt Removed Paths: ------------- Balder2D Win32 Development Environment Setup Instructions.txt Deleted: Balder2D Win32 Development Environment Setup Instructions.txt =================================================================== --- Balder2D Win32 Development Environment Setup Instructions.txt 2007-11-05 23:52:11 UTC (rev 81) +++ Balder2D Win32 Development Environment Setup Instructions.txt 2007-11-07 00:43:00 UTC (rev 82) @@ -1,364 +0,0 @@ -Balder2D Win32 Development Environment Setup Instructions - -Author: Reuben Lord -Last Revised: 11/14/06 -================================================================================== -Please note: - 1. The build and install process described below has only been tested in the order written from top to bottom. - 2. Path names for libraries and development tools that have been extracted from packages with different version numbers than the ones described below may very. - -================================================================================== -Installing MinGW ------------------ - 1. Download the installer "MinGW-5.0.0.exe" or later from: http://www.mingw.org - 2. Double click the installer to run it. - 3. Click "Next >" at the Welcome screen. - 4. Click "I Agree" at the EULA. - 5. Select a mirror that is physically closest to you. - 6. Make sure "Download as needed and install" is selected. - 7. Click the "Next >" button. - 8. Select the "Current" MinGW package. - 9. Click "Next >". - 10. Under the list of components to install, check "MinGW base tools" and "g++ compiler". - 11. Click "Next >". - 12. Select an install path for MinGW. Default: "c:\MinGW" - 13. Click "Next >". - 14. Select a folder in the Start Menu for you MinGW shortcuts to go in. Default: "MinGW" - 15. Click "Install". - 16. Watch MinGW download and install. - 17. Click "Finish". - -================================================================================== -Installing MSYS ----------------- - 1. Download the installer "MSYS-1.0.11-2004.04.30-1.exe" or later from: http://www.mingw.org - 2. Double click the installer to run it. - 3. You will be asked "Do you really want to install Minimal SYStem?" Click "Yes". - 4. Click "Next >" at the Welcome screen. - 5. Click "Yes" at the EULA. - 6. Click "Next >" at the Information screen. - 7. Select an install path. Default: "C:\msys\1.0" - 8. Under component selection, select "Installation for i386 based CPUs (Works for all x86 based CPUs >= i386)". - 9. Click "Next >". - 10. Select a folder in the Start Menu for you MinGW shortcuts to go in. Default: "MinGW" - 11. Click "Next >". - 12. Review setup settings. - 13. Click "Install". - 14. Watch it install MSYS. - 15. A command prompt with the MSYS post installer setup tool in it should appear after the installer finishes installing MSYS. - 16. Press the "y" key on you keyboard and hit "Enter" to continue with the post installer. - 17. Press "y" and hit "Enter" if you have MinGW installed. - 18. Enter the location of your MinGW installation in the following format. Default: "c:\\MinGW" - 19. It will perform some checks and then ask you to "Press any key to continue..." - 20. The post installer tool will now close and bring you back to the primary installer. - 21. Uncheck all check boxes. - 22. Click "Finish". - 23. If you want to change the colors for the MSYS interface they are defined in the file "C:\msys\1.0\msys.bat". - -================================================================================== -Building & Installing SDL (Simple Directmedia Layer) Libraries ---------------------------------------------------------------- - 1. Download the source code "SDL-1.2.9.zip" or later from: http://www.libsdl.org - 2. Extract all of the files to "C:\tmp\". - 3. Run the MSYS shell. - 4. Type: cd /c/tmp/SDL-1.2.9/ - 5. Type: ./configure && make && make install - 6. MSYS will now start building and installing the primary SDL libraries. - 7. For the DLL file, refer to the section below named "Installing DLL Files". - -================================================================================== -Installing SDL_image Libraries -------------------------------- - 1. Download the source code "SDL_image-devel-1.2.4-VC6.zip" or later from: http://www.libsdl.org/projects/SDL_image/ - 2. Extract all of the files to "C:\tmp\". - 3. Go to: C:\tmp\SDL_image-1.2.4\ - 4. Copy "include\SDL_image.h" to "C:\msys\1.0\local\include\SDL". - 5. Copy "lib\SDL_image.lib" to "C:\msys\1.0\local\lib". - 6. For the DLL files, refer to the section below named "Installing DLL Files". - -================================================================================== -Installing SDL_mixer Libraries -------------------------------- - 1. Download the source code "SDL_mixer-devel-1.2.6-VC6.zip" or later from: http://www.libsdl.org/projects/SDL_mixer/ - 2. Extract all of the files to "C:\tmp\". - 3. Go to: C:\tmp\SDL_mixer-1.2.6\ - 4. Copy "include\SDL_mixer.h" to "C:\msys\1.0\local\include\SDL". - 5. Copy "lib\SDL_mixer.lib" to "C:\msys\1.0\local\lib". - 6. For the DLL files, refer to the section below named "Installing DLL Files". - -================================================================================== -Building & Installing SDL_gfx Libraries ----------------------------------------- - 1. Download the source code "SDL_gfx-2.0.13.zip" or later from: http://www.ferzkopp.net/joomla/content/view/19/14/ - 2. Extract all of the files to "C:\tmp\". - 3. Make the modifications listed in step 5 to the following header files: - a. C:\Tmp\SDL_gfx-2.0.13\SDL_framerate.h - b. C:\Tmp\SDL_gfx-2.0.13\SDL_gfxPrimitives.h - c. C:\Tmp\SDL_gfx-2.0.13\SDL_imageFilter.h - d. C:\Tmp\SDL_gfx-2.0.13\SDL_rotozoom.h - 4. The following is the original code block in 4 of the SDL_gfx header files: - #ifdef WIN32 - #ifdef BUILD_DLL - #define DLLINTERFACE __declspec(dllexport) - #else - #define DLLINTERFACE __declspec(dllimport) - #endif - #else - #define DLLINTERFACE - #endif - 5. Make changes in all 4 header files listed above by REM'ing out lines 1, 2, 3, 4, 5, 6, 7 and 9 of the following code block: - //#ifdef WIN32 - //#ifdef BUILD_DLL - //#define DLLINTERFACE __declspec(dllexport) - //#else - //#define DLLINTERFACE __declspec(dllimport) - //#endif - //#else - #define DLLINTERFACE - //#endif - 6. Run the MSYS shell. - 7. Type: cd /c/tmp/sdl_gfx-2.0.13 - 8. The "README" file in the dir - 8. Type: ./autogen.sh - 9. Type: ./configure - 10. Type: ./nodebug.sh - 11. Type: make - 12. Type: make install - 13. Type (this doesn't work): ldconfig - 14. There is no DLL file for this library. - -================================================================================== -Building & Installing Boost Libraries --------------------------------------- - 1. For a complete description on how to install Boost go to: http://www.boost.org/more/getting_started.html - 2. or continue here by downloading "boost_1_33_1.zip" or later from: http://sourceforge.net/project/showfiles.php?group_id=7586&package_id=8041 - 3. Download "boost-jam-3.1.11-1-ntx86.zip" or later from: http://sourceforge.net/project/showfiles.php?group_id=7586&package_id=72941 - 4. Extract all of the files to "C:\tmp\". - 5. Run the MSYS shell. - 6. Type: cd /c/tmp/boost-jam-3.1.11-1-ntx86 - 7. Type (copying "bjam.exe" to the MSYS %PATH% directory): cp bjam.exe /usr/local/bin/ - 8. Type: cd /c/tmp/boost_1_33_1/ - 9. Type: bjam.exe -sTOOLS=mingw boost_filesystem - 10. MSYS will start building the Boost File System libraries. - 11. Type: cp bin/boost/libs/filesystem/build/libboost_filesystem.lib/mingw/release/libboost_filesystem-mgw-1_33_1.lib /usr/local/lib/ - 12. Type: cp boost /usr/local/include/ -r - 13. There is no DLL file for this library. - -================================================================================== -Installing Guichan Libraries ------------------------------ - 1. Download "guichan-0.4.0-mingw32.zip" or later from: http://guichan.sourceforge.net/ - 2. Extract all of the files to "C:\tmp\". - 3. Copy all files from "C:\tmp\guichan-0.4.0-mingw32\include\" to "C:\msys\1.0\local\include\". - 4. Copy all "*.a" files from "C:\tmp\guichan-0.4.0-mingw32\lib\" to "C:\msys\1.0\local\lib\". - 5. For the DLL files, refer to the section below named "Installing DLL Files". - -================================================================================== -Installing Python Libraries ----------------------------- - 1. Download "python-2.4.2.msi" or later from: http://www.python.org/ - 2. Run the Python installer. - 3. On the user selection screen select "Install for all users". - 4. Click "Next >>". - 5. On the Select Destination Directory screen make sure the destination is set to: C:\Python24\ - 6. Click "Next >>". - 7. On the Customize Python 2.4.2 screen select all components. - 8. Click "Next >>". - 9. Watch the installer install Python 2.4.2. - 10. On the Completed installation screen click "Finish". - 11. For the DLL files, refer to the section below named "Installing DLL Files". - -================================================================================== -Installing Psyco Libraries ---------------------------- - 1. Download "psyco-1.5.win32-py2.4.exe" or later from: http://psyco.sourceforge.net/ - 2. Run the Psyco installer. - 3. On the Welcome screen click "Next >". - 4. On the Python installation verification screen make sure it located the version of Python you currently have installed. - 5. Click "Next >". - 6. On the Ready to Install screen click "Next >". - 7. Watch Psyco install. - 8. On the last screen just click "Finish". - 9. For the DLL files, refer to the section below named "Installing DLL Files". - -================================================================================== -Installing TortoiseSVN-1.4.0.7501-win32-svn-1.4.0.msi SVN Tool ---------------------------------------------------------------- - 1. Download "TortoiseSVN-1.4.0.7501-win32-svn-1.4.0.msi" or later from: http://tortoisesvn.net/ - 2. Run the Tortoise SVN installer. - 3. On the welcome screen of the installer click "Next >". - 4. Mark Accept for the EULA. - 5. Click "Next >". - 6. Make sure all components are selected on the Custom Setup screen. - 7. Pick an installation path. Default: C:\Program Files\TortoiseSVN\ - 8. Click "Next >". - 9. On the Ready to Install screen click "Install". - 10. It will now begin installing. - 11. On the completion screen un-check "Show Changelog". - 12. Click "Finish". - 13. It will now ask you to restart you system, click "Yes". - 14. Your system should restart now. - 15. Open your C:\ drive. - 16. Create a new directory named "Balder2D". - 17. Right click on the directory "C:\Balder2D\" directory that you just created to get the context menu. - 18. Click on the "SVN Checkout..." command. - 19. The Checkout dialog box will now appear. - 20. In the "URL of repository" field enter: https://svn.sourceforge.net/svnroot/balder - 21. Make sure the "Checkout directory:" says: C:\Balder2D - 22. Click "OK". - 23. It should now start checking everything out of the SVN and list them out as it does check them out. - 24. When it's done just click the "OK" button. - 25. You should have the latest copy of the Balder2D source code all downloaded into the "C:\Balder2D\" directory at this point. - -================================================================================== -Installing DLL Files ---------------------- -- SDL DLL - 1. Copy from "C:\msys\1.0\local\bin\SDL.dll" to "C:\Balder2D\bin\". -- Guichan DLL's - 2. Copy from "C:\Tmp\guichan-0.4.0-mingw32\bin\guichan.dll" to "C:\Balder2D\bin\". - 3. Copy from "C:\Tmp\guichan-0.4.0-mingw32\bin\guichan_sdl.dll" to "C:\Balder2D\bin\". -- SDL_image DLL's - 4. (DON'T NEED) Copy from "C:\Tmp\SDL_image-1.2.5\lib\jpeg.dll" to "C:\Balder2D\bin\". - 5. Copy from "C:\Tmp\SDL_image-1.2.5\lib\libpng12.dll" to "C:\Balder2D\bin\". - 6. Copy from "C:\Tmp\SDL_image-1.2.5\lib\SDL_image.dll" to "C:\Balder2D\bin\". - 7. Copy from "C:\Tmp\SDL_image-1.2.5\lib\zlib1.dll" to "C:\Balder2D\bin\". -- SDL_mixer version 1.2.6.0 DLL - 8. Copy from "C:\Tmp\SDL_mixer-1.2.6\lib\SDL_mixer.dll" to "C:\Balder2D\bin\". -- SDL_mixer version 1.2.7.0 DLL or later - 9. Copy from "C:\Tmp\SDL_mixer-1.2.7\lib\ogg.dll" to "C:\Balder2D\bin\". - 10. Copy from "C:\Tmp\SDL_mixer-1.2.7\lib\SDL_mixer.dll" to "C:\Balder2D\bin\". - 11. Copy from "C:\Tmp\SDL_mixer-1.2.7\lib\vorbis.dll" to "C:\Balder2D\bin\". - 12. Copy from "C:\Tmp\SDL_mixer-1.2.7\lib\vorbisfile.dll" to "C:\Balder2D\bin\". -- Python 2.4 DLL - 13. When Python 2.4 is installed it installs the DLL in the %PATH% directory. -- Psyco 1.5 - 14. If it has any DLL's it installs them for you. - -================================================================================== -Installing Code::Blocks IDE ----------------------------- - 1. Download "codeblocks-1.0rc2.exe" or later from: http://www.codeblocks.org/ - 2. Run the installer. - 3. At the Welcome screen click "Next >". - 4. On the EULA screen select the accept option. - 5. Click "Next >". - 6. On the Select Destination Location screen choose your installation path. Default: C:\Program Files\CodeBlocks - 7. Click "Next >". - 8. On the Select Components screen select "Full installation". - 9. Click "Next >". - 10. On the Select Start Menu Folder screen select a folder to store it in or leave the default. - 11. Click "Next >". - 12. On the Select Additional Tasks screen select the icons that you want it to make. - 13. Click "Next >". - 14. On the Ready to Install screen review your installation configuration. - 15. Click "Install". - 16. Watch it install Code::Blocks for you. - 17. On the Information screen click "Next >". - 18. On the Complete screen click "Finish". - 19. Code::Blocks will now load for you. - 20. The Compilers auto-detection screen will appear. - 21. Select the compiler: GNU GCC Compiler - 22. The Status for the "GNU GCC Compiler" should equal: Detected - 23. Click the "Set as default" button. - 24. Make sure at the bottom of the window you see the string: Default compiler: GNU GCC Compiler - 25. Click "Close". - 26. Code::Blocks finished loading up. - 27. If the "Tip of the Day" shows up uncheck "Show tips at startup" and click "Close" on the Tip dialog box. - 28. To open the project file click on the "File" menu. - 29. Then click the "Open" menu option. - 30. Open "C:\Balder2D\Balder2D.cbp". - 31. Now you should be able to build Balder2D with in Code::Blocks. - 32. To build Balder2D in Code::Blocks click on the "Build" menu. - 33. Then click the "Build" menu option (or press Ctrl+F9 to build). - 34. It will then build Balder2D and put the executable file in the following path: C:\Balder2D\bin\Balder2D.exe - -================================================================================== -Creating a Code::Blocks IDE project file ------------------------------------------ - 1. Open Code::Blocks. - 2. If you have any projects open, then close them. - a. On the main menu click on the "File" menu. - b. Then click on the "Close project" menu option. - 3. On the main menu click on the "Project" menu. - 4. Then click on the "New project..." menu option. - 5. The "New from template" dialog box will appear. - 6. Select the "Console Application" icon. - 7. Check the "Do not create any files" check box. - 8. Set Project options: Console Application - 9. Set File(s) options: C++ source - 10. Click the "Create" button. - 11. The "Save project" dialog box will appear. - 12. Save it to: C:\Balder2D\Balder2D.cbp - 13. On the right hand side of the IDE is a tabbed window named "Management" (in the main menu it is "View>Manager" (Shift+F2)). This will be referred to as the "Management Bar". - 14. Select the "Projects" tab on the Management Bar. - 15. Right click on the "Console application" node. - 16. Click on the "Properties" menu option. - 17. The "Project/targets options" dialog will appear. - 18. Select the "Project" tab. - 19. Set Title: Balder2D - 20. Select the "Targets" tab. - 21. Set Output filename: bin\Balder2D.exe - 22. Set Execution working dir: bin\ - 23. Select the "Project" tab. - 24. Click on the "Project's build options..." button. - 25. This will make the "Project's Build options" dialog box appear. - a. You can also reach this dialog box by right clicking on the project's node in the Management Bar. - b. Click on the "Build options" menu option. - 26. Select the "Linker" tab. - 27. Add all of the libraries for the linker to link to the project. I'm not sure if it requires a certain order, but if it does this order works. - a. mingw32 - b. guichan - c. guichan_sdl - d. SDLmain - e. SDL_gfx - f. SDL - g. SDL_image - h. SDL_mixer - i. C:\msys\1.0\local\lib\libboost_filesystem-mgw-1_33_1.lib - j. python24 - 28. Click on the "Add" button. - 29. Set File: [LIBRARY NAME] - 30. Click "OK". - 31. Repeat until all libraries have been added. - 32. Under the "Linker" tab there is a text window titled "Other linker options:", add this line: -mwindows - 33. Select the "Directories" tab. - 34. Under the "Directories" tab select the "Compiler" tab. - 35. Add all of the #include directories for the compiler to look in for the different library header files. Please note when entering directories here do not put an ending "\" because it confuses the compiler. - a. C:\MinGW\include - b. C:\msys\1.0\local\include - c. C:\msys\1.0\local\include\SDL - d. C:\Python24\include - 36. Click on the "Add" button. - 37. Set Directory: [#INCLUDE PATH] - 38. Click "OK". - 39. Repeat until all #include directories have been added. - 40. Select the "Directories" tab. - 41. Under the "Directories" tab select the "Linker" tab. - 42. Add all of the library directories for the compiler to look in for the different library files. Please note when entering directories here do not put an ending "\" because it confuses the compiler. - a. C:\MinGW\lib - b. C:\msys\1.0\local\lib - c. C:\Python24\libs - 43. Click on the "Add" button. - 44. Set Directory: [LIBRARY PATH] - 45. Click "OK". - 46. Repeat until all library directories have been added. - 47. Click the "OK" button on the "Project's Build options" dialog box. - 48. Click the "OK" button on the "Project/targets options" dialog box. - 49. Right click on the project node "Balder2D" in the Management Bar. - 50. Click on the "Add files recursively..." menu option. - 51. Select: C:\Balder2D\src\ - 52. Click the "OK" button. - 53. The "Multiple selection" dialog box will appear. - 54. Make sure all files are selected. Make sure you see Selected: 40 - 55. Click the "OK" button. - 56. Right click on the project node "Balder2D" in the Management Bar. - 57. Click on the "Add files recursively..." menu option. - 58. Select: C:\Balder2D\include\ - 59. Click the "OK" button. - 60. The "Multiple selection" dialog box will appear. - 61. Make sure all files are selected. Make sure you see Selected: 31 - 62. Click the "OK" button. - 63. Click "File" on the main menu. - 64. Click the "Save project" menu option. - 65. This project file is ready to compile. \ No newline at end of file Added: Balder2D-Win-README.txt =================================================================== --- Balder2D-Win-README.txt (rev 0) +++ Balder2D-Win-README.txt 2007-11-07 00:43:00 UTC (rev 82) @@ -0,0 +1,364 @@ +Balder2D Win32 Development Environment Setup Instructions + +Author: Reuben Lord +Last Revised: 11/14/06 +================================================================================== +Please note: + 1. The build and install process described below has only been tested in the order written from top to bottom. + 2. Path names for libraries and development tools that have been extracted from packages with different version numbers than the ones described below may very. + +================================================================================== +Installing MinGW +----------------- + 1. Download the installer "MinGW-5.0.0.exe" or later from: http://www.mingw.org + 2. Double click the installer to run it. + 3. Click "Next >" at the Welcome screen. + 4. Click "I Agree" at the EULA. + 5. Select a mirror that is physically closest to you. + 6. Make sure "Download as needed and install" is selected. + 7. Click the "Next >" button. + 8. Select the "Current" MinGW package. + 9. Click "Next >". + 10. Under the list of components to install, check "MinGW base tools" and "g++ compiler". + 11. Click "Next >". + 12. Select an install path for MinGW. Default: "c:\MinGW" + 13. Click "Next >". + 14. Select a folder in the Start Menu for you MinGW shortcuts to go in. Default: "MinGW" + 15. Click "Install". + 16. Watch MinGW download and install. + 17. Click "Finish". + +================================================================================== +Installing MSYS +---------------- + 1. Download the installer "MSYS-1.0.11-2004.04.30-1.exe" or later from: http://www.mingw.org + 2. Double click the installer to run it. + 3. You will be asked "Do you really want to install Minimal SYStem?" Click "Yes". + 4. Click "Next >" at the Welcome screen. + 5. Click "Yes" at the EULA. + 6. Click "Next >" at the Information screen. + 7. Select an install path. Default: "C:\msys\1.0" + 8. Under component selection, select "Installation for i386 based CPUs (Works for all x86 based CPUs >= i386)". + 9. Click "Next >". + 10. Select a folder in the Start Menu for you MinGW shortcuts to go in. Default: "MinGW" + 11. Click "Next >". + 12. Review setup settings. + 13. Click "Install". + 14. Watch it install MSYS. + 15. A command prompt with the MSYS post installer setup tool in it should appear after the installer finishes installing MSYS. + 16. Press the "y" key on you keyboard and hit "Enter" to continue with the post installer. + 17. Press "y" and hit "Enter" if you have MinGW installed. + 18. Enter the location of your MinGW installation in the following format. Default: "c:\\MinGW" + 19. It will perform some checks and then ask you to "Press any key to continue..." + 20. The post installer tool will now close and bring you back to the primary installer. + 21. Uncheck all check boxes. + 22. Click "Finish". + 23. If you want to change the colors for the MSYS interface they are defined in the file "C:\msys\1.0\msys.bat". + +================================================================================== +Building & Installing SDL (Simple Directmedia Layer) Libraries +--------------------------------------------------------------- + 1. Download the source code "SDL-1.2.9.zip" or later from: http://www.libsdl.org + 2. Extract all of the files to "C:\tmp\". + 3. Run the MSYS shell. + 4. Type: cd /c/tmp/SDL-1.2.9/ + 5. Type: ./configure && make && make install + 6. MSYS will now start building and installing the primary SDL libraries. + 7. For the DLL file, refer to the section below named "Installing DLL Files". + +================================================================================== +Installing SDL_image Libraries +------------------------------- + 1. Download the source code "SDL_image-devel-1.2.4-VC6.zip" or later from: http://www.libsdl.org/projects/SDL_image/ + 2. Extract all of the files to "C:\tmp\". + 3. Go to: C:\tmp\SDL_image-1.2.4\ + 4. Copy "include\SDL_image.h" to "C:\msys\1.0\local\include\SDL". + 5. Copy "lib\SDL_image.lib" to "C:\msys\1.0\local\lib". + 6. For the DLL files, refer to the section below named "Installing DLL Files". + +================================================================================== +Installing SDL_mixer Libraries +------------------------------- + 1. Download the source code "SDL_mixer-devel-1.2.6-VC6.zip" or later from: http://www.libsdl.org/projects/SDL_mixer/ + 2. Extract all of the files to "C:\tmp\". + 3. Go to: C:\tmp\SDL_mixer-1.2.6\ + 4. Copy "include\SDL_mixer.h" to "C:\msys\1.0\local\include\SDL". + 5. Copy "lib\SDL_mixer.lib" to "C:\msys\1.0\local\lib". + 6. For the DLL files, refer to the section below named "Installing DLL Files". + +================================================================================== +Building & Installing SDL_gfx Libraries +---------------------------------------- + 1. Download the source code "SDL_gfx-2.0.13.zip" or later from: http://www.ferzkopp.net/joomla/content/view/19/14/ + 2. Extract all of the files to "C:\tmp\". + 3. Make the modifications listed in step 5 to the following header files: + a. C:\Tmp\SDL_gfx-2.0.13\SDL_framerate.h + b. C:\Tmp\SDL_gfx-2.0.13\SDL_gfxPrimitives.h + c. C:\Tmp\SDL_gfx-2.0.13\SDL_imageFilter.h + d. C:\Tmp\SDL_gfx-2.0.13\SDL_rotozoom.h + 4. The following is the original code block in 4 of the SDL_gfx header files: + #ifdef WIN32 + #ifdef BUILD_DLL + #define DLLINTERFACE __declspec(dllexport) + #else + #define DLLINTERFACE __declspec(dllimport) + #endif + #else + #define DLLINTERFACE + #endif + 5. Make changes in all 4 header files listed above by REM'ing out lines 1, 2, 3, 4, 5, 6, 7 and 9 of the following code block: + //#ifdef WIN32 + //#ifdef BUILD_DLL + //#define DLLINTERFACE __declspec(dllexport) + //#else + //#define DLLINTERFACE __declspec(dllimport) + //#endif + //#else + #define DLLINTERFACE + //#endif + 6. Run the MSYS shell. + 7. Type: cd /c/tmp/sdl_gfx-2.0.13 + 8. The "README" file in the dir + 8. Type: ./autogen.sh + 9. Type: ./configure + 10. Type: ./nodebug.sh + 11. Type: make + 12. Type: make install + 13. Type (this doesn't work): ldconfig + 14. There is no DLL file for this library. + +================================================================================== +Building & Installing Boost Libraries +-------------------------------------- + 1. For a complete description on how to install Boost go to: http://www.boost.org/more/getting_started.html + 2. or continue here by downloading "boost_1_33_1.zip" or later from: http://sourceforge.net/project/showfiles.php?group_id=7586&package_id=8041 + 3. Download "boost-jam-3.1.11-1-ntx86.zip" or later from: http://sourceforge.net/project/showfiles.php?group_id=7586&package_id=72941 + 4. Extract all of the files to "C:\tmp\". + 5. Run the MSYS shell. + 6. Type: cd /c/tmp/boost-jam-3.1.11-1-ntx86 + 7. Type (copying "bjam.exe" to the MSYS %PATH% directory): cp bjam.exe /usr/local/bin/ + 8. Type: cd /c/tmp/boost_1_33_1/ + 9. Type: bjam.exe -sTOOLS=mingw boost_filesystem + 10. MSYS will start building the Boost File System libraries. + 11. Type: cp bin/boost/libs/filesystem/build/libboost_filesystem.lib/mingw/release/libboost_filesystem-mgw-1_33_1.lib /usr/local/lib/ + 12. Type: cp boost /usr/local/include/ -r + 13. There is no DLL file for this library. + +================================================================================== +Installing Guichan Libraries +----------------------------- + 1. Download "guichan-0.4.0-mingw32.zip" or later from: http://guichan.sourceforge.net/ + 2. Extract all of the files to "C:\tmp\". + 3. Copy all files from "C:\tmp\guichan-0.4.0-mingw32\include\" to "C:\msys\1.0\local\include\". + 4. Copy all "*.a" files from "C:\tmp\guichan-0.4.0-mingw32\lib\" to "C:\msys\1.0\local\lib\". + 5. For the DLL files, refer to the section below named "Installing DLL Files". + +================================================================================== +Installing Python Libraries +---------------------------- + 1. Download "python-2.4.2.msi" or later from: http://www.python.org/ + 2. Run the Python installer. + 3. On the user selection screen select "Install for all users". + 4. Click "Next >>". + 5. On the Select Destination Directory screen make sure the destination is set to: C:\Python24\ + 6. Click "Next >>". + 7. On the Customize Python 2.4.2 screen select all components. + 8. Click "Next >>". + 9. Watch the installer install Python 2.4.2. + 10. On the Completed installation screen click "Finish". + 11. For the DLL files, refer to the section below named "Installing DLL Files". + +================================================================================== +Installing Psyco Libraries +--------------------------- + 1. Download "psyco-1.5.win32-py2.4.exe" or later from: http://psyco.sourceforge.net/ + 2. Run the Psyco installer. + 3. On the Welcome screen click "Next >". + 4. On the Python installation verification screen make sure it located the version of Python you currently have installed. + 5. Click "Next >". + 6. On the Ready to Install screen click "Next >". + 7. Watch Psyco install. + 8. On the last screen just click "Finish". + 9. For the DLL files, refer to the section below named "Installing DLL Files". + +================================================================================== +Installing TortoiseSVN-1.4.0.7501-win32-svn-1.4.0.msi SVN Tool +--------------------------------------------------------------- + 1. Download "TortoiseSVN-1.4.0.7501-win32-svn-1.4.0.msi" or later from: http://tortoisesvn.net/ + 2. Run the Tortoise SVN installer. + 3. On the welcome screen of the installer click "Next >". + 4. Mark Accept for the EULA. + 5. Click "Next >". + 6. Make sure all components are selected on the Custom Setup screen. + 7. Pick an installation path. Default: C:\Program Files\TortoiseSVN\ + 8. Click "Next >". + 9. On the Ready to Install screen click "Install". + 10. It will now begin installing. + 11. On the completion screen un-check "Show Changelog". + 12. Click "Finish". + 13. It will now ask you to restart you system, click "Yes". + 14. Your system should restart now. + 15. Open your C:\ drive. + 16. Create a new directory named "Balder2D". + 17. Right click on the directory "C:\Balder2D\" directory that you just created to get the context menu. + 18. Click on the "SVN Checkout..." command. + 19. The Checkout dialog box will now appear. + 20. In the "URL of repository" field enter: https://svn.sourceforge.net/svnroot/balder + 21. Make sure the "Checkout directory:" says: C:\Balder2D + 22. Click "OK". + 23. It should now start checking everything out of the SVN and list them out as it does check them out. + 24. When it's done just click the "OK" button. + 25. You should have the latest copy of the Balder2D source code all downloaded into the "C:\Balder2D\" directory at this point. + +================================================================================== +Installing DLL Files +--------------------- +- SDL DLL + 1. Copy from "C:\msys\1.0\local\bin\SDL.dll" to "C:\Balder2D\bin\". +- Guichan DLL's + 2. Copy from "C:\Tmp\guichan-0.4.0-mingw32\bin\guichan.dll" to "C:\Balder2D\bin\". + 3. Copy from "C:\Tmp\guichan-0.4.0-mingw32\bin\guichan_sdl.dll" to "C:\Balder2D\bin\". +- SDL_image DLL's + 4. (DON'T NEED) Copy from "C:\Tmp\SDL_image-1.2.5\lib\jpeg.dll" to "C:\Balder2D\bin\". + 5. Copy from "C:\Tmp\SDL_image-1.2.5\lib\libpng12.dll" to "C:\Balder2D\bin\". + 6. Copy from "C:\Tmp\SDL_image-1.2.5\lib\SDL_image.dll" to "C:\Balder2D\bin\". + 7. Copy from "C:\Tmp\SDL_image-1.2.5\lib\zlib1.dll" to "C:\Balder2D\bin\". +- SDL_mixer version 1.2.6.0 DLL + 8. Copy from "C:\Tmp\SDL_mixer-1.2.6\lib\SDL_mixer.dll" to "C:\Balder2D\bin\". +- SDL_mixer version 1.2.7.0 DLL or later + 9. Copy from "C:\Tmp\SDL_mixer-1.2.7\lib\ogg.dll" to "C:\Balder2D\bin\". + 10. Copy from "C:\Tmp\SDL_mixer-1.2.7\lib\SDL_mixer.dll" to "C:\Balder2D\bin\". + 11. Copy from "C:\Tmp\SDL_mixer-1.2.7\lib\vorbis.dll" to "C:\Balder2D\bin\". + 12. Copy from "C:\Tmp\SDL_mixer-1.2.7\lib\vorbisfile.dll" to "C:\Balder2D\bin\". +- Python 2.4 DLL + 13. When Python 2.4 is installed it installs the DLL in the %PATH% directory. +- Psyco 1.5 + 14. If it has any DLL's it installs them for you. + +================================================================================== +Installing Code::Blocks IDE +---------------------------- + 1. Download "codeblocks-1.0rc2.exe" or later from: http://www.codeblocks.org/ + 2. Run the installer. + 3. At the Welcome screen click "Next >". + 4. On the EULA screen select the accept option. + 5. Click "Next >". + 6. On the Select Destination Location screen choose your installation path. Default: C:\Program Files\CodeBlocks + 7. Click "Next >". + 8. On the Select Components screen select "Full installation". + 9. Click "Next >". + 10. On the Select Start Menu Folder screen select a folder to store it in or leave the default. + 11. Click "Next >". + 12. On the Select Additional Tasks screen select the icons that you want it to make. + 13. Click "Next >". + 14. On the Ready to Install screen review your installation configuration. + 15. Click "Install". + 16. Watch it install Code::Blocks for you. + 17. On the Information screen click "Next >". + 18. On the Complete screen click "Finish". + 19. Code::Blocks will now load for you. + 20. The Compilers auto-detection screen will appear. + 21. Select the compiler: GNU GCC Compiler + 22. The Status for the "GNU GCC Compiler" should equal: Detected + 23. Click the "Set as default" button. + 24. Make sure at the bottom of the window you see the string: Default compiler: GNU GCC Compiler + 25. Click "Close". + 26. Code::Blocks finished loading up. + 27. If the "Tip of the Day" shows up uncheck "Show tips at startup" and click "Close" on the Tip dialog box. + 28. To open the project file click on the "File" menu. + 29. Then click the "Open" menu option. + 30. Open "C:\Balder2D\Balder2D.cbp". + 31. Now you should be able to build Balder2D with in Code::Blocks. + 32. To build Balder2D in Code::Blocks click on the "Build" menu. + 33. Then click the "Build" menu option (or press Ctrl+F9 to build). + 34. It will then build Balder2D and put the executable file in the following path: C:\Balder2D\bin\Balder2D.exe + +================================================================================== +Creating a Code::Blocks IDE project file +----------------------------------------- + 1. Open Code::Blocks. + 2. If you have any projects open, then close them. + a. On the main menu click on the "File" menu. + b. Then click on the "Close project" menu option. + 3. On the main menu click on the "Project" menu. + 4. Then click on the "New project..." menu option. + 5. The "New from template" dialog box will appear. + 6. Select the "Console Application" icon. + 7. Check the "Do not create any files" check box. + 8. Set Project options: Console Application + 9. Set File(s) options: C++ source + 10. Click the "Create" button. + 11. The "Save project" dialog box will appear. + 12. Save it to: C:\Balder2D\Balder2D.cbp + 13. On the right hand side of the IDE is a tabbed window named "Management" (in the main menu it is "View>Manager" (Shift+F2)). This will be referred to as the "Management Bar". + 14. Select the "Projects" tab on the Management Bar. + 15. Right click on the "Console application" node. + 16. Click on the "Properties" menu option. + 17. The "Project/targets options" dialog will appear. + 18. Select the "Project" tab. + 19. Set Title: Balder2D + 20. Select the "Targets" tab. + 21. Set Output filename: bin\Balder2D.exe + 22. Set Execution working dir: bin\ + 23. Select the "Project" tab. + 24. Click on the "Project's build options..." button. + 25. This will make the "Project's Build options" dialog box appear. + a. You can also reach this dialog box by right clicking on the project's node in the Management Bar. + b. Click on the "Build options" menu option. + 26. Select the "Linker" tab. + 27. Add all of the libraries for the linker to link to the project. I'm not sure if it requires a certain order, but if it does this order works. + a. mingw32 + b. guichan + c. guichan_sdl + d. SDLmain + e. SDL_gfx + f. SDL + g. SDL_image + h. SDL_mixer + i. C:\msys\1.0\local\lib\libboost_filesystem-mgw-1_33_1.lib + j. python24 + 28. Click on the "Add" button. + 29. Set File: [LIBRARY NAME] + 30. Click "OK". + 31. Repeat until all libraries have been added. + 32. Under the "Linker" tab there is a text window titled "Other linker options:", add this line: -mwindows + 33. Select the "Directories" tab. + 34. Under the "Directories" tab select the "Compiler" tab. + 35. Add all of the #include directories for the compiler to look in for the different library header files. Please note when entering directories here do not put an ending "\" because it confuses the compiler. + a. C:\MinGW\include + b. C:\msys\1.0\local\include + c. C:\msys\1.0\local\include\SDL + d. C:\Python24\include + 36. Click on the "Add" button. + 37. Set Directory: [#INCLUDE PATH] + 38. Click "OK". + 39. Repeat until all #include directories have been added. + 40. Select the "Directories" tab. + 41. Under the "Directories" tab select the "Linker" tab. + 42. Add all of the library directories for the compiler to look in for the different library files. Please note when entering directories here do not put an ending "\" because it confuses the compiler. + a. C:\MinGW\lib + b. C:\msys\1.0\local\lib + c. C:\Python24\libs + 43. Click on the "Add" button. + 44. Set Directory: [LIBRARY PATH] + 45. Click "OK". + 46. Repeat until all library directories have been added. + 47. Click the "OK" button on the "Project's Build options" dialog box. + 48. Click the "OK" button on the "Project/targets options" dialog box. + 49. Right click on the project node "Balder2D" in the Management Bar. + 50. Click on the "Add files recursively..." menu option. + 51. Select: C:\Balder2D\src\ + 52. Click the "OK" button. + 53. The "Multiple selection" dialog box will appear. + 54. Make sure all files are selected. Make sure you see Selected: 40 + 55. Click the "OK" button. + 56. Right click on the project node "Balder2D" in the Management Bar. + 57. Click on the "Add files recursively..." menu option. + 58. Select: C:\Balder2D\include\ + 59. Click the "OK" button. + 60. The "Multiple selection" dialog box will appear. + 61. Make sure all files are selected. Make sure you see Selected: 31 + 62. Click the "OK" button. + 63. Click "File" on the main menu. + 64. Click the "Save project" menu option. + 65. This project file is ready to compile. \ No newline at end of file Modified: history.txt =================================================================== --- history.txt 2007-11-05 23:52:11 UTC (rev 81) +++ history.txt 2007-11-07 00:43:00 UTC (rev 82) @@ -3,6 +3,10 @@ History entries are in reverse chronological order (newest entries first). +06 Nov-2007 + - Reuben renamed the Windows installation instructions to + Balder2D-Win-README.txt. + 05 Nov-2007 - Reuben removed Boost FS lib flags from Balder2D-Win.cbp. - Reuben added some more temp log points. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <col...@us...> - 2007-11-05 23:52:08
|
Revision: 81 http://balder.svn.sourceforge.net/balder/?rev=81&view=rev Author: colalord Date: 2007-11-05 15:52:11 -0800 (Mon, 05 Nov 2007) Log Message: ----------- 05 Nov-2007 - Reuben removed Boost FS lib flags from Balder2D-Win.cbp. - Reuben added some more temp log points. Modified Paths: -------------- history.txt src/artificialcontroller.cpp src/menu/maplistmodel.cpp Modified: history.txt =================================================================== --- history.txt 2007-11-02 23:48:21 UTC (rev 80) +++ history.txt 2007-11-05 23:52:11 UTC (rev 81) @@ -3,6 +3,10 @@ History entries are in reverse chronological order (newest entries first). +05 Nov-2007 + - Reuben removed Boost FS lib flags from Balder2D-Win.cbp. + - Reuben added some more temp log points. + 24 Oct-2007 - Reuben added filepathmanager.cpp/h to Balder2D-Win.cbp project file. - Reuben added some log file check points for tracking an AI bug. Modified: src/artificialcontroller.cpp =================================================================== --- src/artificialcontroller.cpp 2007-11-02 23:48:21 UTC (rev 80) +++ src/artificialcontroller.cpp 2007-11-05 23:52:11 UTC (rev 81) @@ -57,7 +57,8 @@ //Iterate through the list: for(std::list<std::string>::iterator iter = searchpath.begin(); iter != searchpath.end(); ++iter) { - std::string command = "sys.path.append('" + *iter + "/scripts')\n"; + Log::output("Setting script search path: " + *iter + "/scripts/"); + std::string command = "sys.path.append('" + *iter + "/scripts/')\n"; PyRun_SimpleString(command.c_str()); } PyObject *balder_module = Py_InitModule("balder", BalderAIMethods); Modified: src/menu/maplistmodel.cpp =================================================================== --- src/menu/maplistmodel.cpp 2007-11-02 23:48:21 UTC (rev 80) +++ src/menu/maplistmodel.cpp 2007-11-05 23:52:11 UTC (rev 81) @@ -18,6 +18,7 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ +#include "log.h" #include "menu/maplistmodel.h" #include <physfs.h> @@ -32,10 +33,14 @@ bool find_file( const std::string map_dir, const std::string & file_name) { + Log::output("Comparing in dir: " + map_dir); char **files = PHYSFS_enumerateFiles(map_dir.c_str()); char **i; for (i = files; *i != NULL; i++){ - if (file_name == *i) { + std::string f = *i; + Log::output("Comparing found file: " + f); + Log::output("with desired file: " + file_name); + if (file_name == f) { PHYSFS_freeList(files); return true; } @@ -52,12 +57,15 @@ std::string mapname; for (i = files; *i != NULL; i++){ mapname = *i; + Log::output("Loading next map name: " + mapname); if (PHYSFS_isDirectory((map_dir+mapname).c_str())){ - // lets try to check that this directory really contains a map + Log::output("Found map directory."); + // lets try to check that this directory really contains a map if (find_file(map_dir+mapname, "maptags.xml") && find_file(map_dir+mapname, "geometry.png") && find_file(map_dir+mapname, "background.png") ) { - mapnames.push_back(mapname); + Log::output("Adding map to map list: " + mapname); + mapnames.push_back(mapname); ++numMaps; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <col...@us...> - 2007-11-02 23:48:17
|
Revision: 80 http://balder.svn.sourceforge.net/balder/?rev=80&view=rev Author: colalord Date: 2007-11-02 16:48:21 -0700 (Fri, 02 Nov 2007) Log Message: ----------- 24 Oct-2007 - Reuben added some log file check points for tracking an AI bug. Modified Paths: -------------- Balder2D-Win.cbp history.txt src/artificialcontroller.cpp src/computerprobecontrol.cpp src/gamemanager.cpp src/main.cpp Modified: Balder2D-Win.cbp =================================================================== --- Balder2D-Win.cbp 2007-11-02 18:19:59 UTC (rev 79) +++ Balder2D-Win.cbp 2007-11-02 23:48:21 UTC (rev 80) @@ -12,12 +12,16 @@ <Option type="1" /> <Option compiler="gcc" /> <Option projectResourceIncludeDirsRelation="1" /> + <Compiler> + <Add option="-g" /> + </Compiler> </Target> </Build> <VirtualTargets> <Add alias="All" targets="default;" /> </VirtualTargets> <Compiler> + <Add option="-g" /> <Add directory="C:\MinGW\include" /> <Add directory="C:\msys\1.0\local\include" /> <Add directory="C:\msys\1.0\local\include\SDL" /> Modified: history.txt =================================================================== --- history.txt 2007-11-02 18:19:59 UTC (rev 79) +++ history.txt 2007-11-02 23:48:21 UTC (rev 80) @@ -5,7 +5,8 @@ 24 Oct-2007 - Reuben added filepathmanager.cpp/h to Balder2D-Win.cbp project file. - + - Reuben added some log file check points for tracking an AI bug. + 24 Oct-2007 - Bjorn fixed the bug where life, time, and score limits were not set unless the option was toggled via the checkbox. Modified: src/artificialcontroller.cpp =================================================================== --- src/artificialcontroller.cpp 2007-11-02 18:19:59 UTC (rev 79) +++ src/artificialcontroller.cpp 2007-11-02 23:48:21 UTC (rev 80) @@ -49,15 +49,15 @@ void ArtificialController::Initialize() { - Py_InitializeEx(0); + Py_InitializeEx(0); // set up the python environment to find the scrpits Log::output("Loading AI scripts. . ."); PyRun_SimpleString("import sys\n"); std::list<std::string> searchpath = FilePathManager::GetSearchPath(); //Iterate through the list: for(std::list<std::string>::iterator iter = searchpath.begin(); iter != searchpath.end(); ++iter) - { - std::string command = "sys.path.append('" + *iter + "/scripts')\n"; + { + std::string command = "sys.path.append('" + *iter + "/scripts')\n"; PyRun_SimpleString(command.c_str()); } PyObject *balder_module = Py_InitModule("balder", BalderAIMethods); @@ -76,7 +76,9 @@ ++pit; } controlled_probes.clear(); - Py_Finalize(); + if (Py_IsInitialized()){ + Py_Finalize(); + } } Modified: src/computerprobecontrol.cpp =================================================================== --- src/computerprobecontrol.cpp 2007-11-02 18:19:59 UTC (rev 79) +++ src/computerprobecontrol.cpp 2007-11-02 23:48:21 UTC (rev 80) @@ -45,8 +45,9 @@ PyObject* Balder::ComputerProbeControl::LoadPythonModule(std::string module) { PyObject *pName; - pName = PyString_FromString(module.c_str()); + pName = PyString_FromString(module.c_str()); /* Error checking of pName left out */ + Log::output("Importing module named: " + module); PyObject *pModule = PyImport_Import(pName); Py_DECREF(pName); if (pModule != NULL) { Modified: src/gamemanager.cpp =================================================================== --- src/gamemanager.cpp 2007-11-02 18:19:59 UTC (rev 79) +++ src/gamemanager.cpp 2007-11-02 23:48:21 UTC (rev 80) @@ -108,7 +108,7 @@ { throw "error creating player, or player probe"; } - Log::output("running as Server . . "); + Log::output("Starting game..."); start_time = SDL_GetTicks(); int time = ConfigManager::GetIntValue("GameSetup", "TimeLimit"); if (time > 0) end_time = start_time + (time*60*1000); @@ -437,6 +437,7 @@ void GameManager::Quit() { + Log::output("Quiting game..."); still_playing = false; } Modified: src/main.cpp =================================================================== --- src/main.cpp 2007-11-02 18:19:59 UTC (rev 79) +++ src/main.cpp 2007-11-02 23:48:21 UTC (rev 80) @@ -161,9 +161,10 @@ Log::output(message ); fflush(stdout); } - // that game is done, destroy the evidence! + // that game is done, destroy the evidence! + Log::output("Cleaning up GameManager..."); delete game_manager; - Log::output("GameManager Desstroyed"); + Log::output("GameManager Destroyed!"); // show the mouse pointer SDL_ShowCursor(SDL_ENABLE); render->SetScreen(800,600); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <col...@us...> - 2007-11-02 18:19:55
|
Revision: 79 http://balder.svn.sourceforge.net/balder/?rev=79&view=rev Author: colalord Date: 2007-11-02 11:19:59 -0700 (Fri, 02 Nov 2007) Log Message: ----------- 24 Oct-2007 - Reuben added filepathmanager.cpp/h to Balder2D-Win.cbp project file. Modified Paths: -------------- Balder2D-Win.cbp history.txt Modified: Balder2D-Win.cbp =================================================================== --- Balder2D-Win.cbp 2007-10-25 04:43:20 UTC (rev 78) +++ Balder2D-Win.cbp 2007-11-02 18:19:59 UTC (rev 79) @@ -47,6 +47,7 @@ <Unit filename="include\computerprobecontrol.h" /> <Unit filename="include\configmanager.h" /> <Unit filename="include\entity.h" /> + <Unit filename="include\filepathmanager.h" /> <Unit filename="include\gamemanager.h" /> <Unit filename="include\imageloader.h" /> <Unit filename="include\input.h" /> @@ -85,6 +86,7 @@ <Unit filename="src\computerprobecontrol.cpp" /> <Unit filename="src\configmanager.cpp" /> <Unit filename="src\entity.cpp" /> + <Unit filename="src\filepathmanager.cpp" /> <Unit filename="src\gamemanager.cpp" /> <Unit filename="src\imageloader.cpp" /> <Unit filename="src\input.cpp" /> Modified: history.txt =================================================================== --- history.txt 2007-10-25 04:43:20 UTC (rev 78) +++ history.txt 2007-11-02 18:19:59 UTC (rev 79) @@ -4,6 +4,9 @@ History entries are in reverse chronological order (newest entries first). 24 Oct-2007 + - Reuben added filepathmanager.cpp/h to Balder2D-Win.cbp project file. + +24 Oct-2007 - Bjorn fixed the bug where life, time, and score limits were not set unless the option was toggled via the checkbox. - Bjorn added a function to imageloader to unload (SDL_FreeSurface()) an This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hol...@us...> - 2007-10-25 04:43:18
|
Revision: 78 http://balder.svn.sourceforge.net/balder/?rev=78&view=rev Author: holomorph Date: 2007-10-24 21:43:20 -0700 (Wed, 24 Oct 2007) Log Message: ----------- fixed life,time,score not set unless toggled Modified Paths: -------------- history.txt src/menu/gamesetup.cpp Modified: history.txt =================================================================== --- history.txt 2007-10-25 04:39:19 UTC (rev 77) +++ history.txt 2007-10-25 04:43:20 UTC (rev 78) @@ -4,6 +4,8 @@ History entries are in reverse chronological order (newest entries first). 24 Oct-2007 + - Bjorn fixed the bug where life, time, and score limits were not set + unless the option was toggled via the checkbox. - Bjorn added a function to imageloader to unload (SDL_FreeSurface()) an image, instead of letting it be called directly - Bjorn made it so imageloader will only load an image once, after that it Modified: src/menu/gamesetup.cpp =================================================================== --- src/menu/gamesetup.cpp 2007-10-25 04:39:19 UTC (rev 77) +++ src/menu/gamesetup.cpp 2007-10-25 04:43:20 UTC (rev 78) @@ -97,7 +97,6 @@ scoreLimitValue->setValue(score); scoreLimitValue->setEnabled(score > 0); scoreLimitValue->setVisible(score > 0); - ConfigManager::SetIntValue("GameSetup", "ScoreLimit", scoreLimitValue->getValue()); } else if (action.getId() == "toggleTimeLimit") { @@ -107,7 +106,6 @@ timeLimitValue->setValue(time); timeLimitValue->setEnabled(time > 0); timeLimitValue->setVisible(time > 0); - ConfigManager::SetIntValue("GameSetup", "TimeLimit", timeLimitValue->getValue()); } else if (action.getId() == "toggleLifeLimit") { @@ -117,10 +115,12 @@ lifeLimitValue->setValue(life); lifeLimitValue->setEnabled(life > 0); lifeLimitValue->setVisible(life > 0); - ConfigManager::SetIntValue("GameSetup", "LifeLimit", lifeLimitValue->getValue()); } else if (action.getId() == "back") { + ConfigManager::SetIntValue("GameSetup", "ScoreLimit", scoreLimitValue->getValue()); + ConfigManager::SetIntValue("GameSetup", "TimeLimit", timeLimitValue->getValue()); + ConfigManager::SetIntValue("GameSetup", "LifeLimit", lifeLimitValue->getValue()); hide(); parent->show(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hol...@us...> - 2007-10-25 04:39:20
|
Revision: 77 http://balder.svn.sourceforge.net/balder/?rev=77&view=rev Author: holomorph Date: 2007-10-24 21:39:19 -0700 (Wed, 24 Oct 2007) Log Message: ----------- added imageloader::freeImage and keep references of loaded images so they only can be loaded once Modified Paths: -------------- history.txt include/imageloader.h src/collisionmask.cpp src/imageloader.cpp src/player.cpp src/powerupfactory.cpp src/probefactory.cpp src/projectilefactory.cpp src/renderer.cpp Modified: history.txt =================================================================== --- history.txt 2007-10-25 03:36:42 UTC (rev 76) +++ history.txt 2007-10-25 04:39:19 UTC (rev 77) @@ -4,6 +4,10 @@ History entries are in reverse chronological order (newest entries first). 24 Oct-2007 + - Bjorn added a function to imageloader to unload (SDL_FreeSurface()) an + image, instead of letting it be called directly + - Bjorn made it so imageloader will only load an image once, after that it + will just return the previously loaded reference - Bjorn tweaked the soundmanager to load sound files correctly, using the full path as obtained from filepathmanager. - Bjorn fixed a crash from double deletion of the font image in renderer Modified: include/imageloader.h =================================================================== --- include/imageloader.h 2007-10-25 03:36:42 UTC (rev 76) +++ include/imageloader.h 2007-10-25 04:39:19 UTC (rev 77) @@ -24,14 +24,19 @@ #include <SDL/SDL_image.h> #include <guichan.hpp> #include <guichan/sdl.hpp> +#include <map> namespace Balder{ class ImageLoader{ public: static SDL_Surface* LoadImage(const char* filename); + static void FreeImage(const char* filename); static gcn::Image* LoadGcnImage(const char* filename); static gcn::ImageFont* LoadGcnImageFont(const char* filename); +private: + static std::map<std::string,SDL_Surface*> SDLImages; + static std::map<std::string,gcn::Image*> gcnImages; }; } #endif // LOG_H Modified: src/collisionmask.cpp =================================================================== --- src/collisionmask.cpp 2007-10-25 03:36:42 UTC (rev 76) +++ src/collisionmask.cpp 2007-10-25 04:39:19 UTC (rev 77) @@ -51,7 +51,7 @@ else mask[y*width + x] = false; } } - SDL_FreeSurface(field); + ImageLoader::FreeImage(filename.c_str()); } CollisionMask::~CollisionMask() Modified: src/imageloader.cpp =================================================================== --- src/imageloader.cpp 2007-10-25 03:36:42 UTC (rev 76) +++ src/imageloader.cpp 2007-10-25 04:39:19 UTC (rev 77) @@ -25,14 +25,34 @@ using namespace Balder; +std::map<std::string,SDL_Surface*> ImageLoader::SDLImages; +std::map<std::string,gcn::Image*> ImageLoader::gcnImages; + SDL_Surface* ImageLoader::LoadImage(const char* filename) { - return IMG_Load(FilePathManager::GetFullPath(filename).c_str()); + if (!SDLImages.count(filename)) + { + SDLImages[filename] = IMG_Load(FilePathManager::GetFullPath(filename).c_str()); + } + return SDLImages[filename]; } +void ImageLoader::FreeImage(const char* filename) +{ + if (SDLImages.count(filename)) + { + SDL_FreeSurface(SDLImages[filename]); + SDLImages.erase(filename); + } +} + gcn::Image* ImageLoader::LoadGcnImage(const char* filename) { - return gcn::Image::load(FilePathManager::GetFullPath(filename).c_str()); + if (!gcnImages.count(filename)) + { + gcnImages[filename] = gcn::Image::load(FilePathManager::GetFullPath(filename).c_str()); + } + return gcnImages[filename]; } gcn::ImageFont* ImageLoader::LoadGcnImageFont(const char* filename) Modified: src/player.cpp =================================================================== --- src/player.cpp 2007-10-25 03:36:42 UTC (rev 76) +++ src/player.cpp 2007-10-25 04:39:19 UTC (rev 77) @@ -58,8 +58,8 @@ delete scoreFont; delete lifeFont; scoreFont = lifeFont = 0; - SDL_FreeSurface(scoreFontImage); - SDL_FreeSurface(lifeFontImage); +// SDL_FreeSurface(scoreFontImage); +// SDL_FreeSurface(lifeFontImage); } } void Player::DoControl ( input_states states ) Modified: src/powerupfactory.cpp =================================================================== --- src/powerupfactory.cpp 2007-10-25 03:36:42 UTC (rev 76) +++ src/powerupfactory.cpp 2007-10-25 04:39:19 UTC (rev 77) @@ -44,7 +44,7 @@ // class destructor PowerUpFactory::~PowerUpFactory() { - SDL_FreeSurface(sprite); + ImageLoader::FreeImage("powerups.png"); } void PowerUpFactory::SetCollisionMask ( CollisionMask* c ) Modified: src/probefactory.cpp =================================================================== --- src/probefactory.cpp 2007-10-25 03:36:42 UTC (rev 76) +++ src/probefactory.cpp 2007-10-25 04:39:19 UTC (rev 77) @@ -51,7 +51,7 @@ // class destructor ProbeFactory::~ProbeFactory() { - SDL_FreeSurface(sprite); + ImageLoader::FreeImage("probe.png"); } /** Modified: src/projectilefactory.cpp =================================================================== --- src/projectilefactory.cpp 2007-10-25 03:36:42 UTC (rev 76) +++ src/projectilefactory.cpp 2007-10-25 04:39:19 UTC (rev 77) @@ -41,7 +41,7 @@ // class destructor ProjectileFactory::~ProjectileFactory() { - SDL_FreeSurface(sprite); + ImageLoader::FreeImage("projectile.png"); } /** Modified: src/renderer.cpp =================================================================== --- src/renderer.cpp 2007-10-25 03:36:42 UTC (rev 76) +++ src/renderer.cpp 2007-10-25 04:39:19 UTC (rev 77) @@ -62,11 +62,15 @@ bool Renderer::LoadBackground(const char* mapname) { + /* Note that the previous background is not unloaded. This is ok, as if it + is the same bacground, the LoadImage call below will just give us the same + pointer back, if it's different...well worst case is we load one copy of the + bacground for each map the user plays and have them all in memory + */ std::string filename("maps/"); filename += mapname; filename += "/"; filename += "background.png"; - if (background) {delete background;} // so we don't leak the memory each time a new background is loaded background = ImageLoader::LoadImage(filename.c_str()); if (background == 0) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hol...@us...> - 2007-10-25 03:36:38
|
Revision: 76 http://balder.svn.sourceforge.net/balder/?rev=76&view=rev Author: holomorph Date: 2007-10-24 20:36:42 -0700 (Wed, 24 Oct 2007) Log Message: ----------- updated soundmanager to load sounds using the full path Modified Paths: -------------- history.txt include/renderer.h src/filepathmanager.cpp src/renderer.cpp src/soundmanager.cpp Modified: history.txt =================================================================== --- history.txt 2007-10-24 20:50:59 UTC (rev 75) +++ history.txt 2007-10-25 03:36:42 UTC (rev 76) @@ -4,11 +4,14 @@ History entries are in reverse chronological order (newest entries first). 24 Oct-2007 + - Bjorn tweaked the soundmanager to load sound files correctly, using the + full path as obtained from filepathmanager. + - Bjorn fixed a crash from double deletion of the font image in renderer - Reuben changed the main window caption icon to use /balder2d.xpm. 23 Oct-2007 - Bjorn fixed a bunch of memory leaks in ArtificialCotroller::DoControl - - Bjorn fixed a few other minor leaks, but there are still many in + - Bjorn fixed a few other minor leaks, but there are still many in gamemanager (players, spawns, entities are not deleted) 11 Oct-2007 Modified: include/renderer.h =================================================================== --- include/renderer.h 2007-10-24 20:50:59 UTC (rev 75) +++ include/renderer.h 2007-10-25 03:36:42 UTC (rev 76) @@ -60,7 +60,6 @@ SDL_Surface* screen; SDL_Surface* background; Font* font; - SDL_Surface* fontImage; }; } Modified: src/filepathmanager.cpp =================================================================== --- src/filepathmanager.cpp 2007-10-24 20:50:59 UTC (rev 75) +++ src/filepathmanager.cpp 2007-10-25 03:36:42 UTC (rev 76) @@ -117,7 +117,7 @@ const char* path = PHYSFS_getRealDir(filename); if (NULL == path) { Log::output(std::string("file not found: ").append(filename)); - return 0; + return ""; } std::string fullpath(path); fullpath.append(PHYSFS_getDirSeparator()).append(filename); Modified: src/renderer.cpp =================================================================== --- src/renderer.cpp 2007-10-24 20:50:59 UTC (rev 75) +++ src/renderer.cpp 2007-10-25 03:36:42 UTC (rev 76) @@ -33,15 +33,13 @@ Renderer::Renderer(): background(0) { SetScreen(800, 600); - fontImage = ImageLoader::LoadImage("SFont/scorefont.png"); - font = new Font(fontImage); + font = new Font(ImageLoader::LoadImage("SFont/scorefont.png")); } Renderer::~Renderer() { - delete font; - delete fontImage; + delete font; // this deletes fontImage as well if(background) delete background; screen = 0; } Modified: src/soundmanager.cpp =================================================================== --- src/soundmanager.cpp 2007-10-24 20:50:59 UTC (rev 75) +++ src/soundmanager.cpp 2007-10-25 03:36:42 UTC (rev 76) @@ -36,10 +36,12 @@ Mix_CloseAudio(); } -bool SoundManager::LoadSoundType(const char* name, const char* file) +bool SoundManager::LoadSoundType(const char* name, const char* filename) { if(sound_registry.count(name)){return true;} // there is already a sound with that name loaded - Mix_Chunk *sample = Mix_LoadWAV(file); + std::string fullpath = FilePathManager::GetFullPath(filename); + if (fullpath.empty()) {return false;} + Mix_Chunk *sample = Mix_LoadWAV(fullpath.c_str()); if (0 == sample) { return false;} sound_registry[name] = sample; return true; @@ -64,7 +66,8 @@ music_file += name; music_file += ".ogg"; if (ConfigManager::GetIntValue("Sound", "music")) { - music = Mix_LoadMUS(music_file.c_str()); + std::string fullpath = FilePathManager::GetFullPath(music_file.c_str()); + music = Mix_LoadMUS(fullpath.c_str()); if (music){ Mix_PlayMusic(music,1); double volume = ConfigManager::GetDoubleValue("Sound", "musicvolume"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <col...@us...> - 2007-10-24 20:50:55
|
Revision: 75 http://balder.svn.sourceforge.net/balder/?rev=75&view=rev Author: colalord Date: 2007-10-24 13:50:59 -0700 (Wed, 24 Oct 2007) Log Message: ----------- 24 Oct-2007 - Reuben changed the main window caption icon to use /balder2d.xpm. Modified Paths: -------------- history.txt src/main.cpp Modified: history.txt =================================================================== --- history.txt 2007-10-24 05:16:55 UTC (rev 74) +++ history.txt 2007-10-24 20:50:59 UTC (rev 75) @@ -2,6 +2,10 @@ http://balder.sourceforge.net/ History entries are in reverse chronological order (newest entries first). + +24 Oct-2007 + - Reuben changed the main window caption icon to use /balder2d.xpm. + 23 Oct-2007 - Bjorn fixed a bunch of memory leaks in ArtificialCotroller::DoControl - Bjorn fixed a few other minor leaks, but there are still many in Modified: src/main.cpp =================================================================== --- src/main.cpp 2007-10-24 05:16:55 UTC (rev 74) +++ src/main.cpp 2007-10-24 20:50:59 UTC (rev 75) @@ -66,7 +66,8 @@ Log::output("Audio & video initialized correctly" ); } atexit(SDL_Quit); - SDL_WM_SetIcon(ImageLoader::LoadImage("icon.png"), NULL); + //Set window cation and icon + SDL_WM_SetIcon(ImageLoader::LoadImage("balder2d.xpm"), NULL); SDL_WM_SetCaption("Balder 2D","balder2d"); // We want unicode SDL_EnableUNICODE(1); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hol...@us...> - 2007-10-24 05:16:55
|
Revision: 74 http://balder.svn.sourceforge.net/balder/?rev=74&view=rev Author: holomorph Date: 2007-10-23 22:16:55 -0700 (Tue, 23 Oct 2007) Log Message: ----------- more memory leak fixes Modified Paths: -------------- history.txt include/input.h src/input.cpp src/mapparser.cpp src/renderer.cpp src/soundmanager.cpp Modified: history.txt =================================================================== --- history.txt 2007-10-24 04:14:54 UTC (rev 73) +++ history.txt 2007-10-24 05:16:55 UTC (rev 74) @@ -4,6 +4,8 @@ History entries are in reverse chronological order (newest entries first). 23 Oct-2007 - Bjorn fixed a bunch of memory leaks in ArtificialCotroller::DoControl + - Bjorn fixed a few other minor leaks, but there are still many in + gamemanager (players, spawns, entities are not deleted) 11 Oct-2007 - Bjorn added an arg parser to filepathmanager and a method to get the full Modified: include/input.h =================================================================== --- include/input.h 2007-10-24 04:14:54 UTC (rev 73) +++ include/input.h 2007-10-24 05:16:55 UTC (rev 74) @@ -47,6 +47,7 @@ public: // contstructor Input(GameManager *gm, int num_players); + ~Input(); // checks the input state and pass it along to the game manager void CheckInput(); void SetPlayerInputController(player_id id, int controller_number); Modified: src/input.cpp =================================================================== --- src/input.cpp 2007-10-24 04:14:54 UTC (rev 73) +++ src/input.cpp 2007-10-24 05:16:55 UTC (rev 74) @@ -97,8 +97,7 @@ bool Input::keymapInitialized = false; // contstructor - Input::Input(GameManager* gm, int nplayers): - game_manager(gm), num_players(nplayers) +Input::Input(GameManager* gm, int nplayers):game_manager(gm), num_players(nplayers) { SDL_JoystickEventState(SDL_ENABLE); joystick = SDL_JoystickOpen(0); // joystick 0 @@ -106,6 +105,11 @@ BindKeys(); } +Input::~Input() +{ + delete[] controllers; +} + // checks the input state and pass it along to the game manager void Input::CheckInput() { Modified: src/mapparser.cpp =================================================================== --- src/mapparser.cpp 2007-10-24 04:14:54 UTC (rev 73) +++ src/mapparser.cpp 2007-10-24 05:16:55 UTC (rev 74) @@ -36,7 +36,9 @@ map_file->LoadFile(); } MapParser::~MapParser() -{} +{ + delete map_file; +} const char* MapParser::GetMapMusic() { Modified: src/renderer.cpp =================================================================== --- src/renderer.cpp 2007-10-24 04:14:54 UTC (rev 73) +++ src/renderer.cpp 2007-10-24 05:16:55 UTC (rev 74) @@ -30,7 +30,7 @@ std::map<std::string,SDL_Surface*> Renderer::sprite_registry; -Renderer::Renderer() +Renderer::Renderer(): background(0) { SetScreen(800, 600); fontImage = ImageLoader::LoadImage("SFont/scorefont.png"); @@ -40,6 +40,9 @@ Renderer::~Renderer() { + delete font; + delete fontImage; + if(background) delete background; screen = 0; } @@ -65,6 +68,7 @@ filename += mapname; filename += "/"; filename += "background.png"; + if (background) {delete background;} // so we don't leak the memory each time a new background is loaded background = ImageLoader::LoadImage(filename.c_str()); if (background == 0) { Modified: src/soundmanager.cpp =================================================================== --- src/soundmanager.cpp 2007-10-24 04:14:54 UTC (rev 73) +++ src/soundmanager.cpp 2007-10-24 05:16:55 UTC (rev 74) @@ -38,6 +38,7 @@ bool SoundManager::LoadSoundType(const char* name, const char* file) { + if(sound_registry.count(name)){return true;} // there is already a sound with that name loaded Mix_Chunk *sample = Mix_LoadWAV(file); if (0 == sample) { return false;} sound_registry[name] = sample; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hol...@us...> - 2007-10-24 04:15:14
|
Revision: 73 http://balder.svn.sourceforge.net/balder/?rev=73&view=rev Author: holomorph Date: 2007-10-23 21:14:54 -0700 (Tue, 23 Oct 2007) Log Message: ----------- Fixed a bunch of memory leaks in Artificial controller Modified Paths: -------------- history.txt Modified: history.txt =================================================================== --- history.txt 2007-10-24 04:13:13 UTC (rev 72) +++ history.txt 2007-10-24 04:14:54 UTC (rev 73) @@ -2,6 +2,8 @@ http://balder.sourceforge.net/ History entries are in reverse chronological order (newest entries first). +23 Oct-2007 + - Bjorn fixed a bunch of memory leaks in ArtificialCotroller::DoControl 11 Oct-2007 - Bjorn added an arg parser to filepathmanager and a method to get the full This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hol...@us...> - 2007-10-24 04:13:09
|
Revision: 72 http://balder.svn.sourceforge.net/balder/?rev=72&view=rev Author: holomorph Date: 2007-10-23 21:13:13 -0700 (Tue, 23 Oct 2007) Log Message: ----------- Fixed a bunch of memory leaks in Artificial controller Modified Paths: -------------- src/artificialcontroller.cpp src/filepathmanager.cpp src/soundmanager.cpp Modified: src/artificialcontroller.cpp =================================================================== --- src/artificialcontroller.cpp 2007-10-12 02:13:10 UTC (rev 71) +++ src/artificialcontroller.cpp 2007-10-24 04:13:13 UTC (rev 72) @@ -124,20 +124,29 @@ while (ent != entities.end()) { // first create a dictionary and add things common to all entities PyObject* pEntityData = PyDict_New(); - PyDict_SetItemString(pEntityData, "x", PyInt_FromLong((*ent)->GetX())); - PyDict_SetItemString(pEntityData, "y", PyInt_FromLong((*ent)->GetY())); - PyDict_SetItemString(pEntityData, "x_velocity", PyFloat_FromDouble((*ent)->GetXVelocity())); - PyDict_SetItemString(pEntityData, "y_velocity", PyFloat_FromDouble((*ent)->GetYVelocity())); + PyObject* x = PyInt_FromLong((*ent)->GetX()); + PyObject* y = PyInt_FromLong((*ent)->GetY()); + PyObject* x_velocity = PyFloat_FromDouble((*ent)->GetXVelocity()); + PyObject* y_velocity = PyFloat_FromDouble((*ent)->GetYVelocity()); + PyDict_SetItemString(pEntityData, "x", x); Py_DECREF(x); + PyDict_SetItemString(pEntityData, "y", y); Py_DECREF(y); + PyDict_SetItemString(pEntityData, "x_velocity", x_velocity); Py_DECREF(x_velocity); + PyDict_SetItemString(pEntityData, "y_velocity", y_velocity); Py_DECREF(y_velocity); if ((*ent)->GetType() == "probe") { Probe* p = dynamic_cast<Probe*>(*ent); - PyDict_SetItemString(pEntityData, "charge", PyInt_FromLong(p->GetCharge())); - PyDict_SetItemString(pEntityData, "life", PyInt_FromLong(p->GetLife())); - PyDict_SetItemString(pEntityData, "deaths", PyInt_FromLong(p->GetDeaths())); - PyDict_SetItemString(pEntityData, "deaths", PyInt_FromLong(p->GetDeaths())); - PyDict_SetItemString(pEntityData, "stuck", PyBool_FromLong(p->GetStuckStatus())); - PyDict_SetItemString(pEntityData, "rotation_angle", PyFloat_FromDouble(p->GetRotationAngle())); + PyObject* charge = PyInt_FromLong(p->GetCharge()); + PyObject* life = PyInt_FromLong(p->GetLife()); + PyObject* deaths = PyInt_FromLong(p->GetDeaths()); + PyObject* stuck = PyBool_FromLong(p->GetStuckStatus()); + PyObject* rotation_angle = PyFloat_FromDouble(p->GetRotationAngle()); + PyDict_SetItemString(pEntityData, "charge", charge); Py_DECREF(charge); + PyDict_SetItemString(pEntityData, "life", life); Py_DECREF(life); + PyDict_SetItemString(pEntityData, "deaths", deaths); Py_DECREF(deaths); + PyDict_SetItemString(pEntityData, "stuck", stuck); Py_DECREF(stuck); + PyDict_SetItemString(pEntityData, "rotation_angle", rotation_angle); Py_DECREF(rotation_angle); // add to probe dictionary with the id as the key - PyDict_SetItem(probes, PyInt_FromLong(p->GetOwner()), pEntityData); + PyObject* owner = PyInt_FromLong(p->GetOwner()); + PyDict_SetItem(probes, owner , pEntityData);Py_DECREF(owner); } else if ((*ent)->GetType() == "projectile") { // add to projectile list @@ -148,6 +157,7 @@ PyList_Append( powerups, pEntityData); } ++ent; + Py_DECREF(pEntityData); } PyTuple_SetItem(pArgs, 1, probes); PyTuple_SetItem(pArgs, 2, projectiles); @@ -180,8 +190,17 @@ if ((*pit)->inputs != old ) { game_manager->SendInputState((*pit)->id,(*pit)->inputs); } + //Py_DECREF(inputs); + //Py_DECREF(probeID); ++pit; } + // need to decref all the lists etc that we created at the beginning of this function + // probably would be better to just create these once in initialization, and then clear them each time + Py_DECREF(probes); + Py_DECREF(projectiles); + Py_DECREF(powerups); + Py_DECREF(pArgs); + } PyObject* ArtificialController::py_IsWall(PyObject *self, PyObject *args) Modified: src/filepathmanager.cpp =================================================================== --- src/filepathmanager.cpp 2007-10-12 02:13:10 UTC (rev 71) +++ src/filepathmanager.cpp 2007-10-24 04:13:13 UTC (rev 72) @@ -132,5 +132,6 @@ for (i = sp; *i != NULL; i++){ searchpath.push_back(std::string(*i)); } + PHYSFS_freeList(sp); return searchpath; } Modified: src/soundmanager.cpp =================================================================== --- src/soundmanager.cpp 2007-10-12 02:13:10 UTC (rev 71) +++ src/soundmanager.cpp 2007-10-24 04:13:13 UTC (rev 72) @@ -1,4 +1,25 @@ +/*************************************************************************** + * Copyright (C) 2007 by Bjorn Hansen * + * hol...@us... * + * * + * 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. * + ***************************************************************************/ + #include "soundmanager.h" +#include "filepathmanager.h" using namespace Balder; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hol...@us...> - 2007-10-12 02:13:06
|
Revision: 71 http://balder.svn.sourceforge.net/balder/?rev=71&view=rev Author: holomorph Date: 2007-10-11 19:13:10 -0700 (Thu, 11 Oct 2007) Log Message: ----------- added command line parser to filepathmanager and a method to get the full config file path Modified Paths: -------------- include/filepathmanager.h src/artificialcontroller.cpp src/filepathmanager.cpp src/main.cpp Modified: include/filepathmanager.h =================================================================== --- include/filepathmanager.h 2007-10-12 02:12:56 UTC (rev 70) +++ include/filepathmanager.h 2007-10-12 02:13:10 UTC (rev 71) @@ -29,15 +29,18 @@ class FilePathManager { public: - static void Init(char *argv[]); + static void Init(int argc, char *argv[]); static void Cleanup(); static std::string GetFullPath(const char* filename); static std::list<std::string> GetSearchPath(); + static std::string GetConfigPath(){return configPath;} protected: + static bool ParseArgs(int argc, char *argv[], const char* flag, std::string *value); static bool SetConfig(const char* data_directory); private: FilePathManager(){}; ~FilePathManager(){}; + static std::string configPath; }; } Modified: src/artificialcontroller.cpp =================================================================== --- src/artificialcontroller.cpp 2007-10-12 02:12:56 UTC (rev 70) +++ src/artificialcontroller.cpp 2007-10-12 02:13:10 UTC (rev 71) @@ -57,7 +57,7 @@ //Iterate through the list: for(std::list<std::string>::iterator iter = searchpath.begin(); iter != searchpath.end(); ++iter) { - std::string command = "sys.path.append('" + *iter + "scripts')\n"; + std::string command = "sys.path.append('" + *iter + "/scripts')\n"; PyRun_SimpleString(command.c_str()); } PyObject *balder_module = Py_InitModule("balder", BalderAIMethods); Modified: src/filepathmanager.cpp =================================================================== --- src/filepathmanager.cpp 2007-10-12 02:12:56 UTC (rev 70) +++ src/filepathmanager.cpp 2007-10-12 02:13:10 UTC (rev 71) @@ -25,10 +25,21 @@ using namespace Balder; using namespace std; -void FilePathManager::Init(char *argv[]) +string FilePathManager::configPath = "config.xml"; + +void FilePathManager::Init(int argc, char *argv[]) { PHYSFS_init(argv[0]); - SetConfig(argv[2]); + string s; + if (ParseArgs(argc, argv, "config", &s)) { + configPath = s; + } + if (ParseArgs(argc, argv, "data", &s)){ + SetConfig(s.c_str()); + } + else { + SetConfig(NULL); + } char **searchpath = PHYSFS_getSearchPath(); char **i; Log::output("search path set to:"); @@ -42,6 +53,19 @@ { PHYSFS_deinit(); } +// returns true if the flag is found and the value for that flag is assigned to *value +bool FilePathManager::ParseArgs(int argc, char *argv[], const char* flag, string *value) +{ + string flagstring = "--"; + flagstring += flag; + for (int i=1;i<argc-1;++i){ + if (argv[i] == flagstring){ + *value = argv[i+1]; + return true; + } + } + return false; +} bool FilePathManager::SetConfig(const char* data_directory) { Modified: src/main.cpp =================================================================== --- src/main.cpp 2007-10-12 02:12:56 UTC (rev 70) +++ src/main.cpp 2007-10-12 02:13:10 UTC (rev 71) @@ -39,16 +39,11 @@ int main(int argc, char *argv[]) { - FilePathManager::Init(argv); + FilePathManager::Init(argc, argv); // first, load the config file try{ Log::output("Loading config manager"); - if (argc == 2 ) { // use the configu file specified on the command line - ConfigManager::LoadConfigFile( argv[1] ); - } - else { // no config file specified, try to load the default one - ConfigManager::LoadConfigFile( ); - } + ConfigManager::LoadConfigFile( FilePathManager::GetConfigPath().c_str() ); } catch (const char *message) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hol...@us...> - 2007-10-12 02:12:52
|
Revision: 70 http://balder.svn.sourceforge.net/balder/?rev=70&view=rev Author: holomorph Date: 2007-10-11 19:12:56 -0700 (Thu, 11 Oct 2007) Log Message: ----------- added command line parser to filepathmanager and a method to get the full config file path Modified Paths: -------------- history.txt Modified: history.txt =================================================================== --- history.txt 2007-10-12 01:05:25 UTC (rev 69) +++ history.txt 2007-10-12 02:12:56 UTC (rev 70) @@ -4,6 +4,8 @@ History entries are in reverse chronological order (newest entries first). 11 Oct-2007 + - Bjorn added an arg parser to filepathmanager and a method to get the full + path to the config file. - Bjorn added FilePathManager class to abstract calls to physicsfs and provide utility methods to get the search path and find the real path of a file. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hol...@us...> - 2007-10-12 01:05:21
|
Revision: 69 http://balder.svn.sourceforge.net/balder/?rev=69&view=rev Author: holomorph Date: 2007-10-11 18:05:25 -0700 (Thu, 11 Oct 2007) Log Message: ----------- added FilePathManager and add all possible script directories to python path Modified Paths: -------------- history.txt src/artificialcontroller.cpp src/imageloader.cpp src/main.cpp src/mapparser.cpp Added Paths: ----------- include/filepathmanager.h src/filepathmanager.cpp Modified: history.txt =================================================================== --- history.txt 2007-10-11 06:12:18 UTC (rev 68) +++ history.txt 2007-10-12 01:05:25 UTC (rev 69) @@ -3,6 +3,13 @@ History entries are in reverse chronological order (newest entries first). +11 Oct-2007 + - Bjorn added FilePathManager class to abstract calls to physicsfs and + provide utility methods to get the search path and find the real path of + a file. + - Bjorn made the artificialcontroller set up iterate through the search + path and add all scrip directories to the python path. + 10 Oct-2007 - Bjorn added physfs dependancy in order to make file opening independant of the location of the binary. @@ -15,7 +22,7 @@ 08 Oct-2007 - Reuben separated the CodeBlocks project file into two project files, one - for Windows and one for Linux, as the environment variable may very. + for Windows and one for Linux, as the environment variable may vary. - Reuben modified the CodeBlocks Project file to include the PhysFS lib. 19 Aug-2007 Added: include/filepathmanager.h =================================================================== --- include/filepathmanager.h (rev 0) +++ include/filepathmanager.h 2007-10-12 01:05:25 UTC (rev 69) @@ -0,0 +1,45 @@ +/*************************************************************************** + * Copyright (C) 2007 by Bjorn Hansen * + * hol...@us... * + * * + * 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 FilePathManager_H +#define FilePathManager_H + +#include <string> +#include <list> + +namespace Balder { + +class FilePathManager +{ + public: + static void Init(char *argv[]); + static void Cleanup(); + static std::string GetFullPath(const char* filename); + static std::list<std::string> GetSearchPath(); + protected: + static bool SetConfig(const char* data_directory); + private: + FilePathManager(){}; + ~FilePathManager(){}; +}; + +} + +#endif // FilePathManager_H Modified: src/artificialcontroller.cpp =================================================================== --- src/artificialcontroller.cpp 2007-10-11 06:12:18 UTC (rev 68) +++ src/artificialcontroller.cpp 2007-10-12 01:05:25 UTC (rev 69) @@ -28,6 +28,7 @@ #include "input.h" #include "entity.h" #include "probe.h" +#include "filepathmanager.h" #include "log.h" using namespace Balder; @@ -52,7 +53,13 @@ // set up the python environment to find the scrpits Log::output("Loading AI scripts. . ."); PyRun_SimpleString("import sys\n"); - PyRun_SimpleString("sys.path.append('scripts')\n"); + std::list<std::string> searchpath = FilePathManager::GetSearchPath(); + //Iterate through the list: + for(std::list<std::string>::iterator iter = searchpath.begin(); iter != searchpath.end(); ++iter) + { + std::string command = "sys.path.append('" + *iter + "scripts')\n"; + PyRun_SimpleString(command.c_str()); + } PyObject *balder_module = Py_InitModule("balder", BalderAIMethods); PyModule_AddIntConstant(balder_module, "INPUT_LEFT", LEFT); PyModule_AddIntConstant(balder_module, "INPUT_RIGHT", RIGHT); Added: src/filepathmanager.cpp =================================================================== --- src/filepathmanager.cpp (rev 0) +++ src/filepathmanager.cpp 2007-10-12 01:05:25 UTC (rev 69) @@ -0,0 +1,112 @@ +/*************************************************************************** + * Copyright (C) 2007 by Bjorn Hansen * + * hol...@us... * + * * + * 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. * + ***************************************************************************/ + +#include "filepathmanager.h" +#include <physfs.h> +#include "log.h" + +using namespace Balder; +using namespace std; + +void FilePathManager::Init(char *argv[]) +{ + PHYSFS_init(argv[0]); + SetConfig(argv[2]); + char **searchpath = PHYSFS_getSearchPath(); + char **i; + Log::output("search path set to:"); + for ( i=searchpath; *i != NULL; ++i){ + Log::output(*i); + } + PHYSFS_freeList(searchpath); +} + +void FilePathManager::Cleanup() +{ + PHYSFS_deinit(); +} + +bool FilePathManager::SetConfig(const char* data_directory) +{ + const char *basedir = PHYSFS_getBaseDir(); + const char *userdir = PHYSFS_getUserDir(); + const char *dirsep = PHYSFS_getDirSeparator(); + const char *dir = "balder2d"; + + string str(userdir); + str.append(dirsep).append(dir); + + if (!PHYSFS_setWriteDir(str.c_str())) + { + cout << "setWriteDir failed" << endl; + int no_write = 0; + if ( (PHYSFS_setWriteDir(userdir)) && + (PHYSFS_mkdir(dir)) ) + { + cout << "set write directory and created " << dir << " directory" <<endl; + if (!PHYSFS_setWriteDir(str.c_str())){ + cout << "failed to set write directory to " << dir << endl; + no_write = 1; + } + } /* if */ + else + { + no_write = 1; + } /* else */ + + if (no_write) + { + cout << "setting write directory to null " << endl; + PHYSFS_setWriteDir(NULL); /* just in case. */ + } /* if */ + } /* if */ + + /* Put write dir first in search path... */ + PHYSFS_addToSearchPath(str.c_str(), 0); + // add the data directory if it was specified + if (data_directory != NULL){ PHYSFS_addToSearchPath(data_directory,1);} + /* Put base path on search path... */ + PHYSFS_addToSearchPath(basedir, 1); + + return(true); +} + +string FilePathManager::GetFullPath(const char* filename) +{ + const char* path = PHYSFS_getRealDir(filename); + if (NULL == path) { + Log::output(std::string("file not found: ").append(filename)); + return 0; + } + std::string fullpath(path); + fullpath.append(PHYSFS_getDirSeparator()).append(filename); + return fullpath; +} + +std::list<std::string> FilePathManager::GetSearchPath() +{ + std::list<std::string> searchpath; + char **sp = PHYSFS_getSearchPath(); + char **i; + for (i = sp; *i != NULL; i++){ + searchpath.push_back(std::string(*i)); + } + return searchpath; +} Modified: src/imageloader.cpp =================================================================== --- src/imageloader.cpp 2007-10-11 06:12:18 UTC (rev 68) +++ src/imageloader.cpp 2007-10-12 01:05:25 UTC (rev 69) @@ -20,34 +20,22 @@ #include "imageloader.h" #include "log.h" -#include <physfs.h> +#include "filepathmanager.h" #include <string> using namespace Balder; -std::string GetFullPath(const char* filename) -{ - const char* path = PHYSFS_getRealDir(filename); - if (NULL == path) { - Log::output(std::string("file not found: ").append(filename)); - return 0; - } - std::string fullpath(path); - fullpath.append(PHYSFS_getDirSeparator()).append(filename); - return fullpath; -} - SDL_Surface* ImageLoader::LoadImage(const char* filename) { - return IMG_Load(GetFullPath(filename).c_str()); + return IMG_Load(FilePathManager::GetFullPath(filename).c_str()); } gcn::Image* ImageLoader::LoadGcnImage(const char* filename) { - return gcn::Image::load(GetFullPath(filename).c_str()); + return gcn::Image::load(FilePathManager::GetFullPath(filename).c_str()); } gcn::ImageFont* ImageLoader::LoadGcnImageFont(const char* filename) { - return new gcn::ImageFont(GetFullPath(filename).c_str()); + return new gcn::ImageFont(FilePathManager::GetFullPath(filename).c_str()); } Modified: src/main.cpp =================================================================== --- src/main.cpp 2007-10-11 06:12:18 UTC (rev 68) +++ src/main.cpp 2007-10-12 01:05:25 UTC (rev 69) @@ -22,7 +22,6 @@ #include <SDL/SDL_image.h> #include <SDL/SDL_thread.h> #include <SDL/SDL_mixer.h> -#include <physfs.h> #include <string> #include "gamemanager.h" #include "renderer.h" @@ -30,6 +29,7 @@ #include "configmanager.h" #include "menu/menu.h" #include "imageloader.h" +#include "filepathmanager.h" #include "log.h" using namespace std; @@ -39,15 +39,7 @@ int main(int argc, char *argv[]) { - PHYSFS_init(argv[0]); - setConfig(argv[2]); - char **searchpath = PHYSFS_getSearchPath(); - char **i; - Log::output("search path set to:"); - for ( i=searchpath; *i != NULL; ++i){ - Log::output(*i); - } - PHYSFS_freeList(searchpath); + FilePathManager::Init(argv); // first, load the config file try{ Log::output("Loading config manager"); @@ -187,50 +179,6 @@ delete render; delete sound; SDL_Quit(); + FilePathManager::Cleanup(); return 0; } - -bool setConfig(const char* data_directory) -{ - const char *basedir = PHYSFS_getBaseDir(); - const char *userdir = PHYSFS_getUserDir(); - const char *dirsep = PHYSFS_getDirSeparator(); - const char *dir = "balder2d"; - - string str(userdir); - str.append(dirsep).append(dir); - - if (!PHYSFS_setWriteDir(str.c_str())) - { - cout << "setWriteDir failed" << endl; - int no_write = 0; - if ( (PHYSFS_setWriteDir(userdir)) && - (PHYSFS_mkdir(dir)) ) - { - cout << "set write directory and created " << dir << " directory" <<endl; - if (!PHYSFS_setWriteDir(str.c_str())){ - cout << "failed to set write directory to " << dir << endl; - no_write = 1; - } - } /* if */ - else - { - no_write = 1; - } /* else */ - - if (no_write) - { - cout << "setting write directory to null " << endl; - PHYSFS_setWriteDir(NULL); /* just in case. */ - } /* if */ - } /* if */ - - /* Put write dir first in search path... */ - PHYSFS_addToSearchPath(str.c_str(), 0); - // add the data directory if it was specified - if (data_directory != NULL){ PHYSFS_addToSearchPath(data_directory,1);} - /* Put base path on search path... */ - PHYSFS_addToSearchPath(basedir, 1); - - return(true); -} Modified: src/mapparser.cpp =================================================================== --- src/mapparser.cpp 2007-10-11 06:12:18 UTC (rev 68) +++ src/mapparser.cpp 2007-10-12 01:05:25 UTC (rev 69) @@ -22,16 +22,15 @@ #include "mapparser.h" #include "gamemanager.h" #include "tinyxml/tinyxml.h" -#include <string> +#include "filepathmanager.h" using namespace Balder; MapParser::MapParser(const char* mapname) { std::string filename("maps/"); - filename += mapname; - filename += "/"; - filename += "maptags.xml"; + filename = filename + mapname + "/" + "maptags.xml"; + filename = FilePathManager::GetFullPath(filename.c_str()); Log::output("Loading Mapfile " + filename); map_file = new TiXmlDocument( filename ); map_file->LoadFile(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hol...@us...> - 2007-10-11 06:12:20
|
Revision: 68 http://balder.svn.sourceforge.net/balder/?rev=68&view=rev Author: holomorph Date: 2007-10-10 23:12:18 -0700 (Wed, 10 Oct 2007) Log Message: ----------- Added physfs dependancy in order to make file opening independant of the location of the binary. Added changes so that images (both sdl and guichan) are loaded through the imagemanager methods. These methods use physfs to locate the desired file and then pass the full path to the SDL and Guichan image loading functions. Eliminated the need for boost::filesystem. The directory search/enumeration is now done using physicsfs. Modified Paths: -------------- SConstruct history.txt include/imageloader.h src/imageloader.cpp src/main.cpp src/menu/ailistmodel.cpp src/menu/maplistmodel.cpp src/menu/menu.cpp src/menu/playersetup.cpp src/menu/sampleprobewidget.cpp Modified: SConstruct =================================================================== --- SConstruct 2007-10-08 23:44:38 UTC (rev 67) +++ SConstruct 2007-10-11 06:12:18 UTC (rev 68) @@ -10,7 +10,7 @@ import glob files = glob.glob("src/*.cpp") + glob.glob("src/*/*.cpp") + glob.glob("src/*/*.c") -libs = Split('guichan_sdl guichan SDL_image SDL_mixer SDL_gfx python2.4 boost_filesystem') +libs = Split('guichan_sdl guichan SDL_image SDL_mixer SDL_gfx python2.4 physfs') env.ParseConfig('sdl-config --cflags --libs') env.Program('bin/balder2d',files, LIBS=libs) Modified: history.txt =================================================================== --- history.txt 2007-10-08 23:44:38 UTC (rev 67) +++ history.txt 2007-10-11 06:12:18 UTC (rev 68) @@ -3,6 +3,16 @@ History entries are in reverse chronological order (newest entries first). +10 Oct-2007 + - Bjorn added physfs dependancy in order to make file opening independant + of the location of the binary. + - Bjorn added changes so that images (both sdl and guichan) are loaded + through the imagemanager methods. These methods use physfs to locate + the desired file and then pass the full path to the SDL and Guichan + image loading functions. + - Bjorn eliminated the need for boost::filesystem. The directory search/ + enumeration is now done using physicsfs. + 08 Oct-2007 - Reuben separated the CodeBlocks project file into two project files, one for Windows and one for Linux, as the environment variable may very. @@ -10,11 +20,11 @@ 19 Aug-2007 - Bjorn set bindNextKey to false at the beginning of the action handler - for the player setup menu and refreshed the keys so that doing anything + for the player setup menu and refreshed the keys so that doing anything other than pressing a key to bind will cancel the keybinding. 16 Aug-2007 - - Bjorn fixed the crash when using the keyboard to select keybinding + - Bjorn fixed the crash when using the keyboard to select keybinding buttons due to uninitialized value of bindNextKey. - Bjorn updated SConstruct to remove gne library path. - Reuben updated: /src/menu/playersetup.cpp & /src/menu/playersetup.h @@ -23,7 +33,7 @@ function signature to match that of the function keyPressed in the class gcn::KeyListener for proper overloading. Bug Fixed: Key Bindings in the Player Setup menu now work again. - + 15 Aug-2007 - Reuben updated: /src/menu/gamesetup.cpp Updated: mapDropDown width to 400. @@ -48,7 +58,7 @@ Added: pulseAnimation(). 18 July-2007 - - Bjorn applied a patch from Alexander Clausen which adds support for + - Bjorn applied a patch from Alexander Clausen which adds support for pausing the game using the Pause key. 16 July-2007 @@ -69,24 +79,24 @@ - Reuben made the buttonskins.png more transparent. 30 Nov-2006 - - Bjorn changed background animation scheme to have a static image and - then place animation widgets over animated portions. Hopefully this + - Bjorn changed background animation scheme to have a static image and + then place animation widgets over animated portions. Hopefully this will be faster. - - Bjorn fixed a bug in skinnedbuttonwidget where parent constructor was + - Bjorn fixed a bug in skinnedbuttonwidget where parent constructor was not called, resulting in some un-initialized values in the widget - Reuben adjusted skinnedbuttonwidget.cpp so when initialized buttonState is assigned the value buttonUp. - Reuben updated buttonskins.png with new skin. - Reuben cleaned up code in animationwidget.cpp and animationwidget.hpp. - They no longer have setAnimation() and getAnimationFileName() as internal + They no longer have setAnimation() and getAnimationFileName() as internal methods due to a possible memory leak. They weren't needed in any case. - Reuben added skinnedbuttonwidget.cpp and skinnedbuttonwidget.hpp to allow for skinned button support. - Reuben modified Main Menu buttons to utilize the skinnedbuttonwidget instead of the regular button widget. - Reuben added buttonskins.png which contains the buttons skins. - - Bjorn fixed a bug in the collision mask where pixels pixels just - outside the width or height of the map could be tested, resulting + - Bjorn fixed a bug in the collision mask where pixels pixels just + outside the width or height of the map could be tested, resulting in a crash (on some machines) 29 Nov-2006 @@ -122,46 +132,46 @@ - Reuben made a Code::Blocks project file for Windows builds. Added file: Balder2D.cbp - Reuben composed a document containing instruction on how to set up a - Win32 Development Environment for Balder2D. Added file: + Win32 Development Environment for Balder2D. Added file: Balder2D Win32 Development Environment Setup Instructions.txt 12 Oct-2006 - Bjorn made projectile velocity adjustable via the config file. - Bjorn changed probe velocity to projectile addition to be AddProbeVelocity - - Bjorn made sure to call RefreshKeys() when the player setup menu is - created so that everything is correct when it is first displayed (ie, key + - Bjorn made sure to call RefreshKeys() when the player setup menu is + created so that everything is correct when it is first displayed (ie, key binding buttons are hidden if player 1 is computer controlled). - - Bjorn fixed label bug for keybinding menu, label sizes were not adjusted + - Bjorn fixed label bug for keybinding menu, label sizes were not adjusted when labels were changed, now they are. 18 Sep-2006 - - Bjorn fixed the keybinding bug (keybinding was totally broken by the menu + - Bjorn fixed the keybinding bug (keybinding was totally broken by the menu refactor). - Bjorn added a spawn animation. - Bjorn added drawing some circles outside of the probe to further highlight which way the probe is aiming - + 9 Sep-2006 - Bjorn removed networkmanager and references to it from the new branch - - Bjorn created a no_network branch for creating packages w/o any network + - Bjorn created a no_network branch for creating packages w/o any network dependancies. - Bjorn added the packer subdirectory (for package generation) to CVS - - Bjorn added a script to run balder2d when it is installed in a system + - Bjorn added a script to run balder2d when it is installed in a system wide directory on a linux machine. - - Bjorn added a method to ConfigManager to generate a config file if the + - Bjorn added a method to ConfigManager to generate a config file if the requested config file does not exist. - - Bjorn added the ability to use an alternate config file, specified on + - Bjorn added the ability to use an alternate config file, specified on the command line as the first argument. - + 8 Sep-2006 - Bjorn added some menu files that somehow got missed when he refactored the menu system. 20 Aug-2006 - - Bjorn did a major refactoring of the menu code. Each submenu is now its - own file (well, almost, the multiplayer menus will have to be broken up - if they get worked on again). Almost everything that used to work seems - to be working again. Some testing is required to make sure this didn't + - Bjorn did a major refactoring of the menu code. Each submenu is now its + own file (well, almost, the multiplayer menus will have to be broken up + if they get worked on again). Almost everything that used to work seems + to be working again. Some testing is required to make sure this didn't introduce new bugs. 26-June-2006 @@ -218,16 +228,16 @@ "Host" button. - Reuben updated the todo.txt list with new networking goals, main menu background, player options menu updates. Some finished items were also - marked as done. + marked as done. 19-May-2006 - - Bjorn ripped out all the GNE network code in preparation for a network + - Bjorn ripped out all the GNE network code in preparation for a network overhaul. 29-Apr-2006 - Bjorn fixed the timer bug so it displays 0:00 at the end of the game. - - Bjorn fixed the bug where the explosion animation plays twice when - a probe runs out of life - however, probes for players that disconnect in + - Bjorn fixed the bug where the explosion animation plays twice when + a probe runs out of life - however, probes for players that disconnect in a multiplayer game will now simply dissapear, rather than exploding. 12-Apr-2006 @@ -276,7 +286,7 @@ 23-Mar-2006 - Bjorn reduced the projectile lifetime to 200 frames (was 400). - Bjorn added checks so that you can't configure keybindings/AI scripts for - more players than are set by "Number of Players" in the options menu. + more players than are set by "Number of Players" in the options menu. - Bjorn changed the ammo indicators so they rotate around the probe, rather than aligning with the aiming angle. This makes it easier to see. - Bjorn added menu.ogg and default.ogg to the music menu. These are not @@ -301,13 +311,13 @@ main menu it starts to play the "menu" music once again. - Reuben made it so SoundManager::PlayMusic() checks to see if the music option is enabled. - - Bjorn made aiListBox fire "changeAIScript" event directly when clicked, + - Bjorn made aiListBox fire "changeAIScript" event directly when clicked, instead of having next/previous or returning to the options menu cause it. - Bjorn hid keybining button/labels for computer players - Reuben PlayMusic(const char *name) and StopMusic() to the SoundManager. - - Bjorn added menu/sampleprobewidget which is now added to the player - setup menu, and is drawn by the gui, rather than blitting a probe sprite + - Bjorn added menu/sampleprobewidget which is now added to the player + setup menu, and is drawn by the gui, rather than blitting a probe sprite on top of the menu, which ended up showing on top of the AI dropdown. - Bjorn moved the AI selector box to the top of the player setup screen - Reuben added the 'music' directory and set the soundmanager to load @@ -325,20 +335,20 @@ - Reuben patched a bug in the main menu where only some options were saved on program exit and the rest were saved on game start. Now all options are saved on program exit and game start. - - Bjorn ran a code reformatter (astyle), just for fun, on player.cpp Yea - that pretty much obfuscates all the changes, but it looks nice :p. + - Bjorn ran a code reformatter (astyle), just for fun, on player.cpp Yea + that pretty much obfuscates all the changes, but it looks nice :p. - Bjorn aligned the livesleft and score indicators to the right side of the - stat box. + stat box. - Bjorn added a new font for lives left. - Reuben patched a bug in the lives remaining counter in the stat box to - hide the lives remaining counter when the game settings are set to - unlimited lives per round. - - Reuben update co-ax map background. - - Bjorn fixed a bug in Probe::AddImpulse() where push power would remain + hide the lives remaining counter when the game settings are set to + unlimited lives per round. + - Reuben update co-ax map background. + - Bjorn fixed a bug in Probe::AddImpulse() where push power would remain charged when bumped off a wall, or blown up. - - Bjorn fixed a bug in Probe::AddImpulse() where being bumped off a wall - was different in the horizontal or vertical directions, from a diagonal, - because of failing to use the magnitude of the collision velocity, and + - Bjorn fixed a bug in Probe::AddImpulse() where being bumped off a wall + was different in the horizontal or vertical directions, from a diagonal, + because of failing to use the magnitude of the collision velocity, and simply adding x and y componants in stead. - Bjorn bugfix for my own dumbassness (x^2 != x*x) - Reuben added a "Player Lives Remaining" counter to the players stat box. @@ -347,9 +357,9 @@ off speed indication. - Bjorn fixed the Probe-Probe collisions, so exploding probes don't collide - Bjorn fixed ArtificialController::py_IsLineOfSight so that it tests - evenly along x or y, avoiding missing walls when x's are close together + evenly along x or y, avoiding missing walls when x's are close together but y's are not. - - Bjorn did some more work on the ai scripts, so computer players will + - Bjorn did some more work on the ai scripts, so computer players will try to collect powerups. 20-Mar-2006 @@ -358,42 +368,42 @@ - Reuben changed the method in which the config file is saved so were is saves on program exit as well as start game. - Bjorn added a mock ArtificialController in 'ac.h' to the bin/scripts/test/ - directory, which will initialize the python interpreter and add the 'balder' - module, which many of the scripts require. The unit tests for the scripts + directory, which will initialize the python interpreter and add the 'balder' + module, which many of the scripts require. The unit tests for the scripts should now be run by running the 'runtests' executable in the test directory. - Reuben added broken functionality to the menu to save the selected AI script to the config file. NOTE: must work on this some more for it to - work properly. + work properly. - Reuben added functionality to the menu to load the selected AI script from the config file. - Reuben added ConfigManager::SetControlType(int, const char*). 19-Mar-2006 - - Bjorn added runtest.cpp, which should allow unit tests to be run on scripts + - Bjorn added runtest.cpp, which should allow unit tests to be run on scripts by including ArtificialController, which initializes the 'balder' module. - - Bjorn modified balderai script so the probes don't try to fire through + - Bjorn modified balderai script so the probes don't try to fire through walls, and don't fire as fast at far away targets (needs work still) 18-Mar-2006 - - Bjorn added balder.IsLineOfSight and balder.IsWall python mappings which + - Bjorn added balder.IsLineOfSight and balder.IsWall python mappings which map to py_IsLineOfSight and py_IsWall methods of ArtificialController - - Bjorn fixed the ArtificialController::ShutDown() function to properly + - Bjorn fixed the ArtificialController::ShutDown() function to properly empty the controlled probe list. - Bjorn restructured the scripts directory - Bjorn added some python exception handling to the ArtificiallController - DoControl method. Now if a script fails, the traceback and exception are - printed, and the probe is removed from the list of probes to control. - - Bjorn made ArtificialController have all static methods and a private - constructor, so it can no longer be instantiated. Instead, it now has + DoControl method. Now if a script fails, the traceback and exception are + printed, and the probe is removed from the list of probes to control. + - Bjorn made ArtificialController have all static methods and a private + constructor, so it can no longer be instantiated. Instead, it now has methods "Initialize" and "ShutDown". - - Bjorn moved python module and function loading functions into + - Bjorn moved python module and function loading functions into ComputerProbeControl structure, and put ComputerProbeControl in its own file. 17-Mar-2006 - Bjorn updated the probe sprite to let the amo show through a bit better. - Bjorn tweaked the ammo positioning in the probe for better visibility. - - Bjorn changed PROJECTILEWIDTH and PROJECTILEHEIGHT in probe.h to - AMMOWIDTH and AMMOHEIGHT, to avoid any possible conflicts with + - Bjorn changed PROJECTILEWIDTH and PROJECTILEHEIGHT in probe.h to + AMMOWIDTH and AMMOHEIGHT, to avoid any possible conflicts with PROJECTILEWIDTH and PROJECTILEHEIGHT defined in projectile.h. 17-Mar-2006 @@ -412,27 +422,27 @@ rendered on the top left corner of the probes sprite. 14-Mar-2006 - - Bjorn commented out the registering of the 'balder' module. More - thought is required here. For now it imports in the other scripts + - Bjorn commented out the registering of the 'balder' module. More + thought is required here. For now it imports in the other scripts from the balder.py file; but if constants change, this would have to - be updated. + be updated. - Bjorn added two new AI scripts, "randomai" and "simple_aimer". - - Bjorn fixed the python glue code so that if the AI script throws an + - Bjorn fixed the python glue code so that if the AI script throws an exception, it gets cleared, and doesn't kill the python interpreter. - - Bjorn added the ability to specify different ai scripts for different + - Bjorn added the ability to specify different ai scripts for different probes. 11-Mar-2006 - Bjorn fixed the "still able to fire when you're blowing up" bug. - - Bjorn fixed a bug where removed players were still trying to be + - Bjorn fixed a bug where removed players were still trying to be controlled by the AI. - - Bjorn changed AI scripts so computer probes now aim at the + - Bjorn changed AI scripts so computer probes now aim at the closest enemy probe. - Bjorn updated the mingw jamfile to add the python include and link stuff. 10-Mar-2006 - Bjorn added some cleanup stuff to gamemanager, I'm sure more is needed. - - Bjorn wrote a simple AI script which causes computer controlled + - Bjorn wrote a simple AI script which causes computer controlled probes to aim for player two and fire. - Bjorn added python bindings to artificialcontroller @@ -441,31 +451,31 @@ 3-Mar-2006 - Bjorn added AI framework. - - Bjorn added code to play a sound when shields are raised (though this + - Bjorn added code to play a sound when shields are raised (though this sound does not exist yet). - - Bjorn changed it so shields regenerate after a hit is taken. This + - Bjorn changed it so shields regenerate after a hit is taken. This should balance the shield powerup with the other two a bit more. - Bjorn made the extra spreadfire projectiles start a bit more spread out. - Bjorn updated the spreadfire indicator so it is easier to see. - - Bjorn tweaked the probe sprite a bit so hopefully it is easier to see + - Bjorn tweaked the probe sprite a bit so hopefully it is easier to see where the gun is aiming. - Bjorn updated the hit animation to be a bit more transparent. 2-Mar-2006 - Bjorn made shields draw around shielded probes. - - Bjorn increased the erased area around all sprites, which should + - Bjorn increased the erased area around all sprites, which should eliminate artifacts when we draw effects outside the probe radius. - Reuben added an indicator so that players may know when their probes - are recharging ammo faster with the powerup 'fast ammo recharge'. The + are recharging ammo faster with the powerup 'fast ammo recharge'. The players probe flashes a modified color once every 3 secs if the powerup is in effect. - Reuben added an additional layer to the probe sprites rendered to - show when a spread fire powerup has been aquired by a probe. + show when a spread fire powerup has been aquired by a probe. 1-Mar-2006 - - Bjorn updated the probe sprite so it looks more badass and added some + - Bjorn updated the probe sprite so it looks more badass and added some extra guns to be drawn when a spreadfire is picked up. - - Bjorn adjusted the life indicator on the probe so that it can never be + - Bjorn adjusted the life indicator on the probe so that it can never be larger than the probe radius, and full life takes up 2/3 of the probe radius - Reuben added player life indication into the probes that are rendered onto the game screen. @@ -481,22 +491,22 @@ - const probe_color RED = 3; - const probe_color GREEN = 4; - Reuben added sample probe to the 'Players Option' menu for color - sampling. + sampling. - Reuben fixed minor bug with sample probes sprite id. Changed sample probes sprite id from 'probe' to 'sampleprobe'. I did this to avoid - crash after playing game and returning to the players options menu. + crash after playing game and returning to the players options menu. 26-Feb-2006 - - Bjorn fixed the exploding projectile artifact bug. - - Bjorn removed probestate, projectilestate, and playerinputstate from + - Bjorn fixed the exploding projectile artifact bug. + - Bjorn removed probestate, projectilestate, and playerinputstate from the source tree as they never contained any real source. 25-Feb-2006 - - Bjorn made probes spawn "randomly" (still deterministic) when no + - Bjorn made probes spawn "randomly" (still deterministic) when no suitible spawn location can be found. - - Bjorn fixed Collisionmask so that it will return false for points with + - Bjorn fixed Collisionmask so that it will return false for points with negative values, instead of causing a segmentation fault. - - Bjorn removed old, commented out, collision code, as well as some other + - Bjorn removed old, commented out, collision code, as well as some other bits of commented old crusty stuff that was not needed. 24-Feb-2006 - Reuben modified the way the ConfigManager::GetPlayerColor() @@ -504,7 +514,7 @@ - Reuben modified the way the ConfigManager::SetPlayerColor() saves a 24 bit color. - Reuben added the action 'colorChange' to menu.cpp and then - connected 'redSlider', 'greenSlider' and 'blueSlider' to + connected 'redSlider', 'greenSlider' and 'blueSlider' to 'colorChange' on change. 23-Feb-2006 @@ -517,10 +527,10 @@ - Reuben added the Red, Green and Blue Slide controllers to the 'Player Options' menu. They currently load settings from the config file, but do not save settings to the config file. - - Bjorn added the redspectrum image to the player setup menu. - - Bjorn made the Player Setup container larger, so there was a + - Bjorn added the redspectrum image to the player setup menu. + - Bjorn made the Player Setup container larger, so there was a 100 pixel border on the right as well as the left (insteaf of 150). - - Bjorn switched the positions of the 'Player Setup' and + - Bjorn switched the positions of the 'Player Setup' and 'Sound and Video' menus in the options menu. 22-Feb-2006 @@ -532,14 +542,14 @@ 20-Feb-2006 - Reuben modified configmanager.cpp to format a 24 bit color from the - config file to a 32 bit color including an 8 bit alpha component. + config file to a 32 bit color including an 8 bit alpha component. 18-Feb-2006 - - Bjorn added "press Esc to return to main menu" to the text displayed + - Bjorn added "press Esc to return to main menu" to the text displayed when the game ends. - - Bjorn added experimental joystick support. Joystick controls are + - Bjorn added experimental joystick support. Joystick controls are hard coded to use joystick 0 to control the second player (controller[1]) - in *addition* to any keys that player might have mapped. + in *addition* to any keys that player might have mapped. Button0=fire, button1=stick/push, left/right on the direction pad rotate. 15-Feb-2006 @@ -548,7 +558,7 @@ the new probe blank on top of it. ** note, this introduced a new library dependancy, SDL_gfx ** - Bjorn changed the way entities are rendered. They now have a "DrawOnto" - method which takes a surface, (in our case, the screen) and draws the + method which takes a surface, (in our case, the screen) and draws the correct frame in the correct spot. - Bjorn tweaked the frame calculations to make aiming match match better. - Bjorn replaced the blue probe with a semi-transparent blank in preparation @@ -572,14 +582,14 @@ casts rather then assign and truncate to avoid compiler warnings. 5-Feb-2006 - - Bjorn tweaked the time delay for freindly projectiles to not + - Bjorn tweaked the time delay for freindly projectiles to not destroy each other, and tested to make sure they are freindly. - - Bjorn fixed the bounce collision detection to only test pixels - on the circle around the edge of an entity, using a better + - Bjorn fixed the bounce collision detection to only test pixels + on the circle around the edge of an entity, using a better algorithm to determine what pixels to test than before. 25-Jan-2006 - - Bjorn made the id of the last player remaining display when only one + - Bjorn made the id of the last player remaining display when only one remains. - Bjorn made player scores display according to their player ID so that when a player is eliminated, their scores will be left visible. @@ -589,8 +599,8 @@ 02-Jan-2006 - Bjorn made a clock display for timed games. - - Bjorn made "Game Over" and an optional additional message display - when one of the game mode conditions are met. The game then + - Bjorn made "Game Over" and an optional additional message display + when one of the game mode conditions are met. The game then waits for escape to be pressed and then returns to the main menu. - Bjorn added a DisplayText method to the Renderer. - Bjorn made the game end when the time runs out. @@ -609,55 +619,55 @@ 23-Dec-2005 - Bjorn added the NumberField class to the menu. - - Bjorn moved map selection to a submenu "Game Setup" of the Options - menu. Also added three game types to this menu. These are radio - selections. + - Bjorn moved map selection to a submenu "Game Setup" of the Options + menu. Also added three game types to this menu. These are radio + selections. 11-Sept-2005 - Bjorn changed "mutiplayer" in the main menu to "join network game". 28-Oct-2005 - Bjorn added/implemented serialize and deserilalize methods for - projectiles and powerups. Also added necesarry logic to the - network manager, and update functions in the gamemanager so that - these entities are propegated over the network when a client joins. + projectiles and powerups. Also added necesarry logic to the + network manager, and update functions in the gamemanager so that + these entities are propegated over the network when a client joins. - Bjorn made the powerup spawn interval load from the config file. - Bjorn made the recharge accellerator powerup be times 3 instead of 2. - + 13-Oct-2005 - - Bjorn fixed a bug where powerups would spawn outside the + - Bjorn fixed a bug where powerups would spawn outside the boundaries, (accidentally using width instead of height) - - Bjorn made probes gain health when picking up a powerup that + - Bjorn made probes gain health when picking up a powerup that the probe already has. 12-Oct-2005 - - Bjorn added effects for the shield and recharge acceleration + - Bjorn added effects for the shield and recharge acceleration powerups. - - Bjorn added sprites for more powerups and made generation + - Bjorn added sprites for more powerups and made generation random. Also selects the graphic for each powerup. - - Bjorn got the spreadfire powerups working. Powerups + - Bjorn got the spreadfire powerups working. Powerups are lost when the probe is destroyed. - - Bjorn fixed a segfault resusting from projectiles fired + - Bjorn fixed a segfault resusting from projectiles fired into walls. 7-Oct-2005 - - Bjorn made random (seeded from the frame number) powerups - appear every certain number of frames (hard coded, needs to go + - Bjorn made random (seeded from the frame number) powerups + appear every certain number of frames (hard coded, needs to go in config). 6-Oct-2005 - Bjorn added a powerup entity and a factory to produce it -22-Sep-2005 - - Bjorn made clients quit when the server disconnects - - Bjorn changed some static_cast to reinterpret_cast to - compile with gcc 4.0. This also appears possibly to have +22-Sep-2005 + - Bjorn made clients quit when the server disconnects + - Bjorn changed some static_cast to reinterpret_cast to + compile with gcc 4.0. This also appears possibly to have fixed synchronization problems somehow. - Bjorn added a test map with just an empty area - + 18-Sep-2005 - Bjorn fixed the map selection to load from the config file. - - Bjorn added deletion of probe_factory and projectile_factory + - Bjorn added deletion of probe_factory and projectile_factory when GameManager is deleted. 15-Sep-2005 @@ -665,52 +675,52 @@ 14-Sep-2005 - Bjorn added UpdatePlayer and UpdateProbe methods to GameManager - - Bjorn changed the network scheme so that entities can + - Bjorn changed the network scheme so that entities can serialize and deserialize themselves to and from a given buffer. - + 09-Sep-2005 - - Bjorn removed some (hopefully) unecisarry mutex locks in + - Bjorn removed some (hopefully) unecisarry mutex locks in networkmanager to avoid deadlock occuring. 07-Sep-2005 - - Bjorn added some more mutex locking to + - Bjorn added some more mutex locking to NetworkManager::DeliverEvents() to hopefully fix some server crashes. 05-Sep-2005 - - Bjorn added client notification to destroy probes and players + - Bjorn added client notification to destroy probes and players when other clients disconnect. - - Bjorn added code so that when a client disconnects from the - server, the probes which were under the control of that client - (which is also now kept track of) are destroyed and removed from - the game along with the player objects that controlled them. - (this only happens on the server, notifying other clients still + - Bjorn added code so that when a client disconnects from the + server, the probes which were under the control of that client + (which is also now kept track of) are destroyed and removed from + the game along with the player objects that controlled them. + (this only happens on the server, notifying other clients still needs to be implemented) 04-Sep-2005 - - Bjorn fixed the code so that the server no longer crashes when - the client disconnects. This is accomplished by checking that a - connection is still connected before sending anything over it and + - Bjorn fixed the code so that the server no longer crashes when + the client disconnects. This is accomplished by checking that a + connection is still connected before sending anything over it and (hopefully) removing the connection from the connection list. 30-March-2005 - - Bjorn made the client wait to deliver events until packets for that frame + - Bjorn made the client wait to deliver events until packets for that frame arrive from the server. 29-March-2005 - - Bjorn addded numbering of inputstate packets and started to implement - tracking by number on the client so it can be assured that all packets for + - Bjorn addded numbering of inputstate packets and started to implement + tracking by number on the client so it can be assured that all packets for a frame have arrived before the frame is processed. 25-March-2005 - - Bjorn changed input event scheduling on the server to be for the following + - Bjorn changed input event scheduling on the server to be for the following frame to help avoid missed input events. 24-March-2005 - Bjorn added sending input over the network. - - Bjorn fixed new player creation to occur in the correct frame, so now - (assuming packets arrive on time) as long as no one touches any controls - clients can join and everyone will stay synchronized. If a player creation - packet arrives after the frame that the player was created in, an error will + - Bjorn fixed new player creation to occur in the correct frame, so now + (assuming packets arrive on time) as long as no one touches any controls + clients can join and everyone will stay synchronized. If a player creation + packet arrives after the frame that the player was created in, an error will be printed; eventeully this should result in a complete update request. - Bjorn fixed a bug where the starting frame was not being set on the client - Bjorn made sound volume loaded from and saved to the config file. @@ -720,75 +730,75 @@ - Bjorn changed probe creation and respawning to take into account stuck status (and velocity in the case of respawn). -22-March-2005 +22-March-2005 - Bjorn changed the timing scheme so that the game will run faster if it gets behind the frame it should be at. This will helps client synchronization. 23-Feb-2005 - - Bjorn added a third player/probe creation method which takes position and - velocity parameters for the probe, which are now sent from the server to the + - Bjorn added a third player/probe creation method which takes position and + velocity parameters for the probe, which are now sent from the server to the client so the starting position and velocity of the probes are synchronized. 22-Feb-2005 - - Bjorn made the probe creation on the client work. The client now recieves - updates and creates all of the probes which exist on the server, and then - reqeusts creation of as many new probes as hhere are local players on the - client. The server creates those probes and sends back player id's for + - Bjorn made the probe creation on the client work. The client now recieves + updates and creates all of the probes which exist on the server, and then + reqeusts creation of as many new probes as hhere are local players on the + client. The server creates those probes and sends back player id's for each. - + 19-Feb-2005 - Bjorn did some more work on client initialization: - Clients now send a request for game state and the server responds - by sending the "update complete" packet that will eventually signal + Clients now send a request for game state and the server responds + by sending the "update complete" packet that will eventually signal to the client that the server has sent all of the necesarry information. - - Bjorn also changed the list of network connections to be a map, using + - Bjorn also changed the list of network connections to be a map, using the initial network remoteAddress of the reliable (tcp) connection for - the key. + the key. -18-Feb-2005 +18-Feb-2005 - Bjorn did more work on requesting and sending initial game state. 17-Feb-2005 - - Bjorn added a GameStatePacket and moved some of the packet source to + - Bjorn added a GameStatePacket and moved some of the packet source to packets.cpp instead of having everithing in the header. -16-Feb-2005 - - Bjorn fixed connections so the client can connect and get the map name - without causing a crash on either side. +16-Feb-2005 + - Bjorn fixed connections so the client can connect and get the map name + without causing a crash on either side. - Bjorn added a very basic log class to use instead of std::cout << for all - messages. This way logging capabilities can easily be extented. + messages. This way logging capabilities can easily be extented. -15-Feb-2005 - - Bjorn moved GNE initialization and shutdown into main, so now at least +15-Feb-2005 + - Bjorn moved GNE initialization and shutdown into main, so now at least the network stuff doesn't break anithing that used to work. - + 01-Feb-2005 - Bjorn started network stuff, added packets and a connection listener - + 28-Jan-2005 - - Bjorn made the map selection dropdown only list directories that actually - contain all of the files needed for a map (or at least named that way). + - Bjorn made the map selection dropdown only list directories that actually + contain all of the files needed for a map (or at least named that way). - Bjorn added a multiplayer menu. 27-Jan-2005 - Bjorn made map selection a drop down menu item instead of a text box. - + 22-Jan-2005 - Bjorn fixed the bug where blits did not work in fullscreen mode in windows. - - Bjorn fixed a bug where probes could push off faster than the supposed + - Bjorn fixed a bug where probes could push off faster than the supposed maximum speed. - + 17-Jan-2005 - Bjorn made push off speed variable. - - Bjorn made probes have a lasting explosion so one exploding probe can + - Bjorn made probes have a lasting explosion so one exploding probe can destroy multiple other probes. 15-Jan-2005 - - Bjorn made the volume control slider and fullscreen checkboxes in - the sound/video options menu work. Fullscreen mode shows no sprites + - Bjorn made the volume control slider and fullscreen checkboxes in + the sound/video options menu work. Fullscreen mode shows no sprites though for some reason. - Bjorn made keybinding on the player setup menu actualy do something. - + 11-Jan-2005 - Bjorn made it possible to stick to walls and push off with the same key. - Bjorn made keybindings be displayed it the player configuration menu. No @@ -802,17 +812,17 @@ 06-Jan-2005 - Bjorn added a text feild it the options menu to select the map to use. - - Bjorn added sound options to the options menu to toggle on or off sound - or music and adjust the volume. None of these controls do anything yet + - Bjorn added sound options to the options menu to toggle on or off sound + or music and adjust the volume. None of these controls do anything yet however. 24-Dec-2004 - - Bjorn fixed a bug where a dying probe that was hit would restart its - explosion sequence and give another 3 points to the player firing that + - Bjorn fixed a bug where a dying probe that was hit would restart its + explosion sequence and give another 3 points to the player firing that shot. - Bjorn made scores be displayed in the status information for each probe. - The current scheme is 1 point for a hit, 3 for a kill, -1 if you hit - yourself, and -1 for dying. + The current scheme is 1 point for a hit, 3 for a kill, -1 if you hit + yourself, and -1 for dying. - Bjorn added the options menu and an option to set the number of players. 22-Dec-2004 @@ -821,72 +831,72 @@ 21-Dec-2004 - Bjorn moved a few probe "constants" to the config file. more will follow. - Bjorn made the ConfigManager stuff static. - + 20-Dec-2004 - Bjorn made the background color of each status display match (sorta) the probe color for that player. 18-Dec-2004 - Bjorn added a status display area with indicators for ammo and life - remaining for each probe. - - Bjorn added convenience function to the renderer to blit an arbitrary + remaining for each probe. + - Bjorn added convenience function to the renderer to blit an arbitrary surface to the screen at some location (mostly for HUD/status stuff). 17-Dec-2004 - - Bjorn added the maptags.xml file for maps. This file currently - defines the dimensions of the map, and contains a list of spawn - locations for the map. - - Bjorn made the map to load configurable (via config.xml). Maps are + - Bjorn added the maptags.xml file for maps. This file currently + defines the dimensions of the map, and contains a list of spawn + locations for the map. + - Bjorn made the map to load configurable (via config.xml). Maps are now loaded from the maps/mapname directory. 16-Dec-2004 - - Bjorn made number of players configurable via config.xml and fixed bug - where having a keybinding not found in the config file would cause the + - Bjorn made number of players configurable via config.xml and fixed bug + where having a keybinding not found in the config file would cause the game to crash when input tried to use a null pointer as a key. 11-Dec-2004 - Bjorn update the game field, adding a bit more geometry. - - Bjorn changed how players initially spawn (so they use spawn locations) - and how they respawn (no longer moving and now "stuck") so players can + - Bjorn changed how players initially spawn (so they use spawn locations) + and how they respawn (no longer moving and now "stuck") so players can choose which direction they want to move after they respawn. - Bjorn made 3 players start by default. Still need to make this variable. -27-Nov-2004 - - Bjorn added a circular linked list of spawn locations so that afte a - probe is destroyed it will respawn in the next location, checking to make - sure that spot is not already occupied (prevents spawning on top of other - probes). - +27-Nov-2004 + - Bjorn added a circular linked list of spawn locations so that afte a + probe is destroyed it will respawn in the next location, checking to make + sure that spot is not already occupied (prevents spawning on top of other + probes). + 26-Nov-2004 - - Bjorn added sounds support. All sounds are in the sounds/ directory. - The sound manager plays the "sounds/music.ogg" file as music and proobes + - Bjorn added sounds support. All sounds are in the sounds/ directory. + The sound manager plays the "sounds/music.ogg" file as music and proobes now play sounds for all actions, if the sound file exists for that action. - + 25-Nov-2004 - Bjorn added animation to the projectiles and a hit animation to the probes - + 24-Nov-2004 - Bjorn added different color probes and death (exploding) animations for dying probes. - - Bjorn changed the input class so that there is one Input instance in the - game which is responsible for doing input for all players. It loads + - Bjorn changed the input class so that there is one Input instance in the + game which is responsible for doing input for all players. It loads keybindings from the ConfigManager and maps them to the local players. - Bjorn added a publically accessible ConfigManager to the GameManager. - + 23-Nov-2004 - - Bjorn added the ConfigManager class which uses tinyxml to load and parse - a config file. Also added the config file config.xml and the source for + - Bjorn added the ConfigManager class which uses tinyxml to load and parse + a config file. Also added the config file config.xml and the source for tinyxml to the repository. 19-Nov-2004 - Bjorn fixed probe starting locations so they depend on id. - Bjorn made sticking to walls work and changed the keybindings a bit. - - Bjorn reduded the speed at which probes turn and made them respawn with + - Bjorn reduded the speed at which probes turn and made them respawn with some velocity. - Bjorn made probes transfer momentum between each other when colliding. - - Bjorn fixed the bug where entities with overlapping bounding boxes would + - Bjorn fixed the bug where entities with overlapping bounding boxes would have parts of one entity erased by the other. - + 17-Nov-2004 - Bjorn made entities collide with each other. - Bjorn Created history.txt Modified: include/imageloader.h =================================================================== --- include/imageloader.h 2007-10-08 23:44:38 UTC (rev 67) +++ include/imageloader.h 2007-10-11 06:12:18 UTC (rev 68) @@ -22,12 +22,16 @@ #define IMAGELOADER_H #include <SDL/SDL_image.h> +#include <guichan.hpp> +#include <guichan/sdl.hpp> namespace Balder{ class ImageLoader{ public: - static SDL_Surface* LoadImage(const char* imagename); + static SDL_Surface* LoadImage(const char* filename); + static gcn::Image* LoadGcnImage(const char* filename); + static gcn::ImageFont* LoadGcnImageFont(const char* filename); }; } #endif // LOG_H Modified: src/imageloader.cpp =================================================================== --- src/imageloader.cpp 2007-10-08 23:44:38 UTC (rev 67) +++ src/imageloader.cpp 2007-10-11 06:12:18 UTC (rev 68) @@ -21,10 +21,33 @@ #include "imageloader.h" #include "log.h" #include <physfs.h> +#include <string> using namespace Balder; -SDL_Surface* ImageLoader::LoadImage(const char* imagename) +std::string GetFullPath(const char* filename) { - return IMG_Load(imagename); + const char* path = PHYSFS_getRealDir(filename); + if (NULL == path) { + Log::output(std::string("file not found: ").append(filename)); + return 0; + } + std::string fullpath(path); + fullpath.append(PHYSFS_getDirSeparator()).append(filename); + return fullpath; } + +SDL_Surface* ImageLoader::LoadImage(const char* filename) +{ + return IMG_Load(GetFullPath(filename).c_str()); +} + +gcn::Image* ImageLoader::LoadGcnImage(const char* filename) +{ + return gcn::Image::load(GetFullPath(filename).c_str()); +} + +gcn::ImageFont* ImageLoader::LoadGcnImageFont(const char* filename) +{ + return new gcn::ImageFont(GetFullPath(filename).c_str()); +} Modified: src/main.cpp =================================================================== --- src/main.cpp 2007-10-08 23:44:38 UTC (rev 67) +++ src/main.cpp 2007-10-11 06:12:18 UTC (rev 68) @@ -22,6 +22,8 @@ #include <SDL/SDL_image.h> #include <SDL/SDL_thread.h> #include <SDL/SDL_mixer.h> +#include <physfs.h> +#include <string> #include "gamemanager.h" #include "renderer.h" #include "soundmanager.h" @@ -33,8 +35,19 @@ using namespace std; using namespace Balder; +bool setConfig(const char* data_directory = NULL); + int main(int argc, char *argv[]) { + PHYSFS_init(argv[0]); + setConfig(argv[2]); + char **searchpath = PHYSFS_getSearchPath(); + char **i; + Log::output("search path set to:"); + for ( i=searchpath; *i != NULL; ++i){ + Log::output(*i); + } + PHYSFS_freeList(searchpath); // first, load the config file try{ Log::output("Loading config manager"); @@ -176,3 +189,48 @@ SDL_Quit(); return 0; } + +bool setConfig(const char* data_directory) +{ + const char *basedir = PHYSFS_getBaseDir(); + const char *userdir = PHYSFS_getUserDir(); + const char *dirsep = PHYSFS_getDirSeparator(); + const char *dir = "balder2d"; + + string str(userdir); + str.append(dirsep).append(dir); + + if (!PHYSFS_setWriteDir(str.c_str())) + { + cout << "setWriteDir failed" << endl; + int no_write = 0; + if ( (PHYSFS_setWriteDir(userdir)) && + (PHYSFS_mkdir(dir)) ) + { + cout << "set write directory and created " << dir << " directory" <<endl; + if (!PHYSFS_setWriteDir(str.c_str())){ + cout << "failed to set write directory to " << dir << endl; + no_write = 1; + } + } /* if */ + else + { + no_write = 1; + } /* else */ + + if (no_write) + { + cout << "setting write directory to null " << endl; + PHYSFS_setWriteDir(NULL); /* just in case. */ + } /* if */ + } /* if */ + + /* Put write dir first in search path... */ + PHYSFS_addToSearchPath(str.c_str(), 0); + // add the data directory if it was specified + if (data_directory != NULL){ PHYSFS_addToSearchPath(data_directory,1);} + /* Put base path on search path... */ + PHYSFS_addToSearchPath(basedir, 1); + + return(true); +} Modified: src/menu/ailistmodel.cpp =================================================================== --- src/menu/ailistmodel.cpp 2007-10-08 23:44:38 UTC (rev 67) +++ src/menu/ailistmodel.cpp 2007-10-11 06:12:18 UTC (rev 68) @@ -19,8 +19,7 @@ ***************************************************************************/ #include "menu/ailistmodel.h" -#include "boost/filesystem/operations.hpp" -#include "boost/filesystem/path.hpp" +#include <physfs.h> using namespace Balder; @@ -33,30 +32,21 @@ void AIListModel::FindScripts() { - // always show Human option as it disables any ai scripting so that a user may play. + std::string script_dir("scripts/"); + // always show Human option as it disables any ai scripting so that a user may play. scriptnames.push_back("Human"); - ++numScripts; - - boost::filesystem::path script_path( "scripts/" ); - boost::filesystem::directory_iterator end_iter; - for ( boost::filesystem::directory_iterator dir_itr( script_path ); dir_itr != end_iter; ++dir_itr ) { - if ( !boost::filesystem::is_directory( *dir_itr ) ) { - // lets see if this file really is a script - const std::string script_ext = ".py"; - std::string file_name = dir_itr->leaf(); - - int extpos = file_name.rfind(script_ext); - std::string file_ext = file_name; - file_ext.erase(0, extpos); - - // if this file really is a AI script then display it in the selection list. - if (file_ext == script_ext) { - file_name.erase(extpos, file_name.size()); - scriptnames.push_back(file_name); - ++numScripts; - } - } + ++numScripts; + char **files = PHYSFS_enumerateFiles("scripts/"); + char **i; + std::string script; + for (i = files; *i != NULL; i++){ + script = *i; + if (!PHYSFS_isDirectory((script_dir+script).c_str()) && !script.compare(script.size()-3, 3, ".py")){ + scriptnames.push_back(script.substr(0,script.size()-3)); + ++numScripts; } + } + PHYSFS_freeList(files); } Modified: src/menu/maplistmodel.cpp =================================================================== --- src/menu/maplistmodel.cpp 2007-10-08 23:44:38 UTC (rev 67) +++ src/menu/maplistmodel.cpp 2007-10-11 06:12:18 UTC (rev 68) @@ -19,8 +19,7 @@ ***************************************************************************/ #include "menu/maplistmodel.h" -#include "boost/filesystem/operations.hpp" -#include "boost/filesystem/path.hpp" +#include <physfs.h> using namespace Balder; @@ -31,44 +30,39 @@ MapListModel::~MapListModel() {} -bool find_file( const boost::filesystem::path & dir_path, const std::string & file_name) +bool find_file( const std::string map_dir, const std::string & file_name) { - if ( !exists( dir_path ) ) return false; - boost::filesystem::directory_iterator end_itr; // default construction yields past-the-end - for ( boost::filesystem::directory_iterator itr( dir_path ); - itr != end_itr; - ++itr ) - { - if ( is_directory( *itr ) ) - { - if ( find_file( *itr, file_name ) ) return true; + char **files = PHYSFS_enumerateFiles(map_dir.c_str()); + char **i; + for (i = files; *i != NULL; i++){ + if (file_name == *i) { + PHYSFS_freeList(files); + return true; + } } - else if ( itr->leaf() == file_name ) // see below - { - return true; - } - } - return false; + PHYSFS_freeList(files); + return false; } void MapListModel::FindMaps() { - boost::filesystem::path map_path( "maps/" ); - boost::filesystem::directory_iterator end_iter; - for ( boost::filesystem::directory_iterator dir_itr( map_path ); - dir_itr != end_iter; - ++dir_itr ) - { - if ( boost::filesystem::is_directory( *dir_itr ) ) { + std::string map_dir("maps/"); + char **files = PHYSFS_enumerateFiles(map_dir.c_str()); + char **i; + std::string mapname; + for (i = files; *i != NULL; i++){ + mapname = *i; + if (PHYSFS_isDirectory((map_dir+mapname).c_str())){ // lets try to check that this directory really contains a map - if (find_file(*dir_itr, "maptags.xml") - && find_file(*dir_itr, "geometry.png") - && find_file(*dir_itr, "background.png") ) { - mapnames.push_back(dir_itr->leaf()); + if (find_file(map_dir+mapname, "maptags.xml") + && find_file(map_dir+mapname, "geometry.png") + && find_file(map_dir+mapname, "background.png") ) { + mapnames.push_back(mapname); ++numMaps; - } + } } } + PHYSFS_freeList(files); } Modified: src/menu/menu.cpp =================================================================== --- src/menu/menu.cpp 2007-10-08 23:44:38 UTC (rev 67) +++ src/menu/menu.cpp 2007-10-11 06:12:18 UTC (rev 68) @@ -22,6 +22,7 @@ #include "menu/menu.h" #include "menu/mainmenu.h" #include "soundmanager.h" +#include "imageloader.h" #include <iostream> using namespace Balder; @@ -60,7 +61,7 @@ // Load the image font. try { - font = new gcn::ImageFont("menu/balderfont.png"); + font = ImageLoader::LoadGcnImageFont("menu/balderfont.png"); } catch(gcn::Exception e) { @@ -79,9 +80,9 @@ /* Strip Location */ 0, /* Frame Width */100, /* Frame Height */100, /* Base Frame Index */0, /* Starting Frame Index */1, /* Animation Frame Quantity Including Starting Frame */3, /* Frame Interval in MS (1Sec == 1000MS) */1); - backgroundImage = gcn::Image::load("menu/menubackground.png"); + backgroundImage = ImageLoader::LoadGcnImage("menu/menubackground.png"); backgroundIcon = new gcn::Icon(backgroundImage); - headerImage = gcn::Image::load("menu/balderheader.png"); + headerImage = ImageLoader::LoadGcnImage("menu/balderheader.png"); headerIcon = new gcn::Icon(headerImage); topContainer->add(backgroundIcon, 0, 0); topContainer->add(pulseAnimation,575,50); Modified: src/menu/playersetup.cpp =================================================================== --- src/menu/playersetup.cpp 2007-10-08 23:44:38 UTC (rev 67) +++ src/menu/playersetup.cpp 2007-10-11 06:12:18 UTC (rev 68) @@ -25,6 +25,7 @@ #include "menu/sampleprobewidget.h" #include "menu/ailistmodel.h" #include "input.h" +#include "imageloader.h" #include <sstream> using namespace Balder; @@ -94,7 +95,7 @@ playerColor = playerColor >> 8; Uint8 cRed = Uint8(playerColor); - redImage= gcn::Image::load("menu/redspectrum.png"); + redImage= ImageLoader::LoadGcnImage("menu/redspectrum.png"); redIcon = new gcn::Icon(redImage); redSlider = new gcn::Slider(0, 255); redSlider->setWidth(redIcon->getWidth()); @@ -103,7 +104,7 @@ redSlider->setActionEventId("colorChange"); redSlider->addActionListener(this); - greenImage= gcn::Image::load("menu/greenspectrum.png"); + greenImage= ImageLoader::LoadGcnImage("menu/greenspectrum.png"); greenIcon = new gcn::Icon(greenImage); greenSlider = new gcn::Slider(0, 255); greenSlider->setWidth(redIcon->getWidth()); @@ -112,7 +113,7 @@ greenSlider->setActionEventId("colorChange"); greenSlider->addActionListener(this); - blueImage= gcn::Image::load("menu/bluespectrum.png"); + blueImage= ImageLoader::LoadGcnImage("menu/bluespectrum.png"); blueIcon = new gcn::Icon(blueImage); blueSlider = new gcn::Slider(0, 255); blueSlider->setWidth(redIcon->getWidth()); Modified: src/menu/sampleprobewidget.cpp =================================================================== --- src/menu/sampleprobewidget.cpp 2007-10-08 23:44:38 UTC (rev 67) +++ src/menu/sampleprobewidget.cpp 2007-10-11 06:12:18 UTC (rev 68) @@ -25,13 +25,14 @@ #include <SDL/SDL_gfxPrimitives.h> #include "menu/sampleprobewidget.h" #include "probe.h" +#include "imageloader.h" #include "log.h" using namespace Balder; SampleProbeWidget::SampleProbeWidget(): probeFrame(0), probeColor(0) { // Loads sprite for sample probe. - probeSpriteImage = gcn::Image::load("probe.png"); + probeSpriteImage = ImageLoader::LoadGcnImage("probe.png"); if (probeSpriteImage == 0){ throw "could not load Probe sprite!"; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <col...@us...> - 2007-10-08 23:44:44
|
Revision: 67 http://balder.svn.sourceforge.net/balder/?rev=67&view=rev Author: colalord Date: 2007-10-08 16:44:38 -0700 (Mon, 08 Oct 2007) Log Message: ----------- 08 Oct-2007 - Reuben separated the CodeBlocks project file into two project files, one for Windows and one for Linux, as the environment variable may very. - Reuben modified the CodeBlocks Project file to include the PhysFS lib. Modified Paths: -------------- history.txt Added Paths: ----------- Balder2D-Linux.cbp Balder2D-Win.cbp Removed Paths: ------------- Balder2D.cbp Added: Balder2D-Linux.cbp =================================================================== --- Balder2D-Linux.cbp (rev 0) +++ Balder2D-Linux.cbp 2007-10-08 23:44:38 UTC (rev 67) @@ -0,0 +1,129 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> +<CodeBlocks_project_file> + <FileVersion major="1" minor="6" /> + <Project> + <Option title="Balder2D" /> + <Option pch_mode="0" /> + <Option compiler="gcc" /> + <Build> + <Target title="default"> + <Option output="bin\Balder2D.exe" prefix_auto="0" extension_auto="0" /> + <Option working_dir="bin" /> + <Option type="1" /> + <Option compiler="gcc" /> + <Option projectResourceIncludeDirsRelation="1" /> + </Target> + </Build> + <VirtualTargets> + <Add alias="All" targets="default;" /> + </VirtualTargets> + <Compiler> + <Add directory="C:\MinGW\include" /> + <Add directory="C:\msys\1.0\local\include" /> + <Add directory="C:\msys\1.0\local\include\SDL" /> + <Add directory="C:\Python25\include" /> + <Add directory="C:\Balder2D\include" /> + </Compiler> + <Linker> + <Add option="-mwindows" /> + <Add library="mingw32" /> + <Add library="guichan" /> + <Add library="guichan_sdl" /> + <Add library="SDLmain" /> + <Add library="SDL_gfx" /> + <Add library="SDL" /> + <Add library="SDL_image" /> + <Add library="SDL_mixer" /> + <Add library="C:\msys\1.0\local\lib\libboost_filesystem-mgw-1_33_1.lib" /> + <Add library="Python25" /> + <Add library="physfs" /> + <Add directory="C:\MinGW\lib" /> + <Add directory="C:\msys\1.0\local\lib" /> + <Add directory="C:\Python25\libs" /> + </Linker> + <Unit filename="include\artificialcontroller.h" /> + <Unit filename="include\balder2dtypes.h" /> + <Unit filename="include\collisionmask.h" /> + <Unit filename="include\computerprobecontrol.h" /> + <Unit filename="include\configmanager.h" /> + <Unit filename="include\entity.h" /> + <Unit filename="include\gamemanager.h" /> + <Unit filename="include\imageloader.h" /> + <Unit filename="include\input.h" /> + <Unit filename="include\log.h" /> + <Unit filename="include\mapparser.h" /> + <Unit filename="include\menu\ailistmodel.h" /> + <Unit filename="include\menu\animationwidget.h" /> + <Unit filename="include\menu\gamesetup.h" /> + <Unit filename="include\menu\mainmenu.h" /> + <Unit filename="include\menu\maplistmodel.h" /> + <Unit filename="include\menu\menu.h" /> + <Unit filename="include\menu\numberfield.h" /> + <Unit filename="include\menu\options.h" /> + <Unit filename="include\menu\playersetup.h" /> + <Unit filename="include\menu\samplemapwidget.h" /> + <Unit filename="include\menu\sampleprobewidget.h" /> + <Unit filename="include\menu\skinnedbuttonwidget.h" /> + <Unit filename="include\menu\soundvideo.h" /> + <Unit filename="include\menu\submenu.h" /> + <Unit filename="include\player.h" /> + <Unit filename="include\powerup.h" /> + <Unit filename="include\powerupfactory.h" /> + <Unit filename="include\probe.h" /> + <Unit filename="include\probefactory.h" /> + <Unit filename="include\projectile.h" /> + <Unit filename="include\projectilefactory.h" /> + <Unit filename="include\renderer.h" /> + <Unit filename="include\soundmanager.h" /> + <Unit filename="src\SFont\Font.h" /> + <Unit filename="src\SFont\SFont.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="src\SFont\SFont.h" /> + <Unit filename="src\artificialcontroller.cpp" /> + <Unit filename="src\collisionmask.cpp" /> + <Unit filename="src\computerprobecontrol.cpp" /> + <Unit filename="src\configmanager.cpp" /> + <Unit filename="src\entity.cpp" /> + <Unit filename="src\gamemanager.cpp" /> + <Unit filename="src\imageloader.cpp" /> + <Unit filename="src\input.cpp" /> + <Unit filename="src\log.cpp" /> + <Unit filename="src\main.cpp" /> + <Unit filename="src\mapparser.cpp" /> + <Unit filename="src\menu\ailistmodel.cpp" /> + <Unit filename="src\menu\animationwidget.cpp" /> + <Unit filename="src\menu\gamesetup.cpp" /> + <Unit filename="src\menu\mainmenu.cpp" /> + <Unit filename="src\menu\maplistmodel.cpp" /> + <Unit filename="src\menu\menu.cpp" /> + <Unit filename="src\menu\numberfield.cpp" /> + <Unit filename="src\menu\options.cpp" /> + <Unit filename="src\menu\playersetup.cpp" /> + <Unit filename="src\menu\samplemapwidget.cpp" /> + <Unit filename="src\menu\sampleprobewidget.cpp" /> + <Unit filename="src\menu\skinnedbuttonwidget.cpp" /> + <Unit filename="src\menu\soundvideo.cpp" /> + <Unit filename="src\menu\submenu.cpp" /> + <Unit filename="src\player.cpp" /> + <Unit filename="src\powerup.cpp" /> + <Unit filename="src\powerupfactory.cpp" /> + <Unit filename="src\probe.cpp" /> + <Unit filename="src\probefactory.cpp" /> + <Unit filename="src\projectile.cpp" /> + <Unit filename="src\projectilefactory.cpp" /> + <Unit filename="src\renderer.cpp" /> + <Unit filename="src\soundmanager.cpp" /> + <Unit filename="src\tinyxml\tinystr.cpp" /> + <Unit filename="src\tinyxml\tinystr.h" /> + <Unit filename="src\tinyxml\tinyxml.cpp" /> + <Unit filename="src\tinyxml\tinyxml.h" /> + <Unit filename="src\tinyxml\tinyxmlerror.cpp" /> + <Unit filename="src\tinyxml\tinyxmlparser.cpp" /> + <Extensions> + <code_completion /> + <envvars /> + <debugger /> + </Extensions> + </Project> +</CodeBlocks_project_file> Added: Balder2D-Win.cbp =================================================================== --- Balder2D-Win.cbp (rev 0) +++ Balder2D-Win.cbp 2007-10-08 23:44:38 UTC (rev 67) @@ -0,0 +1,129 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> +<CodeBlocks_project_file> + <FileVersion major="1" minor="6" /> + <Project> + <Option title="Balder2D" /> + <Option pch_mode="0" /> + <Option compiler="gcc" /> + <Build> + <Target title="default"> + <Option output="bin\Balder2D.exe" prefix_auto="0" extension_auto="0" /> + <Option working_dir="bin" /> + <Option type="1" /> + <Option compiler="gcc" /> + <Option projectResourceIncludeDirsRelation="1" /> + </Target> + </Build> + <VirtualTargets> + <Add alias="All" targets="default;" /> + </VirtualTargets> + <Compiler> + <Add directory="C:\MinGW\include" /> + <Add directory="C:\msys\1.0\local\include" /> + <Add directory="C:\msys\1.0\local\include\SDL" /> + <Add directory="C:\Python25\include" /> + <Add directory="C:\Balder2D\include" /> + </Compiler> + <Linker> + <Add option="-mwindows" /> + <Add library="mingw32" /> + <Add library="guichan" /> + <Add library="guichan_sdl" /> + <Add library="SDLmain" /> + <Add library="SDL_gfx" /> + <Add library="SDL" /> + <Add library="SDL_image" /> + <Add library="SDL_mixer" /> + <Add library="C:\msys\1.0\local\lib\libboost_filesystem-mgw-1_33_1.lib" /> + <Add library="Python25" /> + <Add library="physfs" /> + <Add directory="C:\MinGW\lib" /> + <Add directory="C:\msys\1.0\local\lib" /> + <Add directory="C:\Python25\libs" /> + </Linker> + <Unit filename="include\artificialcontroller.h" /> + <Unit filename="include\balder2dtypes.h" /> + <Unit filename="include\collisionmask.h" /> + <Unit filename="include\computerprobecontrol.h" /> + <Unit filename="include\configmanager.h" /> + <Unit filename="include\entity.h" /> + <Unit filename="include\gamemanager.h" /> + <Unit filename="include\imageloader.h" /> + <Unit filename="include\input.h" /> + <Unit filename="include\log.h" /> + <Unit filename="include\mapparser.h" /> + <Unit filename="include\menu\ailistmodel.h" /> + <Unit filename="include\menu\animationwidget.h" /> + <Unit filename="include\menu\gamesetup.h" /> + <Unit filename="include\menu\mainmenu.h" /> + <Unit filename="include\menu\maplistmodel.h" /> + <Unit filename="include\menu\menu.h" /> + <Unit filename="include\menu\numberfield.h" /> + <Unit filename="include\menu\options.h" /> + <Unit filename="include\menu\playersetup.h" /> + <Unit filename="include\menu\samplemapwidget.h" /> + <Unit filename="include\menu\sampleprobewidget.h" /> + <Unit filename="include\menu\skinnedbuttonwidget.h" /> + <Unit filename="include\menu\soundvideo.h" /> + <Unit filename="include\menu\submenu.h" /> + <Unit filename="include\player.h" /> + <Unit filename="include\powerup.h" /> + <Unit filename="include\powerupfactory.h" /> + <Unit filename="include\probe.h" /> + <Unit filename="include\probefactory.h" /> + <Unit filename="include\projectile.h" /> + <Unit filename="include\projectilefactory.h" /> + <Unit filename="include\renderer.h" /> + <Unit filename="include\soundmanager.h" /> + <Unit filename="src\SFont\Font.h" /> + <Unit filename="src\SFont\SFont.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="src\SFont\SFont.h" /> + <Unit filename="src\artificialcontroller.cpp" /> + <Unit filename="src\collisionmask.cpp" /> + <Unit filename="src\computerprobecontrol.cpp" /> + <Unit filename="src\configmanager.cpp" /> + <Unit filename="src\entity.cpp" /> + <Unit filename="src\gamemanager.cpp" /> + <Unit filename="src\imageloader.cpp" /> + <Unit filename="src\input.cpp" /> + <Unit filename="src\log.cpp" /> + <Unit filename="src\main.cpp" /> + <Unit filename="src\mapparser.cpp" /> + <Unit filename="src\menu\ailistmodel.cpp" /> + <Unit filename="src\menu\animationwidget.cpp" /> + <Unit filename="src\menu\gamesetup.cpp" /> + <Unit filename="src\menu\mainmenu.cpp" /> + <Unit filename="src\menu\maplistmodel.cpp" /> + <Unit filename="src\menu\menu.cpp" /> + <Unit filename="src\menu\numberfield.cpp" /> + <Unit filename="src\menu\options.cpp" /> + <Unit filename="src\menu\playersetup.cpp" /> + <Unit filename="src\menu\samplemapwidget.cpp" /> + <Unit filename="src\menu\sampleprobewidget.cpp" /> + <Unit filename="src\menu\skinnedbuttonwidget.cpp" /> + <Unit filename="src\menu\soundvideo.cpp" /> + <Unit filename="src\menu\submenu.cpp" /> + <Unit filename="src\player.cpp" /> + <Unit filename="src\powerup.cpp" /> + <Unit filename="src\powerupfactory.cpp" /> + <Unit filename="src\probe.cpp" /> + <Unit filename="src\probefactory.cpp" /> + <Unit filename="src\projectile.cpp" /> + <Unit filename="src\projectilefactory.cpp" /> + <Unit filename="src\renderer.cpp" /> + <Unit filename="src\soundmanager.cpp" /> + <Unit filename="src\tinyxml\tinystr.cpp" /> + <Unit filename="src\tinyxml\tinystr.h" /> + <Unit filename="src\tinyxml\tinyxml.cpp" /> + <Unit filename="src\tinyxml\tinyxml.h" /> + <Unit filename="src\tinyxml\tinyxmlerror.cpp" /> + <Unit filename="src\tinyxml\tinyxmlparser.cpp" /> + <Extensions> + <code_completion /> + <envvars /> + <debugger /> + </Extensions> + </Project> +</CodeBlocks_project_file> Deleted: Balder2D.cbp =================================================================== --- Balder2D.cbp 2007-10-01 05:52:16 UTC (rev 66) +++ Balder2D.cbp 2007-10-08 23:44:38 UTC (rev 67) @@ -1,125 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> -<CodeBlocks_project_file> - <FileVersion major="1" minor="6" /> - <Project> - <Option title="Balder2D" /> - <Option pch_mode="0" /> - <Option compiler="gcc" /> - <Build> - <Target title="default"> - <Option output="bin\Balder2D.exe" prefix_auto="0" extension_auto="0" /> - <Option working_dir="bin" /> - <Option type="1" /> - <Option compiler="gcc" /> - <Option projectResourceIncludeDirsRelation="1" /> - </Target> - </Build> - <VirtualTargets> - <Add alias="All" targets="default;" /> - </VirtualTargets> - <Compiler> - <Add directory="C:\MinGW\include" /> - <Add directory="C:\msys\1.0\local\include" /> - <Add directory="C:\msys\1.0\local\include\SDL" /> - <Add directory="C:\Python25\include" /> - </Compiler> - <Linker> - <Add option="-mwindows" /> - <Add library="mingw32" /> - <Add library="guichan" /> - <Add library="guichan_sdl" /> - <Add library="SDLmain" /> - <Add library="SDL_gfx" /> - <Add library="SDL" /> - <Add library="SDL_image" /> - <Add library="SDL_mixer" /> - <Add library="C:\msys\1.0\local\lib\libboost_filesystem-mgw-1_33_1.lib" /> - <Add library="Python25" /> - <Add directory="C:\MinGW\lib" /> - <Add directory="C:\msys\1.0\local\lib" /> - <Add directory="C:\Python25\libs" /> - </Linker> - <Unit filename="include\artificialcontroller.h" /> - <Unit filename="include\balder2dtypes.h" /> - <Unit filename="include\collisionmask.h" /> - <Unit filename="include\computerprobecontrol.h" /> - <Unit filename="include\configmanager.h" /> - <Unit filename="include\entity.h" /> - <Unit filename="include\gamemanager.h" /> - <Unit filename="include\input.h" /> - <Unit filename="include\log.h" /> - <Unit filename="include\mapparser.h" /> - <Unit filename="include\menu\ailistmodel.h" /> - <Unit filename="include\menu\animationwidget.h" /> - <Unit filename="include\menu\gamesetup.h" /> - <Unit filename="include\menu\mainmenu.h" /> - <Unit filename="include\menu\maplistmodel.h" /> - <Unit filename="include\menu\menu.h" /> - <Unit filename="include\menu\numberfield.h" /> - <Unit filename="include\menu\options.h" /> - <Unit filename="include\menu\playersetup.h" /> - <Unit filename="include\menu\samplemapwidget.h" /> - <Unit filename="include\menu\sampleprobewidget.h" /> - <Unit filename="include\menu\skinnedbuttonwidget.h" /> - <Unit filename="include\menu\soundvideo.h" /> - <Unit filename="include\menu\submenu.h" /> - <Unit filename="include\player.h" /> - <Unit filename="include\powerup.h" /> - <Unit filename="include\powerupfactory.h" /> - <Unit filename="include\probe.h" /> - <Unit filename="include\probefactory.h" /> - <Unit filename="include\projectile.h" /> - <Unit filename="include\projectilefactory.h" /> - <Unit filename="include\renderer.h" /> - <Unit filename="include\soundmanager.h" /> - <Unit filename="src\SFont\Font.h" /> - <Unit filename="src\SFont\SFont.c"> - <Option compilerVar="CC" /> - </Unit> - <Unit filename="src\SFont\SFont.h" /> - <Unit filename="src\artificialcontroller.cpp" /> - <Unit filename="src\collisionmask.cpp" /> - <Unit filename="src\computerprobecontrol.cpp" /> - <Unit filename="src\configmanager.cpp" /> - <Unit filename="src\entity.cpp" /> - <Unit filename="src\gamemanager.cpp" /> - <Unit filename="src\input.cpp" /> - <Unit filename="src\log.cpp" /> - <Unit filename="src\main.cpp" /> - <Unit filename="src\mapparser.cpp" /> - <Unit filename="src\menu\ailistmodel.cpp" /> - <Unit filename="src\menu\animationwidget.cpp" /> - <Unit filename="src\menu\gamesetup.cpp" /> - <Unit filename="src\menu\mainmenu.cpp" /> - <Unit filename="src\menu\maplistmodel.cpp" /> - <Unit filename="src\menu\menu.cpp" /> - <Unit filename="src\menu\numberfield.cpp" /> - <Unit filename="src\menu\options.cpp" /> - <Unit filename="src\menu\playersetup.cpp" /> - <Unit filename="src\menu\samplemapwidget.cpp" /> - <Unit filename="src\menu\sampleprobewidget.cpp" /> - <Unit filename="src\menu\skinnedbuttonwidget.cpp" /> - <Unit filename="src\menu\soundvideo.cpp" /> - <Unit filename="src\menu\submenu.cpp" /> - <Unit filename="src\player.cpp" /> - <Unit filename="src\powerup.cpp" /> - <Unit filename="src\powerupfactory.cpp" /> - <Unit filename="src\probe.cpp" /> - <Unit filename="src\probefactory.cpp" /> - <Unit filename="src\projectile.cpp" /> - <Unit filename="src\projectilefactory.cpp" /> - <Unit filename="src\renderer.cpp" /> - <Unit filename="src\soundmanager.cpp" /> - <Unit filename="src\tinyxml\tinystr.cpp" /> - <Unit filename="src\tinyxml\tinystr.h" /> - <Unit filename="src\tinyxml\tinyxml.cpp" /> - <Unit filename="src\tinyxml\tinyxml.h" /> - <Unit filename="src\tinyxml\tinyxmlerror.cpp" /> - <Unit filename="src\tinyxml\tinyxmlparser.cpp" /> - <Extensions> - <code_completion /> - <envvars /> - <debugger /> - </Extensions> - </Project> -</CodeBlocks_project_file> Modified: history.txt =================================================================== --- history.txt 2007-10-01 05:52:16 UTC (rev 66) +++ history.txt 2007-10-08 23:44:38 UTC (rev 67) @@ -3,6 +3,11 @@ History entries are in reverse chronological order (newest entries first). +08 Oct-2007 + - Reuben separated the CodeBlocks project file into two project files, one + for Windows and one for Linux, as the environment variable may very. + - Reuben modified the CodeBlocks Project file to include the PhysFS lib. + 19 Aug-2007 - Bjorn set bindNextKey to false at the beginning of the action handler for the player setup menu and refreshed the keys so that doing anything This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |