You can subscribe to this list here.
| 2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(70) |
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
|
From: <xs...@us...> - 2006-05-18 19:04:43
|
Revision: 29 Author: xsdwx Date: 2006-05-18 12:04:28 -0700 (Thu, 18 May 2006) ViewCVS: http://svn.sourceforge.net/perceptioncrash/?rev=29&view=rev Log Message: ----------- Removed Paths: ------------- trunk/perceptioncrash/src/Singleton.hpp Deleted: trunk/perceptioncrash/src/Singleton.hpp =================================================================== --- trunk/perceptioncrash/src/Singleton.hpp 2006-05-18 19:02:34 UTC (rev 28) +++ trunk/perceptioncrash/src/Singleton.hpp 2006-05-18 19:04:28 UTC (rev 29) @@ -1,23 +0,0 @@ -#ifndef SINGLETON_HPP -#define SINGLETON_HPP - -template<class T> -class Singleton -{ - public: - static T& getSingleton() - { - static T instance; - - return instance; - } - - private: - Singleton(); - ~Singleton(); - - Singleton(Singleton const &); - Singleton& operator=(Singleton const &); -}; - -#endif // SINGLETON_HPP This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <xs...@us...> - 2006-05-18 19:02:39
|
Revision: 28 Author: xsdwx Date: 2006-05-18 12:02:34 -0700 (Thu, 18 May 2006) ViewCVS: http://svn.sourceforge.net/perceptioncrash/?rev=28&view=rev Log Message: ----------- Removed Paths: ------------- trunk/perceptioncrash/src/Graphics.cpp trunk/perceptioncrash/src/Graphics.hpp Deleted: trunk/perceptioncrash/src/Graphics.cpp =================================================================== --- trunk/perceptioncrash/src/Graphics.cpp 2006-05-18 18:59:36 UTC (rev 27) +++ trunk/perceptioncrash/src/Graphics.cpp 2006-05-18 19:02:34 UTC (rev 28) @@ -1,37 +0,0 @@ -#include "Graphics.hpp" - -graphics::graphics() - : mRoot(new Ogre::Root("plugins.cfg", "ogre.cfg", "ogre.log")), - mSmgr(mRoot->createSceneManager("BspSceneManager")) -{ - // HACK This is setting either OpenGL or first thing it comes to - Ogre::RenderSystemList* renderers = mRoot->getAvailableRenderers(); - Ogre::RenderSystem* r = *renderers->begin(); // default - - for (Ogre::RenderSystemList::iterator i = renderers->begin(); - i != renderers->end(); ++i) - { - if (Ogre::StringUtil::match((*i)->getName(), "*opengl*", false)) - r = *i; - } - - r->setConfigOption("FSAA", "0"); - r->setConfigOption("Full Screen", "no"); - r->setConfigOption("RTT Preferred Mode", "FBO"); - r->setConfigOption("Video Mode", "800 x 600"); - - mRoot->setRenderSystem(r); - mWindow = mRoot->initialise(true, "Application"); - - // Should probably change this stuff - mCamera = mSmgr->createCamera("camera"); - mCamera->setPosition(Ogre::Vector3(0.0f, 0.0f, 500.0f)); - mCamera->lookAt(Ogre::Vector3(0.0f, 0.0f, 0.0f)); - mCamera->setNearClipDistance(5.0f); - mCamera->setFarClipDistance(5000.0f); - - mViewport = mWindow->addViewport(mCamera); - mViewport->setBackgroundColour(Ogre::ColourValue(0.3f, 0.3f, 0.3f)); - - mCamera->setAspectRatio(Ogre::Real(mViewport->getActualWidth()) / Ogre::Real(mViewport->getActualHeight())); -} Deleted: trunk/perceptioncrash/src/Graphics.hpp =================================================================== --- trunk/perceptioncrash/src/Graphics.hpp 2006-05-18 18:59:36 UTC (rev 27) +++ trunk/perceptioncrash/src/Graphics.hpp 2006-05-18 19:02:34 UTC (rev 28) @@ -1,42 +0,0 @@ -#ifndef PC_GRAPHICS_HPP -#define PC_GRAPHICS_HPP - -#include <memory> - -#include <Ogre.h> -#include <OgreEventListeners.h> -#include <OgreKeyEvent.h> - -#include "Singleton.hpp" - -class graphics -{ - public: - graphics(); - - void update() - { mRoot->_updateAllRenderTargets(); } - - Ogre::Root* getRootPtr() const - { return mRoot.get(); } - Ogre::RenderWindow* getWindowPtr() const - { return mWindow; } - Ogre::SceneManager* getSceneManagerPtr() const - { return mSmgr; } - Ogre::Camera* getCameraPtr() const - { return mCamera; } - Ogre::Viewport* getViewportPtr() const - { return mViewport; } - - private: - std::auto_ptr<Ogre::Root> mRoot; - - Ogre::RenderWindow* mWindow; - Ogre::SceneManager* mSmgr; - Ogre::Camera* mCamera; - Ogre::Viewport* mViewport; -}; - -typedef Singleton<graphics> Graphics; - -#endif /* PC_GRAPHICS_HPP*/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <xs...@us...> - 2006-05-18 18:59:40
|
Revision: 27 Author: xsdwx Date: 2006-05-18 11:59:36 -0700 (Thu, 18 May 2006) ViewCVS: http://svn.sourceforge.net/perceptioncrash/?rev=27&view=rev Log Message: ----------- Removed Paths: ------------- trunk/perceptioncrash/src/Game.cpp trunk/perceptioncrash/src/Game.hpp trunk/perceptioncrash/src/Input.cpp trunk/perceptioncrash/src/Input.hpp Deleted: trunk/perceptioncrash/src/Game.cpp =================================================================== --- trunk/perceptioncrash/src/Game.cpp 2006-05-18 06:56:47 UTC (rev 26) +++ trunk/perceptioncrash/src/Game.cpp 2006-05-18 18:59:36 UTC (rev 27) @@ -1,87 +0,0 @@ -#include <cmath> - -#include <boost/bind.hpp> - -#include "Game.hpp" - -Game::Game() - : mKeyQuit(Input::getSingleton().createKey("quit", Ogre::KC_ESCAPE)), - mKeyUp(Input::getSingleton().createKey("up", Ogre::KC_W)), - mKeyRight(Input::getSingleton().createKey("right", Ogre::KC_D)), - mKeyDown(Input::getSingleton().createKey("down", Ogre::KC_S)), - mKeyLeft(Input::getSingleton().createKey("left", Ogre::KC_A)) -{ - Input::getSingleton().registerMouseListener(boost::bind(&Game::mouseMotionListener, this, _1,_2)); -} - -void -Game::run() -{ - // 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()); - - rgm.linkWorldGeometryToResourceGroup(rgm.getWorldResourceGroupName(), - "ogretestmap.bsp", - Graphics::getSingleton().getSceneManagerPtr()); - - rgm.initialiseAllResourceGroups(); - rgm.loadResourceGroup(rgm.getWorldResourceGroupName(), false, true); - - Ogre::ViewPoint vp = Graphics::getSingleton().getSceneManagerPtr()->getSuggestedViewpoint(true); - Graphics::getSingleton().getCameraPtr()->setPosition(vp.position); - Graphics::getSingleton().getCameraPtr()->pitch(Ogre::Degree(90)); - Graphics::getSingleton().getCameraPtr()->rotate(vp.orientation); - Graphics::getSingleton().getCameraPtr()->setFixedYawAxis(true, Ogre::Vector3::UNIT_Z); - - Graphics::getSingleton().getSceneManagerPtr()->setAmbientLight(Ogre::ColourValue(1, 1, 1)); - - Ogre::Entity* myEntity = Graphics::getSingleton().getSceneManagerPtr()->createEntity("Robot1", "robot.mesh"); - Ogre::SceneNode* myNode = Graphics::getSingleton().getSceneManagerPtr()->getRootSceneNode()->createChildSceneNode("Robot1Node"); - myNode->attachObject(myEntity); - - // This is how the real game loop should go - while (!mKeyQuit->isDown()) - { - if (!Graphics::getSingleton().getRootPtr()->_fireFrameStarted()) - break; - - think(); - - Graphics::getSingleton().update(); - - if (!Graphics::getSingleton().getRootPtr()->_fireFrameEnded()) - break; - } -} - -void -Game::think() -{ - if (mKeyUp->isDown()) - { - Graphics::getSingleton().getCameraPtr()->moveRelative(Ogre::Vector3(0, 0, -2)); - } - if (mKeyRight->isDown()) - { - Graphics::getSingleton().getCameraPtr()->moveRelative(Ogre::Vector3(2, 0, 0)); - } - if (mKeyDown->isDown()) - { - Graphics::getSingleton().getCameraPtr()->moveRelative(Ogre::Vector3(0, 0, 2)); - } - if (mKeyLeft->isDown()) - { - Graphics::getSingleton().getCameraPtr()->moveRelative(Ogre::Vector3(-2, 0, 0)); - } -} - -void -Game::mouseMotionListener(Ogre::Real x, Ogre::Real y) -{ - Graphics::getSingleton().getCameraPtr()->yaw(Ogre::Radian(-x * 1.f)); - Graphics::getSingleton().getCameraPtr()->pitch(Ogre::Radian(-y * 1.f)); -} Deleted: trunk/perceptioncrash/src/Game.hpp =================================================================== --- trunk/perceptioncrash/src/Game.hpp 2006-05-18 06:56:47 UTC (rev 26) +++ trunk/perceptioncrash/src/Game.hpp 2006-05-18 18:59:36 UTC (rev 27) @@ -1,31 +0,0 @@ -#ifndef PC_GAME_HPP -#define PC_GAME_HPP - -#include <memory> - -#include <Ogre.h> -#include <OgreEventListeners.h> -#include <OgreKeyEvent.h> - -#include "Graphics.hpp" -#include "Input.hpp" - - -class Game -{ - public: - Game(); - - void run(); - void think(); - void mouseMotionListener(Ogre::Real, Ogre::Real); - - private: - InputKey* mKeyQuit; - InputKey* mKeyUp; - InputKey* mKeyRight; - InputKey* mKeyDown; - InputKey* mKeyLeft; -}; - -#endif /*PC_GAME_HPP*/ Deleted: trunk/perceptioncrash/src/Input.cpp =================================================================== --- trunk/perceptioncrash/src/Input.cpp 2006-05-18 06:56:47 UTC (rev 26) +++ trunk/perceptioncrash/src/Input.cpp 2006-05-18 18:59:36 UTC (rev 27) @@ -1,83 +0,0 @@ -#include "Input.hpp" -#include "Graphics.hpp" - -input::input() - : mEventProcessor(new Ogre::EventProcessor) -{ - mEventProcessor->addKeyListener(this); - mEventProcessor->addMouseMotionListener(this); - mEventProcessor->initialise(Graphics::getSingleton().getWindowPtr()); - mEventProcessor->startProcessingEvents(); -} - -InputKey* -input::createKey(std::string str, int keycode) -{ - if (mKeys.find(str) == mKeys.end()) - return mKeys[str] = new InputKey(keycode); - - return 0; -} - -InputKey* -input::findKey(std::string str) -{ - if (mKeys.find(str) != mKeys.end()) - return mKeys[str]; - - return 0; -} - -void -input::keyClicked(Ogre::KeyEvent* e) -{ - // TODO make some clicked code, probably not needed -} - -void -input::keyPressed(Ogre::KeyEvent* e) -{ - std::map<std::string, InputKey*>::iterator i; - for (i = mKeys.begin(); i != mKeys.end(); ++i) - { - if (e->getKey() == i->second->getKey()) - { - i->second->setDown(); - } - } -} - -void -input::keyReleased(Ogre::KeyEvent* e) -{ - std::map<std::string, InputKey*>::iterator i; - for (i = mKeys.begin(); i != mKeys.end(); ++i) - { - if (e->getKey() == i->second->getKey()) - { - i->second->setDown(false); - } - } -} - -void -input::mouseMoved(Ogre::MouseEvent* e) -{ - std::list<boost::function<void(Ogre::Real, Ogre::Real)> >::iterator i; - for (i = mMouseListeners.begin(); i != mMouseListeners.end(); ++i) - { - (*i) (e->getRelX(), e->getRelY()); - } -} - -void -input::mouseDragged(Ogre::MouseEvent* e) -{ - -} - -void -input::mouseDragMoved(Ogre::MouseEvent* e) -{ - -} Deleted: trunk/perceptioncrash/src/Input.hpp =================================================================== --- trunk/perceptioncrash/src/Input.hpp 2006-05-18 06:56:47 UTC (rev 26) +++ trunk/perceptioncrash/src/Input.hpp 2006-05-18 18:59:36 UTC (rev 27) @@ -1,63 +0,0 @@ -#ifndef PC_INPUT_HPP -#define PC_INPUT_HPP - -#include <map> -#include <list> - -#include <boost/function.hpp> - -#include <Ogre.h> -#include <OgreEventListeners.h> -#include <OgreKeyEvent.h> - -#include "Singleton.hpp" - -class InputKey -{ - public: - InputKey(int key): mKeycode(key), mDown(false) { } - - int getKey() const - { return mKeycode; } - bool isDown() const - { return mDown; } - - void setDown(bool yes = true) - { mDown = yes; } - - private: - int mKeycode; - bool mDown; -}; - -class input : public Ogre::KeyListener, - public Ogre::MouseMotionListener -{ - public: - input(); - - InputKey* createKey(std::string, int); - InputKey* findKey(std::string); - - void keyClicked(Ogre::KeyEvent*); - void keyPressed(Ogre::KeyEvent*); - void keyReleased(Ogre::KeyEvent*); - - void mouseMoved(Ogre::MouseEvent*); - void mouseDragged(Ogre::MouseEvent*); - void mouseDragMoved(Ogre::MouseEvent*); - - void registerMouseListener(boost::function<void(Ogre::Real, Ogre::Real)> m) - { mMouseListeners.push_back(m); } - - private: - std::map<std::string,InputKey*> mKeys; - std::list<boost::function<void(Ogre::Real, Ogre::Real)> > mMouseListeners; - - std::auto_ptr<Ogre::EventProcessor> mEventProcessor; -}; - -typedef - Singleton<input> Input; - -#endif /*PC_INPUT_HPP*/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <sik...@us...> - 2006-05-18 06:56:52
|
Revision: 26 Author: sik0fewl Date: 2006-05-17 23:56:47 -0700 (Wed, 17 May 2006) ViewCVS: http://svn.sourceforge.net/perceptioncrash/?rev=26&view=rev Log Message: ----------- Replace tabs with spaces Modified Paths: -------------- trunk/perceptioncrash/src/IntroState.hpp Modified: trunk/perceptioncrash/src/IntroState.hpp =================================================================== --- trunk/perceptioncrash/src/IntroState.hpp 2006-05-18 06:48:18 UTC (rev 25) +++ trunk/perceptioncrash/src/IntroState.hpp 2006-05-18 06:56:47 UTC (rev 26) @@ -8,38 +8,38 @@ class IntroState : public GameState { public: - void enter(); - void exit(); + void enter(); + void exit(); - void pause(); - void resume(); + 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); + 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() + static IntroState* getInstance() { return &mIntroState; } protected: - IntroState() { } + IntroState() { } - Ogre::Root *mRoot; - Ogre::SceneManager* mSceneMgr; - Ogre::Viewport* mViewport; - Ogre::InputReader* mInputDevice; - Ogre::Camera* mCamera; + 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; + // 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; + bool mExitGame; private: - static IntroState mIntroState; + static IntroState mIntroState; }; #endif /*PC_INTRO_STATE*/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
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. |
|
From: <sik...@us...> - 2006-05-18 03:14:16
|
Revision: 24 Author: sik0fewl Date: 2006-05-17 20:13:59 -0700 (Wed, 17 May 2006) ViewCVS: http://svn.sourceforge.net/perceptioncrash/?rev=24&view=rev Log Message: ----------- More housekeeping Modified Paths: -------------- trunk/perceptioncrash/src/main.cpp Added Paths: ----------- trunk/perceptioncrash/src/Game.cpp trunk/perceptioncrash/src/Game.hpp trunk/perceptioncrash/src/Graphics.cpp trunk/perceptioncrash/src/Graphics.hpp trunk/perceptioncrash/src/Input.cpp trunk/perceptioncrash/src/Input.hpp trunk/perceptioncrash/src/Singleton.hpp Removed Paths: ------------- trunk/perceptioncrash/src/game.cpp trunk/perceptioncrash/src/game.hpp trunk/perceptioncrash/src/graphics.cpp trunk/perceptioncrash/src/graphics.hpp trunk/perceptioncrash/src/input.cpp trunk/perceptioncrash/src/input.hpp trunk/perceptioncrash/src/singleton.hpp Copied: trunk/perceptioncrash/src/Game.cpp (from rev 23, trunk/perceptioncrash/src/game.cpp) =================================================================== --- trunk/perceptioncrash/src/Game.cpp (rev 0) +++ trunk/perceptioncrash/src/Game.cpp 2006-05-18 03:13:59 UTC (rev 24) @@ -0,0 +1,86 @@ +#include <cmath> + +#include <boost/bind.hpp> + +#include "Game.hpp" + +Game::Game() + : mKeyQuit(Input::getSingleton().createKey("quit", Ogre::KC_ESCAPE)), + mKeyUp(Input::getSingleton().createKey("up", Ogre::KC_W)), + mKeyRight(Input::getSingleton().createKey("right", Ogre::KC_D)), + mKeyDown(Input::getSingleton().createKey("down", Ogre::KC_S)), + mKeyLeft(Input::getSingleton().createKey("left", Ogre::KC_A)) +{ + Input::getSingleton().registerMouseListener(boost::bind(&Game::mouseMotionListener, this, _1,_2)); +} + +void +Game::run() +{ + // This is all temporary stuff + Ogre::ResourceGroupManager rgm = Ogre::ResourceGroupManager::getSingleton(); + rgm.addResourceLocation("data/objects", "FileSystem", "General"); + rgm.addResourceLocation("data/maps/ogretestmap.zip", "Zip", + rgm.getWorldResourceGroupName()); + + rgm.linkWorldGeometryToResourceGroup(rgm.getWorldResourceGroupName(), + "ogretestmap.bsp", + Graphics::getSingleton().getSceneManagerPtr()); + + rgm.initialiseAllResourceGroups(); + rgm.loadResourceGroup(rgm.getWorldResourceGroupName(), false, true); + + Ogre::ViewPoint vp = Graphics::getSingleton().getSceneManagerPtr()->getSuggestedViewpoint(true); + Graphics::getSingleton().getCameraPtr()->setPosition(vp.position); + Graphics::getSingleton().getCameraPtr()->pitch(Ogre::Degree(90)); + Graphics::getSingleton().getCameraPtr()->rotate(vp.orientation); + Graphics::getSingleton().getCameraPtr()->setFixedYawAxis(true, Ogre::Vector3::UNIT_Z); + + Graphics::getSingleton().getSceneManagerPtr()->setAmbientLight(Ogre::ColourValue(1, 1, 1)); + + Ogre::Entity* myEntity = Graphics::getSingleton().getSceneManagerPtr()->createEntity("Robot1", "robot.mesh"); + Ogre::SceneNode* myNode = Graphics::getSingleton().getSceneManagerPtr()->getRootSceneNode()->createChildSceneNode("Robot1Node"); + myNode->attachObject(myEntity); + + // This is how the real game loop should go + while (!mKeyQuit->isDown()) + { + if (!Graphics::getSingleton().getRootPtr()->_fireFrameStarted()) + break; + + think(); + + Graphics::getSingleton().update(); + + if (!Graphics::getSingleton().getRootPtr()->_fireFrameEnded()) + break; + } +} + +void +Game::think() +{ + if (mKeyUp->isDown()) + { + Graphics::getSingleton().getCameraPtr()->moveRelative(Ogre::Vector3(0, 0, -2)); + } + if (mKeyRight->isDown()) + { + Graphics::getSingleton().getCameraPtr()->moveRelative(Ogre::Vector3(2, 0, 0)); + } + if (mKeyDown->isDown()) + { + Graphics::getSingleton().getCameraPtr()->moveRelative(Ogre::Vector3(0, 0, 2)); + } + if (mKeyLeft->isDown()) + { + Graphics::getSingleton().getCameraPtr()->moveRelative(Ogre::Vector3(-2, 0, 0)); + } +} + +void +Game::mouseMotionListener(Ogre::Real x, Ogre::Real y) +{ + Graphics::getSingleton().getCameraPtr()->yaw(Ogre::Radian(-x * 1.f)); + Graphics::getSingleton().getCameraPtr()->pitch(Ogre::Radian(-y * 1.f)); +} Copied: trunk/perceptioncrash/src/Game.hpp (from rev 23, trunk/perceptioncrash/src/game.hpp) =================================================================== --- trunk/perceptioncrash/src/Game.hpp (rev 0) +++ trunk/perceptioncrash/src/Game.hpp 2006-05-18 03:13:59 UTC (rev 24) @@ -0,0 +1,31 @@ +#ifndef PC_GAME_HPP +#define PC_GAME_HPP + +#include <memory> + +#include <Ogre.h> +#include <OgreEventListeners.h> +#include <OgreKeyEvent.h> + +#include "Graphics.hpp" +#include "Input.hpp" + + +class Game +{ + public: + Game(); + + void run(); + void think(); + void mouseMotionListener(Ogre::Real, Ogre::Real); + + private: + InputKey* mKeyQuit; + InputKey* mKeyUp; + InputKey* mKeyRight; + InputKey* mKeyDown; + InputKey* mKeyLeft; +}; + +#endif /*PC_GAME_HPP*/ Copied: trunk/perceptioncrash/src/Graphics.cpp (from rev 23, trunk/perceptioncrash/src/graphics.cpp) =================================================================== --- trunk/perceptioncrash/src/Graphics.cpp (rev 0) +++ trunk/perceptioncrash/src/Graphics.cpp 2006-05-18 03:13:59 UTC (rev 24) @@ -0,0 +1,37 @@ +#include "Graphics.hpp" + +graphics::graphics() + : mRoot(new Ogre::Root("plugins.cfg", "ogre.cfg", "ogre.log")), + mSmgr(mRoot->createSceneManager("BspSceneManager")) +{ + // HACK This is setting either OpenGL or first thing it comes to + Ogre::RenderSystemList* renderers = mRoot->getAvailableRenderers(); + Ogre::RenderSystem* r = *renderers->begin(); // default + + for (Ogre::RenderSystemList::iterator i = renderers->begin(); + i != renderers->end(); ++i) + { + if (Ogre::StringUtil::match((*i)->getName(), "*opengl*", false)) + r = *i; + } + + r->setConfigOption("FSAA", "0"); + r->setConfigOption("Full Screen", "no"); + r->setConfigOption("RTT Preferred Mode", "FBO"); + r->setConfigOption("Video Mode", "800 x 600"); + + mRoot->setRenderSystem(r); + mWindow = mRoot->initialise(true, "Application"); + + // Should probably change this stuff + mCamera = mSmgr->createCamera("camera"); + mCamera->setPosition(Ogre::Vector3(0.0f, 0.0f, 500.0f)); + mCamera->lookAt(Ogre::Vector3(0.0f, 0.0f, 0.0f)); + mCamera->setNearClipDistance(5.0f); + mCamera->setFarClipDistance(5000.0f); + + mViewport = mWindow->addViewport(mCamera); + mViewport->setBackgroundColour(Ogre::ColourValue(0.3f, 0.3f, 0.3f)); + + mCamera->setAspectRatio(Ogre::Real(mViewport->getActualWidth()) / Ogre::Real(mViewport->getActualHeight())); +} Copied: trunk/perceptioncrash/src/Graphics.hpp (from rev 23, trunk/perceptioncrash/src/graphics.hpp) =================================================================== --- trunk/perceptioncrash/src/Graphics.hpp (rev 0) +++ trunk/perceptioncrash/src/Graphics.hpp 2006-05-18 03:13:59 UTC (rev 24) @@ -0,0 +1,42 @@ +#ifndef PC_GRAPHICS_HPP +#define PC_GRAPHICS_HPP + +#include <memory> + +#include <Ogre.h> +#include <OgreEventListeners.h> +#include <OgreKeyEvent.h> + +#include "Singleton.hpp" + +class graphics +{ + public: + graphics(); + + void update() + { mRoot->_updateAllRenderTargets(); } + + Ogre::Root* getRootPtr() const + { return mRoot.get(); } + Ogre::RenderWindow* getWindowPtr() const + { return mWindow; } + Ogre::SceneManager* getSceneManagerPtr() const + { return mSmgr; } + Ogre::Camera* getCameraPtr() const + { return mCamera; } + Ogre::Viewport* getViewportPtr() const + { return mViewport; } + + private: + std::auto_ptr<Ogre::Root> mRoot; + + Ogre::RenderWindow* mWindow; + Ogre::SceneManager* mSmgr; + Ogre::Camera* mCamera; + Ogre::Viewport* mViewport; +}; + +typedef Singleton<graphics> Graphics; + +#endif /* PC_GRAPHICS_HPP*/ Copied: trunk/perceptioncrash/src/Input.cpp (from rev 23, trunk/perceptioncrash/src/input.cpp) =================================================================== --- trunk/perceptioncrash/src/Input.cpp (rev 0) +++ trunk/perceptioncrash/src/Input.cpp 2006-05-18 03:13:59 UTC (rev 24) @@ -0,0 +1,83 @@ +#include "Input.hpp" +#include "Graphics.hpp" + +input::input() + : mEventProcessor(new Ogre::EventProcessor) +{ + mEventProcessor->addKeyListener(this); + mEventProcessor->addMouseMotionListener(this); + mEventProcessor->initialise(Graphics::getSingleton().getWindowPtr()); + mEventProcessor->startProcessingEvents(); +} + +InputKey* +input::createKey(std::string str, int keycode) +{ + if (mKeys.find(str) == mKeys.end()) + return mKeys[str] = new InputKey(keycode); + + return 0; +} + +InputKey* +input::findKey(std::string str) +{ + if (mKeys.find(str) != mKeys.end()) + return mKeys[str]; + + return 0; +} + +void +input::keyClicked(Ogre::KeyEvent* e) +{ + // TODO make some clicked code, probably not needed +} + +void +input::keyPressed(Ogre::KeyEvent* e) +{ + std::map<std::string, InputKey*>::iterator i; + for (i = mKeys.begin(); i != mKeys.end(); ++i) + { + if (e->getKey() == i->second->getKey()) + { + i->second->setDown(); + } + } +} + +void +input::keyReleased(Ogre::KeyEvent* e) +{ + std::map<std::string, InputKey*>::iterator i; + for (i = mKeys.begin(); i != mKeys.end(); ++i) + { + if (e->getKey() == i->second->getKey()) + { + i->second->setDown(false); + } + } +} + +void +input::mouseMoved(Ogre::MouseEvent* e) +{ + std::list<boost::function<void(Ogre::Real, Ogre::Real)> >::iterator i; + for (i = mMouseListeners.begin(); i != mMouseListeners.end(); ++i) + { + (*i) (e->getRelX(), e->getRelY()); + } +} + +void +input::mouseDragged(Ogre::MouseEvent* e) +{ + +} + +void +input::mouseDragMoved(Ogre::MouseEvent* e) +{ + +} Copied: trunk/perceptioncrash/src/Input.hpp (from rev 23, trunk/perceptioncrash/src/input.hpp) =================================================================== --- trunk/perceptioncrash/src/Input.hpp (rev 0) +++ trunk/perceptioncrash/src/Input.hpp 2006-05-18 03:13:59 UTC (rev 24) @@ -0,0 +1,63 @@ +#ifndef PC_INPUT_HPP +#define PC_INPUT_HPP + +#include <map> +#include <list> + +#include <boost/function.hpp> + +#include <Ogre.h> +#include <OgreEventListeners.h> +#include <OgreKeyEvent.h> + +#include "Singleton.hpp" + +class InputKey +{ + public: + InputKey(int key): mKeycode(key), mDown(false) { } + + int getKey() const + { return mKeycode; } + bool isDown() const + { return mDown; } + + void setDown(bool yes = true) + { mDown = yes; } + + private: + int mKeycode; + bool mDown; +}; + +class input : public Ogre::KeyListener, + public Ogre::MouseMotionListener +{ + public: + input(); + + InputKey* createKey(std::string, int); + InputKey* findKey(std::string); + + void keyClicked(Ogre::KeyEvent*); + void keyPressed(Ogre::KeyEvent*); + void keyReleased(Ogre::KeyEvent*); + + void mouseMoved(Ogre::MouseEvent*); + void mouseDragged(Ogre::MouseEvent*); + void mouseDragMoved(Ogre::MouseEvent*); + + void registerMouseListener(boost::function<void(Ogre::Real, Ogre::Real)> m) + { mMouseListeners.push_back(m); } + + private: + std::map<std::string,InputKey*> mKeys; + std::list<boost::function<void(Ogre::Real, Ogre::Real)> > mMouseListeners; + + std::auto_ptr<Ogre::EventProcessor> mEventProcessor; +}; + +typedef + Singleton<input> Input; + +#endif /*PC_INPUT_HPP*/ Copied: trunk/perceptioncrash/src/Singleton.hpp (from rev 23, trunk/perceptioncrash/src/singleton.hpp) =================================================================== --- trunk/perceptioncrash/src/Singleton.hpp (rev 0) +++ trunk/perceptioncrash/src/Singleton.hpp 2006-05-18 03:13:59 UTC (rev 24) @@ -0,0 +1,23 @@ +#ifndef SINGLETON_HPP +#define SINGLETON_HPP + +template<class T> +class Singleton +{ + public: + static T& getSingleton() + { + static T instance; + + return instance; + } + + private: + Singleton(); + ~Singleton(); + + Singleton(Singleton const &); + Singleton& operator=(Singleton const &); +}; + +#endif // SINGLETON_HPP Deleted: trunk/perceptioncrash/src/game.cpp =================================================================== --- trunk/perceptioncrash/src/game.cpp 2006-05-18 03:09:48 UTC (rev 23) +++ trunk/perceptioncrash/src/game.cpp 2006-05-18 03:13:59 UTC (rev 24) @@ -1,86 +0,0 @@ -#include <cmath> - -#include <boost/bind.hpp> - -#include "game.hpp" - -Game::Game() - : mKeyQuit(Input::getSingleton().createKey("quit", Ogre::KC_ESCAPE)), - mKeyUp(Input::getSingleton().createKey("up", Ogre::KC_W)), - mKeyRight(Input::getSingleton().createKey("right", Ogre::KC_D)), - mKeyDown(Input::getSingleton().createKey("down", Ogre::KC_S)), - mKeyLeft(Input::getSingleton().createKey("left", Ogre::KC_A)) -{ - Input::getSingleton().registerMouseListener(boost::bind(&Game::mouseMotionListener, this, _1,_2)); -} - -void -Game::run() -{ - // This is all temporary stuff - Ogre::ResourceGroupManager rgm = Ogre::ResourceGroupManager::getSingleton(); - rgm.addResourceLocation("data/objects", "FileSystem", "General"); - rgm.addResourceLocation("data/maps/ogretestmap.zip", "Zip", - rgm.getWorldResourceGroupName()); - - rgm.linkWorldGeometryToResourceGroup(rgm.getWorldResourceGroupName(), - "ogretestmap.bsp", - Graphics::getSingleton().getSceneManagerPtr()); - - rgm.initialiseAllResourceGroups(); - rgm.loadResourceGroup(rgm.getWorldResourceGroupName(), false, true); - - Ogre::ViewPoint vp = Graphics::getSingleton().getSceneManagerPtr()->getSuggestedViewpoint(true); - Graphics::getSingleton().getCameraPtr()->setPosition(vp.position); - Graphics::getSingleton().getCameraPtr()->pitch(Ogre::Degree(90)); - Graphics::getSingleton().getCameraPtr()->rotate(vp.orientation); - Graphics::getSingleton().getCameraPtr()->setFixedYawAxis(true, Ogre::Vector3::UNIT_Z); - - Graphics::getSingleton().getSceneManagerPtr()->setAmbientLight(Ogre::ColourValue(1, 1, 1)); - - Ogre::Entity* myEntity = Graphics::getSingleton().getSceneManagerPtr()->createEntity("Robot1", "robot.mesh"); - Ogre::SceneNode* myNode = Graphics::getSingleton().getSceneManagerPtr()->getRootSceneNode()->createChildSceneNode("Robot1Node"); - myNode->attachObject(myEntity); - - // This is how the real game loop should go - while (!mKeyQuit->isDown()) - { - if (!Graphics::getSingleton().getRootPtr()->_fireFrameStarted()) - break; - - think(); - - Graphics::getSingleton().update(); - - if (!Graphics::getSingleton().getRootPtr()->_fireFrameEnded()) - break; - } -} - -void -Game::think() -{ - if (mKeyUp->isDown()) - { - Graphics::getSingleton().getCameraPtr()->moveRelative(Ogre::Vector3(0, 0, -2)); - } - if (mKeyRight->isDown()) - { - Graphics::getSingleton().getCameraPtr()->moveRelative(Ogre::Vector3(2, 0, 0)); - } - if (mKeyDown->isDown()) - { - Graphics::getSingleton().getCameraPtr()->moveRelative(Ogre::Vector3(0, 0, 2)); - } - if (mKeyLeft->isDown()) - { - Graphics::getSingleton().getCameraPtr()->moveRelative(Ogre::Vector3(-2, 0, 0)); - } -} - -void -Game::mouseMotionListener(Ogre::Real x, Ogre::Real y) -{ - Graphics::getSingleton().getCameraPtr()->yaw(Ogre::Radian(-x * 1.f)); - Graphics::getSingleton().getCameraPtr()->pitch(Ogre::Radian(-y * 1.f)); -} Deleted: trunk/perceptioncrash/src/game.hpp =================================================================== --- trunk/perceptioncrash/src/game.hpp 2006-05-18 03:09:48 UTC (rev 23) +++ trunk/perceptioncrash/src/game.hpp 2006-05-18 03:13:59 UTC (rev 24) @@ -1,31 +0,0 @@ -#ifndef PC_GAME_HPP -#define PC_GAME_HPP - -#include <memory> - -#include <Ogre.h> -#include <OgreEventListeners.h> -#include <OgreKeyEvent.h> - -#include "graphics.hpp" -#include "input.hpp" - - -class Game -{ - public: - Game(); - - void run(); - void think(); - void mouseMotionListener(Ogre::Real, Ogre::Real); - - private: - InputKey* mKeyQuit; - InputKey* mKeyUp; - InputKey* mKeyRight; - InputKey* mKeyDown; - InputKey* mKeyLeft; -}; - -#endif /*PC_GAME_HPP*/ Deleted: trunk/perceptioncrash/src/graphics.cpp =================================================================== --- trunk/perceptioncrash/src/graphics.cpp 2006-05-18 03:09:48 UTC (rev 23) +++ trunk/perceptioncrash/src/graphics.cpp 2006-05-18 03:13:59 UTC (rev 24) @@ -1,37 +0,0 @@ -#include "graphics.hpp" - -graphics::graphics() - : mRoot(new Ogre::Root("plugins.cfg", "ogre.cfg", "ogre.log")), - mSmgr(mRoot->createSceneManager("BspSceneManager")) -{ - // HACK This is setting either OpenGL or first thing it comes to - Ogre::RenderSystemList* renderers = mRoot->getAvailableRenderers(); - Ogre::RenderSystem* r = *renderers->begin(); // default - - for (Ogre::RenderSystemList::iterator i = renderers->begin(); - i != renderers->end(); ++i) - { - if (Ogre::StringUtil::match((*i)->getName(), "*opengl*", false)) - r = *i; - } - - r->setConfigOption("FSAA", "0"); - r->setConfigOption("Full Screen", "no"); - r->setConfigOption("RTT Preferred Mode", "FBO"); - r->setConfigOption("Video Mode", "800 x 600"); - - mRoot->setRenderSystem(r); - mWindow = mRoot->initialise(true, "Application"); - - // Should probably change this stuff - mCamera = mSmgr->createCamera("camera"); - mCamera->setPosition(Ogre::Vector3(0.0f, 0.0f, 500.0f)); - mCamera->lookAt(Ogre::Vector3(0.0f, 0.0f, 0.0f)); - mCamera->setNearClipDistance(5.0f); - mCamera->setFarClipDistance(5000.0f); - - mViewport = mWindow->addViewport(mCamera); - mViewport->setBackgroundColour(Ogre::ColourValue(0.3f, 0.3f, 0.3f)); - - mCamera->setAspectRatio(Ogre::Real(mViewport->getActualWidth()) / Ogre::Real(mViewport->getActualHeight())); -} Deleted: trunk/perceptioncrash/src/graphics.hpp =================================================================== --- trunk/perceptioncrash/src/graphics.hpp 2006-05-18 03:09:48 UTC (rev 23) +++ trunk/perceptioncrash/src/graphics.hpp 2006-05-18 03:13:59 UTC (rev 24) @@ -1,42 +0,0 @@ -#ifndef PC_GRAPHICS_HPP -#define PC_GRAPHICS_HPP - -#include <memory> - -#include <Ogre.h> -#include <OgreEventListeners.h> -#include <OgreKeyEvent.h> - -#include "singleton.hpp" - -class graphics -{ - public: - graphics(); - - void update() - { mRoot->_updateAllRenderTargets(); } - - Ogre::Root* getRootPtr() const - { return mRoot.get(); } - Ogre::RenderWindow* getWindowPtr() const - { return mWindow; } - Ogre::SceneManager* getSceneManagerPtr() const - { return mSmgr; } - Ogre::Camera* getCameraPtr() const - { return mCamera; } - Ogre::Viewport* getViewportPtr() const - { return mViewport; } - - private: - std::auto_ptr<Ogre::Root> mRoot; - - Ogre::RenderWindow* mWindow; - Ogre::SceneManager* mSmgr; - Ogre::Camera* mCamera; - Ogre::Viewport* mViewport; -}; - -typedef Singleton<graphics> Graphics; - -#endif /* PC_GRAPHICS_HPP*/ Deleted: trunk/perceptioncrash/src/input.cpp =================================================================== --- trunk/perceptioncrash/src/input.cpp 2006-05-18 03:09:48 UTC (rev 23) +++ trunk/perceptioncrash/src/input.cpp 2006-05-18 03:13:59 UTC (rev 24) @@ -1,83 +0,0 @@ -#include "input.hpp" -#include "graphics.hpp" - -input::input() - : mEventProcessor(new Ogre::EventProcessor) -{ - mEventProcessor->addKeyListener(this); - mEventProcessor->addMouseMotionListener(this); - mEventProcessor->initialise(Graphics::getSingleton().getWindowPtr()); - mEventProcessor->startProcessingEvents(); -} - -InputKey* -input::createKey(std::string str, int keycode) -{ - if (mKeys.find(str) == mKeys.end()) - return mKeys[str] = new InputKey(keycode); - - return 0; -} - -InputKey* -input::findKey(std::string str) -{ - if (mKeys.find(str) != mKeys.end()) - return mKeys[str]; - - return 0; -} - -void -input::keyClicked(Ogre::KeyEvent* e) -{ - // TODO make some clicked code, probably not needed -} - -void -input::keyPressed(Ogre::KeyEvent* e) -{ - std::map<std::string, InputKey*>::iterator i; - for (i = mKeys.begin(); i != mKeys.end(); ++i) - { - if (e->getKey() == i->second->getKey()) - { - i->second->setDown(); - } - } -} - -void -input::keyReleased(Ogre::KeyEvent* e) -{ - std::map<std::string, InputKey*>::iterator i; - for (i = mKeys.begin(); i != mKeys.end(); ++i) - { - if (e->getKey() == i->second->getKey()) - { - i->second->setDown(false); - } - } -} - -void -input::mouseMoved(Ogre::MouseEvent* e) -{ - std::list<boost::function<void(Ogre::Real, Ogre::Real)> >::iterator i; - for (i = mMouseListeners.begin(); i != mMouseListeners.end(); ++i) - { - (*i) (e->getRelX(), e->getRelY()); - } -} - -void -input::mouseDragged(Ogre::MouseEvent* e) -{ - -} - -void -input::mouseDragMoved(Ogre::MouseEvent* e) -{ - -} Deleted: trunk/perceptioncrash/src/input.hpp =================================================================== --- trunk/perceptioncrash/src/input.hpp 2006-05-18 03:09:48 UTC (rev 23) +++ trunk/perceptioncrash/src/input.hpp 2006-05-18 03:13:59 UTC (rev 24) @@ -1,63 +0,0 @@ -#ifndef PC_INPUT_HPP -#define PC_INPUT_HPP - -#include <map> -#include <list> - -#include <boost/function.hpp> - -#include <Ogre.h> -#include <OgreEventListeners.h> -#include <OgreKeyEvent.h> - -#include "singleton.hpp" - -class InputKey -{ - public: - InputKey(int key): mKeycode(key), mDown(false) { } - - int getKey() const - { return mKeycode; } - bool isDown() const - { return mDown; } - - void setDown(bool yes = true) - { mDown = yes; } - - private: - int mKeycode; - bool mDown; -}; - -class input : public Ogre::KeyListener, - public Ogre::MouseMotionListener -{ - public: - input(); - - InputKey* createKey(std::string, int); - InputKey* findKey(std::string); - - void keyClicked(Ogre::KeyEvent*); - void keyPressed(Ogre::KeyEvent*); - void keyReleased(Ogre::KeyEvent*); - - void mouseMoved(Ogre::MouseEvent*); - void mouseDragged(Ogre::MouseEvent*); - void mouseDragMoved(Ogre::MouseEvent*); - - void registerMouseListener(boost::function<void(Ogre::Real, Ogre::Real)> m) - { mMouseListeners.push_back(m); } - - private: - std::map<std::string,InputKey*> mKeys; - std::list<boost::function<void(Ogre::Real, Ogre::Real)> > mMouseListeners; - - std::auto_ptr<Ogre::EventProcessor> mEventProcessor; -}; - -typedef - Singleton<input> Input; - -#endif /*PC_INPUT_HPP*/ Modified: trunk/perceptioncrash/src/main.cpp =================================================================== --- trunk/perceptioncrash/src/main.cpp 2006-05-18 03:09:48 UTC (rev 23) +++ trunk/perceptioncrash/src/main.cpp 2006-05-18 03:13:59 UTC (rev 24) @@ -3,7 +3,7 @@ #include <Ogre.h> #include <OgreErrorDialog.h> -#include "game.hpp" +#include "Game.hpp" #if OGRE_PLATFORM==OGRE_PLATFORM_WIN32 #define WIN32_LEAN_AND_MEAN Deleted: trunk/perceptioncrash/src/singleton.hpp =================================================================== --- trunk/perceptioncrash/src/singleton.hpp 2006-05-18 03:09:48 UTC (rev 23) +++ trunk/perceptioncrash/src/singleton.hpp 2006-05-18 03:13:59 UTC (rev 24) @@ -1,23 +0,0 @@ -#ifndef SINGLETON_HPP -#define SINGLETON_HPP - -template<class T> -class Singleton -{ - public: - static T& getSingleton() - { - static T instance; - - return instance; - } - - private: - Singleton(); - ~Singleton(); - - Singleton(Singleton const &); - Singleton& operator=(Singleton const &); -}; - -#endif // SINGLETON_HPP This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <sik...@us...> - 2006-05-18 03:09:59
|
Revision: 23 Author: sik0fewl Date: 2006-05-17 20:09:48 -0700 (Wed, 17 May 2006) ViewCVS: http://svn.sourceforge.net/perceptioncrash/?rev=23&view=rev Log Message: ----------- Some housekeeping Modified Paths: -------------- trunk/perceptioncrash/src/GameManager.cpp trunk/perceptioncrash/src/game.cpp trunk/perceptioncrash/src/game.hpp trunk/perceptioncrash/src/graphics.cpp trunk/perceptioncrash/src/graphics.hpp trunk/perceptioncrash/src/input.cpp trunk/perceptioncrash/src/input.hpp trunk/perceptioncrash/src/main.cpp trunk/perceptioncrash/src/singleton.hpp Modified: trunk/perceptioncrash/src/GameManager.cpp =================================================================== --- trunk/perceptioncrash/src/GameManager.cpp 2006-05-18 02:10:53 UTC (rev 22) +++ trunk/perceptioncrash/src/GameManager.cpp 2006-05-18 03:09:48 UTC (rev 23) @@ -112,7 +112,7 @@ while (seci.hasMoreElements()) { secName = seci.peekNextKey(); - ConfigFile::SettingsMultiMap * settings = seci.getNext(); + ConfigFile::SettingsMultiMap* settings = seci.getNext(); ConfigFile::SettingsMultiMap::iterator i; for (i = settings->begin(); i != settings->end(); ++i) { Modified: trunk/perceptioncrash/src/game.cpp =================================================================== --- trunk/perceptioncrash/src/game.cpp 2006-05-18 02:10:53 UTC (rev 22) +++ trunk/perceptioncrash/src/game.cpp 2006-05-18 03:09:48 UTC (rev 23) @@ -1,73 +1,86 @@ -#include "game.hpp" +#include <cmath> #include <boost/bind.hpp> -#include <cmath> +#include "game.hpp" Game::Game() - : key_quit(Input::getSingleton().createKey("quit", Ogre::KC_ESCAPE)), - key_up(Input::getSingleton().createKey("up", Ogre::KC_W)), - key_right(Input::getSingleton().createKey("right", Ogre::KC_D)), - key_down(Input::getSingleton().createKey("down", Ogre::KC_S)), - key_left(Input::getSingleton().createKey("left", Ogre::KC_A)) -{ - Input::getSingleton().register_mouselistener( boost::bind(&Game::mousemotion_listener, - this, _1, _2) ); + : mKeyQuit(Input::getSingleton().createKey("quit", Ogre::KC_ESCAPE)), + mKeyUp(Input::getSingleton().createKey("up", Ogre::KC_W)), + mKeyRight(Input::getSingleton().createKey("right", Ogre::KC_D)), + mKeyDown(Input::getSingleton().createKey("down", Ogre::KC_S)), + mKeyLeft(Input::getSingleton().createKey("left", Ogre::KC_A)) +{ + Input::getSingleton().registerMouseListener(boost::bind(&Game::mouseMotionListener, this, _1,_2)); } -void Game::run() { - +void +Game::run() +{ // This is all temporary stuff - Ogre::ResourceGroupManager::getSingleton().addResourceLocation( "data/objects", - "FileSystem", - "General" ); - Ogre::ResourceGroupManager::getSingleton().addResourceLocation( "data/maps/ogretestmap.zip", - "Zip", - Ogre::ResourceGroupManager::getSingleton().getWorldResourceGroupName() ); - Ogre::ResourceGroupManager::getSingleton().linkWorldGeometryToResourceGroup( - Ogre::ResourceGroupManager::getSingleton().getWorldResourceGroupName(), - "ogretestmap.bsp", Graphics::getSingleton().getSceneManagerPtr()); - - Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups(); - Ogre::ResourceGroupManager::getSingleton().loadResourceGroup( - Ogre::ResourceGroupManager::getSingleton().getWorldResourceGroupName(), - false, true); - + Ogre::ResourceGroupManager rgm = Ogre::ResourceGroupManager::getSingleton(); + rgm.addResourceLocation("data/objects", "FileSystem", "General"); + rgm.addResourceLocation("data/maps/ogretestmap.zip", "Zip", + rgm.getWorldResourceGroupName()); + + rgm.linkWorldGeometryToResourceGroup(rgm.getWorldResourceGroupName(), + "ogretestmap.bsp", + Graphics::getSingleton().getSceneManagerPtr()); + + rgm.initialiseAllResourceGroups(); + rgm.loadResourceGroup(rgm.getWorldResourceGroupName(), false, true); + Ogre::ViewPoint vp = Graphics::getSingleton().getSceneManagerPtr()->getSuggestedViewpoint(true); Graphics::getSingleton().getCameraPtr()->setPosition(vp.position); - Graphics::getSingleton().getCameraPtr()->pitch( Ogre::Degree(90) ); + Graphics::getSingleton().getCameraPtr()->pitch(Ogre::Degree(90)); Graphics::getSingleton().getCameraPtr()->rotate(vp.orientation); Graphics::getSingleton().getCameraPtr()->setFixedYawAxis(true, Ogre::Vector3::UNIT_Z); - - Graphics::getSingleton().getSceneManagerPtr()->setAmbientLight( Ogre::ColourValue(1, 1, 1) ); - - Ogre::Entity *myEntity = - Graphics::getSingleton().getSceneManagerPtr()->createEntity("Robot1", "robot.mesh"); - Ogre::SceneNode *myNode = - Graphics::getSingleton().getSceneManagerPtr()-> - getRootSceneNode()->createChildSceneNode("Robot1Node"); - myNode->attachObject(myEntity); - + + Graphics::getSingleton().getSceneManagerPtr()->setAmbientLight(Ogre::ColourValue(1, 1, 1)); + + Ogre::Entity* myEntity = Graphics::getSingleton().getSceneManagerPtr()->createEntity("Robot1", "robot.mesh"); + Ogre::SceneNode* myNode = Graphics::getSingleton().getSceneManagerPtr()->getRootSceneNode()->createChildSceneNode("Robot1Node"); + myNode->attachObject(myEntity); + // This is how the real game loop should go - while ( !key_quit->isDown() ) { - if ( !Graphics::getSingleton().getRootPtr()->_fireFrameStarted() ) break; + while (!mKeyQuit->isDown()) + { + if (!Graphics::getSingleton().getRootPtr()->_fireFrameStarted()) + break; - Think(); - - Graphics::getSingleton().Update(); + think(); - if ( !Graphics::getSingleton().getRootPtr()->_fireFrameEnded() ) break; - } + Graphics::getSingleton().update(); + + if (!Graphics::getSingleton().getRootPtr()->_fireFrameEnded()) + break; + } } -void Game::Think() { - if (key_up->isDown()) { Graphics::getSingleton().getCameraPtr()->moveRelative( Ogre::Vector3(0, 0, -2) ); } - if (key_right->isDown()) { Graphics::getSingleton().getCameraPtr()->moveRelative( Ogre::Vector3(2, 0, 0) ); } - if (key_down->isDown()) { Graphics::getSingleton().getCameraPtr()->moveRelative( Ogre::Vector3(0, 0, 2) ); } - if (key_left->isDown()) { Graphics::getSingleton().getCameraPtr()->moveRelative( Ogre::Vector3(-2, 0, 0) ); } +void +Game::think() +{ + if (mKeyUp->isDown()) + { + Graphics::getSingleton().getCameraPtr()->moveRelative(Ogre::Vector3(0, 0, -2)); + } + if (mKeyRight->isDown()) + { + Graphics::getSingleton().getCameraPtr()->moveRelative(Ogre::Vector3(2, 0, 0)); + } + if (mKeyDown->isDown()) + { + Graphics::getSingleton().getCameraPtr()->moveRelative(Ogre::Vector3(0, 0, 2)); + } + if (mKeyLeft->isDown()) + { + Graphics::getSingleton().getCameraPtr()->moveRelative(Ogre::Vector3(-2, 0, 0)); + } } -void Game::mousemotion_listener(Ogre::Real x, Ogre::Real y) { - Graphics::getSingleton().getCameraPtr()->yaw( Ogre::Radian(-x * 1.f) ); - Graphics::getSingleton().getCameraPtr()->pitch( Ogre::Radian(-y * 1.f) ); +void +Game::mouseMotionListener(Ogre::Real x, Ogre::Real y) +{ + Graphics::getSingleton().getCameraPtr()->yaw(Ogre::Radian(-x * 1.f)); + Graphics::getSingleton().getCameraPtr()->pitch(Ogre::Radian(-y * 1.f)); } Modified: trunk/perceptioncrash/src/game.hpp =================================================================== --- trunk/perceptioncrash/src/game.hpp 2006-05-18 02:10:53 UTC (rev 22) +++ trunk/perceptioncrash/src/game.hpp 2006-05-18 03:09:48 UTC (rev 23) @@ -1,29 +1,31 @@ -#ifndef GAME_HPP -#define GAME_HPP +#ifndef PC_GAME_HPP +#define PC_GAME_HPP -#include "graphics.hpp" -#include "input.hpp" +#include <memory> #include <Ogre.h> #include <OgreEventListeners.h> #include <OgreKeyEvent.h> -#include <memory> +#include "graphics.hpp" +#include "input.hpp" -class Game { -public: - Game(); - void run(); - void Think(); - void mousemotion_listener(Ogre::Real, Ogre::Real); +class Game +{ + public: + Game(); -private: - input_key* key_quit; - input_key* key_up; - input_key* key_right; - input_key* key_down; - input_key* key_left; + void run(); + void think(); + void mouseMotionListener(Ogre::Real, Ogre::Real); + + private: + InputKey* mKeyQuit; + InputKey* mKeyUp; + InputKey* mKeyRight; + InputKey* mKeyDown; + InputKey* mKeyLeft; }; -#endif // GAME_HPP +#endif /*PC_GAME_HPP*/ Modified: trunk/perceptioncrash/src/graphics.cpp =================================================================== --- trunk/perceptioncrash/src/graphics.cpp 2006-05-18 02:10:53 UTC (rev 22) +++ trunk/perceptioncrash/src/graphics.cpp 2006-05-18 03:09:48 UTC (rev 23) @@ -1,16 +1,17 @@ #include "graphics.hpp" graphics::graphics() - : m_pRoot(new Ogre::Root("plugins.cfg", "ogre.cfg", "ogre.log")), - m_pSmgr(m_pRoot->createSceneManager("BspSceneManager")) -{ + : mRoot(new Ogre::Root("plugins.cfg", "ogre.cfg", "ogre.log")), + mSmgr(mRoot->createSceneManager("BspSceneManager")) +{ // HACK This is setting either OpenGL or first thing it comes to - Ogre::RenderSystemList *renderers = m_pRoot->getAvailableRenderers(); - Ogre::RenderSystem *r = *renderers->begin(); // default + Ogre::RenderSystemList* renderers = mRoot->getAvailableRenderers(); + Ogre::RenderSystem* r = *renderers->begin(); // default - Ogre::RenderSystemList::iterator i; - for(i = renderers->begin(); i != renderers->end(); ++i) { - if ( Ogre::StringUtil::match((*i)->getName(), "*opengl*", false) ) + for (Ogre::RenderSystemList::iterator i = renderers->begin(); + i != renderers->end(); ++i) + { + if (Ogre::StringUtil::match((*i)->getName(), "*opengl*", false)) r = *i; } @@ -18,20 +19,19 @@ r->setConfigOption("Full Screen", "no"); r->setConfigOption("RTT Preferred Mode", "FBO"); r->setConfigOption("Video Mode", "800 x 600"); - - m_pRoot->setRenderSystem(r); - m_pWindow = m_pRoot->initialise(true, "Application"); - + + mRoot->setRenderSystem(r); + mWindow = mRoot->initialise(true, "Application"); + // Should probably change this stuff - m_pCamera = m_pSmgr->createCamera("camera"); - m_pCamera->setPosition(Ogre::Vector3(0.0f, 0.0f, 500.0f)); - m_pCamera->lookAt(Ogre::Vector3(0.0f, 0.0f, 0.0f)); - m_pCamera->setNearClipDistance(5.0f); - m_pCamera->setFarClipDistance(5000.0f); + mCamera = mSmgr->createCamera("camera"); + mCamera->setPosition(Ogre::Vector3(0.0f, 0.0f, 500.0f)); + mCamera->lookAt(Ogre::Vector3(0.0f, 0.0f, 0.0f)); + mCamera->setNearClipDistance(5.0f); + mCamera->setFarClipDistance(5000.0f); - m_pViewport = m_pWindow->addViewport( m_pCamera ); - m_pViewport->setBackgroundColour( Ogre::ColourValue(0.3f, 0.3f, 0.3f) ); + mViewport = mWindow->addViewport(mCamera); + mViewport->setBackgroundColour(Ogre::ColourValue(0.3f, 0.3f, 0.3f)); - m_pCamera->setAspectRatio( Ogre::Real(m_pViewport->getActualWidth()) / - Ogre::Real(m_pViewport->getActualHeight()) ); + mCamera->setAspectRatio(Ogre::Real(mViewport->getActualWidth()) / Ogre::Real(mViewport->getActualHeight())); } Modified: trunk/perceptioncrash/src/graphics.hpp =================================================================== --- trunk/perceptioncrash/src/graphics.hpp 2006-05-18 02:10:53 UTC (rev 22) +++ trunk/perceptioncrash/src/graphics.hpp 2006-05-18 03:09:48 UTC (rev 23) @@ -1,35 +1,42 @@ -#ifndef GRAPHICS_HPP -#define GRAPHICS_HPP +#ifndef PC_GRAPHICS_HPP +#define PC_GRAPHICS_HPP -#include "singleton.hpp" +#include <memory> #include <Ogre.h> #include <OgreEventListeners.h> #include <OgreKeyEvent.h> -#include <memory> +#include "singleton.hpp" -class graphics { -public: +class graphics +{ + public: graphics(); - - void Update() { m_pRoot->_updateAllRenderTargets(); } - - Ogre::Root* getRootPtr() const { return m_pRoot.get(); } - Ogre::RenderWindow* getWindowPtr() const { return m_pWindow; } - Ogre::SceneManager* getSceneManagerPtr() const { return m_pSmgr; } - Ogre::Camera* getCameraPtr() const { return m_pCamera; } - Ogre::Viewport* getViewportPtr() const { return m_pViewport; } - -private: - std::auto_ptr<Ogre::Root> m_pRoot; - Ogre::RenderWindow *m_pWindow; - Ogre::SceneManager *m_pSmgr; - Ogre::Camera *m_pCamera; - Ogre::Viewport *m_pViewport; + + void update() + { mRoot->_updateAllRenderTargets(); } + + Ogre::Root* getRootPtr() const + { return mRoot.get(); } + Ogre::RenderWindow* getWindowPtr() const + { return mWindow; } + Ogre::SceneManager* getSceneManagerPtr() const + { return mSmgr; } + Ogre::Camera* getCameraPtr() const + { return mCamera; } + Ogre::Viewport* getViewportPtr() const + { return mViewport; } + + private: + std::auto_ptr<Ogre::Root> mRoot; + + Ogre::RenderWindow* mWindow; + Ogre::SceneManager* mSmgr; + Ogre::Camera* mCamera; + Ogre::Viewport* mViewport; }; -typedef singleton<graphics> Graphics; +typedef Singleton<graphics> Graphics; -#endif // GRAPHICS.HPP - +#endif /* PC_GRAPHICS_HPP*/ Modified: trunk/perceptioncrash/src/input.cpp =================================================================== --- trunk/perceptioncrash/src/input.cpp 2006-05-18 02:10:53 UTC (rev 22) +++ trunk/perceptioncrash/src/input.cpp 2006-05-18 03:09:48 UTC (rev 23) @@ -2,61 +2,82 @@ #include "graphics.hpp" input::input() - : m_pEventProcessor( new Ogre::EventProcessor ) + : mEventProcessor(new Ogre::EventProcessor) { - m_pEventProcessor->addKeyListener( this ); - m_pEventProcessor->addMouseMotionListener( this ); - m_pEventProcessor->initialise( Graphics::getSingleton().getWindowPtr() ); - m_pEventProcessor->startProcessingEvents(); + mEventProcessor->addKeyListener(this); + mEventProcessor->addMouseMotionListener(this); + mEventProcessor->initialise(Graphics::getSingleton().getWindowPtr()); + mEventProcessor->startProcessingEvents(); } - -input_key* input::createKey(std::string str, int keycode) { - if (m_Keys.find(str) == m_Keys.end()) - return m_Keys[str] = new input_key(keycode); - - return 0; + +InputKey* +input::createKey(std::string str, int keycode) +{ + if (mKeys.find(str) == mKeys.end()) + return mKeys[str] = new InputKey(keycode); + + return 0; } -input_key* input::findKey(std::string str) { - if (m_Keys.find(str) != m_Keys.end()) - return m_Keys[str]; - - return 0; +InputKey* +input::findKey(std::string str) +{ + if (mKeys.find(str) != mKeys.end()) + return mKeys[str]; + + return 0; } -void input::keyClicked(Ogre::KeyEvent *e) { - // TODO make some clicked code, probably not needed +void +input::keyClicked(Ogre::KeyEvent* e) +{ + // TODO make some clicked code, probably not needed } -void input::keyPressed(Ogre::KeyEvent *e) { - std::map<std::string, input_key*>::iterator i; - for (i = m_Keys.begin(); i != m_Keys.end(); ++i) { - if ( e->getKey() == i->second->getKey() ) { - i->second->setDown(); - } - } +void +input::keyPressed(Ogre::KeyEvent* e) +{ + std::map<std::string, InputKey*>::iterator i; + for (i = mKeys.begin(); i != mKeys.end(); ++i) + { + if (e->getKey() == i->second->getKey()) + { + i->second->setDown(); + } + } } -void input::keyReleased(Ogre::KeyEvent *e) { - std::map<std::string, input_key*>::iterator i; - for (i = m_Keys.begin(); i != m_Keys.end(); ++i) { - if ( e->getKey() == i->second->getKey() ) { - i->second->setDown(false); - } - } +void +input::keyReleased(Ogre::KeyEvent* e) +{ + std::map<std::string, InputKey*>::iterator i; + for (i = mKeys.begin(); i != mKeys.end(); ++i) + { + if (e->getKey() == i->second->getKey()) + { + i->second->setDown(false); + } + } } -void input::mouseMoved(Ogre::MouseEvent *e) { - std::list< boost::function<void (Ogre::Real, Ogre::Real)> >::iterator i; - for (i = m_MouseListeners.begin(); i != m_MouseListeners.end(); ++i) { - (*i)(e->getRelX(), e->getRelY()); - } +void +input::mouseMoved(Ogre::MouseEvent* e) +{ + std::list<boost::function<void(Ogre::Real, Ogre::Real)> >::iterator i; + for (i = mMouseListeners.begin(); i != mMouseListeners.end(); ++i) + { + (*i) (e->getRelX(), e->getRelY()); + } } -void input::mouseDragged(Ogre::MouseEvent *e){ +void +input::mouseDragged(Ogre::MouseEvent* e) +{ } -void input::mouseDragMoved(Ogre::MouseEvent *e) { - +void +input::mouseDragMoved(Ogre::MouseEvent* e) +{ + } Modified: trunk/perceptioncrash/src/input.hpp =================================================================== --- trunk/perceptioncrash/src/input.hpp 2006-05-18 02:10:53 UTC (rev 22) +++ trunk/perceptioncrash/src/input.hpp 2006-05-18 03:09:48 UTC (rev 23) @@ -1,57 +1,63 @@ -#ifndef INPUT_HPP -#define INPUT_HPP +#ifndef PC_INPUT_HPP +#define PC_INPUT_HPP -#include "singleton.hpp" +#include <map> +#include <list> +#include <boost/function.hpp> + #include <Ogre.h> #include <OgreEventListeners.h> #include <OgreKeyEvent.h> -#include <boost/function.hpp> +#include "singleton.hpp" -#include <map> -#include <list> +class InputKey +{ + public: + InputKey(int key): mKeycode(key), mDown(false) { } -class input_key { -public: - input_key(int key) : keycode(key), down(false) { } - - int getKey() const { return keycode; } - bool isDown() const { return down; } - - void setDown(bool yes = true) { down = yes; } - -private: - int keycode; - bool down; + int getKey() const + { return mKeycode; } + bool isDown() const + { return mDown; } + + void setDown(bool yes = true) + { mDown = yes; } + + private: + int mKeycode; + bool mDown; }; -class input : public Ogre::KeyListener, public Ogre::MouseMotionListener { -public: +class input : public Ogre::KeyListener, + public Ogre::MouseMotionListener +{ + public: input(); - - input_key* createKey(std::string, int); - input_key* findKey(std::string); - - void keyClicked(Ogre::KeyEvent *); - void keyPressed(Ogre::KeyEvent *); - void keyReleased(Ogre::KeyEvent *); - - void mouseMoved(Ogre::MouseEvent *); - void mouseDragged(Ogre::MouseEvent *); - void mouseDragMoved(Ogre::MouseEvent *); - - void register_mouselistener(boost::function<void (Ogre::Real, Ogre::Real)> m) { - m_MouseListeners.push_back(m); - } - -private: - std::map<std::string, input_key*> m_Keys; - std::list< boost::function<void (Ogre::Real, Ogre::Real)> > m_MouseListeners; - std::auto_ptr<Ogre::EventProcessor> m_pEventProcessor; + InputKey* createKey(std::string, int); + InputKey* findKey(std::string); + + void keyClicked(Ogre::KeyEvent*); + void keyPressed(Ogre::KeyEvent*); + void keyReleased(Ogre::KeyEvent*); + + void mouseMoved(Ogre::MouseEvent*); + void mouseDragged(Ogre::MouseEvent*); + void mouseDragMoved(Ogre::MouseEvent*); + + void registerMouseListener(boost::function<void(Ogre::Real, Ogre::Real)> m) + { mMouseListeners.push_back(m); } + + private: + std::map<std::string,InputKey*> mKeys; + std::list<boost::function<void(Ogre::Real, Ogre::Real)> > mMouseListeners; + + std::auto_ptr<Ogre::EventProcessor> mEventProcessor; }; -typedef singleton<input> Input; +typedef + Singleton<input> Input; -#endif // INPUT_HPP +#endif /*PC_INPUT_HPP*/ Modified: trunk/perceptioncrash/src/main.cpp =================================================================== --- trunk/perceptioncrash/src/main.cpp 2006-05-18 02:10:53 UTC (rev 22) +++ trunk/perceptioncrash/src/main.cpp 2006-05-18 03:09:48 UTC (rev 23) @@ -1,27 +1,32 @@ -#include "game.hpp" - #include <memory> #include <Ogre.h> #include <OgreErrorDialog.h> +#include "game.hpp" + #if OGRE_PLATFORM==OGRE_PLATFORM_WIN32 #define WIN32_LEAN_AND_MEAN #include "windows.h" -INT WINAPI WinMain(HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT) +INT WINAPI +WinMain(HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT) #else -int main(int argc, char **argv) +int +main(int argc, char **argv) #endif { Game game; - try { - game.run(); - } - catch (Ogre::Exception& e) { - std::auto_ptr<Ogre::ErrorDialog> tmpdlg(Ogre::PlatformManager::getSingleton().createErrorDialog()); - tmpdlg->display(e.getFullDescription()); - return 1; - } - return 0; + try + { + game.run(); + } + catch(Ogre::Exception& e) + { + std::auto_ptr<Ogre::ErrorDialog> tmpdlg(Ogre::PlatformManager::getSingleton().createErrorDialog()); + tmpdlg->display(e.getFullDescription()); + return 1; + } + + return 0; } Modified: trunk/perceptioncrash/src/singleton.hpp =================================================================== --- trunk/perceptioncrash/src/singleton.hpp 2006-05-18 02:10:53 UTC (rev 22) +++ trunk/perceptioncrash/src/singleton.hpp 2006-05-18 03:09:48 UTC (rev 23) @@ -2,19 +2,22 @@ #define SINGLETON_HPP template<class T> -class singleton { -public: - static T& getSingleton() { - static T instance; - return instance; - } - -private: - singleton(); - ~singleton(); - - singleton(singleton const&); - singleton& operator=(singleton const&); +class Singleton +{ + public: + static T& getSingleton() + { + static T instance; + + return instance; + } + + private: + Singleton(); + ~Singleton(); + + Singleton(Singleton const &); + Singleton& operator=(Singleton const &); }; #endif // SINGLETON_HPP This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <sik...@us...> - 2006-05-18 02:11:07
|
Revision: 22 Author: sik0fewl Date: 2006-05-17 19:10:53 -0700 (Wed, 17 May 2006) ViewCVS: http://svn.sourceforge.net/perceptioncrash/?rev=22&view=rev Log Message: ----------- Added game state files Not yet integrated Added Paths: ----------- 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 Added: trunk/perceptioncrash/src/GameManager.cpp =================================================================== --- trunk/perceptioncrash/src/GameManager.cpp (rev 0) +++ trunk/perceptioncrash/src/GameManager.cpp 2006-05-18 02:10:53 UTC (rev 22) @@ -0,0 +1,194 @@ +#include <OGRE/Ogre.h> + +#include "GameManager.hpp" +#include "InputManager.hpp" +#include "GameState.hpp" + +using namespace Ogre; + +template<> GameManager* Singleton<GameManager>::ms_Singleton = 0; + +GameManager::GameManager() +{ + mRoot = 0; + mInputManager = 0; +} + +GameManager::~GameManager() +{ + // clean up all the states + while (!mStates.empty()) + { + mStates.back()->exit(); + mStates.pop_back(); + } + + if (mInputManager) + delete mInputManager; + + if (mRoot) + delete mRoot; +} + +void +GameManager::start(GameState* state) +{ + mRoot = new Root(); + + setupResources(); + + if (!configure()) + return; + + mRoot->addFrameListener(this); + + mInputManager = new InputManager(mRoot->getAutoCreatedWindow()); + mInputManager->getEventProcessor()->addKeyListener(this); + + changeState(state); + + mRoot->startRendering(); +} + +void +GameManager::changeState(GameState* state) +{ + // cleanup the current state + if (!mStates.empty()) + { + mStates.back()->exit(); + mStates.pop_back(); + } + + // store and init the new state + mStates.push_back(state); + mStates.back()->enter(); +} + +void +GameManager::pushState(GameState* state) +{ + // pause current state + if (!mStates.empty()) + { + mStates.back()->pause(); + } + + // store and init the new state + mStates.push_back(state); + mStates.back()->enter(); +} + +void +GameManager::popState() +{ + // cleanup the current state + if (!mStates.empty()) + { + mStates.back()->exit(); + mStates.pop_back(); + } + + // resume previous state + if (!mStates.empty()) + { + mStates.back()->resume(); + } +} + +void +GameManager::setupResources(void) +{ + // load resource paths from config file + ConfigFile cf; + + cf.load("resources.cfg"); + + // go through all settings in the file + ConfigFile::SectionIterator seci = cf.getSectionIterator(); + + String secName, typeName, archName; + + while (seci.hasMoreElements()) + { + secName = seci.peekNextKey(); + ConfigFile::SettingsMultiMap * settings = seci.getNext(); + ConfigFile::SettingsMultiMap::iterator i; + for (i = settings->begin(); i != settings->end(); ++i) + { + typeName = i->first; + archName = i->second; + ResourceGroupManager::getSingleton().addResourceLocation(archName, + typeName, + secName); + } + } +} + +bool GameManager::configure(void) +{ + // load config settings from ogre.cfg + if (!mRoot->restoreConfig()) + { + // if there is no config file, show the configuration dialog + if (!mRoot->showConfigDialog()) + { + return false; + } + } + + // initialise and create a default rendering window + mRenderWindow = mRoot->initialise(true); + + ResourceGroupManager::getSingleton().initialiseAllResourceGroups(); + + return true; +} + +void +GameManager::keyClicked(KeyEvent* e) +{ + // call keyClicked of current state + mStates.back()->keyClicked(e); +} + +void +GameManager::keyPressed(KeyEvent* e) +{ + // call keyPressed of current state + mStates.back()->keyPressed(e); +} + +void +GameManager::keyReleased(KeyEvent* e) +{ + // call keyReleased of current state + mStates.back()->keyReleased(e); +} + +bool +GameManager::frameStarted(const FrameEvent& evt) +{ + // call frameStarted of current state + return mStates.back()->frameStarted(evt); +} + +bool +GameManager::frameEnded(const FrameEvent& evt) +{ + // call frameEnded of current state + return mStates.back()->frameEnded(evt); +} + +GameManager* +GameManager::getSingletonPtr(void) +{ + return ms_Singleton; +} + +GameManager& +GameManager::getSingleton(void) +{ + assert(ms_Singleton); + return *ms_Singleton; +} Property changes on: trunk/perceptioncrash/src/GameManager.cpp ___________________________________________________________________ Name: svn:keywrords + Id Name: svn:eol-style + native Added: trunk/perceptioncrash/src/GameManager.hpp =================================================================== --- trunk/perceptioncrash/src/GameManager.hpp (rev 0) +++ trunk/perceptioncrash/src/GameManager.hpp 2006-05-18 02:10:53 UTC (rev 22) @@ -0,0 +1,48 @@ +#ifndef PC_GAME_MANAGER_HPP +#define PC_GAME_MANAGER_HPP + +#include <vector> +#include <OGRE/Ogre.h> +#include <OGRE/OgreEventListeners.h> +#include <OGRE/OgreSingleton.h> + +#include "InputManager.hpp" + +class GameState; + +class GameManager : public Ogre::FrameListener, + public Ogre::KeyListener, + public Ogre::Singleton<GameManager> +{ + public: + GameManager(); + ~GameManager(); + + void start(GameState* state); + void changeState(GameState* state); + void pushState(GameState* state); + void popState(); + + static GameManager& getSingleton(void); + static GameManager* getSingletonPtr(void); + + protected: + Ogre::Root* mRoot; + Ogre::RenderWindow* mRenderWindow; + InputManager* mInputManager; + + void setupResources(void); + bool configure(void); + + 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); + + private: + std::vector<GameState*> mStates; +}; + +#endif /*PC_GAME_MANAGER */ Added: trunk/perceptioncrash/src/GameState.hpp =================================================================== --- trunk/perceptioncrash/src/GameState.hpp (rev 0) +++ trunk/perceptioncrash/src/GameState.hpp 2006-05-18 02:10:53 UTC (rev 22) @@ -0,0 +1,43 @@ +#ifndef PC_GAME_STATE_HPP +#define PC_GAME_STATE_HPP + +#include <OGRE/Ogre.h> + +#include "GameManager.hpp" + +class GameState +{ + public: + virtual ~GameState(); + + virtual void enter() = 0; + virtual void exit() = 0; + + virtual void pause() = 0; + virtual void resume() = 0; + + virtual void keyClicked(Ogre::KeyEvent* e) = 0; + virtual void keyPressed(Ogre::KeyEvent* e) = 0; + virtual void keyReleased(Ogre::KeyEvent* e) = 0; + virtual bool frameStarted(const Ogre::FrameEvent& evt) = 0; + virtual bool frameEnded(const Ogre::FrameEvent& evt) = 0; + + void changeState(GameState* state) + { + GameManager::getSingletonPtr()->changeState(state); + } + + void pushState(GameState* state) + { + GameManager::getSingletonPtr()->pushState(state); + } + + void popState() + { + GameManager::getSingletonPtr()->popState(); + } + protected: + GameState() { } +}; + +#endif /*PC_GAME_STATE_HPP */ Added: trunk/perceptioncrash/src/InputManager.cpp =================================================================== --- trunk/perceptioncrash/src/InputManager.cpp (rev 0) +++ trunk/perceptioncrash/src/InputManager.cpp 2006-05-18 02:10:53 UTC (rev 22) @@ -0,0 +1,32 @@ +#include <OGRE/OgreEventProcessor.h> + +#include "InputManager.hpp" + +template<> InputManager* Ogre::Singleton<InputManager>::ms_Singleton = 0; + +InputManager::InputManager(Ogre::RenderWindow* window) +{ + mEventProcessor = new Ogre::EventProcessor(); + mEventProcessor->initialise(window); + mEventProcessor->startProcessingEvents(); + mInputDevice = mEventProcessor->getInputReader(); +} + +InputManager::~InputManager() +{ + if (mEventProcessor) + delete mEventProcessor; +} + +InputManager* +InputManager::getSingletonPtr(void) +{ + return ms_Singleton; +} + +InputManager& +InputManager::getSingleton(void) +{ + assert(ms_Singleton); + return *ms_Singleton; +} Property changes on: trunk/perceptioncrash/src/InputManager.cpp ___________________________________________________________________ Name: svn:keywrords + Id Name: svn:eol-style + native Added: trunk/perceptioncrash/src/InputManager.hpp =================================================================== --- trunk/perceptioncrash/src/InputManager.hpp (rev 0) +++ trunk/perceptioncrash/src/InputManager.hpp 2006-05-18 02:10:53 UTC (rev 22) @@ -0,0 +1,26 @@ +#ifndef PC_INPUT_MANAGER_HPP +#define PC_INPUT_MANAGER_HPP + +#include <OGRE/OgreSingleton.h> +#include <OGRE/OgreInput.h> + +class InputManager : public Ogre::Singleton<InputManager> +{ + public: + InputManager(Ogre::RenderWindow* rwindow); + virtual ~InputManager(); + + inline Ogre::InputReader* getInputDevice() const + { return mInputDevice; } + inline Ogre::EventProcessor* getEventProcessor() const + { return mEventProcessor; } + + static InputManager& getSingleton(void); + static InputManager* getSingletonPtr(void); + + private: + Ogre::EventProcessor* mEventProcessor; + Ogre::InputReader* mInputDevice; +}; + +#endif /*PC_INPUT_MANAGER_HPP */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <mac...@us...> - 2006-05-17 23:26:08
|
Revision: 21 Author: machaira Date: 2006-05-17 16:26:01 -0700 (Wed, 17 May 2006) ViewCVS: http://svn.sourceforge.net/perceptioncrash/?rev=21&view=rev Log Message: ----------- Modified Paths: -------------- trunk/perceptioncrash/src/main.cpp Modified: trunk/perceptioncrash/src/main.cpp =================================================================== --- trunk/perceptioncrash/src/main.cpp 2006-05-17 23:23:03 UTC (rev 20) +++ trunk/perceptioncrash/src/main.cpp 2006-05-17 23:26:01 UTC (rev 21) @@ -5,7 +5,14 @@ #include <Ogre.h> #include <OgreErrorDialog.h> -int main(int argc, char **argv) { +#if OGRE_PLATFORM==OGRE_PLATFORM_WIN32 +#define WIN32_LEAN_AND_MEAN +#include "windows.h" +INT WINAPI WinMain(HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT) +#else +int main(int argc, char **argv) +#endif +{ Game game; try { game.run(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <mac...@us...> - 2006-05-17 23:24:46
|
Revision: 20 Author: machaira Date: 2006-05-17 16:23:03 -0700 (Wed, 17 May 2006) ViewCVS: http://svn.sourceforge.net/perceptioncrash/?rev=20&view=rev Log Message: ----------- Added Paths: ----------- trunk/perceptioncrash/VC++Project/ trunk/perceptioncrash/VC++Project/perceptioncrash/ trunk/perceptioncrash/VC++Project/perceptioncrash/bin/ trunk/perceptioncrash/VC++Project/perceptioncrash/bin/debug/ trunk/perceptioncrash/VC++Project/perceptioncrash/obj/ trunk/perceptioncrash/VC++Project/perceptioncrash/obj/Debug/ trunk/perceptioncrash/VC++Project/perceptioncrash/perceptioncrash.ncb trunk/perceptioncrash/VC++Project/perceptioncrash/perceptioncrash.sln trunk/perceptioncrash/VC++Project/perceptioncrash/perceptioncrash.vcproj Added: trunk/perceptioncrash/VC++Project/perceptioncrash/perceptioncrash.ncb =================================================================== --- trunk/perceptioncrash/VC++Project/perceptioncrash/perceptioncrash.ncb (rev 0) +++ trunk/perceptioncrash/VC++Project/perceptioncrash/perceptioncrash.ncb 2006-05-17 23:23:03 UTC (rev 20) @@ -0,0 +1,35887 @@ +Microsoft C/C++ MSF 7.00 +DS |
|
From: <sik...@us...> - 2006-05-17 23:19:56
|
Revision: 19 Author: sik0fewl Date: 2006-05-17 16:19:53 -0700 (Wed, 17 May 2006) ViewCVS: http://svn.sourceforge.net/perceptioncrash/?rev=19&view=rev Log Message: ----------- Updated README Modified Paths: -------------- trunk/perceptioncrash/README Modified: trunk/perceptioncrash/README =================================================================== --- trunk/perceptioncrash/README 2006-05-17 16:23:42 UTC (rev 18) +++ trunk/perceptioncrash/README 2006-05-17 23:19:53 UTC (rev 19) @@ -1,2 +1,13 @@ +Perception Crash +================ + Website: http://perceptioncrash.sourceforge.net/ Project page: http://sourceforge.net/project/perceptioncrash/ + +Libraries +--------- + +Perception Crash currently depends on the following libraries: + OGRE >= 1.2.0 + CEGUI >= 0.4.1 + Boost This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <sik...@us...> - 2006-05-17 16:23:47
|
Revision: 18 Author: sik0fewl Date: 2006-05-17 09:23:42 -0700 (Wed, 17 May 2006) ViewCVS: http://svn.sourceforge.net/perceptioncrash/?rev=18&view=rev Log Message: ----------- API doc upload script Added Paths: ----------- trunk/perceptioncrash/doc/upload.sh Added: trunk/perceptioncrash/doc/upload.sh =================================================================== --- trunk/perceptioncrash/doc/upload.sh (rev 0) +++ trunk/perceptioncrash/doc/upload.sh 2006-05-17 16:23:42 UTC (rev 18) @@ -0,0 +1,3 @@ +#!/bin/sh + +rsync -rv -e ssh --delete --delete-after doxygen/ $PC_...@sh...:/home/groups/p/pe/perceptioncrash/htdocs/doc Property changes on: trunk/perceptioncrash/doc/upload.sh ___________________________________________________________________ Name: svn:executable + * Name: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <xs...@us...> - 2006-05-17 04:23:52
|
Revision: 17 Author: xsdwx Date: 2006-05-16 21:23:47 -0700 (Tue, 16 May 2006) ViewCVS: http://svn.sourceforge.net/perceptioncrash/?rev=17&view=rev Log Message: ----------- Modified Paths: -------------- trunk/perceptioncrash/src/game.cpp trunk/perceptioncrash/src/game.hpp trunk/perceptioncrash/src/input.cpp trunk/perceptioncrash/src/input.hpp Added Paths: ----------- trunk/perceptioncrash/src/graphics.cpp trunk/perceptioncrash/src/graphics.hpp Modified: trunk/perceptioncrash/src/game.cpp =================================================================== --- trunk/perceptioncrash/src/game.cpp 2006-05-17 03:57:29 UTC (rev 16) +++ trunk/perceptioncrash/src/game.cpp 2006-05-17 04:23:47 UTC (rev 17) @@ -5,51 +5,12 @@ #include <cmath> Game::Game() - : m_pRoot(new Ogre::Root("plugins.cfg", "ogre.cfg", "ogre.log")), - m_pSmgr(m_pRoot->createSceneManager("BspSceneManager")), - m_pEventProcessor(new Ogre::EventProcessor), - key_quit(Input::getSingleton().createKey("quit", Ogre::KC_ESCAPE)), + : key_quit(Input::getSingleton().createKey("quit", Ogre::KC_ESCAPE)), key_up(Input::getSingleton().createKey("up", Ogre::KC_W)), key_right(Input::getSingleton().createKey("right", Ogre::KC_D)), key_down(Input::getSingleton().createKey("down", Ogre::KC_S)), key_left(Input::getSingleton().createKey("left", Ogre::KC_A)) { - // HACK This is setting either OpenGL or first thing it comes to - Ogre::RenderSystemList *renderers = m_pRoot->getAvailableRenderers(); - Ogre::RenderSystem *r = *renderers->begin(); // default - - Ogre::RenderSystemList::iterator i; - for(i = renderers->begin(); i != renderers->end(); ++i) { - if ( Ogre::StringUtil::match((*i)->getName(), "*opengl*", false) ) - r = *i; - } - - r->setConfigOption("FSAA", "0"); - r->setConfigOption("Full Screen", "no"); - r->setConfigOption("RTT Preferred Mode", "FBO"); - r->setConfigOption("Video Mode", "800 x 600"); - - m_pRoot->setRenderSystem(r); - m_pWindow = m_pRoot->initialise(true, "Application"); - - // Should probably change this stuff - m_pCamera = m_pSmgr->createCamera("camera"); - m_pCamera->setPosition(Ogre::Vector3(0.0f, 0.0f, 500.0f)); - m_pCamera->lookAt(Ogre::Vector3(0.0f, 0.0f, 0.0f)); - m_pCamera->setNearClipDistance(5.0f); - m_pCamera->setFarClipDistance(5000.0f); - - m_pViewport = m_pWindow->addViewport( m_pCamera ); - m_pViewport->setBackgroundColour( Ogre::ColourValue(0.3f, 0.3f, 0.3f) ); - - m_pCamera->setAspectRatio( Ogre::Real(m_pViewport->getActualWidth()) / - Ogre::Real(m_pViewport->getActualHeight()) ); - - m_pEventProcessor->addKeyListener( &Input::getSingleton() ); - m_pEventProcessor->addMouseMotionListener( &Input::getSingleton() ); - m_pEventProcessor->initialise( m_pWindow ); - m_pEventProcessor->startProcessingEvents(); - Input::getSingleton().register_mouselistener( boost::bind(&Game::mousemotion_listener, this, _1, _2) ); } @@ -65,45 +26,48 @@ Ogre::ResourceGroupManager::getSingleton().getWorldResourceGroupName() ); Ogre::ResourceGroupManager::getSingleton().linkWorldGeometryToResourceGroup( Ogre::ResourceGroupManager::getSingleton().getWorldResourceGroupName(), - "ogretestmap.bsp", m_pSmgr); + "ogretestmap.bsp", Graphics::getSingleton().getSceneManagerPtr()); Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups(); Ogre::ResourceGroupManager::getSingleton().loadResourceGroup( Ogre::ResourceGroupManager::getSingleton().getWorldResourceGroupName(), false, true); - Ogre::ViewPoint vp = m_pSmgr->getSuggestedViewpoint(true); - m_pCamera->setPosition(vp.position); - m_pCamera->pitch( Ogre::Degree(90) ); - m_pCamera->rotate(vp.orientation); - m_pCamera->setFixedYawAxis(true, Ogre::Vector3::UNIT_Z); + Ogre::ViewPoint vp = Graphics::getSingleton().getSceneManagerPtr()->getSuggestedViewpoint(true); + Graphics::getSingleton().getCameraPtr()->setPosition(vp.position); + Graphics::getSingleton().getCameraPtr()->pitch( Ogre::Degree(90) ); + Graphics::getSingleton().getCameraPtr()->rotate(vp.orientation); + Graphics::getSingleton().getCameraPtr()->setFixedYawAxis(true, Ogre::Vector3::UNIT_Z); - m_pSmgr->setAmbientLight( Ogre::ColourValue(1, 1, 1) ); + Graphics::getSingleton().getSceneManagerPtr()->setAmbientLight( Ogre::ColourValue(1, 1, 1) ); - Ogre::Entity *myEntity = m_pSmgr->createEntity("Robot1", "robot.mesh"); - Ogre::SceneNode *myNode = m_pSmgr->getRootSceneNode()->createChildSceneNode("Robot1Node"); + Ogre::Entity *myEntity = + Graphics::getSingleton().getSceneManagerPtr()->createEntity("Robot1", "robot.mesh"); + Ogre::SceneNode *myNode = + Graphics::getSingleton().getSceneManagerPtr()-> + getRootSceneNode()->createChildSceneNode("Robot1Node"); myNode->attachObject(myEntity); // This is how the real game loop should go while ( !key_quit->isDown() ) { - if ( !m_pRoot->_fireFrameStarted() ) break; + if ( !Graphics::getSingleton().getRootPtr()->_fireFrameStarted() ) break; Think(); - m_pRoot->_updateAllRenderTargets(); + Graphics::getSingleton().Update(); - if ( !m_pRoot->_fireFrameEnded() ) break; + if ( !Graphics::getSingleton().getRootPtr()->_fireFrameEnded() ) break; } } void Game::Think() { - if (key_up->isDown()) { m_pCamera->moveRelative( Ogre::Vector3(0, 0, -2) ); } - if (key_right->isDown()) { m_pCamera->moveRelative( Ogre::Vector3(2, 0, 0) ); } - if (key_down->isDown()) { m_pCamera->moveRelative( Ogre::Vector3(0, 0, 2) ); } - if (key_left->isDown()) { m_pCamera->moveRelative( Ogre::Vector3(-2, 0, 0) ); } + if (key_up->isDown()) { Graphics::getSingleton().getCameraPtr()->moveRelative( Ogre::Vector3(0, 0, -2) ); } + if (key_right->isDown()) { Graphics::getSingleton().getCameraPtr()->moveRelative( Ogre::Vector3(2, 0, 0) ); } + if (key_down->isDown()) { Graphics::getSingleton().getCameraPtr()->moveRelative( Ogre::Vector3(0, 0, 2) ); } + if (key_left->isDown()) { Graphics::getSingleton().getCameraPtr()->moveRelative( Ogre::Vector3(-2, 0, 0) ); } } void Game::mousemotion_listener(Ogre::Real x, Ogre::Real y) { - m_pCamera->yaw( Ogre::Radian(-x * 1.f) ); - m_pCamera->pitch( Ogre::Radian(-y * 1.f) ); + Graphics::getSingleton().getCameraPtr()->yaw( Ogre::Radian(-x * 1.f) ); + Graphics::getSingleton().getCameraPtr()->pitch( Ogre::Radian(-y * 1.f) ); } Modified: trunk/perceptioncrash/src/game.hpp =================================================================== --- trunk/perceptioncrash/src/game.hpp 2006-05-17 03:57:29 UTC (rev 16) +++ trunk/perceptioncrash/src/game.hpp 2006-05-17 04:23:47 UTC (rev 17) @@ -1,6 +1,7 @@ #ifndef GAME_HPP #define GAME_HPP +#include "graphics.hpp" #include "input.hpp" #include <Ogre.h> @@ -18,13 +19,6 @@ void mousemotion_listener(Ogre::Real, Ogre::Real); private: - std::auto_ptr<Ogre::Root> m_pRoot; - Ogre::RenderWindow *m_pWindow; - Ogre::SceneManager *m_pSmgr; - Ogre::Camera *m_pCamera; - Ogre::Viewport *m_pViewport; - std::auto_ptr<Ogre::EventProcessor> m_pEventProcessor; - input_key* key_quit; input_key* key_up; input_key* key_right; Added: trunk/perceptioncrash/src/graphics.cpp =================================================================== --- trunk/perceptioncrash/src/graphics.cpp (rev 0) +++ trunk/perceptioncrash/src/graphics.cpp 2006-05-17 04:23:47 UTC (rev 17) @@ -0,0 +1,37 @@ +#include "graphics.hpp" + +graphics::graphics() + : m_pRoot(new Ogre::Root("plugins.cfg", "ogre.cfg", "ogre.log")), + m_pSmgr(m_pRoot->createSceneManager("BspSceneManager")) +{ + // HACK This is setting either OpenGL or first thing it comes to + Ogre::RenderSystemList *renderers = m_pRoot->getAvailableRenderers(); + Ogre::RenderSystem *r = *renderers->begin(); // default + + Ogre::RenderSystemList::iterator i; + for(i = renderers->begin(); i != renderers->end(); ++i) { + if ( Ogre::StringUtil::match((*i)->getName(), "*opengl*", false) ) + r = *i; + } + + r->setConfigOption("FSAA", "0"); + r->setConfigOption("Full Screen", "no"); + r->setConfigOption("RTT Preferred Mode", "FBO"); + r->setConfigOption("Video Mode", "800 x 600"); + + m_pRoot->setRenderSystem(r); + m_pWindow = m_pRoot->initialise(true, "Application"); + + // Should probably change this stuff + m_pCamera = m_pSmgr->createCamera("camera"); + m_pCamera->setPosition(Ogre::Vector3(0.0f, 0.0f, 500.0f)); + m_pCamera->lookAt(Ogre::Vector3(0.0f, 0.0f, 0.0f)); + m_pCamera->setNearClipDistance(5.0f); + m_pCamera->setFarClipDistance(5000.0f); + + m_pViewport = m_pWindow->addViewport( m_pCamera ); + m_pViewport->setBackgroundColour( Ogre::ColourValue(0.3f, 0.3f, 0.3f) ); + + m_pCamera->setAspectRatio( Ogre::Real(m_pViewport->getActualWidth()) / + Ogre::Real(m_pViewport->getActualHeight()) ); +} Added: trunk/perceptioncrash/src/graphics.hpp =================================================================== --- trunk/perceptioncrash/src/graphics.hpp (rev 0) +++ trunk/perceptioncrash/src/graphics.hpp 2006-05-17 04:23:47 UTC (rev 17) @@ -0,0 +1,35 @@ +#ifndef GRAPHICS_HPP +#define GRAPHICS_HPP + +#include "singleton.hpp" + +#include <Ogre.h> +#include <OgreEventListeners.h> +#include <OgreKeyEvent.h> + +#include <memory> + +class graphics { +public: + graphics(); + + void Update() { m_pRoot->_updateAllRenderTargets(); } + + Ogre::Root* getRootPtr() const { return m_pRoot.get(); } + Ogre::RenderWindow* getWindowPtr() const { return m_pWindow; } + Ogre::SceneManager* getSceneManagerPtr() const { return m_pSmgr; } + Ogre::Camera* getCameraPtr() const { return m_pCamera; } + Ogre::Viewport* getViewportPtr() const { return m_pViewport; } + +private: + std::auto_ptr<Ogre::Root> m_pRoot; + Ogre::RenderWindow *m_pWindow; + Ogre::SceneManager *m_pSmgr; + Ogre::Camera *m_pCamera; + Ogre::Viewport *m_pViewport; +}; + +typedef singleton<graphics> Graphics; + +#endif // GRAPHICS.HPP + Modified: trunk/perceptioncrash/src/input.cpp =================================================================== --- trunk/perceptioncrash/src/input.cpp 2006-05-17 03:57:29 UTC (rev 16) +++ trunk/perceptioncrash/src/input.cpp 2006-05-17 04:23:47 UTC (rev 17) @@ -1,5 +1,15 @@ #include "input.hpp" +#include "graphics.hpp" +input::input() + : m_pEventProcessor( new Ogre::EventProcessor ) +{ + m_pEventProcessor->addKeyListener( this ); + m_pEventProcessor->addMouseMotionListener( this ); + m_pEventProcessor->initialise( Graphics::getSingleton().getWindowPtr() ); + m_pEventProcessor->startProcessingEvents(); +} + input_key* input::createKey(std::string str, int keycode) { if (m_Keys.find(str) == m_Keys.end()) return m_Keys[str] = new input_key(keycode); Modified: trunk/perceptioncrash/src/input.hpp =================================================================== --- trunk/perceptioncrash/src/input.hpp 2006-05-17 03:57:29 UTC (rev 16) +++ trunk/perceptioncrash/src/input.hpp 2006-05-17 04:23:47 UTC (rev 17) @@ -28,7 +28,7 @@ class input : public Ogre::KeyListener, public Ogre::MouseMotionListener { public: - input() { } + input(); input_key* createKey(std::string, int); input_key* findKey(std::string); @@ -46,8 +46,10 @@ } private: - std::map<std::string, input_key*> m_Keys; - std::list< boost::function<void (Ogre::Real, Ogre::Real)> > m_MouseListeners; + std::map<std::string, input_key*> m_Keys; + std::list< boost::function<void (Ogre::Real, Ogre::Real)> > m_MouseListeners; + + std::auto_ptr<Ogre::EventProcessor> m_pEventProcessor; }; typedef singleton<input> Input; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <xs...@us...> - 2006-05-17 03:57:34
|
Revision: 16 Author: xsdwx Date: 2006-05-16 20:57:29 -0700 (Tue, 16 May 2006) ViewCVS: http://svn.sourceforge.net/perceptioncrash/?rev=16&view=rev Log Message: ----------- Modified Paths: -------------- trunk/perceptioncrash/src/game.cpp trunk/perceptioncrash/src/game.hpp Modified: trunk/perceptioncrash/src/game.cpp =================================================================== --- trunk/perceptioncrash/src/game.cpp 2006-05-17 03:21:59 UTC (rev 15) +++ trunk/perceptioncrash/src/game.cpp 2006-05-17 03:57:29 UTC (rev 16) @@ -7,14 +7,14 @@ Game::Game() : m_pRoot(new Ogre::Root("plugins.cfg", "ogre.cfg", "ogre.log")), m_pSmgr(m_pRoot->createSceneManager("BspSceneManager")), - m_pFrameListener(new Framely), m_pEventProcessor(new Ogre::EventProcessor), - m_pRaySceneQuery( m_pSmgr->createRayQuery(Ogre::Ray()) ), + key_quit(Input::getSingleton().createKey("quit", Ogre::KC_ESCAPE)), key_up(Input::getSingleton().createKey("up", Ogre::KC_W)), key_right(Input::getSingleton().createKey("right", Ogre::KC_D)), key_down(Input::getSingleton().createKey("down", Ogre::KC_S)), key_left(Input::getSingleton().createKey("left", Ogre::KC_A)) { + // HACK This is setting either OpenGL or first thing it comes to Ogre::RenderSystemList *renderers = m_pRoot->getAvailableRenderers(); Ogre::RenderSystem *r = *renderers->begin(); // default @@ -32,6 +32,7 @@ m_pRoot->setRenderSystem(r); m_pWindow = m_pRoot->initialise(true, "Application"); + // Should probably change this stuff m_pCamera = m_pSmgr->createCamera("camera"); m_pCamera->setPosition(Ogre::Vector3(0.0f, 0.0f, 500.0f)); m_pCamera->lookAt(Ogre::Vector3(0.0f, 0.0f, 0.0f)); @@ -41,11 +42,9 @@ m_pViewport = m_pWindow->addViewport( m_pCamera ); m_pViewport->setBackgroundColour( Ogre::ColourValue(0.3f, 0.3f, 0.3f) ); - m_pCamera->setAspectRatio(Ogre::Real(m_pViewport->getActualWidth()) / - Ogre::Real(m_pViewport->getActualHeight())); + m_pCamera->setAspectRatio( Ogre::Real(m_pViewport->getActualWidth()) / + Ogre::Real(m_pViewport->getActualHeight()) ); - m_pRoot->addFrameListener( m_pFrameListener.get() ); - m_pEventProcessor->addKeyListener( &Input::getSingleton() ); m_pEventProcessor->addMouseMotionListener( &Input::getSingleton() ); m_pEventProcessor->initialise( m_pWindow ); @@ -56,6 +55,8 @@ } void Game::run() { + + // This is all temporary stuff Ogre::ResourceGroupManager::getSingleton().addResourceLocation( "data/objects", "FileSystem", "General" ); @@ -83,14 +84,15 @@ Ogre::SceneNode *myNode = m_pSmgr->getRootSceneNode()->createChildSceneNode("Robot1Node"); myNode->attachObject(myEntity); - for (;;) { - if (!m_pRoot->_fireFrameStarted()) break; + // This is how the real game loop should go + while ( !key_quit->isDown() ) { + if ( !m_pRoot->_fireFrameStarted() ) break; Think(); m_pRoot->_updateAllRenderTargets(); - if (!m_pRoot->_fireFrameEnded()) break; + if ( !m_pRoot->_fireFrameEnded() ) break; } } @@ -99,30 +101,9 @@ if (key_right->isDown()) { m_pCamera->moveRelative( Ogre::Vector3(2, 0, 0) ); } if (key_down->isDown()) { m_pCamera->moveRelative( Ogre::Vector3(0, 0, 2) ); } if (key_left->isDown()) { m_pCamera->moveRelative( Ogre::Vector3(-2, 0, 0) ); } - - if ( key_up->isDown() || key_right->isDown() || - key_down->isDown() || key_left->isDown() ) { - Ogre::Ray r( m_pCamera->getPosition(), m_pCamera->getDirection()*20 ); - m_pRaySceneQuery->setRay( r ); - Ogre::RaySceneQueryResult &result = m_pRaySceneQuery->execute(); - Ogre::RaySceneQueryResult::iterator i = result.begin(); - if ( i != result.end() && i->worldFragment ) { - m_pCamera->setPosition( i->worldFragment->singleIntersection ); - } - } } void Game::mousemotion_listener(Ogre::Real x, Ogre::Real y) { m_pCamera->yaw( Ogre::Radian(-x * 1.f) ); m_pCamera->pitch( Ogre::Radian(-y * 1.f) ); } - -bool Framely::frameStarted(Ogre::FrameEvent const &e) { - - return true; -} - -bool Framely::frameEnded(Ogre::FrameEvent const &e) { - - return !key_quit->isDown(); -} Modified: trunk/perceptioncrash/src/game.hpp =================================================================== --- trunk/perceptioncrash/src/game.hpp 2006-05-17 03:21:59 UTC (rev 15) +++ trunk/perceptioncrash/src/game.hpp 2006-05-17 03:57:29 UTC (rev 16) @@ -9,17 +9,6 @@ #include <memory> -class Framely : public Ogre::FrameListener { -public: - Framely() : key_quit(Input::getSingleton().createKey("quit", Ogre::KC_ESCAPE)) { } - - bool frameStarted(Ogre::FrameEvent const &); - bool frameEnded(Ogre::FrameEvent const &); - -private: - input_key* key_quit; -}; - class Game { public: Game(); @@ -34,11 +23,9 @@ Ogre::SceneManager *m_pSmgr; Ogre::Camera *m_pCamera; Ogre::Viewport *m_pViewport; - - std::auto_ptr<Framely> m_pFrameListener; std::auto_ptr<Ogre::EventProcessor> m_pEventProcessor; - std::auto_ptr<Ogre::RaySceneQuery> m_pRaySceneQuery; + input_key* key_quit; input_key* key_up; input_key* key_right; input_key* key_down; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <sik...@us...> - 2006-05-17 03:22:05
|
Revision: 15 Author: sik0fewl Date: 2006-05-16 20:21:59 -0700 (Tue, 16 May 2006) ViewCVS: http://svn.sourceforge.net/perceptioncrash/?rev=15&view=rev Log Message: ----------- Updated Jamfile Modified Paths: -------------- trunk/perceptioncrash/Jamfile Modified: trunk/perceptioncrash/Jamfile =================================================================== --- trunk/perceptioncrash/Jamfile 2006-05-17 03:14:05 UTC (rev 14) +++ trunk/perceptioncrash/Jamfile 2006-05-17 03:21:59 UTC (rev 15) @@ -4,5 +4,5 @@ UseAutoconf ; -InstallDoc README ; +InstallDoc AUTHORS ChangeLog COPYING INSTALL NEWS README ; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <sik...@us...> - 2006-05-17 03:14:09
|
Revision: 14 Author: sik0fewl Date: 2006-05-16 20:14:05 -0700 (Tue, 16 May 2006) ViewCVS: http://svn.sourceforge.net/perceptioncrash/?rev=14&view=rev Log Message: ----------- Typo fix Modified Paths: -------------- trunk/perceptioncrash/Jamrules Modified: trunk/perceptioncrash/Jamrules =================================================================== --- trunk/perceptioncrash/Jamrules 2006-05-17 03:04:21 UTC (rev 13) +++ trunk/perceptioncrash/Jamrules 2006-05-17 03:14:05 UTC (rev 14) @@ -20,7 +20,7 @@ switch $(VARIANT) { case optimize : CFLAGS += -O3 -g -Wall -DNDEBUG ; - CXXFLAGS += -O3 -g -Wall -DNDEUB ; + CXXFLAGS += -O3 -g -Wall -DNDEBUG ; LIBS += -g ; case debug : CFLAGS += -Wall -O0 -g3 ; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <sik...@us...> - 2006-05-17 03:04:37
|
Revision: 13 Author: sik0fewl Date: 2006-05-16 20:04:21 -0700 (Tue, 16 May 2006) ViewCVS: http://svn.sourceforge.net/perceptioncrash/?rev=13&view=rev Log Message: ----------- Update svn:ignore Property Changed: ---------------- trunk/perceptioncrash/ Property changes on: trunk/perceptioncrash ___________________________________________________________________ Name: svn:ignore - .sconsign ogre.log build perceptioncrash + .sconsign ogre.log build perceptioncrash configure config.log config.status config.h config.h.in Jamconfig Jamconfig.in autom4te.cache aclocal.m4 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <sik...@us...> - 2006-05-17 03:03:44
|
Revision: 12 Author: sik0fewl Date: 2006-05-16 20:03:39 -0700 (Tue, 16 May 2006) ViewCVS: http://svn.sourceforge.net/perceptioncrash/?rev=12&view=rev Log Message: ----------- Fixed build script Modified Paths: -------------- trunk/perceptioncrash/Jamrules Modified: trunk/perceptioncrash/Jamrules =================================================================== --- trunk/perceptioncrash/Jamrules 2006-05-17 01:53:33 UTC (rev 11) +++ trunk/perceptioncrash/Jamrules 2006-05-17 03:03:39 UTC (rev 12) @@ -19,12 +19,12 @@ # do some compiler settings for the different compilation modes switch $(VARIANT) { case optimize : - CFLAGS += -O3 -g -Wall ; - CXXFLAGS += -O3 -g -Wall ; + CFLAGS += -O3 -g -Wall -DNDEBUG ; + CXXFLAGS += -O3 -g -Wall -DNDEUB ; LIBS += -g ; case debug : - CFLAGS += -Wall -W -O0 -g3 -DDEBUG ; - CXXFLAGS += -Wall -W -O0 -g3 -DDEBUG ; + CFLAGS += -Wall -O0 -g3 ; + CXXFLAGS += -Wall -O0 -g3 ; LIBS += -g3 ; case profile : CFLAGS += -O3 -g3 -pg ; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <sik...@us...> - 2006-05-17 01:51:21
|
Revision: 10 Author: sik0fewl Date: 2006-05-16 18:51:13 -0700 (Tue, 16 May 2006) ViewCVS: http://svn.sourceforge.net/perceptioncrash/?rev=10&view=rev Log Message: ----------- Added Jam build system To build: ./autogen.sh ./configure --enable-debug jam Let me know if you run into any problems. autogen.sh and configure only need to be run once. After that, just use jam to rebuild the project Added Paths: ----------- trunk/perceptioncrash/Jamfile trunk/perceptioncrash/Jamrules trunk/perceptioncrash/autogen.sh trunk/perceptioncrash/configure.ac trunk/perceptioncrash/src/Jamfile Property Changed: ---------------- trunk/perceptioncrash/ Property changes on: trunk/perceptioncrash ___________________________________________________________________ Name: svn:ignore - .sconsign ogre.log perceptioncrash + .sconsign ogre.log build perceptioncrash Added: trunk/perceptioncrash/Jamfile =================================================================== --- trunk/perceptioncrash/Jamfile (rev 0) +++ trunk/perceptioncrash/Jamfile 2006-05-17 01:51:13 UTC (rev 10) @@ -0,0 +1,8 @@ +SubDir TOP ; + +SubInclude TOP src ; + +UseAutoconf ; + +InstallDoc README ; + Added: trunk/perceptioncrash/Jamrules =================================================================== --- trunk/perceptioncrash/Jamrules (rev 0) +++ trunk/perceptioncrash/Jamrules 2006-05-17 01:51:13 UTC (rev 10) @@ -0,0 +1,44 @@ +# make sure top_builddir is set +if ! $(top_builddir) +{ + top_builddir = $(TOP) ; +} +top_srcdir = $(TOP) ; + +# check if a Jamconfig file already exists +JAMCONFIG ?= $(top_builddir)/Jamconfig ; +include $(JAMCONFIG) ; +if ! $(JAMCONFIG_READ) +{ + EXIT "Couldn't find config. Please run 'configure' first." ; +} + +# It's a c++ application, so we should link with the c++ compiler +LINK = $(CXX) ; + +# do some compiler settings for the different compilation modes +switch $(VARIANT) { + case optimize : + CFLAGS += -O3 -g -Wall ; + CXXFLAGS += -O3 -g -Wall ; + LIBS += -g ; + case debug : + CFLAGS += -Wall -W -O0 -g3 -DDEBUG ; + CXXFLAGS += -Wall -W -O0 -g3 -DDEBUG ; + LIBS += -g3 ; + case profile : + CFLAGS += -O3 -g3 -pg ; + CXXFLAGS += -O3 -g3 -pg ; + LIBS += -g3 -pg ; + case * : + EXIT "Invalid variant $(VARIANT) selected" ; +} + +# Include build rules +include $(TOP)/mk/jam/build.jam ; + +# Include the top_builddir dir, because it contains config.h +IncludeDir $(top_builddir) ; + +# also add the src dir as include directory +IncludeDir $(TOP)/src ; Added: trunk/perceptioncrash/autogen.sh =================================================================== --- trunk/perceptioncrash/autogen.sh (rev 0) +++ trunk/perceptioncrash/autogen.sh 2006-05-17 01:51:13 UTC (rev 10) @@ -0,0 +1,25 @@ +#! /bin/sh + +# Correct working directory? +if test ! -f configure.ac ; then + echo "*** Please invoke this script from directory containing configure.ac." + exit 1 +fi + +# construct aclocal.m4 from macro files +MACRODIR=mk/autoconf +aclocal -I $MACRODIR + +# generate a Jamconfig.in +echo 'prefix ?= "@prefix@" ;' > Jamconfig.in +echo 'exec_prefix ?= "@exec_prefix@" ;' >> Jamconfig.in +autoconf --trace=AC_SUBST \ + | sed -e 's/configure.ac:[0-9]*:AC_SUBST:\([^:]*\).*/\1 ?= "@\1@" ;/g' \ + | sort -u \ + >> Jamconfig.in + +# seems autoconf --trace misses some things :-/ +echo 'INSTALL ?= "@INSTALL@" ;' >> Jamconfig.in + +autoheader +autoconf Property changes on: trunk/perceptioncrash/autogen.sh ___________________________________________________________________ Name: svn:executable + * Name: svn:eol-style + native Added: trunk/perceptioncrash/configure.ac =================================================================== --- trunk/perceptioncrash/configure.ac (rev 0) +++ trunk/perceptioncrash/configure.ac 2006-05-17 01:51:13 UTC (rev 10) @@ -0,0 +1,96 @@ +#---------------------------------------------------------------------------- +# Autoconf input script. Start the ./autgen.sh script for producing a +# the configure script. +#---------------------------------------------------------------------------- +AC_PREREQ([2.54]) + +AC_INIT([perceptioncrash], [0.0.0-svn], [per...@li...]) +AC_CONFIG_SRCDIR([src/main.cpp]) +AC_CONFIG_AUX_DIR([mk/autoconf]) + +AC_CANONICAL_BUILD +AC_CANONICAL_HOST +AC_CANONICAL_TARGET + +#---------------------------------------------------------------------------- +# Configuration header +#---------------------------------------------------------------------------- +AC_CONFIG_HEADERS(config.h) + +# stupid autoconf is adding default -g -O2 flags which we don't want :-/ +test ".$CFLAGS" = "." && CFLAGS=" " +test ".$CXXFLAGS" = "." && CXXFLAGS=" " + +#---------------------------------------------------------------------------- +# Check for operating system +#---------------------------------------------------------------------------- +AC_MSG_CHECKING([for target host]) +case $host_os in + mingw*|cygwin*) + AC_MSG_RESULT(WIN32) + AC_DEFINE([WIN32], [], [define when compiling for a win32 box]) + ;; + *) + AC_MSG_RESULT([assuming unix]) + AC_DEFINE([UNIX], [], [define when compiling for a unix/posix system]) + ;; +esac + +#---------------------------------------------------------------------------- +# Check for build variant (debug, profile, optimize) +#---------------------------------------------------------------------------- +VARIANT=optimize +AC_ARG_ENABLE([optimize], [AC_HELP_STRING([--enable-optimize], + [build with optimizations enabled (default YES)])], + [test "$enableval" = "yes" && VARIANT=optimize]) + +AC_ARG_ENABLE([debug], [AC_HELP_STRING([--enable-debug], + [build with debugging information (default NO)])], + [test "$enableval" = "yes" && VARIANT=debug]) + +AC_ARG_ENABLE([profile], [AC_HELP_STRING([--enable-profile], + [build with profiling information (default NO)])], + [test "$enableval" = "yes" && VARIANT=profile]) +AC_SUBST([VARIANT]) + +#---------------------------------------------------------------------------- +# find applications +#---------------------------------------------------------------------------- +AC_PROG_CXX +AC_PROG_INSTALL + +AC_DISABLE_STATIC # (we handle static libraries ourself) +#AC_PROG_LIBTOOL + +#---------------------------------------------------------------------------- +# find libraries +#---------------------------------------------------------------------------- +#AM_PATH_SDL([1.2.5]) + +PKG_CHECK_MODULES([OGRE], [OGRE >= 1.2.0]) +PKG_CHECK_MODULES([CEGUI], [CEGUI >= 0.4.1]) + +OGRE_LIBS="$OGRE_LIBS -lCEGUIOgreRenderer" +AC_SUBST([OGRE_LIBS]) + +NP_FINDLIB([CEGUIOGRERENDERER], [CEGUIOgreRenderer], [CEGUIOgreRenderer], + NP_LANG_PROGRAM([], + []), + [], [-lCEGUIOgreRenderer], + [], + [AC_MSG_ERROR([Unable to find libCEGUIOgreRenderer. Please check your Ogre3d installation.])], + [$OGRE_CFLAGS $CEGUI_CFLAGS], [$OGRE_LIBS $CEGUI_LIBS]) + +# do jam specific fixes +AC_INIT_JAM + +# finally output Jamconfig +AC_CONFIG_FILES([Jamconfig]) +AC_OUTPUT + +# a notice for the users +AC_MSG_NOTICE([ + +Please note that this project uses jam (and not make) as build tool. +]) + Added: trunk/perceptioncrash/src/Jamfile =================================================================== --- trunk/perceptioncrash/src/Jamfile (rev 0) +++ trunk/perceptioncrash/src/Jamfile 2006-05-17 01:51:13 UTC (rev 10) @@ -0,0 +1,24 @@ +SubDir TOP src ; + +# construct a new application target and use all .cpp and .hpp files in this +# directory as sources +sources = + [ Wildcard *.cpp *.hpp ] +; + +# We link with the samplelib from the same package +#LinkWith sample : sharedlib staticlib ; + +# If SDL is available we link with it and define SDL_AVAILABLE constant +#if $(SDL_LIBS) != "" || $(SDL_CFLAGS) != "" +#{ +# CFlags sample : -DSDL_AVAILABLE ; +# ExternalLibs sample : SDL ; +#} + +Application perceptioncrash : $(sources) ; +ExternalLibs perceptioncrash : OGRE CEGUI CEGUIOGRERENDERER ; + +# Construct a description for the help target +Help perceptioncrash : "Build the Perception Crash executable" ; + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <sik...@us...> - 2006-05-17 00:19:58
|
Revision: 9 Author: sik0fewl Date: 2006-05-16 17:19:51 -0700 (Tue, 16 May 2006) ViewCVS: http://svn.sourceforge.net/perceptioncrash/?rev=9&view=rev Log Message: ----------- Updating svn:ignore Property Changed: ---------------- trunk/perceptioncrash/ Property changes on: trunk/perceptioncrash ___________________________________________________________________ Name: svn:ignore - .sconsign ogre.log game + .sconsign ogre.log perceptioncrash This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <sik...@us...> - 2006-05-17 00:18:56
|
Revision: 8 Author: sik0fewl Date: 2006-05-16 17:18:48 -0700 (Tue, 16 May 2006) ViewCVS: http://svn.sourceforge.net/perceptioncrash/?rev=8&view=rev Log Message: ----------- Fix SCons file Modified Paths: -------------- trunk/perceptioncrash/SConstruct Modified: trunk/perceptioncrash/SConstruct =================================================================== --- trunk/perceptioncrash/SConstruct 2006-05-17 00:00:42 UTC (rev 7) +++ trunk/perceptioncrash/SConstruct 2006-05-17 00:18:48 UTC (rev 8) @@ -1,3 +1,5 @@ +# SCons build file for Linux + import glob # create build environment @@ -3,4 +5,8 @@ env = Environment() +# Get library flags +env.ParseConfig('pkg-config --cflags --libs OGRE') +env.ParseConfig('pkg-config --cflags --libs CEGUI') + # gather a list of source files SOURCES = glob.glob('src/*.cpp') @@ -10,11 +16,8 @@ env.Append(CCFLAGS = ['-g', '-Wall']) # add additional libraries to link against -env.Append(LIBS = ['OgreMain','CEGUIBase','CEGUIOgreRenderer']) +env.Append(LIBS = ['CEGUIOgreRenderer']) -# add additional include paths -env.Append(CPPPATH = ['/usr/local/include/OGRE']) - # build target # output executable will be "game" -env.Program(target = 'game', source = SOURCES) +env.Program(target = 'perceptioncrash', source = SOURCES) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <sik...@us...> - 2006-05-17 00:00:52
|
Revision: 7 Author: sik0fewl Date: 2006-05-16 17:00:42 -0700 (Tue, 16 May 2006) ViewCVS: http://svn.sourceforge.net/perceptioncrash/?rev=7&view=rev Log Message: ----------- Added Doxyfile for Doyxgen document generation Added Paths: ----------- trunk/perceptioncrash/Doxyfile trunk/perceptioncrash/doc/ Added: trunk/perceptioncrash/Doxyfile =================================================================== --- trunk/perceptioncrash/Doxyfile (rev 0) +++ trunk/perceptioncrash/Doxyfile 2006-05-17 00:00:42 UTC (rev 7) @@ -0,0 +1,235 @@ +# Doxyfile 1.4.6 + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = Perception Crash +PROJECT_NUMBER = SVN +OUTPUT_DIRECTORY = doc/doxygen +CREATE_SUBDIRS = NO +OUTPUT_LANGUAGE = English +USE_WINDOWS_ENCODING = NO +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ABBREVIATE_BRIEF = "The $name class" \ + "The $name widget" \ + "The $name file" \ + is \ + provides \ + specifies \ + contains \ + represents \ + a \ + an \ + the +ALWAYS_DETAILED_SEC = NO +INLINE_INHERITED_MEMB = NO +FULL_PATH_NAMES = YES +STRIP_FROM_PATH = +STRIP_FROM_INC_PATH = +SHORT_NAMES = NO +JAVADOC_AUTOBRIEF = YES +MULTILINE_CPP_IS_BRIEF = NO +DETAILS_AT_TOP = NO +INHERIT_DOCS = YES +SEPARATE_MEMBER_PAGES = NO +TAB_SIZE = 8 +ALIASES = +OPTIMIZE_OUTPUT_FOR_C = NO +OPTIMIZE_OUTPUT_JAVA = NO +BUILTIN_STL_SUPPORT = YES +DISTRIBUTE_GROUP_DOC = NO +SUBGROUPING = YES +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- +EXTRACT_ALL = YES +EXTRACT_PRIVATE = YES +EXTRACT_STATIC = YES +EXTRACT_LOCAL_CLASSES = YES +EXTRACT_LOCAL_METHODS = NO +HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_CLASSES = NO +HIDE_FRIEND_COMPOUNDS = NO +HIDE_IN_BODY_DOCS = NO +INTERNAL_DOCS = NO +CASE_SENSE_NAMES = YES +HIDE_SCOPE_NAMES = NO +SHOW_INCLUDE_FILES = YES +INLINE_INFO = YES +SORT_MEMBER_DOCS = YES +SORT_BRIEF_DOCS = NO +SORT_BY_SCOPE_NAME = NO +GENERATE_TODOLIST = YES +GENERATE_TESTLIST = YES +GENERATE_BUGLIST = YES +GENERATE_DEPRECATEDLIST= YES +ENABLED_SECTIONS = +MAX_INITIALIZER_LINES = 30 +SHOW_USED_FILES = YES +SHOW_DIRECTORIES = NO +FILE_VERSION_FILTER = +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- +QUIET = YES +WARNINGS = YES +WARN_IF_UNDOCUMENTED = YES +WARN_IF_DOC_ERROR = YES +WARN_NO_PARAMDOC = NO +WARN_FORMAT = "$file:$line: $text" +WARN_LOGFILE = +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = src/ +FILE_PATTERNS = *.cpp \ + *.hpp \ + *.h +RECURSIVE = YES +EXCLUDE = +EXCLUDE_SYMLINKS = NO +EXCLUDE_PATTERNS = +EXAMPLE_PATH = +EXAMPLE_PATTERNS = * +EXAMPLE_RECURSIVE = NO +IMAGE_PATH = +INPUT_FILTER = +FILTER_PATTERNS = +FILTER_SOURCE_FILES = NO +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- +SOURCE_BROWSER = YES +INLINE_SOURCES = YES +STRIP_CODE_COMMENTS = YES +REFERENCED_BY_RELATION = YES +REFERENCES_RELATION = YES +USE_HTAGS = NO +VERBATIM_HEADERS = YES +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- +ALPHABETICAL_INDEX = NO +COLS_IN_ALPHA_INDEX = 5 +IGNORE_PREFIX = +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- +GENERATE_HTML = YES +HTML_OUTPUT = html +HTML_FILE_EXTENSION = .html +HTML_HEADER = +HTML_FOOTER = +HTML_STYLESHEET = +HTML_ALIGN_MEMBERS = YES +GENERATE_HTMLHELP = NO +CHM_FILE = +HHC_LOCATION = +GENERATE_CHI = NO +BINARY_TOC = NO +TOC_EXPAND = NO +DISABLE_INDEX = NO +ENUM_VALUES_PER_LINE = 4 +GENERATE_TREEVIEW = YES +TREEVIEW_WIDTH = 250 +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- +GENERATE_LATEX = NO +LATEX_OUTPUT = latex +LATEX_CMD_NAME = latex +MAKEINDEX_CMD_NAME = makeindex +COMPACT_LATEX = NO +PAPER_TYPE = a4wide +EXTRA_PACKAGES = +LATEX_HEADER = +PDF_HYPERLINKS = NO +USE_PDFLATEX = NO +LATEX_BATCHMODE = NO +LATEX_HIDE_INDICES = NO +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- +GENERATE_RTF = NO +RTF_OUTPUT = rtf +COMPACT_RTF = NO +RTF_HYPERLINKS = NO +RTF_STYLESHEET_FILE = +RTF_EXTENSIONS_FILE = +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- +GENERATE_MAN = NO +MAN_OUTPUT = man +MAN_EXTENSION = .3 +MAN_LINKS = NO +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- +GENERATE_XML = NO +XML_OUTPUT = xml +XML_SCHEMA = +XML_DTD = +XML_PROGRAMLISTING = YES +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- +GENERATE_AUTOGEN_DEF = NO +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- +GENERATE_PERLMOD = NO +PERLMOD_LATEX = NO +PERLMOD_PRETTY = YES +PERLMOD_MAKEVAR_PREFIX = +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = NO +EXPAND_ONLY_PREDEF = NO +SEARCH_INCLUDES = YES +INCLUDE_PATH = +INCLUDE_FILE_PATTERNS = +PREDEFINED = +EXPAND_AS_DEFINED = +SKIP_FUNCTION_MACROS = YES +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- +TAGFILES = +GENERATE_TAGFILE = +ALLEXTERNALS = NO +EXTERNAL_GROUPS = YES +PERL_PATH = /usr/bin/perl +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- +CLASS_DIAGRAMS = NO +HIDE_UNDOC_RELATIONS = NO +HAVE_DOT = YES +CLASS_GRAPH = YES +COLLABORATION_GRAPH = YES +GROUP_GRAPHS = YES +UML_LOOK = NO +TEMPLATE_RELATIONS = YES +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +CALL_GRAPH = YES +GRAPHICAL_HIERARCHY = YES +DIRECTORY_GRAPH = YES +DOT_IMAGE_FORMAT = png +DOT_PATH = +DOTFILE_DIRS = +MAX_DOT_GRAPH_WIDTH = 1024 +MAX_DOT_GRAPH_HEIGHT = 1024 +MAX_DOT_GRAPH_DEPTH = 1000 +DOT_TRANSPARENT = NO +DOT_MULTI_TARGETS = YES +GENERATE_LEGEND = YES +DOT_CLEANUP = YES +#--------------------------------------------------------------------------- +# Configuration::additions related to the search engine +#--------------------------------------------------------------------------- +SEARCHENGINE = NO This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <sik...@us...> - 2006-05-16 23:30:18
|
Revision: 6 Author: sik0fewl Date: 2006-05-16 16:30:10 -0700 (Tue, 16 May 2006) ViewCVS: http://svn.sourceforge.net/perceptioncrash/?rev=6&view=rev Log Message: ----------- Testing commit hook script Modified Paths: -------------- trunk/perceptioncrash/README Modified: trunk/perceptioncrash/README =================================================================== --- trunk/perceptioncrash/README 2006-05-16 17:36:41 UTC (rev 5) +++ trunk/perceptioncrash/README 2006-05-16 23:30:10 UTC (rev 6) @@ -0,0 +1,2 @@ +Website: http://perceptioncrash.sourceforge.net/ +Project page: http://sourceforge.net/project/perceptioncrash/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |