From: <qr...@us...> - 2006-12-10 01:06:16
|
Revision: 290 http://svn.sourceforge.net/opengate/?rev=290&view=rev Author: qrstuvw Date: 2006-12-09 17:06:16 -0800 (Sat, 09 Dec 2006) Log Message: ----------- Basic ALPHA framework Modified Paths: -------------- trunk/current/src/Makefile.am Added Paths: ----------- trunk/current/src/Client.cpp trunk/current/src/Server.cpp trunk/current/src/client/ trunk/current/src/client/GameState.h trunk/current/src/client/GameStateManager.cpp trunk/current/src/client/GameStateManager.h trunk/current/src/client/Global.h trunk/current/src/client/GraphicsSetup.cpp trunk/current/src/client/GraphicsSetup.h trunk/current/src/client/Makefile.am trunk/current/src/client/OpenGateApp.cpp trunk/current/src/client/OpenGateApp.h trunk/current/src/client/logic/ trunk/current/src/client/logic/Makefile.am trunk/current/src/client/state/ trunk/current/src/client/state/IntroState.cpp trunk/current/src/client/state/IntroState.h trunk/current/src/client/state/Makefile.am trunk/current/src/common/ trunk/current/src/common/Makefile.am trunk/current/src/deps/ trunk/current/src/deps/Makefile.am trunk/current/src/deps/tinyxml/ trunk/current/src/deps/tinyxml/Makefile.am trunk/current/src/deps/tinyxml/tinyxml.cpp trunk/current/src/deps/tinyxml/tinyxml.h trunk/current/src/deps/tinyxml/tinyxmlerror.cpp trunk/current/src/deps/tinyxml/tinyxmlparser.cpp trunk/current/src/server/ trunk/current/src/server/Makefile.am Added: trunk/current/src/Client.cpp =================================================================== --- trunk/current/src/Client.cpp (rev 0) +++ trunk/current/src/Client.cpp 2006-12-10 01:06:16 UTC (rev 290) @@ -0,0 +1,49 @@ +/*************************************************************************** + * Copyright (C) 2006 by OpenGate development team * + * eGore eg...@us... * + * Qrstuvw ab...@sl... * + * * + * 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. * + ***************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <iostream> +#include <cstdlib> + +#include "OpenGateApp.h" + +using namespace std; + +int main(int argc, char *argv[]) +{ + // Create application object + OpenGateApp app; + + try + { + app.go(); + } + catch( Exception& e ) + { + fprintf(stderr, "An exception has occured: %s\n", + e.getFullDescription().c_str()); + } + + return EXIT_SUCCESS; +} Property changes on: trunk/current/src/Client.cpp ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Modified: trunk/current/src/Makefile.am =================================================================== --- trunk/current/src/Makefile.am 2006-12-10 00:30:25 UTC (rev 289) +++ trunk/current/src/Makefile.am 2006-12-10 01:06:16 UTC (rev 290) @@ -1,5 +1,10 @@ # set the include path found by configure -INCLUDES= $(all_includes) +INCLUDES = $(all_includes) # the library search path. +bin_PROGRAMS = client server + +server_SOURCES = Server.cpp +client_SOURCES = Client.cpp +SUBDIRS = deps common client server Added: trunk/current/src/Server.cpp =================================================================== --- trunk/current/src/Server.cpp (rev 0) +++ trunk/current/src/Server.cpp 2006-12-10 01:06:16 UTC (rev 290) @@ -0,0 +1,19 @@ +/*************************************************************************** + * Copyright (C) 2006 by OpenGate development team * + * eg...@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. * + ***************************************************************************/ Property changes on: trunk/current/src/Server.cpp ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/current/src/client/GameState.h =================================================================== --- trunk/current/src/client/GameState.h (rev 0) +++ trunk/current/src/client/GameState.h 2006-12-10 01:06:16 UTC (rev 290) @@ -0,0 +1,158 @@ +/*************************************************************************** + * Copyright (C) 2006 by OpenGate development team * + * Qrstuvw ab...@sl... * + * * + * 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 GAMESTATE_H +#define GAMESTATE_H + +#include "Global.h" + +class GameState; + +/** \class GameStateListener + Allows a GameStateManager to recieve callbacks from a GameState. */ +class GameStateListener + { + // Attributes ------------------------------------------------------------------------------ + + // Methods --------------------------------------------------------------------------------- + public: + /** Constructor */ + GameStateListener(void) + {} + ; + + /** Virtual Deconstructor */ + virtual ~GameStateListener(void) + {} + ; + + /** Store a game state to manage. */ + virtual void ManageGameState(Ogre::String state_name, GameState* state) = 0; + + /** Find a state by name. */ + virtual GameState* findByName(Ogre::String state_name) = 0; + + /** Request a change to state. */ + virtual void changeGameState(GameState* state) = 0; + + /** Push state onto the stack. */ + virtual bool pushGameState(GameState* state) = 0; + + /** Pop a game state off the stack. */ + virtual void popGameState() = 0; + + /** Cause a shutdown. */ + virtual void Shutdown() = 0; + }; + +/** \class GameState + Inherit this class to make a game state capable + of being mananged by the game state manager. +*/ +class GameState + { + // Attributes ------------------------------------------------------------------------------ + protected: + /** Stores the GameStateManager which is managing this state. */ + GameStateListener* parent; + + /** Keeps a method of device interaction. */ + framework_info* mFramework; + + // Methods --------------------------------------------------------------------------------- + protected: + /** Constructor: This should be a private member of an inherited class. */ + GameState(void) + {} + ; + + /** Destructor: This should be a private member of an inherited class. */ + virtual ~GameState(void) + {} + ; + + /** Find a state by its name. */ + GameState* findByName(Ogre::String state_name) + { + return parent->findByName(state_name); + } + + /** Request a change to game state. */ + void changeGameState(GameState* state) + { + parent->changeGameState(state); + } + + /** Push game state onto the stack. */ + bool pushGameState(GameState* state) + { + return parent->pushGameState(state); + } + + /** Pop a game state off the stack. */ + void popGameState(void) + { + parent->popGameState(); + } + + /** Cause a shutdown. */ + void Shutdown(void) + { + parent->Shutdown(); + } + + public: + /** Do not inherit this directly! */ + void Create(GameStateListener* parent, const Ogre::String name) + {} + ; + + /** Destroy self. */ + void destroy(void) + { + delete this; + } + + /** Initialize the game state with device information. */ + void init(framework_info* framework) + { + mFramework = framework; + } + + /** Inherit to supply game state enter code. */ + virtual void enter(void) = 0; + + /** Inherit to supply state exit code. */ + virtual void exit(void) = 0; + + /** Inherit to supply pause code. Inherit only if this game state can be paused. + Return true for successful pause, or false to deny pause. */ + virtual bool pause(void) + { + return false; + } + + /** Inherit to supply resume code. Inherit only if this game state can be paused. */ + virtual void resume(void) + {} + ; + }; + +#endif Property changes on: trunk/current/src/client/GameState.h ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/current/src/client/GameStateManager.cpp =================================================================== --- trunk/current/src/client/GameStateManager.cpp (rev 0) +++ trunk/current/src/client/GameStateManager.cpp 2006-12-10 01:06:16 UTC (rev 290) @@ -0,0 +1,193 @@ +/*************************************************************************** + * Copyright (C) 2006 by OpenGate development team * + * Qrstuvw ab...@sl... * + * * + * 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 "GameStateManager.h" + +//--------------------------------------------------------------------------------// +/** Constructs the GameStateManager. */ +GameStateManager::GameStateManager(framework_info* framework) +{ + mFramework = framework; +} + +//--------------------------------------------------------------------------------// +/** Cleans up the game states before the instance dies. */ +GameStateManager::~GameStateManager() +{ + // Clean up all the states on the stack + while (!mStateStack.empty()) + { + cleanup(mStateStack.back()); + mStateStack.pop_back(); + } + + // Destroy the game states + while(!mStates.empty()) + { + mStates.back().state->destroy(); + mStates.pop_back(); + } +} + +//--------------------------------------------------------------------------------// +/** Store a game state to manage. */ +void GameStateManager::ManageGameState(Ogre::String state_name,GameState* state) +{ + state_info new_state_info; + new_state_info.name = state_name; + new_state_info.state = state; + new_state_info.state->init(mFramework); + mStates.push_back(new_state_info); +} + +//--------------------------------------------------------------------------------// + +/** Find a game state by name. + @Remarks returns 0 on failure.*/ +GameState* GameStateManager::findByName(Ogre::String state_name) +{ + std::vector<state_info>::iterator itr; + + for(itr=mStates.begin();itr!=mStates.end();itr++) + { + if(itr->name==state_name) + return itr->state; + } + + return 0; +} + +//--------------------------------------------------------------------------------// +/** Start game state. This is used to start the game state + manager functioning with a particular state. + This function also does the main game loop and + takes care of the Windows message pump.*/ +void GameStateManager::start(GameState* state) +{ + changeGameState(state); + + while (!mShutdown) + { + // HACK: For some reason renderOneFrame() does not work, + // manually updating the window. + mFramework->ogreRoot->_fireFrameStarted(); + + // Run the message pump +#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 + { + MSG msg; + while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) + { + if (msg.message = WM_QUIT) + Shutdown(); + else + { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + } + } +#endif + + mFramework->renderWindow->update(); + mFramework->ogreRoot->_fireFrameEnded(); + } +} + +//--------------------------------------------------------------------------------// +/** Change to a game state. This replaces the current game state + with a new game state. The current game state ends before + the new begins. */ +void GameStateManager::changeGameState(GameState* state) +{ + // Cleanup the current game state + if ( !mStateStack.empty() ) + { + cleanup(mStateStack.back()); + mStateStack.back()->exit(); + mStateStack.pop_back(); + } + + mStateStack.push_back(state); + init(state); + mStateStack.back()->enter(); +} + +//--------------------------------------------------------------------------------// +/** Push a game state onto the stack. This pauses the current game state + and begins a new game state. If the current game state refuses to + be paused, this will return false. */ +bool GameStateManager::pushGameState(GameState* state) +{ + // Pause current game state + if ( !mStateStack.empty() ) + { + if(!mStateStack.back()->pause()) + return false; + cleanup(mStateStack.back()); + } + + // Store and init the new state + mStateStack.push_back(state); + init(state); + mStateStack.back()->enter(); + + return true; +} + +//--------------------------------------------------------------------------------// +/** Pop a game state off the stack. This destroys the current game state + and returns control to the previous game state. */ +void GameStateManager::popGameState(void) +{ + // Cleanup the current game state + if ( !mStateStack.empty() ) + { + cleanup(mStateStack.back()); + mStateStack.back()->exit(); + mStateStack.pop_back(); + } + + // Resume previous game state or quit if there isn't one + if ( !mStateStack.empty() ) + { + init(mStateStack.back()); + mStateStack.back()->resume(); + } + else + Shutdown(); +} + +//--------------------------------------------------------------------------------// +/** Special case function to shutdown the system. */ +void GameStateManager::Shutdown() +{ + mShutdown = true; +} + +//--------------------------------------------------------------------------------// +/** This initializes a game state. */ +void GameStateManager::init(GameState* state) +{} + +//--------------------------------------------------------------------------------// +/** Cleans up a previous state. */ +void GameStateManager::cleanup(GameState* state) +{} Property changes on: trunk/current/src/client/GameStateManager.cpp ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/current/src/client/GameStateManager.h =================================================================== --- trunk/current/src/client/GameStateManager.h (rev 0) +++ trunk/current/src/client/GameStateManager.h 2006-12-10 01:06:16 UTC (rev 290) @@ -0,0 +1,94 @@ +/*************************************************************************** + * Copyright (C) 2006 by OpenGate development team * + * Qrstuvw ab...@sl... * + * * + * 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 GAMESTATEMANAGER_H +#define GAMESTATEMANAGER_H + +#include "GameState.h" + +/** \class GameStateManager + The GameStateManager manages changes in the game states + in the game. It holds a stack of all open game states + and maps all events. */ +class GameStateManager: public GameStateListener + { + // Attributes ------------------------------------------------------------------------------ + protected: + /** Holds information about the states in order to + manage them properly and provide access. */ + typedef struct + { + Ogre::String name; + GameState* state; + } + state_info; + + /** This is the stack where the active states are stored. */ + std::vector<GameState*> mStateStack; + + /** This holds the states that are being managed. */ + std::vector<state_info> mStates; + + /** System Information. */ + framework_info* mFramework; + + /** If this is set to true, the game state manager prepares to exit. */ + bool mShutdown; + + // Methods --------------------------------------------------------------------------------- + protected: + /** This initializes a state. */ + void init(GameState* state); + + /** Cleans up a previous state. */ + void cleanup(GameState* state); + + public: + /** Constructs the GameStateManager. Must have all + input, output, gui functions in order to manage + states. */ + GameStateManager(framework_info* framework); + + /** Cleans up the states before the instance dies. */ + ~GameStateManager(); + + /** Store a game state to manage. */ + void ManageGameState(Ogre::String state_name, GameState* state); + + /** Find a game state by name. */ + GameState* findByName(Ogre::String state_name); + + /** Start game state */ + void start(GameState* state); + + /** Change to a new game state */ + void changeGameState(GameState* state); + + /** Push game state onto the stack. */ + bool pushGameState(GameState* state); + + /** Pop a game state off the stack. */ + void popGameState(void); + + /** This is a special case function to cause a shutdown. */ + void Shutdown(void); + }; + +#endif Property changes on: trunk/current/src/client/GameStateManager.h ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/current/src/client/Global.h =================================================================== --- trunk/current/src/client/Global.h (rev 0) +++ trunk/current/src/client/Global.h 2006-12-10 01:06:16 UTC (rev 290) @@ -0,0 +1,66 @@ +/*************************************************************************** + * Copyright (C) 2006 by OpenGate development team * + * Qrstuvw ab...@sl... * + * * + * 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 GLOBAL_H +#define GLOBAL_H + +#include <OGRE/Ogre.h> +#include <OIS/OISMouse.h> +#include <OIS/OISKeyboard.h> +#include <OIS/OISJoyStick.h> +#include <OIS/OISInputManager.h> +/** This file eases an issue CEGUI has with OGRE's memory manager. Simply include this in + any files that are going to be doing 'CEGUI stuff', rather than CEGUI.h, + OgreCEGUIRender.h, OgreCEGUIResourceProvider.h, and OgreCEGUITexture.h (etc). + You will be in for smooth(er) sailing. **/ +#include <OGRE/OgreNoMemoryMacros.h> +#include <CEGUI/CEGUIImageset.h> +#include <CEGUI/CEGUISystem.h> +#include <CEGUI/CEGUILogger.h> +#include <CEGUI/CEGUISchemeManager.h> +#include <CEGUI/CEGUIWindowManager.h> +#include <CEGUI/CEGUIWindow.h> +#include <OGRE/OgreCEGUIRenderer.h> +#include <OGRE/OgreCEGUIResourceProvider.h> +#include <OGRE/OgreMemoryMacros.h> + +#include <CEGUI/elements/CEGUIEditbox.h> +#include <CEGUI/elements/CEGUIPushButton.h> +#include <CEGUI/elements/CEGUIEditbox.h> +#include <CEGUI/elements/CEGUIFrameWindow.h> +#include <CEGUI/elements/CEGUIStaticImage.h> +#include <CEGUI/elements/CEGUIProgressBar.h> +#include <CEGUI/elements/CEGUIStaticText.h> + +/** Information structure to facilitate the transfer of information between + GameState states. */ +typedef struct + { + Ogre::Root* ogreRoot; + Ogre::SceneManager* sceneMgr; + Ogre::Camera* camera; + Ogre::Viewport* viewport; + Ogre::RenderWindow* renderWindow; + CEGUI::OgreCEGUIRenderer* GUIRenderer; + CEGUI::System* GUISystem; + } +framework_info; + +#endif Property changes on: trunk/current/src/client/Global.h ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/current/src/client/GraphicsSetup.cpp =================================================================== --- trunk/current/src/client/GraphicsSetup.cpp (rev 0) +++ trunk/current/src/client/GraphicsSetup.cpp 2006-12-10 01:06:16 UTC (rev 290) @@ -0,0 +1,204 @@ +/*************************************************************************** + * Copyright (C) 2006 by OpenGate development team * + * Qrstuvw ab...@sl... * + * * + * 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 "GraphicsSetup.h" + +/** Defaul constructor. */ +//--------------------------------------------------------------------------------// +GraphicsSetup::GraphicsSetup() +{} + +/** Default destructor. */ +//--------------------------------------------------------------------------------// +GraphicsSetup::~GraphicsSetup() +{} + +/** This function initialises Ogre and CEGUI. */ +//--------------------------------------------------------------------------------// +bool GraphicsSetup::initGraphics(framework_info* mFramework) +{ + // Create root object and store a pointer to it in mFramework + mFramework->ogreRoot = new Ogre::Root("", "", "OpenGate.log"); + + // Load the render system (Linux only has OpenGL) + mFramework->ogreRoot->loadPlugin("/usr/local/lib/OGRE/RenderSystem_GL.so"); + + // Load engines settings + if (!loadEngineSettings(mFramework)) + { + // Create the Graphics.xml file using default options + if (!saveEngineSettings(mFramework)) + return false; + return false; + } + + // Write all the currently available settings as comment + if (!saveEngineSettings(mFramework)) + return false; + + // Load all resources from XML + if (!setupResources()) + return false; + + // FIXME: Make this do something. Returns an empty string if options are valid + mRenderSystem->validateConfigOptions(); + + // Tell the Ogre what render system to use + mFramework->ogreRoot->setRenderSystem(mRenderSystem); + + // Create our window + mFramework->renderWindow = mFramework->ogreRoot->initialise(true, "OpenGate 0.0.1ALPHA"); + + // Pick a scene manager + mFramework->sceneMgr = mFramework->ogreRoot->createSceneManager(Ogre::ST_GENERIC, "SMInstance"); + + // Setup CEGUI Logging + CEGUI::Logger::getSingleton().setLoggingLevel(CEGUI::Insane); + CEGUI::Logger::getSingleton().setLogFilename("OpenGate.log", true); + + // Tell CEGUI about our window and what scene manager to use + mFramework->GUIRenderer = new CEGUI::OgreCEGUIRenderer(mFramework->renderWindow, Ogre::RENDER_QUEUE_OVERLAY, false, 3000, mFramework->sceneMgr); + + // Hook the CEGUI system to the renderer + mFramework->GUISystem = new CEGUI::System(mFramework->GUIRenderer); + + return true; +} + +/** Get all the options from Graphics.xml and feed them to the RenderSystem. */ +//--------------------------------------------------------------------------------// +bool GraphicsSetup::loadEngineSettings(framework_info* mFramework) +{ + TiXmlDocument doc( "Graphics.xml" ); + if (!doc.LoadFile()) + return false; + doc.LoadFile(); + TiXmlHandle hDoc(&doc); + TiXmlElement* pElem; + TiXmlHandle hRoot(0); + + pElem = hDoc.FirstChildElement().Element(); + hRoot = TiXmlHandle(pElem); + + pElem = hRoot.FirstChild( "Subsystem" ).FirstChild().Element(); + mRenderSystem = mFramework->ogreRoot->getRenderSystemByName(pElem->Attribute("value")); + for (pElem = hRoot.FirstChild( "GraphicsSetup" ).FirstChild().Element(); pElem != 0; pElem = pElem->NextSiblingElement()) + { + mRenderSystem->setConfigOption(pElem->Attribute("name"), pElem->Attribute("value")); + } + + return true; +} + +/** (re)Create Graphics.xml with options taken from the current RenderSystem. */ +//--------------------------------------------------------------------------------// +bool GraphicsSetup::saveEngineSettings(framework_info* mFramework) +{ + int i; + std::string s; + TiXmlElement* _option; + TiXmlDocument doc; + TiXmlDeclaration* _decl = new TiXmlDeclaration( "1.0", "UTF-8", "No" ); + doc.LinkEndChild( _decl ); + TiXmlElement* _root = new TiXmlElement( "OpenGate" ); + doc.LinkEndChild( _root ); + + TiXmlComment* _comment; + _comment = new TiXmlComment(); + _comment->SetValue(" Automatically (re-)generated "); + _root->LinkEndChild( _comment ); + _comment = new TiXmlComment(); + _comment->SetValue(" Let's judge him by what he does next... "); + _root->LinkEndChild( _comment ); + + TiXmlElement* _subsys = new TiXmlElement( "Subsystem" ); + _root->LinkEndChild( _subsys ); + _option = new TiXmlElement( "Option" ); + _option->SetAttribute("name", "Rendering Subsystem"); + _option->SetAttribute("value", mRenderSystem->getName()); + _subsys->LinkEndChild( _option ); + Ogre::RenderSystemList* _rslist; + _rslist = mFramework->ogreRoot->getAvailableRenderers(); + s.clear(); + for (Ogre::RenderSystemList::iterator itr = _rslist->begin(); + itr != _rslist->end(); itr++) + { + s += " " + (*itr)->getName(); + } + s += " "; + _comment = new TiXmlComment(); + _comment->SetValue(s); + _subsys->LinkEndChild( _comment ); + + TiXmlElement* _graphics = new TiXmlElement( "Graphics" ); + _root->LinkEndChild( _graphics ); + Ogre::ConfigOptionMap _optmap; + _optmap = mRenderSystem->getConfigOptions(); + for (Ogre::ConfigOptionMap::iterator itr = _optmap.begin(); + itr != _optmap.end(); itr++) + { + _option = new TiXmlElement( "Option" ); + _option->SetAttribute("name", itr->second.name); + _option->SetAttribute("value", itr->second.currentValue); + _graphics->LinkEndChild( _option ); + s.clear(); + for (i = 0; i < (int)itr->second.possibleValues.size(); i++) + { + s += " " + itr->second.possibleValues.at(i); + } + s += " "; + _comment = new TiXmlComment(); + _comment->SetValue(s); + _graphics->LinkEndChild( _comment ); + } + + doc.SaveFile( "Graphics.xml" ); + + return true; +} + +/** Create and populate resource groups from Resources.xml. */ +//--------------------------------------------------------------------------------// +bool GraphicsSetup::setupResources() +{ + TiXmlDocument doc( "Resources.xml" ); + if (!doc.LoadFile()) + return false; + doc.LoadFile(); + TiXmlHandle hDoc(&doc); + TiXmlElement* pElem; + TiXmlElement* pGroup; + TiXmlHandle hGroup(0); + TiXmlHandle hRoot(0); + + pElem = hDoc.FirstChildElement().Element(); + hRoot = TiXmlHandle(pElem); + + for (pGroup = hRoot.FirstChild( "Resources" ).FirstChild( "Group" ).Element(); pGroup != 0; pGroup = pGroup->NextSiblingElement()) + { + hGroup = TiXmlHandle(pGroup); + for (pElem = hGroup.FirstChild( "Resource" ).Element(); pElem != 0; pElem = pElem->NextSiblingElement()) + { + Ogre::ResourceGroupManager::getSingleton().addResourceLocation(pElem->Attribute("location"), pElem->Attribute("type"), pGroup->Attribute("name"), false); + } + } + + return true; +} Property changes on: trunk/current/src/client/GraphicsSetup.cpp ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/current/src/client/GraphicsSetup.h =================================================================== --- trunk/current/src/client/GraphicsSetup.h (rev 0) +++ trunk/current/src/client/GraphicsSetup.h 2006-12-10 01:06:16 UTC (rev 290) @@ -0,0 +1,58 @@ +/*************************************************************************** + * Copyright (C) 2006 by OpenGate development team * + * Qrstuvw ab...@sl... * + * * + * 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 GRAPHICSSETUP_H +#define GRAPHICSSETUP_H + +#include "Global.h" +#include <tinyxml/tinyxml.h> + +/** \class GraphicsSetup + This class initialises the Ogre engine and CEGUI. It is inherited by the + OpenGateApp class */ +class GraphicsSetup + { + // Attributes ------------------------------------------------------------------------------ + private: + Ogre::RenderSystem* mRenderSystem; + + // Methods --------------------------------------------------------------------------------- + private: + /** Create resource groups from Resources.xml. */ + bool setupResources(); + + /** Get all the options from Graphics.xml and feed them to the RenderSystem. */ + bool loadEngineSettings(framework_info* mFramework); + + /** (re)Create Graphics.xml according to the options taken from the current RenderSystem. */ + bool saveEngineSettings(framework_info* mFramework); + + protected: + /** Defaul constructor. */ + GraphicsSetup(); + + /** Default destructor. */ + ~GraphicsSetup(); + + /** This function initialises Ogre and CEGUI. */ + bool initGraphics(framework_info* mFramework); + }; + +#endif Property changes on: trunk/current/src/client/GraphicsSetup.h ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/current/src/client/Makefile.am =================================================================== --- trunk/current/src/client/Makefile.am (rev 0) +++ trunk/current/src/client/Makefile.am 2006-12-10 01:06:16 UTC (rev 290) @@ -0,0 +1,7 @@ +INCLUDES = $(all_includes) +METASOURCES = AUTO +SUBDIRS = logic state +lib_LTLIBRARIES = libClient.la +libClient_la_SOURCES = GameStateManager.cpp GraphicsSetup.cpp OpenGateApp.cpp +noinst_HEADERS = GameStateManager.h GameState.h Global.h OpenGateApp.h \ + GraphicsSetup.h Property changes on: trunk/current/src/client/Makefile.am ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/current/src/client/OpenGateApp.cpp =================================================================== --- trunk/current/src/client/OpenGateApp.cpp (rev 0) +++ trunk/current/src/client/OpenGateApp.cpp 2006-12-10 01:06:16 UTC (rev 290) @@ -0,0 +1,62 @@ +/*************************************************************************** + * Copyright (C) 2006 by OpenGate development team * + * Qrstuvw ab...@sl... * + * * + * 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 "OpenGateApp.h" +#include "GameStateManager.h" + +// Game states +#include "state/IntroState.h" + +//--------------------------------------------------------------------------------// +/** Default constructor. */ +OpenGateApp::OpenGateApp() +{} + +//--------------------------------------------------------------------------------// +/** Default destructor. */ +OpenGateApp::~OpenGateApp() +{} + +//--------------------------------------------------------------------------------// +/** go() starts the OpenGate client. */ +void OpenGateApp::go() +{ + // Initialise Ogre and CEGUI + if (!initGraphics(&mFramework)) + return; + + // Start the GameStateManager and register the game states + setupGameStateManager(); + + // Start the first game state + GameStateMgr.start(GameStateMgr.findByName("IntroState")); +} + +//--------------------------------------------------------------------------------// +/** Create the GameStateManager and register the game states. */ +void OpenGateApp::setupGameStateManager() +{ + // Create the gamestate manager + GameStateManager GameStateMgr(&mFramework); + + // Create and register game states + IntroState::Create(&GameStateMgr,"IntroState"); +} Property changes on: trunk/current/src/client/OpenGateApp.cpp ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/current/src/client/OpenGateApp.h =================================================================== --- trunk/current/src/client/OpenGateApp.h (rev 0) +++ trunk/current/src/client/OpenGateApp.h 2006-12-10 01:06:16 UTC (rev 290) @@ -0,0 +1,56 @@ +/*************************************************************************** + * Copyright (C) 2006 by OpenGate development team * + * Qrstuvw ab...@sl... * + * * + * 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 OPENGATEAPP_H +#define OPENGATEAPP_H + +#include "Global.h" +#include "GraphicsSetup.h" + +/** \class OpenGateApp + The OpenGateApp class handles the creation and destruction of singleton objects, + populates the framework_info structure, registers the game states and + starts the first game state. It does all this and more by simply calling + go()... */ +class OpenGateApp : private GraphicsSetup + { + // Attributes ------------------------------------------------------------------------------ + private: + /** Information structure to facilitate the transfer of information between + GameState states. */ + framework_info mFramework; + + // Methods --------------------------------------------------------------------------------- + public: + /** Default constructor. */ + OpenGateApp(); + + /** Default destructor. */ + ~OpenGateApp(); + + /** go() starts the OpenGate client. */ + void go(); + + private: + /** Create the GameStateManager and register the game states. */ + void setupGameStateManager(); + }; + +#endif Property changes on: trunk/current/src/client/OpenGateApp.h ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/current/src/client/logic/Makefile.am =================================================================== --- trunk/current/src/client/logic/Makefile.am (rev 0) +++ trunk/current/src/client/logic/Makefile.am 2006-12-10 01:06:16 UTC (rev 290) @@ -0,0 +1,2 @@ +INCLUDES = $(all_includes) +METASOURCES = AUTO Property changes on: trunk/current/src/client/logic/Makefile.am ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/current/src/client/state/IntroState.cpp =================================================================== --- trunk/current/src/client/state/IntroState.cpp (rev 0) +++ trunk/current/src/client/state/IntroState.cpp 2006-12-10 01:06:16 UTC (rev 290) @@ -0,0 +1,31 @@ +/*************************************************************************** + * Copyright (C) 2006 by OpenGate development team * + * Qrstuvw ab...@sl... * + * * + * 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 "IntroState.h" + +//--------------------------------------------------------------------------------// +/** Game state enter code. */ +void IntroState::enter() +{} + +//--------------------------------------------------------------------------------// +/** Game state exit code. */ +void IntroState::exit() +{} Property changes on: trunk/current/src/client/state/IntroState.cpp ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/current/src/client/state/IntroState.h =================================================================== --- trunk/current/src/client/state/IntroState.h (rev 0) +++ trunk/current/src/client/state/IntroState.h 2006-12-10 01:06:16 UTC (rev 290) @@ -0,0 +1,59 @@ +/*************************************************************************** + * Copyright (C) 2006 by OpenGate development team * + * Qrstuvw ab...@sl... * + * * + * 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 INTROSTATE_H +#define INTROSTATE_H + +#include "GameState.h" + +class IntroState : public GameState + { + // Self-creation & registering function ---------------------------------------------------- + public: + /** Create and register the state so that it can be managed by the GameStateManager. */ + static void Create(GameStateListener *parent,const Ogre::String name) + { + IntroState *myGameState = new IntroState(); + myGameState->parent = parent; + parent->ManageGameState(name,myGameState); + } + + // Attributes ------------------------------------------------------------------------------ + + // Methods --------------------------------------------------------------------------------- + public: + /** Default constructor. */ + IntroState() + {} + + /** Default destructor. */ + ~IntroState() + {} + + /** Game state enter code. */ + void enter(); + + /** Game state exit code. */ + void exit(); + + }; + +#endif Property changes on: trunk/current/src/client/state/IntroState.h ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/current/src/client/state/Makefile.am =================================================================== --- trunk/current/src/client/state/Makefile.am (rev 0) +++ trunk/current/src/client/state/Makefile.am 2006-12-10 01:06:16 UTC (rev 290) @@ -0,0 +1,5 @@ +INCLUDES = $(all_includes) +METASOURCES = AUTO +lib_LTLIBRARIES = libStates.la +noinst_HEADERS = IntroState.h +libStates_la_SOURCES = IntroState.cpp Property changes on: trunk/current/src/client/state/Makefile.am ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/current/src/common/Makefile.am =================================================================== --- trunk/current/src/common/Makefile.am (rev 0) +++ trunk/current/src/common/Makefile.am 2006-12-10 01:06:16 UTC (rev 290) @@ -0,0 +1,2 @@ +INCLUDES = $(all_includes) +METASOURCES = AUTO Property changes on: trunk/current/src/common/Makefile.am ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/current/src/deps/Makefile.am =================================================================== --- trunk/current/src/deps/Makefile.am (rev 0) +++ trunk/current/src/deps/Makefile.am 2006-12-10 01:06:16 UTC (rev 290) @@ -0,0 +1,3 @@ +INCLUDES = $(all_includes) +METASOURCES = AUTO +SUBDIRS = tinyxml Property changes on: trunk/current/src/deps/Makefile.am ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/current/src/deps/tinyxml/Makefile.am =================================================================== --- trunk/current/src/deps/tinyxml/Makefile.am (rev 0) +++ trunk/current/src/deps/tinyxml/Makefile.am 2006-12-10 01:06:16 UTC (rev 290) @@ -0,0 +1,4 @@ +INCLUDES = $(all_includes) +METASOURCES = AUTO +lib_LTLIBRARIES = libTinyXML.la +libTinyXML_la_SOURCES = tinyxml.cpp tinyxmlerror.cpp tinyxmlparser.cpp Property changes on: trunk/current/src/deps/tinyxml/Makefile.am ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/current/src/deps/tinyxml/tinyxml.cpp =================================================================== --- trunk/current/src/deps/tinyxml/tinyxml.cpp (rev 0) +++ trunk/current/src/deps/tinyxml/tinyxml.cpp 2006-12-10 01:06:16 UTC (rev 290) @@ -0,0 +1,1866 @@ +/* +www.sourceforge.net/projects/tinyxml +Original code (2.0 and earlier )copyright (c) 2000-2006 Lee Thomason (www.grinninglizard.com) + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any +damages arising from the use of this software. + +Permission is granted to anyone to use this software for any +purpose, including commercial applications, and to alter it and +redistribute it freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must +not claim that you wrote the original software. If you use this +software in a product, an acknowledgment in the product documentation +would be appreciated but is not required. + +2. Altered source versions must be plainly marked as such, and +must not be misrepresented as being the original software. + +3. This notice may not be removed or altered from any source +distribution. +*/ + +#include <ctype.h> + +#ifdef TIXML_USE_STL +#include <sstream> +#include <iostream> +#endif + +#include "tinyxml.h" + + +bool TiXmlBase::condenseWhiteSpace = true; + +void TiXmlBase::PutString( const TIXML_STRING& str, TIXML_STRING* outString ) +{ + int i=0; + + while( i<(int)str.length() ) + { + unsigned char c = (unsigned char) str[i]; + + if ( c == '&' + && i < ( (int)str.length() - 2 ) + && str[i+1] == '#' + && str[i+2] == 'x' ) + { + // Hexadecimal character reference. + // Pass through unchanged. + // © -- copyright symbol, for example. + // + // The -1 is a bug fix from Rob Laveaux. It keeps + // an overflow from happening if there is no ';'. + // There are actually 2 ways to exit this loop - + // while fails (error case) and break (semicolon found). + // However, there is no mechanism (currently) for + // this function to return an error. + while ( i<(int)str.length()-1 ) + { + outString->append( str.c_str() + i, 1 ); + ++i; + if ( str[i] == ';' ) + break; + } + } + else if ( c == '&' ) + { + outString->append( entity[0].str, entity[0].strLength ); + ++i; + } + else if ( c == '<' ) + { + outString->append( entity[1].str, entity[1].strLength ); + ++i; + } + else if ( c == '>' ) + { + outString->append( entity[2].str, entity[2].strLength ); + ++i; + } + else if ( c == '\"' ) + { + outString->append( entity[3].str, entity[3].strLength ); + ++i; + } + else if ( c == '\'' ) + { + outString->append( entity[4].str, entity[4].strLength ); + ++i; + } + else if ( c < 32 ) + { + // Easy pass at non-alpha/numeric/symbol + // Below 32 is symbolic. + char buf[ 32 ]; + + #if defined(TIXML_SNPRINTF) + TIXML_SNPRINTF( buf, sizeof(buf), "&#x%02X;", (unsigned) ( c & 0xff ) ); + #else + sprintf( buf, "&#x%02X;", (unsigned) ( c & 0xff ) ); + #endif + + //*ME: warning C4267: convert 'size_t' to 'int' + //*ME: Int-Cast to make compiler happy ... + outString->append( buf, (int)strlen( buf ) ); + ++i; + } + else + { + //char realc = (char) c; + //outString->append( &realc, 1 ); + *outString += (char) c; // somewhat more efficient function call. + ++i; + } + } +} + + +TiXmlNode::TiXmlNode( NodeType _type ) : TiXmlBase() +{ + parent = 0; + type = _type; + firstChild = 0; + lastChild = 0; + prev = 0; + next = 0; +} + + +TiXmlNode::~TiXmlNode() +{ + TiXmlNode* node = firstChild; + TiXmlNode* temp = 0; + + while ( node ) + { + temp = node; + node = node->next; + delete temp; + } +} + + +void TiXmlNode::CopyTo( TiXmlNode* target ) const +{ + target->SetValue (value.c_str() ); + target->userData = userData; +} + + +void TiXmlNode::Clear() +{ + TiXmlNode* node = firstChild; + TiXmlNode* temp = 0; + + while ( node ) + { + temp = node; + node = node->next; + delete temp; + } + + firstChild = 0; + lastChild = 0; +} + + +TiXmlNode* TiXmlNode::LinkEndChild( TiXmlNode* node ) +{ + assert( node->parent == 0 || node->parent == this ); + assert( node->GetDocument() == 0 || node->GetDocument() == this->GetDocument() ); + + if ( node->Type() == TiXmlNode::DOCUMENT ) + { + delete node; + if ( GetDocument() ) GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN ); + return 0; + } + + node->parent = this; + + node->prev = lastChild; + node->next = 0; + + if ( lastChild ) + lastChild->next = node; + else + firstChild = node; // it was an empty list. + + lastChild = node; + return node; +} + + +TiXmlNode* TiXmlNode::InsertEndChild( const TiXmlNode& addThis ) +{ + if ( addThis.Type() == TiXmlNode::DOCUMENT ) + { + if ( GetDocument() ) GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN ); + return 0; + } + TiXmlNode* node = addThis.Clone(); + if ( !node ) + return 0; + + return LinkEndChild( node ); +} + + +TiXmlNode* TiXmlNode::InsertBeforeChild( TiXmlNode* beforeThis, const TiXmlNode& addThis ) +{ + if ( !beforeThis || beforeThis->parent != this ) { + return 0; + } + if ( addThis.Type() == TiXmlNode::DOCUMENT ) + { + if ( GetDocument() ) GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN ); + return 0; + } + + TiXmlNode* node = addThis.Clone(); + if ( !node ) + return 0; + node->parent = this; + + node->next = beforeThis; + node->prev = beforeThis->prev; + if ( beforeThis->prev ) + { + beforeThis->prev->next = node; + } + else + { + assert( firstChild == beforeThis ); + firstChild = node; + } + beforeThis->prev = node; + return node; +} + + +TiXmlNode* TiXmlNode::InsertAfterChild( TiXmlNode* afterThis, const TiXmlNode& addThis ) +{ + if ( !afterThis || afterThis->parent != this ) { + return 0; + } + if ( addThis.Type() == TiXmlNode::DOCUMENT ) + { + if ( GetDocument() ) GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN ); + return 0; + } + + TiXmlNode* node = addThis.Clone(); + if ( !node ) + return 0; + node->parent = this; + + node->prev = afterThis; + node->next = afterThis->next; + if ( afterThis->next ) + { + afterThis->next->prev = node; + } + else + { + assert( lastChild == afterThis ); + lastChild = node; + } + afterThis->next = node; + return node; +} + + +TiXmlNode* TiXmlNode::ReplaceChild( TiXmlNode* replaceThis, const TiXmlNode& withThis ) +{ + if ( replaceThis->parent != this ) + return 0; + + TiXmlNode* node = withThis.Clone(); + if ( !node ) + return 0; + + node->next = replaceThis->next; + node->prev = replaceThis->prev; + + if ( replaceThis->next ) + replaceThis->next->prev = node; + else + lastChild = node; + + if ( replaceThis->prev ) + replaceThis->prev->next = node; + else + firstChild = node; + + delete replaceThis; + node->parent = this; + return node; +} + + +bool TiXmlNode::RemoveChild( TiXmlNode* removeThis ) +{ + if ( removeThis->parent != this ) + { + assert( 0 ); + return false; + } + + if ( removeThis->next ) + removeThis->next->prev = removeThis->prev; + else + lastChild = removeThis->prev; + + if ( removeThis->prev ) + removeThis->prev->next = removeThis->next; + else + firstChild = removeThis->next; + + delete removeThis; + return true; +} + +const TiXmlNode* TiXmlNode::FirstChild( const char * _value ) const +{ + const TiXmlNode* node; + for ( node = firstChild; node; node = node->next ) + { + if ( strcmp( node->Value(), _value ) == 0 ) + return node; + } + return 0; +} + + +const TiXmlNode* TiXmlNode::LastChild( const char * _value ) const +{ + const TiXmlNode* node; + for ( node = lastChild; node; node = node->prev ) + { + if ( strcmp( node->Value(), _value ) == 0 ) + return node; + } + return 0; +} + + +const TiXmlNode* TiXmlNode::IterateChildren( const TiXmlNode* previous ) const +{ + if ( !previous ) + { + return F... [truncated message content] |
From: <qr...@us...> - 2006-12-10 01:50:34
|
Revision: 291 http://svn.sourceforge.net/opengate/?rev=291&view=rev Author: qrstuvw Date: 2006-12-09 17:50:34 -0800 (Sat, 09 Dec 2006) Log Message: ----------- Modified TinyXML and some Makefiles Modified Paths: -------------- trunk/current/src/client/Makefile.am trunk/current/src/client/state/Makefile.am trunk/current/src/deps/tinyxml/tinyxml.h Modified: trunk/current/src/client/Makefile.am =================================================================== --- trunk/current/src/client/Makefile.am 2006-12-10 01:06:16 UTC (rev 290) +++ trunk/current/src/client/Makefile.am 2006-12-10 01:50:34 UTC (rev 291) @@ -1,4 +1,4 @@ -INCLUDES = $(all_includes) +INCLUDES = -I$(top_srcdir)/src/client -I$(top_srcdir)/src/deps $(all_includes) METASOURCES = AUTO SUBDIRS = logic state lib_LTLIBRARIES = libClient.la Modified: trunk/current/src/client/state/Makefile.am =================================================================== --- trunk/current/src/client/state/Makefile.am 2006-12-10 01:06:16 UTC (rev 290) +++ trunk/current/src/client/state/Makefile.am 2006-12-10 01:50:34 UTC (rev 291) @@ -1,4 +1,4 @@ -INCLUDES = $(all_includes) +INCLUDES = -I$(top_srcdir)/src/client $(all_includes) METASOURCES = AUTO lib_LTLIBRARIES = libStates.la noinst_HEADERS = IntroState.h Modified: trunk/current/src/deps/tinyxml/tinyxml.h =================================================================== --- trunk/current/src/deps/tinyxml/tinyxml.h 2006-12-10 01:06:16 UTC (rev 290) +++ trunk/current/src/deps/tinyxml/tinyxml.h 2006-12-10 01:50:34 UTC (rev 291) @@ -43,6 +43,8 @@ #define DEBUG #endif +#define TIXML_USE_STL + #ifdef TIXML_USE_STL #include <string> #include <iostream> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <qr...@us...> - 2006-12-12 16:18:50
|
Revision: 306 http://svn.sourceforge.net/opengate/?rev=306&view=rev Author: qrstuvw Date: 2006-12-12 08:18:49 -0800 (Tue, 12 Dec 2006) Log Message: ----------- Let there be input (again) Modified Paths: -------------- trunk/current/src/Makefile.am trunk/current/src/client/Global.h trunk/current/src/client/GraphicsSetup.cpp trunk/current/src/client/Makefile.am trunk/current/src/client/OpenGateApp.cpp Added Paths: ----------- trunk/current/src/client/InputManager.cpp trunk/current/src/client/InputManager.h trunk/current/src/client/IntroState.cpp trunk/current/src/client/IntroState.h trunk/current/src/client/LoginListener.h trunk/current/src/client/LoginState.cpp trunk/current/src/client/LoginState.h Modified: trunk/current/src/Makefile.am =================================================================== --- trunk/current/src/Makefile.am 2006-12-12 15:41:21 UTC (rev 305) +++ trunk/current/src/Makefile.am 2006-12-12 16:18:49 UTC (rev 306) @@ -10,4 +10,5 @@ bin_PROGRAMS = opengate-client opengate_client_SOURCES = Client.cpp opengate_client_LDADD = $(top_builddir)/src/deps/tinyxml/libTinyXML.la \ - $(top_builddir)/src/client/state/libStates.la -L/usr/local/lib -lOgreMain -lCEGUIOgreRenderer -lCEGUIBase + $(top_builddir)/src/client/libOpenGateClient.la $(top_builddir)/src/client/state/libStates.la -L/usr/local/lib -lOIS \ + -lOgreMain -lCEGUIOgreRenderer -lCEGUIBase Modified: trunk/current/src/client/Global.h =================================================================== --- trunk/current/src/client/Global.h 2006-12-12 15:41:21 UTC (rev 305) +++ trunk/current/src/client/Global.h 2006-12-12 16:18:49 UTC (rev 306) @@ -22,10 +22,9 @@ #define GLOBAL_H #include <OGRE/Ogre.h> -#include <OIS/OISMouse.h> -#include <OIS/OISKeyboard.h> -#include <OIS/OISJoyStick.h> -#include <OIS/OISInputManager.h> + +#include "InputManager.h" + /** This file eases an issue CEGUI has with OGRE's memory manager. Simply include this in any files that are going to be doing 'CEGUI stuff', rather than CEGUI.h, OgreCEGUIRender.h, OgreCEGUIResourceProvider.h, and OgreCEGUITexture.h (etc). @@ -60,6 +59,7 @@ Ogre::RenderWindow* renderWindow; CEGUI::OgreCEGUIRenderer* GUIRenderer; CEGUI::System* GUISystem; + InputManager *inputMgr; } framework_info; Modified: trunk/current/src/client/GraphicsSetup.cpp =================================================================== --- trunk/current/src/client/GraphicsSetup.cpp 2006-12-12 15:41:21 UTC (rev 305) +++ trunk/current/src/client/GraphicsSetup.cpp 2006-12-12 16:18:49 UTC (rev 306) @@ -39,7 +39,7 @@ // Load the render system (Linux only has OpenGL) mFramework->ogreRoot->loadPlugin("/usr/local/lib/OGRE/RenderSystem_GL.so"); - return false; + // Load engines settings if (!loadEngineSettings(mFramework)) return false; Added: trunk/current/src/client/InputManager.cpp =================================================================== --- trunk/current/src/client/InputManager.cpp (rev 0) +++ trunk/current/src/client/InputManager.cpp 2006-12-12 16:18:49 UTC (rev 306) @@ -0,0 +1,476 @@ +/*************************************************************************** + * Copyright (C) 2006 by OpenGate development team * + * Qrstuvw ab...@sl... * + * * + * 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 "InputManager.h" + +InputManager *InputManager::mInputManager; + +InputManager::InputManager( void ) : + mMouse( 0 ), + mKeyboard( 0 ), + mInputSystem( 0 ) +{} + +InputManager::~InputManager( void ) +{ + if( mInputSystem ) + { + if( mMouse ) + { + mInputSystem->destroyInputObject( mMouse ); + mMouse = 0; + } + + if( mKeyboard ) + { + mInputSystem->destroyInputObject( mKeyboard ); + mKeyboard = 0; + } + + if( mJoysticks.size() > 0 ) + { + itJoystick = mJoysticks.begin(); + itJoystickEnd = mJoysticks.end(); + for(; itJoystick != itJoystickEnd; ++itJoystick ) + { + mInputSystem->destroyInputObject( *itJoystick ); + } + + mJoysticks.clear(); + } + + mInputSystem->destroyInputSystem(); + mInputSystem = 0; + + // Clear Listeners + mKeyListeners.clear(); + mMouseListeners.clear(); + mJoystickListeners.clear(); + } +} + +void InputManager::initialise( Ogre::RenderWindow *renderWindow ) +{ + if( !mInputSystem ) + { + // Setup basic variables + OIS::ParamList paramList; + size_t windowHnd = 0; + std::ostringstream windowHndStr; + + // Get window handle +#if defined OIS_WIN32_PLATFORM + + renderWindow->getCustomAttribute( "HWND", &windowHnd ); +#elif defined OIS_LINUX_PLATFORM + + renderWindow->getCustomAttribute( "GLXWINDOW", &windowHnd ); +#endif + + // Fill parameter list + windowHndStr << (unsigned int) windowHnd; + paramList.insert( std::make_pair( std::string( "WINDOW" ), windowHndStr.str() ) ); + + // Create inputsystem + mInputSystem = OIS::InputManager::createInputSystem( paramList ); + + // If possible create a buffered keyboard + if( mInputSystem->numKeyBoards() > 0 ) + { + mKeyboard = static_cast<OIS::Keyboard*>( mInputSystem->createInputObject( OIS::OISKeyboard, true ) ); + mKeyboard->setEventCallback( this ); + } + + // If possible create a buffered mouse + if( mInputSystem->numMice() > 0 ) + { + mMouse = static_cast<OIS::Mouse*>( mInputSystem->createInputObject( OIS::OISMouse, true ) ); + mMouse->setEventCallback( this ); + + // Get window size + unsigned int width, height, depth; + int left, top; + renderWindow->getMetrics( width, height, depth, left, top ); + + // Set mouse region + this->setWindowExtents( width, height ); + } + + // If possible create all joysticks in buffered mode + if( mInputSystem->numJoysticks() > 0 ) + { + mJoysticks.resize( mInputSystem->numJoysticks() ); + + itJoystick = mJoysticks.begin(); + itJoystickEnd = mJoysticks.end(); + for(; itJoystick != itJoystickEnd; ++itJoystick ) + { + (*itJoystick) = static_cast<OIS::JoyStick*>( mInputSystem->createInputObject( OIS::OISJoyStick, true ) ); + (*itJoystick)->setEventCallback( this ); + } + } + } +} + +void InputManager::capture( void ) +{ + // Need to capture / update each device every frame + if( mMouse ) + { + mMouse->capture(); + } + + if( mKeyboard ) + { + mKeyboard->capture(); + } + + if( mJoysticks.size() > 0 ) + { + itJoystick = mJoysticks.begin(); + itJoystickEnd = mJoysticks.end(); + for(; itJoystick != itJoystickEnd; ++itJoystick ) + { + (*itJoystick)->capture(); + } + } +} + +void InputManager::addKeyListener( OIS::KeyListener *keyListener, const std::string& instanceName ) +{ + if( mKeyboard ) + { + // Check for duplicate items + itKeyListener = mKeyListeners.find( instanceName ); + if( itKeyListener == mKeyListeners.end() ) + { + mKeyListeners[ instanceName ] = keyListener; + } + else + { + // Duplicate Item + } + } +} + +void InputManager::addMouseListener( OIS::MouseListener *mouseListener, const std::string& instanceName ) +{ + if( mMouse ) + { + // Check for duplicate items + itMouseListener = mMouseListeners.find( instanceName ); + if( itMouseListener == mMouseListeners.end() ) + { + mMouseListeners[ instanceName ] = mouseListener; + } + else + { + // Duplicate Item + } + } +} + +void InputManager::addJoystickListener( OIS::JoyStickListener *joystickListener, const std::string& instanceName ) +{ + if( mJoysticks.size() > 0 ) + { + // Check for duplicate items + itJoystickListener = mJoystickListeners.find( instanceName ); + if( itJoystickListener != mJoystickListeners.end() ) + { + mJoystickListeners[ instanceName ] = joystickListener; + } + else + { + // Duplicate Item + } + } +} + +void InputManager::removeKeyListener( const std::string& instanceName ) +{ + // Check if item exists + itKeyListener = mKeyListeners.find( instanceName ); + if( itKeyListener != mKeyListeners.end() ) + { + mKeyListeners.erase( itKeyListener ); + } + else + { + // Doesn't Exist + } +} + +void InputManager::removeMouseListener( const std::string& instanceName ) +{ + // Check if item exists + itMouseListener = mMouseListeners.find( instanceName ); + if( itMouseListener != mMouseListeners.end() ) + { + mMouseListeners.erase( itMouseListener ); + } + else + { + // Doesn't Exist + } +} + +void InputManager::removeJoystickListener( const std::string& instanceName ) +{ + // Check if item exists + itJoystickListener = mJoystickListeners.find( instanceName ); + if( itJoystickListener != mJoystickListeners.end() ) + { + mJoystickListeners.erase( itJoystickListener ); + } + else + { + // Doesn't Exist + } +} + +void InputManager::removeKeyListener( OIS::KeyListener *keyListener ) +{ + itKeyListener = mKeyListeners.begin(); + itKeyListenerEnd = mKeyListeners.end(); + for(; itKeyListener != itKeyListenerEnd; ++itKeyListener ) + { + if( itKeyListener->second == keyListener ) + { + mKeyListeners.erase( itKeyListener ); + break; + } + } +} + +void InputManager::removeMouseListener( OIS::MouseListener *mouseListener ) +{ + itMouseListener = mMouseListeners.begin(); + itMouseListenerEnd = mMouseListeners.end(); + for(; itMouseListener != itMouseListenerEnd; ++itMouseListener ) + { + if( itMouseListener->second == mouseListener ) + { + mMouseListeners.erase( itMouseListener ); + break; + } + } +} + +void InputManager::removeJoystickListener( OIS::JoyStickListener *joystickListener ) +{ + itJoystickListener = mJoystickListeners.begin(); + itJoystickListenerEnd = mJoystickListeners.end(); + for(; itJoystickListener != itJoystickListenerEnd; ++itJoystickListener ) + { + if( itJoystickListener->second == joystickListener ) + { + mJoystickListeners.erase( itJoystickListener ); + break; + } + } +} + +void InputManager::removeAllListeners( void ) +{ + mKeyListeners.clear(); + mMouseListeners.clear(); + mJoystickListeners.clear(); +} + +void InputManager::removeAllKeyListeners( void ) +{ + mKeyListeners.clear(); +} + +void InputManager::removeAllMouseListeners( void ) +{ + mMouseListeners.clear(); +} + +void InputManager::removeAllJoystickListeners( void ) +{ + mJoystickListeners.clear(); +} + +void InputManager::setWindowExtents( int width, int height ) +{ + // Set mouse region (if window resizes, we should alter this to reflect as well) + const OIS::MouseState &mouseState = mMouse->getMouseState(); + mouseState.width = width; + mouseState.height = height; +} + +OIS::Mouse* InputManager::getMouse( void ) +{ + return mMouse; +} + +OIS::Keyboard* InputManager::getKeyboard( void ) +{ + return mKeyboard; +} + +OIS::JoyStick* InputManager::getJoystick( unsigned int index ) +{ + // Make sure it's a valid index + if( index < mJoysticks.size() ) + { + return mJoysticks[ index ]; + } + + return 0; +} + +int InputManager::getNumOfJoysticks( void ) +{ + // Cast to keep compiler happy ^^ + return (int) mJoysticks.size(); +} + +bool InputManager::keyPressed( const OIS::KeyEvent &e ) +{ + itKeyListener = mKeyListeners.begin(); + itKeyListenerEnd = mKeyListeners.end(); + for(; itKeyListener != itKeyListenerEnd; ++itKeyListener ) + { + itKeyListener->second->keyPressed( e ); + } + + return true; +} + +bool InputManager::keyReleased( const OIS::KeyEvent &e ) +{ + itKeyListener = mKeyListeners.begin(); + itKeyListenerEnd = mKeyListeners.end(); + for(; itKeyListener != itKeyListenerEnd; ++itKeyListener ) + { + itKeyListener->second->keyReleased( e ); + } + + return true; +} + +bool InputManager::mouseMoved( const OIS::MouseEvent &e ) +{ + itMouseListener = mMouseListeners.begin(); + itMouseListenerEnd = mMouseListeners.end(); + for(; itMouseListener != itMouseListenerEnd; ++itMouseListener ) + { + itMouseListener->second->mouseMoved( e ); + } + + return true; +} + +bool InputManager::mousePressed( const OIS::MouseEvent &e, OIS::MouseButtonID id ) +{ + itMouseListener = mMouseListeners.begin(); + itMouseListenerEnd = mMouseListeners.end(); + for(; itMouseListener != itMouseListenerEnd; ++itMouseListener ) + { + itMouseListener->second->mousePressed( e, id ); + } + + return true; +} + +bool InputManager::mouseReleased( const OIS::MouseEvent &e, OIS::MouseButtonID id ) +{ + itMouseListener = mMouseListeners.begin(); + itMouseListenerEnd = mMouseListeners.end(); + for(; itMouseListener != itMouseListenerEnd; ++itMouseListener ) + { + itMouseListener->second->mouseReleased( e, id ); + } + + return true; +} + +bool InputManager::povMoved( const OIS::JoyStickEvent &e, int pov ) +{ + itJoystickListener = mJoystickListeners.begin(); + itJoystickListenerEnd = mJoystickListeners.end(); + for(; itJoystickListener != itJoystickListenerEnd; ++itJoystickListener ) + { + itJoystickListener->second->povMoved( e, pov ); + } + + return true; +} + +bool InputManager::axisMoved( const OIS::JoyStickEvent &e, int axis ) +{ + itJoystickListener = mJoystickListeners.begin(); + itJoystickListenerEnd = mJoystickListeners.end(); + for(; itJoystickListener != itJoystickListenerEnd; ++itJoystickListener ) + { + itJoystickListener->second->axisMoved( e, axis ); + } + + return true; +} + +bool InputManager::sliderMoved( const OIS::JoyStickEvent &e, int sliderID ) +{ + itJoystickListener = mJoystickListeners.begin(); + itJoystickListenerEnd = mJoystickListeners.end(); + for(; itJoystickListener != itJoystickListenerEnd; ++itJoystickListener ) + { + itJoystickListener->second->sliderMoved( e, sliderID ); + } + + return true; +} + +bool InputManager::buttonPressed( const OIS::JoyStickEvent &e, int button ) +{ + itJoystickListener = mJoystickListeners.begin(); + itJoystickListenerEnd = mJoystickListeners.end(); + for(; itJoystickListener != itJoystickListenerEnd; ++itJoystickListener ) + { + itJoystickListener->second->buttonPressed( e, button ); + } + + return true; +} + +bool InputManager::buttonReleased( const OIS::JoyStickEvent &e, int button ) +{ + itJoystickListener = mJoystickListeners.begin(); + itJoystickListenerEnd = mJoystickListeners.end(); + for(; itJoystickListener != itJoystickListenerEnd; ++itJoystickListener ) + { + itJoystickListener->second->buttonReleased( e, button ); + } + + return true; +} + +InputManager* InputManager::getSingletonPtr( void ) +{ + if( !mInputManager ) + { + mInputManager = new InputManager(); + } + + return mInputManager; +} Property changes on: trunk/current/src/client/InputManager.cpp ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/current/src/client/InputManager.h =================================================================== --- trunk/current/src/client/InputManager.h (rev 0) +++ trunk/current/src/client/InputManager.h 2006-12-12 16:18:49 UTC (rev 306) @@ -0,0 +1,110 @@ +/*************************************************************************** + * Copyright (C) 2006 by OpenGate development team * + * Qrstuvw ab...@sl... * + * * + * 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 INPUTMANAGER_H +#define INPUTMANAGER_H + +#include <OIS/OISMouse.h> +#include <OIS/OISKeyboard.h> +#include <OIS/OISJoyStick.h> +#include <OIS/OISInputManager.h> + +#include <OGRE/OgreRenderWindow.h> + +/** Basic Global Input */ +class InputManager : public OIS::KeyListener, OIS::MouseListener, OIS::JoyStickListener + { + public: + virtual ~InputManager( void ); + + void initialise( Ogre::RenderWindow *renderWindow ); + void capture( void ); + + void addKeyListener( OIS::KeyListener *keyListener, const std::string& instanceName ); + void addMouseListener( OIS::MouseListener *mouseListener, const std::string& instanceName ); + void addJoystickListener( OIS::JoyStickListener *joystickListener, const std::string& instanceName ); + + void removeKeyListener( const std::string& instanceName ); + void removeMouseListener( const std::string& instanceName ); + void removeJoystickListener( const std::string& instanceName ); + + void removeKeyListener( OIS::KeyListener *keyListener ); + void removeMouseListener( OIS::MouseListener *mouseListener ); + void removeJoystickListener( OIS::JoyStickListener *joystickListener ); + + void removeAllListeners( void ); + void removeAllKeyListeners( void ); + void removeAllMouseListeners( void ); + void removeAllJoystickListeners( void ); + + void setWindowExtents( int width, int height ); + + OIS::Mouse* getMouse( void ); + OIS::Keyboard* getKeyboard( void ); + OIS::JoyStick* getJoystick( unsigned int index ); + + int getNumOfJoysticks( void ); + + static InputManager* getSingletonPtr( void ); + + OIS::InputManager *mInputSystem; + OIS::Mouse *mMouse; + OIS::Keyboard *mKeyboard; + + std::vector<OIS::JoyStick*> mJoysticks; + std::vector<OIS::JoyStick*>::iterator itJoystick; + std::vector<OIS::JoyStick*>::iterator itJoystickEnd; + + private: + InputManager( void ); + InputManager( const InputManager& ) + { } + InputManager & operator = ( const InputManager& ); + + bool keyPressed( const OIS::KeyEvent &e ); + bool keyReleased( const OIS::KeyEvent &e ); + + bool mouseMoved( const OIS::MouseEvent &e ); + bool mousePressed( const OIS::MouseEvent &e, OIS::MouseButtonID id ); + bool mouseReleased( const OIS::MouseEvent &e, OIS::MouseButtonID id ); + + bool povMoved( const OIS::JoyStickEvent &e, int pov ); + bool axisMoved( const OIS::JoyStickEvent &e, int axis ); + bool sliderMoved( const OIS::JoyStickEvent &e, int sliderID ); + bool buttonPressed( const OIS::JoyStickEvent &e, int button ); + bool buttonReleased( const OIS::JoyStickEvent &e, int button ); + + std::map<std::string, OIS::KeyListener*> mKeyListeners; + std::map<std::string, OIS::MouseListener*> mMouseListeners; + std::map<std::string, OIS::JoyStickListener*> mJoystickListeners; + + std::map<std::string, OIS::KeyListener*>::iterator itKeyListener; + std::map<std::string, OIS::MouseListener*>::iterator itMouseListener; + std::map<std::string, OIS::JoyStickListener*>::iterator itJoystickListener; + + std::map<std::string, OIS::KeyListener*>::iterator itKeyListenerEnd; + std::map<std::string, OIS::MouseListener*>::iterator itMouseListenerEnd; + std::map<std::string, OIS::JoyStickListener*>::iterator itJoystickListenerEnd; + + static InputManager *mInputManager; + }; + +#endif Property changes on: trunk/current/src/client/InputManager.h ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/current/src/client/IntroState.cpp =================================================================== --- trunk/current/src/client/IntroState.cpp (rev 0) +++ trunk/current/src/client/IntroState.cpp 2006-12-12 16:18:49 UTC (rev 306) @@ -0,0 +1,31 @@ +/*************************************************************************** + * Copyright (C) 2006 by OpenGate development team * + * Qrstuvw ab...@sl... * + * * + * 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 "IntroState.h" + +//--------------------------------------------------------------------------------// +/** Game state enter code. */ +void IntroState::enter() +{} + +//--------------------------------------------------------------------------------// +/** Game state exit code. */ +void IntroState::exit() +{} Property changes on: trunk/current/src/client/IntroState.cpp ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/current/src/client/IntroState.h =================================================================== --- trunk/current/src/client/IntroState.h (rev 0) +++ trunk/current/src/client/IntroState.h 2006-12-12 16:18:49 UTC (rev 306) @@ -0,0 +1,59 @@ +/*************************************************************************** + * Copyright (C) 2006 by OpenGate development team * + * Qrstuvw ab...@sl... * + * * + * 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 INTROSTATE_H +#define INTROSTATE_H + +#include "GameState.h" + +class IntroState : public GameState + { + // Self-creation & registering function ---------------------------------------------------- + public: + /** Create and register the state so that it can be managed by the GameStateManager. */ + static void Create(GameStateListener *parent,const Ogre::String name) + { + IntroState *myGameState = new IntroState(); + myGameState->parent = parent; + parent->ManageGameState(name,myGameState); + } + + // Attributes ------------------------------------------------------------------------------ + + // Methods --------------------------------------------------------------------------------- + public: + /** Default constructor. */ + IntroState() + {} + + /** Default destructor. */ + ~IntroState() + {} + + /** Game state enter code. */ + void enter(); + + /** Game state exit code. */ + void exit(); + + }; + +#endif Property changes on: trunk/current/src/client/IntroState.h ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/current/src/client/LoginListener.h =================================================================== Property changes on: trunk/current/src/client/LoginListener.h ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/current/src/client/LoginState.cpp =================================================================== --- trunk/current/src/client/LoginState.cpp (rev 0) +++ trunk/current/src/client/LoginState.cpp 2006-12-12 16:18:49 UTC (rev 306) @@ -0,0 +1,19 @@ +/*************************************************************************** + * Copyright (C) 2006 by OpenGate development team * + * Qrstuvw ab...@sl... * + * * + * 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. * + ***************************************************************************/ Property changes on: trunk/current/src/client/LoginState.cpp ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/current/src/client/LoginState.h =================================================================== --- trunk/current/src/client/LoginState.h (rev 0) +++ trunk/current/src/client/LoginState.h 2006-12-12 16:18:49 UTC (rev 306) @@ -0,0 +1,59 @@ +/*************************************************************************** + * Copyright (C) 2006 by OpenGate development team * + * Qrstuvw ab...@sl... * + * * + * 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 LOGINSTATE_H +#define LOGINSTATE_H + +#include "GameState.h" +#include "LoginListener.h" + +class IntroState : public GameState + { + // Self-creation & registering function ---------------------------------------------------- + public: + /** Create and register the state so that it can be managed by the GameStateManager. */ + static void Create(GameStateListener *parent,const Ogre::String name) + { + IntroState *myGameState = new IntroState(); + myGameState->parent = parent; + parent->ManageGameState(name,myGameState); + } + + // Attributes ------------------------------------------------------------------------------ + + // Methods --------------------------------------------------------------------------------- + public: + /** Default constructor. */ + IntroState() + {} + + /** Default destructor. */ + ~IntroState() + {} + + /** Game state enter code. */ + void enter(); + + /** Game state exit code. */ + void exit(); + + }; + +#endif \ No newline at end of file Property changes on: trunk/current/src/client/LoginState.h ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Modified: trunk/current/src/client/Makefile.am =================================================================== --- trunk/current/src/client/Makefile.am 2006-12-12 15:41:21 UTC (rev 305) +++ trunk/current/src/client/Makefile.am 2006-12-12 16:18:49 UTC (rev 306) @@ -3,7 +3,7 @@ METASOURCES = AUTO noinst_HEADERS = GameStateManager.h GameState.h Global.h OpenGateApp.h \ - GraphicsSetup.h IntroState.h LoginListener.h LoginState.h + GraphicsSetup.h IntroState.h LoginListener.h LoginState.h InputManager.h lib_LTLIBRARIES = libOpenGateClient.la libOpenGateClient_la_SOURCES = GameStateManager.cpp GraphicsSetup.cpp \ - OpenGateApp.cpp IntroState.cpp LoginState.cpp + OpenGateApp.cpp IntroState.cpp LoginState.cpp InputManager.cpp Modified: trunk/current/src/client/OpenGateApp.cpp =================================================================== --- trunk/current/src/client/OpenGateApp.cpp 2006-12-12 15:41:21 UTC (rev 305) +++ trunk/current/src/client/OpenGateApp.cpp 2006-12-12 16:18:49 UTC (rev 306) @@ -28,7 +28,16 @@ //--------------------------------------------------------------------------------// /** Default constructor. */ OpenGateApp::OpenGateApp() -{} +{ + mFramework.ogreRoot = 0; + mFramework.sceneMgr = 0; + mFramework.camera = 0; + mFramework.viewport = 0; + mFramework.renderWindow = 0; + mFramework.GUIRenderer = 0; + mFramework.GUISystem = 0; + mFramework.inputMgr = 0; +} //--------------------------------------------------------------------------------// /** Default destructor. */ @@ -43,6 +52,10 @@ if (!initGraphics(&mFramework)) return; + // Start the input manager + mFramework.inputMgr = InputManager::getSingletonPtr(); + mFramework.inputMgr->initialise(mFramework.renderWindow); + /** Create the GameStateManager and register the game states. */ // Create the gamestate manager GameStateManager GameStateMgr(&mFramework); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <qr...@us...> - 2006-12-13 16:08:31
|
Revision: 307 http://svn.sourceforge.net/opengate/?rev=307&view=rev Author: qrstuvw Date: 2006-12-13 08:01:34 -0800 (Wed, 13 Dec 2006) Log Message: ----------- Makefile.am changed Modified Paths: -------------- trunk/current/src/Makefile.am trunk/current/src/client/Makefile.am Modified: trunk/current/src/Makefile.am =================================================================== --- trunk/current/src/Makefile.am 2006-12-12 16:18:49 UTC (rev 306) +++ trunk/current/src/Makefile.am 2006-12-13 16:01:34 UTC (rev 307) @@ -10,5 +10,4 @@ bin_PROGRAMS = opengate-client opengate_client_SOURCES = Client.cpp opengate_client_LDADD = $(top_builddir)/src/deps/tinyxml/libTinyXML.la \ - $(top_builddir)/src/client/libOpenGateClient.la $(top_builddir)/src/client/state/libStates.la -L/usr/local/lib -lOIS \ - -lOgreMain -lCEGUIOgreRenderer -lCEGUIBase + $(top_builddir)/src/client/libOpenGateClient.la -L/usr/local/lib -lOIS -lOgreMain -lCEGUIOgreRenderer -lCEGUIBase Modified: trunk/current/src/client/Makefile.am =================================================================== --- trunk/current/src/client/Makefile.am 2006-12-12 16:18:49 UTC (rev 306) +++ trunk/current/src/client/Makefile.am 2006-12-13 16:01:34 UTC (rev 307) @@ -7,3 +7,4 @@ lib_LTLIBRARIES = libOpenGateClient.la libOpenGateClient_la_SOURCES = GameStateManager.cpp GraphicsSetup.cpp \ OpenGateApp.cpp IntroState.cpp LoginState.cpp InputManager.cpp + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |