|
From: <sik...@us...> - 2006-05-18 06:48:35
|
Revision: 25 Author: sik0fewl Date: 2006-05-17 23:48:18 -0700 (Wed, 17 May 2006) ViewCVS: http://svn.sourceforge.net/perceptioncrash/?rev=25&view=rev Log Message: ----------- Started integrating states Still very minimal, but it's late :) Modified Paths: -------------- trunk/perceptioncrash/src/Game.cpp trunk/perceptioncrash/src/GameManager.cpp trunk/perceptioncrash/src/GameManager.hpp trunk/perceptioncrash/src/GameState.hpp trunk/perceptioncrash/src/InputManager.cpp trunk/perceptioncrash/src/InputManager.hpp trunk/perceptioncrash/src/main.cpp Added Paths: ----------- trunk/perceptioncrash/data/images/ trunk/perceptioncrash/data/images/logo.png trunk/perceptioncrash/data/packs/ trunk/perceptioncrash/data/packs/OgreCore.zip trunk/perceptioncrash/src/IntroState.cpp trunk/perceptioncrash/src/IntroState.hpp Property Changed: ---------------- trunk/perceptioncrash/ trunk/perceptioncrash/doc/ Property changes on: trunk/perceptioncrash ___________________________________________________________________ Name: svn:ignore - .sconsign ogre.log build perceptioncrash configure config.log config.status config.h config.h.in Jamconfig Jamconfig.in autom4te.cache aclocal.m4 + .sconsign ogre.log Ogre.log ogre.cfg build perceptioncrash configure config.log config.status config.h config.h.in Jamconfig Jamconfig.in autom4te.cache aclocal.m4 Added: trunk/perceptioncrash/data/images/logo.png =================================================================== (Binary files differ) Property changes on: trunk/perceptioncrash/data/images/logo.png ___________________________________________________________________ Name: svn:mime-type + image/png Added: trunk/perceptioncrash/data/packs/OgreCore.zip =================================================================== (Binary files differ) Property changes on: trunk/perceptioncrash/data/packs/OgreCore.zip ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Property changes on: trunk/perceptioncrash/doc ___________________________________________________________________ Name: svn:ignore + doxygen Modified: trunk/perceptioncrash/src/Game.cpp =================================================================== --- trunk/perceptioncrash/src/Game.cpp 2006-05-18 03:13:59 UTC (rev 24) +++ trunk/perceptioncrash/src/Game.cpp 2006-05-18 06:48:18 UTC (rev 25) @@ -20,6 +20,7 @@ // This is all temporary stuff Ogre::ResourceGroupManager rgm = Ogre::ResourceGroupManager::getSingleton(); rgm.addResourceLocation("data/objects", "FileSystem", "General"); + rgm.addResourceLocation("data/images", "FileSystem", "General"); rgm.addResourceLocation("data/maps/ogretestmap.zip", "Zip", rgm.getWorldResourceGroupName()); Modified: trunk/perceptioncrash/src/GameManager.cpp =================================================================== --- trunk/perceptioncrash/src/GameManager.cpp 2006-05-18 03:13:59 UTC (rev 24) +++ trunk/perceptioncrash/src/GameManager.cpp 2006-05-18 06:48:18 UTC (rev 25) @@ -1,4 +1,4 @@ -#include <OGRE/Ogre.h> +#include <Ogre.h> #include "GameManager.hpp" #include "InputManager.hpp" @@ -99,6 +99,23 @@ void GameManager::setupResources(void) { + // This is all temporary stuff + Ogre::ResourceGroupManager* rgm = Ogre::ResourceGroupManager::getSingletonPtr(); + rgm->addResourceLocation("data/objects", "FileSystem", "General"); + rgm->addResourceLocation("data/images", "FileSystem", "General"); + rgm->addResourceLocation("data/packs/OgreCore.zip", "Zip", "General"); + + //rgm->addResourceLocation("data/maps/ogretestmap.zip", "Zip", + // rgm->getWorldResourceGroupName()); + + //rgm->linkWorldGeometryToResourceGroup(rgm->getWorldResourceGroupName(), + // "ogretestmap.bsp", + // mSceneMgr); + + //rgm->initialiseAllResourceGroups(); + //rgm->loadResourceGroup(rgm->getWorldResourceGroupName(), false, true); + +#if 0 // load resource paths from config file ConfigFile cf; @@ -123,6 +140,7 @@ secName); } } +#endif } bool GameManager::configure(void) Modified: trunk/perceptioncrash/src/GameManager.hpp =================================================================== --- trunk/perceptioncrash/src/GameManager.hpp 2006-05-18 03:13:59 UTC (rev 24) +++ trunk/perceptioncrash/src/GameManager.hpp 2006-05-18 06:48:18 UTC (rev 25) @@ -2,9 +2,9 @@ #define PC_GAME_MANAGER_HPP #include <vector> -#include <OGRE/Ogre.h> -#include <OGRE/OgreEventListeners.h> -#include <OGRE/OgreSingleton.h> +#include <Ogre.h> +#include <OgreEventListeners.h> +#include <OgreSingleton.h> #include "InputManager.hpp" Modified: trunk/perceptioncrash/src/GameState.hpp =================================================================== --- trunk/perceptioncrash/src/GameState.hpp 2006-05-18 03:13:59 UTC (rev 24) +++ trunk/perceptioncrash/src/GameState.hpp 2006-05-18 06:48:18 UTC (rev 25) @@ -1,14 +1,14 @@ #ifndef PC_GAME_STATE_HPP #define PC_GAME_STATE_HPP -#include <OGRE/Ogre.h> +#include <Ogre.h> #include "GameManager.hpp" class GameState { public: - virtual ~GameState(); + virtual ~GameState() { }; virtual void enter() = 0; virtual void exit() = 0; Modified: trunk/perceptioncrash/src/InputManager.cpp =================================================================== --- trunk/perceptioncrash/src/InputManager.cpp 2006-05-18 03:13:59 UTC (rev 24) +++ trunk/perceptioncrash/src/InputManager.cpp 2006-05-18 06:48:18 UTC (rev 25) @@ -1,4 +1,4 @@ -#include <OGRE/OgreEventProcessor.h> +#include <OgreEventProcessor.h> #include "InputManager.hpp" Modified: trunk/perceptioncrash/src/InputManager.hpp =================================================================== --- trunk/perceptioncrash/src/InputManager.hpp 2006-05-18 03:13:59 UTC (rev 24) +++ trunk/perceptioncrash/src/InputManager.hpp 2006-05-18 06:48:18 UTC (rev 25) @@ -1,8 +1,8 @@ #ifndef PC_INPUT_MANAGER_HPP #define PC_INPUT_MANAGER_HPP -#include <OGRE/OgreSingleton.h> -#include <OGRE/OgreInput.h> +#include <OgreSingleton.h> +#include <OgreInput.h> class InputManager : public Ogre::Singleton<InputManager> { Added: trunk/perceptioncrash/src/IntroState.cpp =================================================================== --- trunk/perceptioncrash/src/IntroState.cpp (rev 0) +++ trunk/perceptioncrash/src/IntroState.cpp 2006-05-18 06:48:18 UTC (rev 25) @@ -0,0 +1,84 @@ +#include <Ogre.h> +#include <OgreKeyEvent.h> + +#include "IntroState.hpp" +//#include "PlayState.hpp" + +using namespace Ogre; + +IntroState IntroState::mIntroState; + +void +IntroState::enter() +{ + mInputDevice = InputManager::getSingletonPtr()->getInputDevice(); + mRoot = Root::getSingletonPtr(); + + mSceneMgr = mRoot->createSceneManager(ST_GENERIC); + mCamera = mSceneMgr->createCamera("IntroCamera"); + mViewport = mRoot->getAutoCreatedWindow()->addViewport(mCamera); + mViewport->setBackgroundColour(ColourValue(1.0, 0.0, 0.0)); + + mLogoOverlay = OverlayManager::getSingleton().getByName("Core/DebugOverlay"); + if (mLogoOverlay) + mLogoOverlay->show(); + + mExitGame = false; +} + +void +IntroState::exit() +{ + mSceneMgr->clearScene(); + mSceneMgr->destroyAllCameras(); + mRoot->getAutoCreatedWindow()->removeAllViewports(); +} + +void +IntroState::pause() +{ +} + +void +IntroState::resume() +{ +} + +void +IntroState::keyClicked(KeyEvent* e) +{ +} + +void +IntroState::keyPressed(KeyEvent* e) +{ + if (e->getKey() == KC_SPACE) + { + //changeState(PlayState::getInstance()); + } + + if (e->getKey() == KC_ESCAPE) + { + mExitGame = true; + } +} + +void +IntroState::keyReleased(KeyEvent* e) +{ +} + +bool +IntroState::frameStarted(const FrameEvent& evt) +{ + return true; +} + +bool +IntroState::frameEnded(const FrameEvent& evt) +{ + if (mExitGame) + return false; + + return true; +} Property changes on: trunk/perceptioncrash/src/IntroState.cpp ___________________________________________________________________ Name: svn:keywrords + Id Name: svn:eol-style + native Added: trunk/perceptioncrash/src/IntroState.hpp =================================================================== --- trunk/perceptioncrash/src/IntroState.hpp (rev 0) +++ trunk/perceptioncrash/src/IntroState.hpp 2006-05-18 06:48:18 UTC (rev 25) @@ -0,0 +1,45 @@ +#ifndef PC_INTRO_STATE_HPP +#define PC_INTRO_STATE_HPP + +#include <Ogre.h> + +#include "GameState.hpp" + +class IntroState : public GameState +{ +public: + void enter(); + void exit(); + + void pause(); + void resume(); + + void keyClicked(Ogre::KeyEvent* e); + void keyPressed(Ogre::KeyEvent* e); + void keyReleased(Ogre::KeyEvent* e); + bool frameStarted(const Ogre::FrameEvent& evt); + bool frameEnded(const Ogre::FrameEvent& evt); + + static IntroState* getInstance() + { return &mIntroState; } + +protected: + IntroState() { } + + Ogre::Root *mRoot; + Ogre::SceneManager* mSceneMgr; + Ogre::Viewport* mViewport; + Ogre::InputReader* mInputDevice; + Ogre::Camera* mCamera; + + // This is temporary and should probably be replaced with some CEGUI stuff + // It currently just shows the Core/DebugOverlay overlay + Ogre::Overlay* mLogoOverlay; + + bool mExitGame; + +private: + static IntroState mIntroState; +}; + +#endif /*PC_INTRO_STATE*/ Modified: trunk/perceptioncrash/src/main.cpp =================================================================== --- trunk/perceptioncrash/src/main.cpp 2006-05-18 03:13:59 UTC (rev 24) +++ trunk/perceptioncrash/src/main.cpp 2006-05-18 06:48:18 UTC (rev 25) @@ -5,6 +5,9 @@ #include "Game.hpp" +#include "GameManager.hpp" +#include "IntroState.hpp" + #if OGRE_PLATFORM==OGRE_PLATFORM_WIN32 #define WIN32_LEAN_AND_MEAN #include "windows.h" @@ -15,11 +18,12 @@ main(int argc, char **argv) #endif { - Game game; + //Game game; + std::auto_ptr<GameManager> gameManager(new GameManager()); try { - game.run(); + gameManager->start(IntroState::getInstance()); } catch(Ogre::Exception& e) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |