rpms/chess/devel chess-ogre14.patch,NONE,1.1
Hans de Goede (jwrdegoede)
fedora-extras-commits at redhat.com
Sun Jul 1 20:35:05 UTC 2007
- Previous message: rpms/chess/devel .cvsignore, 1.2, 1.3 chess.spec, 1.6, 1.7 sources, 1.2, 1.3
- Next message: rpms/libqalculate/devel .cvsignore, 1.8, 1.9 libqalculate.spec, 1.13, 1.14 sources, 1.8, 1.9
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Author: jwrdegoede
Update of /cvs/extras/rpms/chess/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv17964
Added Files:
chess-ogre14.patch
Log Message:
* Sun Jul 1 2007 Hans de Goede <j.w.r.degoede at hhs.nl> 1.0-6
- Port to Ogre 1.4.x + OIS
chess-ogre14.patch:
--- NEW FILE chess-ogre14.patch ---
diff -up chess-1.0/include/State.h.ogre14 chess-1.0/include/State.h
--- chess-1.0/include/State.h.ogre14 2007-07-01 21:47:18.000000000 +0200
+++ chess-1.0/include/State.h 2007-07-01 21:47:18.000000000 +0200
@@ -18,6 +18,10 @@
#ifndef STATE_H
#define STATE_H
+#include <OIS.h>
+
+using namespace OIS;
+
class State
{
public:
@@ -42,19 +46,17 @@ protected:
public:
// Key events
- virtual void keyClicked(KeyEvent *e);
- virtual void keyPressed(KeyEvent *e);
- virtual void keyReleased(KeyEvent *e);
+ virtual void keyPressed(const KeyEvent &e);
+ virtual void keyReleased(const KeyEvent &e);
virtual void keyRepeated(int kc);
protected:
bool isKeyDown(KeyCode kc) const;
public:
// Mouse events
- virtual void mouseMoved(MouseEvent *e);
- virtual void mouseDragged(MouseEvent *e);
- virtual void mousePressed(MouseEvent *e);
- virtual void mouseReleased(MouseEvent *e);
+ virtual void mouseMoved(const MouseEvent &e);
+ virtual void mousePressed(const MouseEvent &e);
+ virtual void mouseReleased(const MouseEvent &e);
};
#endif
diff -up chess-1.0/include/stdafx.h.ogre14 chess-1.0/include/stdafx.h
--- chess-1.0/include/stdafx.h.ogre14 2007-07-01 21:47:18.000000000 +0200
+++ chess-1.0/include/stdafx.h 2007-07-01 21:47:18.000000000 +0200
@@ -35,8 +35,6 @@
#include "OgreMemoryMacros.h"
#include <Ogre.h>
-#include <OgreKeyEvent.h>
-#include <OgreEventListeners.h>
using namespace Ogre;
diff -up chess-1.0/include/GameMenuState.h.ogre14 chess-1.0/include/GameMenuState.h
--- chess-1.0/include/GameMenuState.h.ogre14 2007-07-01 21:47:18.000000000 +0200
+++ chess-1.0/include/GameMenuState.h 2007-07-01 21:47:18.000000000 +0200
@@ -26,7 +26,7 @@ public:
GameMenuState();
// State overrides
- virtual void keyPressed(KeyEvent* e);
+ virtual void keyPressed(const KeyEvent & e);
protected:
virtual void onSelected(MenuItemList::iterator item);
diff -up chess-1.0/include/GameState.h.ogre14 chess-1.0/include/GameState.h
--- chess-1.0/include/GameState.h.ogre14 2007-07-01 21:47:18.000000000 +0200
+++ chess-1.0/include/GameState.h 2007-07-01 21:47:18.000000000 +0200
@@ -21,7 +21,7 @@
#include "ChessState.h"
class Piece;
-class InputManager;
+class ChessInputManager;
class GameState : public ChessState
{
@@ -31,11 +31,10 @@ public:
// State overrides
virtual void pause();
virtual void resume();
- virtual void keyPressed(KeyEvent* e);
- virtual void mouseMoved(MouseEvent* e);
- virtual void mouseDragged(MouseEvent* e);
- virtual void mousePressed(MouseEvent* e);
- virtual void mouseReleased(MouseEvent* e);
+ virtual void keyPressed(const KeyEvent & e);
+ virtual void mouseMoved(const MouseEvent & e);
+ virtual void mousePressed(const MouseEvent & e);
+ virtual void mouseReleased(const MouseEvent & e);
virtual void frameStarted(Real dt);
protected:
@@ -48,7 +47,7 @@ protected:
Ogre::Plane *mPlane;
Piece *mSelectedPiece;
SceneManager *mSceneManager;
- InputManager *mInputManager;
+ ChessInputManager *mInputManager;
bool mPieceSelected;
int mCurrentPosition;
diff -up chess-1.0/include/MenuState.h.ogre14 chess-1.0/include/MenuState.h
--- chess-1.0/include/MenuState.h.ogre14 2007-07-01 21:47:18.000000000 +0200
+++ chess-1.0/include/MenuState.h 2007-07-01 21:47:18.000000000 +0200
@@ -29,9 +29,9 @@ public:
virtual void initialize();
virtual void cleanup();
virtual void frameStarted(Real dt);
- virtual void keyPressed(KeyEvent *e);
+ virtual void keyPressed(const KeyEvent &e);
virtual void keyRepeated(int kc);
- virtual void mouseMoved(MouseEvent* e);
+ virtual void mouseMoved(const MouseEvent & e);
protected:
typedef std::vector<OverlayElement*> MenuItemList;
diff -up chess-1.0/include/ChessState.h.ogre14 chess-1.0/include/ChessState.h
--- chess-1.0/include/ChessState.h.ogre14 2007-07-01 21:47:18.000000000 +0200
+++ chess-1.0/include/ChessState.h 2007-07-01 21:47:18.000000000 +0200
@@ -30,8 +30,8 @@ public:
ChessState() : mGameOGRE(0), mGameAI(0) {}
// State overrides
virtual void initialize();
- virtual void keyPressed(KeyEvent* e);
- virtual void mouseMoved(MouseEvent* e);
+ virtual void keyPressed(const KeyEvent & e);
+ virtual void mouseMoved(const MouseEvent & e);
virtual void frameStarted(Real dt);
virtual void frameEnded(Real dt);
diff -up chess-1.0/include/StateManager.h.ogre14 chess-1.0/include/StateManager.h
--- chess-1.0/include/StateManager.h.ogre14 2007-07-01 21:47:18.000000000 +0200
+++ chess-1.0/include/StateManager.h 2007-07-01 22:02:13.000000000 +0200
@@ -18,18 +18,21 @@
#ifndef STATEMANAGER_H
#define STATEMANAGER_H
-#include <OgreKeyEvent.h>
-#include <OgreEventListeners.h>
+#include <OIS.h>
+
+using namespace OIS;
class State;
class StateManager : public FrameListener, public KeyListener, public MouseListener,
- public MouseMotionListener, public Singleton<StateManager>
+ public Singleton<StateManager>
{
public:
// Creation/destruction
StateManager(RenderWindow* window);
virtual ~StateManager();
+
+ void capture();
public:
// State management
@@ -45,24 +48,18 @@ public:
public:
// KeyListener overrides
- virtual void keyClicked(KeyEvent *e);
- virtual void keyPressed(KeyEvent *e);
- virtual void keyReleased(KeyEvent *e);
+ virtual bool keyPressed(const KeyEvent &e);
+ virtual bool keyReleased(const KeyEvent &e);
void setKeyRepeatDelay(Real initial = 0.15, Real continous = 0.05);
public:
- // MouseMotionListener overrides
- virtual void mouseMoved(MouseEvent *e);
- virtual void mouseDragged(MouseEvent *e);
- // MouseListener overrides
- virtual void mousePressed(MouseEvent *e);
- virtual void mouseReleased(MouseEvent *e);
- virtual void mouseClicked(MouseEvent* e) {}
- virtual void mouseEntered(MouseEvent* e) {}
- virtual void mouseExited(MouseEvent* e) {}
+ // MouseListener overrides
+ virtual bool mousePressed(const MouseEvent &e, MouseButtonID id );
+ virtual bool mouseReleased(const MouseEvent &e, MouseButtonID id );
+ virtual bool mouseMoved(const MouseEvent &e);
- EventProcessor* mEventProcessor;
+ Keyboard *mKeyboard;
protected:
RenderWindow* mWindow;
@@ -72,6 +69,9 @@ protected:
Real mContinousKeyRepeatDelay;
int mRepeatKey;
Real mRepeatKeyDelay;
+
+ InputManager *m_ois;
+ Mouse *mMouse;
};
#endif
diff -up chess-1.0/include/HelpState.h.ogre14 chess-1.0/include/HelpState.h
--- chess-1.0/include/HelpState.h.ogre14 2007-07-01 21:47:18.000000000 +0200
+++ chess-1.0/include/HelpState.h 2007-07-01 21:47:18.000000000 +0200
@@ -26,7 +26,7 @@ public:
HelpState();
// State overrides
- virtual void keyPressed(KeyEvent* e);
+ virtual void keyPressed(const KeyEvent & e);
};
#endif
diff -up chess-1.0/include/InputManager.h.ogre14 chess-1.0/include/InputManager.h
--- chess-1.0/include/InputManager.h.ogre14 2007-07-01 21:47:18.000000000 +0200
+++ chess-1.0/include/InputManager.h 2007-07-01 21:47:18.000000000 +0200
@@ -20,11 +20,11 @@
class Piece;
-class InputManager : public Ogre::Singleton<InputManager>
+class ChessInputManager : public Ogre::Singleton<ChessInputManager>
{
public:
- InputManager();
- virtual ~InputManager();
+ ChessInputManager();
+ virtual ~ChessInputManager();
void ShowSelectionNode(SceneNode *node);
void HideSelectionNode(void);
diff -up chess-1.0/include/ChessApplication.h.ogre14 chess-1.0/include/ChessApplication.h
--- chess-1.0/include/ChessApplication.h.ogre14 2007-07-01 21:47:18.000000000 +0200
+++ chess-1.0/include/ChessApplication.h 2007-07-01 21:47:18.000000000 +0200
@@ -21,7 +21,7 @@
#include "Application.h"
class StateManager;
-class InputManager;
+class ChessInputManager;
class GameOGRE;
class GameAI;
@@ -60,7 +60,7 @@ protected:
Viewport *mPlayerViewport, *mMenuViewport, *mMessageViewport;
Overlay *mMenuOverlay, *mDebugOverlay, *mMessageOverlay;
StateManager* mStateManager;
- InputManager* mInputManager;
+ ChessInputManager* mInputManager;
GameOGRE* mGameOGRE;
GameAI* mGameAI;
SceneNode* mGameRoot;
diff -up chess-1.0/include/GameOverState.h.ogre14 chess-1.0/include/GameOverState.h
--- chess-1.0/include/GameOverState.h.ogre14 2007-07-01 21:47:18.000000000 +0200
+++ chess-1.0/include/GameOverState.h 2007-07-01 21:47:18.000000000 +0200
@@ -26,7 +26,7 @@ public:
GameOverState();
// State overrides
- virtual void keyPressed(KeyEvent* e);
+ virtual void keyPressed(const KeyEvent & e);
void DisplayResult(const String outcome, const String winner);
};
diff -up chess-1.0/src/GameMenuState.cpp.ogre14 chess-1.0/src/GameMenuState.cpp
--- chess-1.0/src/GameMenuState.cpp.ogre14 2005-05-11 15:01:40.000000000 +0200
+++ chess-1.0/src/GameMenuState.cpp 2007-07-01 21:47:18.000000000 +0200
@@ -37,9 +37,9 @@ GameMenuState::GameMenuState()
}
// State overrides
-void GameMenuState::keyPressed(KeyEvent* e)
+void GameMenuState::keyPressed(const KeyEvent & e)
{
- if (e->getKey() == KC_ESCAPE)
+ if (e.key == KC_ESCAPE)
StateManager::getSingleton().popState();
else
MenuState::keyPressed(e);
diff -up chess-1.0/src/GameOverState.cpp.ogre14 chess-1.0/src/GameOverState.cpp
--- chess-1.0/src/GameOverState.cpp.ogre14 2005-05-10 20:01:00.000000000 +0200
+++ chess-1.0/src/GameOverState.cpp 2007-07-01 21:47:18.000000000 +0200
@@ -35,7 +35,7 @@ void GameOverState::DisplayResult(const
overlayManager->getOverlayElement("GameOverMenu/Winner")->setCaption(winner);
}
-void GameOverState::keyPressed(KeyEvent* e)
+void GameOverState::keyPressed(const KeyEvent & e)
{
ChessState::keyPressed(e);
// Return to main menu
diff -up chess-1.0/src/StateManager.cpp.ogre14 chess-1.0/src/StateManager.cpp
--- chess-1.0/src/StateManager.cpp.ogre14 2005-05-10 20:01:02.000000000 +0200
+++ chess-1.0/src/StateManager.cpp 2007-07-01 22:10:00.000000000 +0200
@@ -27,18 +27,23 @@ StateManager::StateManager(RenderWindow*
: mWindow(window), mRunning(true), mRepeatKey(-1),
mInitialRepeatKeyDelay(0.15), mContinousKeyRepeatDelay(0.05)
{
+ OIS::ParamList pl;
+ unsigned long hWnd;
+
// Register frame listener
Root::getSingleton().addFrameListener(this);
- // Create event processor
- mEventProcessor = new EventProcessor();
- mEventProcessor->initialise(mWindow);
- mEventProcessor->startProcessingEvents();
-
- // Register event listeners
- mEventProcessor->addKeyListener(this);
- mEventProcessor->addMouseMotionListener(this);
- mEventProcessor->addMouseListener(this);
+ window->getCustomAttribute("WINDOW", &hWnd);
+ pl.insert(ParamList::value_type("WINDOW", StringConverter::toString(hWnd)));
+ m_ois = InputManager::createInputSystem(pl);
+
+ mMouse = static_cast<Mouse*>(m_ois->createInputObject(OISMouse, true));
+ mKeyboard = static_cast<Keyboard*>(m_ois->createInputObject(OISKeyboard, true));
+ mMouse->setEventCallback(this);
+ mKeyboard->setEventCallback(this);
+ const MouseState &ms = mMouse->getMouseState();
+ ms.width = window->getWidth();
+ ms.height = window->getHeight();
}
StateManager::~StateManager()
@@ -51,17 +56,24 @@ StateManager::~StateManager()
}
// Unregister event listeners
- mEventProcessor->removeKeyListener(this);
- mEventProcessor->removeMouseMotionListener(this);
- mEventProcessor->removeMouseListener(this);
-
+ if (mMouse)
+ delete mMouse;
+ if (mKeyboard)
+ delete mKeyboard;
+
// Destroy event processor
- delete mEventProcessor;
+ InputManager::destroyInputSystem(m_ois);
// Unregister frame listener
Root::getSingleton().removeFrameListener(this);
}
+void StateManager::capture()
+{
+ mMouse->capture();
+ mKeyboard->capture();
+}
+
// State management
void StateManager::changeState(State* state)
{
@@ -138,28 +150,25 @@ bool StateManager::frameEnded(const Fram
}
// KeyListener overrides
-void StateManager::keyClicked(KeyEvent *e)
-{
- mStateStack.back()->keyClicked(e);
-}
-
-void StateManager::keyPressed(KeyEvent *e)
+bool StateManager::keyPressed(const KeyEvent &e)
{
mStateStack.back()->keyPressed(e);
// Start repeating key
- mRepeatKey = e->getKey();
+ mRepeatKey = e.key;
mRepeatKeyDelay = mInitialRepeatKeyDelay;
mStateStack.back()->keyRepeated(mRepeatKey);
+ return true;
}
-void StateManager::keyReleased(KeyEvent *e)
+bool StateManager::keyReleased(const KeyEvent &e)
{
mStateStack.back()->keyReleased(e);
// Stop repeating key
- if (e->getKey() == mRepeatKey)
+ if (e.key == mRepeatKey)
mRepeatKey = -1;
+ return true;
}
void StateManager::setKeyRepeatDelay(Real initial, Real continous)
@@ -169,22 +178,20 @@ void StateManager::setKeyRepeatDelay(Rea
}
// MouseMotionListener overrides
-void StateManager::mouseMoved(MouseEvent *e)
+bool StateManager::mouseMoved(const MouseEvent &e)
{
mStateStack.back()->mouseMoved(e);
+ return true;
}
-void StateManager::mouseDragged(MouseEvent *e)
-{
- mStateStack.back()->mouseDragged(e);
-}
-
-void StateManager::mousePressed(MouseEvent *e)
+bool StateManager::mousePressed(const MouseEvent &e, MouseButtonID id)
{
mStateStack.back()->mousePressed(e);
+ return true;
}
-void StateManager::mouseReleased(MouseEvent *e)
+bool StateManager::mouseReleased(const MouseEvent &e, MouseButtonID id)
{
mStateStack.back()->mouseReleased(e);
+ return true;
}
diff -up chess-1.0/src/ChessState.cpp.ogre14 chess-1.0/src/ChessState.cpp
--- chess-1.0/src/ChessState.cpp.ogre14 2005-05-10 20:01:00.000000000 +0200
+++ chess-1.0/src/ChessState.cpp 2007-07-01 22:04:15.000000000 +0200
@@ -30,16 +30,16 @@ void ChessState::initialize()
mApplication = static_cast<ChessApplication*>(Application::getSingletonPtr());
}
-void ChessState::mouseMoved(MouseEvent* e)
+void ChessState::mouseMoved(const MouseEvent & e)
{
// Update CEGUI with the mouse motion
- CEGUI::System::getSingleton().injectMouseMove(e->getRelX() * mApplication->getGUIRenderer()->getWidth(), e->getRelY() * mApplication->getGUIRenderer()->getHeight());
+ CEGUI::System::getSingleton().injectMouseMove(e.state.X.rel, e.state.Y.rel);
}
-void ChessState::keyPressed(KeyEvent* e)
+void ChessState::keyPressed(const KeyEvent & e)
{
// Handle keys common to all game states
- switch (e->getKey())
+ switch (e.key)
{
case KC_F12:
{
diff -up chess-1.0/src/MenuState.cpp.ogre14 chess-1.0/src/MenuState.cpp
--- chess-1.0/src/MenuState.cpp.ogre14 2005-05-10 20:01:00.000000000 +0200
+++ chess-1.0/src/MenuState.cpp 2007-07-01 21:47:18.000000000 +0200
@@ -53,9 +53,9 @@ void MenuState::frameStarted(Real dt)
ChessState::frameStarted(dt);
}
-void MenuState::keyPressed(KeyEvent *e)
+void MenuState::keyPressed(const KeyEvent &e)
{
- switch (e->getKey())
+ switch (e.key)
{
case KC_RETURN:
case KC_NUMPADENTER:
@@ -93,7 +93,7 @@ void MenuState::keyRepeated(int kc)
}
}
-void MenuState::mouseMoved(MouseEvent* e)
+void MenuState::mouseMoved(const MouseEvent & e)
{
ChessState::mouseMoved(e);
}
diff -up chess-1.0/src/InputManager.cpp.ogre14 chess-1.0/src/InputManager.cpp
--- chess-1.0/src/InputManager.cpp.ogre14 2007-07-01 21:47:18.000000000 +0200
+++ chess-1.0/src/InputManager.cpp 2007-07-01 21:47:18.000000000 +0200
@@ -22,9 +22,9 @@
#include "ChessApplication.h"
// Singleton instance
-template<> InputManager* Singleton<InputManager>::ms_Singleton = 0;
+template<> ChessInputManager* Singleton<ChessInputManager>::ms_Singleton = 0;
-InputManager::InputManager(void) : mSelectionEntity(0), mSelectionNode(0), mCurrentEntity(0), mCurrentNode(0)
+ChessInputManager::ChessInputManager(void) : mSelectionEntity(0), mSelectionNode(0), mCurrentEntity(0), mCurrentNode(0)
{
// keep a pointer to the scene manager for quickness-sake
mSceneManager = static_cast<Application*>(Application::getSingletonPtr())->getSceneManager();
@@ -54,7 +54,7 @@ InputManager::InputManager(void) : mSele
mCurrentNode->setVisible(false);
}
-InputManager::~InputManager()
+ChessInputManager::~ChessInputManager()
{
delete mPlane;
@@ -82,7 +82,7 @@ InputManager::~InputManager()
}
}
-void InputManager::ShowSelectionNode(SceneNode *node)
+void ChessInputManager::ShowSelectionNode(SceneNode *node)
{
// move the node
mSelectionNode->setPosition(node->getPosition());
@@ -94,12 +94,12 @@ void InputManager::ShowSelectionNode(Sce
HideCurrentNode();
}
-void InputManager::HideSelectionNode(void)
+void ChessInputManager::HideSelectionNode(void)
{
mSelectionNode->setVisible(false);
}
-void InputManager::ShowCurrentNode(Vector3 position, Piece* thePiece, int& currentPosition)
+void ChessInputManager::ShowCurrentNode(Vector3 position, Piece* thePiece, int& currentPosition)
{
Vector3 showPos;
int pos;
@@ -130,12 +130,12 @@ void InputManager::ShowCurrentNode(Vecto
currentPosition = pos;
}
-void InputManager::HideCurrentNode(void)
+void ChessInputManager::HideCurrentNode(void)
{
mCurrentNode->setVisible(false);
}
-void InputManager::Update(Real dt)
+void ChessInputManager::Update(Real dt)
{
// rotate the entity
if (mSelectionNode != 0)
diff -up chess-1.0/src/State.cpp.ogre14 chess-1.0/src/State.cpp
--- chess-1.0/src/State.cpp.ogre14 2005-05-10 20:01:02.000000000 +0200
+++ chess-1.0/src/State.cpp 2007-07-01 21:47:18.000000000 +0200
@@ -38,19 +38,17 @@ void State::changeState(State* state)
}
// Key events
-void State::keyClicked(KeyEvent *e) {}
-void State::keyPressed(KeyEvent *e) {}
-void State::keyReleased(KeyEvent *e) {}
+void State::keyPressed(const KeyEvent &e) {}
+void State::keyReleased(const KeyEvent &e) {}
void State::keyRepeated(int kc) {}
bool State::isKeyDown(KeyCode kc) const
{
- InputReader* inputReader = StateManager::getSingleton().mEventProcessor->getInputReader();
- return inputReader->isKeyDown(kc);
+ Keyboard * keyboard = StateManager::getSingleton().mKeyboard;
+ return keyboard->isKeyDown(kc);
}
// Mouse events
-void State::mouseMoved(MouseEvent *e) {}
-void State::mouseDragged(MouseEvent *e) {}
-void State::mousePressed(MouseEvent *e) {}
-void State::mouseReleased(MouseEvent *e) {}
+void State::mouseMoved(const MouseEvent &e) {}
+void State::mousePressed(const MouseEvent &e) {}
+void State::mouseReleased(const MouseEvent &e) {}
diff -up chess-1.0/src/GameState.cpp.ogre14 chess-1.0/src/GameState.cpp
--- chess-1.0/src/GameState.cpp.ogre14 2005-05-11 22:36:32.000000000 +0200
+++ chess-1.0/src/GameState.cpp 2007-07-01 22:07:39.000000000 +0200
@@ -30,7 +30,7 @@ GameState::GameState() : mLMouseDown(fal
{
// get some pointers
mSceneManager = static_cast<ChessApplication*>(ChessApplication::getSingletonPtr())->getSceneManager();
- mInputManager = InputManager::getSingletonPtr();
+ mInputManager = ChessInputManager::getSingletonPtr();
// Create RaySceneQuery
mRaySceneQuery = mSceneManager->createRayQuery(Ogre::Ray());
@@ -67,10 +67,10 @@ void GameState::resume()
mGameOGRE->mCameraWantedPitch = mSavedCameraPitch;
}
-void GameState::keyPressed(KeyEvent* e)
+void GameState::keyPressed(const KeyEvent & e)
{
// Handle keys common to all game states
- switch (e->getKey())
+ switch (e.key)
{
case KC_ESCAPE:
StateManager::getSingleton().pushState(GameMenuState::getSingletonPtr());
@@ -82,7 +82,7 @@ void GameState::keyPressed(KeyEvent* e)
}
}
-void GameState::mouseMoved(MouseEvent* e)
+void GameState::mouseMoved(const MouseEvent & e)
{
// update the mouse pointer
ChessState::mouseMoved(e);
@@ -93,7 +93,7 @@ void GameState::mouseMoved(MouseEvent* e
const Real minDistance = 22.5;
const Real maxDistance = 500;
- mGameOGRE->mCameraWantedDistance -= 100.0*e->getRelZ();
+ mGameOGRE->mCameraWantedDistance -= e.state.Z.rel;
if (mGameOGRE->mCameraWantedDistance < minDistance)
mGameOGRE->mCameraWantedDistance = minDistance;
@@ -101,6 +101,25 @@ void GameState::mouseMoved(MouseEvent* e
if (mGameOGRE->mCameraWantedDistance > maxDistance)
mGameOGRE->mCameraWantedDistance = maxDistance;
+ if (mRMouseDown)
+ {
+ const Real maxYaw = 0.45*Math::PI;
+ const Real maxPitch = 0.05*Math::PI;
+ const Real minPitch = 0.45*Math::PI;
+
+ // Adjust and clamp wanted camera yaw
+ mGameOGRE->mCameraWantedYaw -= e.state.X.rel;
+
+ // Adjust and clamp wanted camera pitch
+ mGameOGRE->mCameraWantedPitch -= e.state.Y.rel;
+
+ if (mGameOGRE->mCameraWantedPitch > -Radian(maxPitch).valueDegrees()) {
+ mGameOGRE->mCameraWantedPitch = -Radian(maxPitch).valueDegrees();
+ } else if (mGameOGRE->mCameraWantedPitch < -Radian(minPitch).valueDegrees()) {
+ mGameOGRE->mCameraWantedPitch = -Radian(minPitch).valueDegrees();
+ }
+ }
+
// move the current position
if (!mGameAI->IsCurrentPlayerAI() && mPieceSelected)
{
@@ -122,39 +141,14 @@ void GameState::mouseMoved(MouseEvent* e
static_cast<ChessApplication*>(ChessApplication::getSingletonPtr())->DetachRootNode();
}
-void GameState::mouseDragged(MouseEvent* e)
-{
- // Update CEGUI with the mouse motion
- ChessState::mouseMoved(e);
-
- if (mRMouseDown)
- {
- const Real maxYaw = 0.45*Math::PI;
- const Real maxPitch = 0.05*Math::PI;
- const Real minPitch = 0.45*Math::PI;
-
- // Adjust and clamp wanted camera yaw
- mGameOGRE->mCameraWantedYaw -= 100*e->getRelX();
-
- // Adjust and clamp wanted camera pitch
- mGameOGRE->mCameraWantedPitch -= 100*e->getRelY();
-
- if (mGameOGRE->mCameraWantedPitch > -Radian(maxPitch).valueDegrees()) {
- mGameOGRE->mCameraWantedPitch = -Radian(maxPitch).valueDegrees();
- } else if (mGameOGRE->mCameraWantedPitch < -Radian(minPitch).valueDegrees()) {
- mGameOGRE->mCameraWantedPitch = -Radian(minPitch).valueDegrees();
- }
- }
-}
-
-void GameState::mousePressed(MouseEvent* e)
+void GameState::mousePressed(const MouseEvent & e)
{
- if (e->getButtonID() & InputEvent::BUTTON0_MASK)
+ if (e.state.buttonDown(MB_Left))
mLMouseDown = true;
else
mLMouseDown = false;
- if (e->getButtonID() & InputEvent::BUTTON1_MASK)
+ if (e.state.buttonDown(MB_Right))
mRMouseDown = true;
else
mRMouseDown = false;
@@ -225,12 +219,12 @@ void GameState::mousePressed(MouseEvent*
static_cast<ChessApplication*>(ChessApplication::getSingletonPtr())->DetachRootNode();
}
-void GameState::mouseReleased(MouseEvent* e)
+void GameState::mouseReleased(const MouseEvent & e)
{
- if (e->getButtonID() & InputEvent::BUTTON0_MASK)
+ if (!e.state.buttonDown(MB_Left))
mLMouseDown = false;
- if (e->getButtonID() & InputEvent::BUTTON1_MASK)
+ if (!e.state.buttonDown(MB_Right))
mRMouseDown = false;
}
@@ -241,4 +235,4 @@ void GameState::frameStarted(Real dt)
// do base class
ChessState::frameStarted(dt);
-}
\ No newline at end of file
+}
diff -up chess-1.0/src/ChessApplication.cpp.ogre14 chess-1.0/src/ChessApplication.cpp
--- chess-1.0/src/ChessApplication.cpp.ogre14 2007-07-01 21:47:18.000000000 +0200
+++ chess-1.0/src/ChessApplication.cpp 2007-07-01 21:47:18.000000000 +0200
@@ -53,7 +53,7 @@ void ChessApplication::preStartRendering
// Create managers and game object
mStateManager = new StateManager(mWindow);
- mInputManager = new InputManager();
+ mInputManager = new ChessInputManager();
mGameAI = new GameAI();
mGameOGRE = new GameOGRE(mPlayerCamera, mReflectCamera, mReflectCameraGround, mSceneManager, mWindow);
}
@@ -315,6 +315,7 @@ void ChessApplication::postViewportUpdat
// render target events
void ChessApplication::preRenderTargetUpdate(const RenderTargetEvent& evt)
{
+ mStateManager->capture();
AttachRootNode();
}
diff -up chess-1.0/src/HelpState.cpp.ogre14 chess-1.0/src/HelpState.cpp
--- chess-1.0/src/HelpState.cpp.ogre14 2005-05-10 20:01:00.000000000 +0200
+++ chess-1.0/src/HelpState.cpp 2007-07-01 21:47:18.000000000 +0200
@@ -30,7 +30,7 @@ HelpState::HelpState()
mMenuOverlay = static_cast<Overlay*>(OverlayManager::getSingleton().getByName("Menu/HelpMenu"));
}
-void HelpState::keyPressed(KeyEvent* e)
+void HelpState::keyPressed(const KeyEvent & e)
{
ChessState::keyPressed(e);
diff -up chess-1.0/media/gui/tahoma-12.font.ogre14 chess-1.0/media/gui/tahoma-12.font
--- chess-1.0/media/gui/tahoma-12.font.ogre14 2007-07-01 21:47:18.000000000 +0200
+++ chess-1.0/media/gui/tahoma-12.font 2007-07-01 21:47:18.000000000 +0200
@@ -1,2 +1,2 @@
<?xml version="1.0" ?>
-<Font Name="Tahoma-12" Filename="/usr/share/fonts/bitstream-vera/Vera.ttf" Type="Dynamic" Size="12" NativeHorzRes="800" NativeVertRes="600" AutoScaled="true"/>
+<Font Name="Tahoma-12" Filename="/usr/share/fonts/bitstream-vera/Vera.ttf" Type="FreeType" Size="12" NativeHorzRes="800" NativeVertRes="600" AutoScaled="true"/>
diff -up chess-1.0/Makefile.ogre14 chess-1.0/Makefile
--- chess-1.0/Makefile.ogre14 2007-07-01 21:47:18.000000000 +0200
+++ chess-1.0/Makefile 2007-07-01 21:47:18.000000000 +0200
@@ -2,10 +2,10 @@ PREFIX = /home/opt
DATADIR = $(PREFIX)/share/$(TARGET)
OPTFLAGS= -g -Wall -O2
CFLAGS = $(OPTFLAGS) -Iinclude $(shell pkg-config --cflags OGRE) \
- -I/usr/include/coldet
+ $(shell pkg-config --cflags OIS) -I/usr/include/coldet
CXXFLAGS= $(CFLAGS)
-LDFLAGS = $(shell pkg-config --libs OGRE) \
- $(shell pkg-config --libs CEGUI-OGRE) -lcoldet -lboost_thread
+LDFLAGS = $(shell pkg-config --libs OGRE) -lcoldet -lboost_thread \
+ $(shell pkg-config --libs CEGUI-OGRE) $(shell pkg-config --libs OIS)
DEFINES = -DDATADIR=\"$(DATADIR)/\"
OBJS = src/AISearchAgent.o src/AISearchAgentAlphabeta.o \
- Previous message: rpms/chess/devel .cvsignore, 1.2, 1.3 chess.spec, 1.6, 1.7 sources, 1.2, 1.3
- Next message: rpms/libqalculate/devel .cvsignore, 1.8, 1.9 libqalculate.spec, 1.13, 1.14 sources, 1.8, 1.9
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the scm-commits
mailing list