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. |