forked from teamnwah/openmw-tes3coop
added navigation mode selection
This commit is contained in:
parent
526d75df51
commit
8f73cc9268
4 changed files with 48 additions and 14 deletions
|
@ -15,7 +15,7 @@ namespace CSVRender
|
|||
: QWidget(parent)
|
||||
, mWindow(NULL)
|
||||
, mCamera(NULL)
|
||||
, mSceneMgr(NULL), mNavigationMode (NavigationMode_Free), mUpdate (false)
|
||||
, mSceneMgr(NULL), mNavigationMode (NavigationMode_1stPerson), mUpdate (false)
|
||||
, mKeyForward (false), mKeyBackward (false), mKeyLeft (false), mKeyRight (false)
|
||||
, mFast (false), mDragging (false), mMod1 (false)
|
||||
, mMouseSensitivity (2), mFastFactor (4) /// \todo make these configurable
|
||||
|
@ -94,6 +94,15 @@ namespace CSVRender
|
|||
Ogre::Root::getSingleton().destroyRenderTarget(mWindow);
|
||||
}
|
||||
|
||||
void SceneWidget::setNavigationMode (NavigationMode mode)
|
||||
{
|
||||
if (mode!=mNavigationMode)
|
||||
{
|
||||
mNavigationMode = mode;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void SceneWidget::paintEvent(QPaintEvent* e)
|
||||
{
|
||||
if (!mWindow)
|
||||
|
|
|
@ -20,14 +20,18 @@ namespace CSVRender
|
|||
|
||||
enum NavigationMode
|
||||
{
|
||||
NavigationMode_Free
|
||||
NavigationMode_1stPerson,
|
||||
NavigationMode_Free,
|
||||
NavigationMode_Orbit
|
||||
};
|
||||
|
||||
SceneWidget(QWidget *parent);
|
||||
virtual ~SceneWidget(void);
|
||||
virtual ~SceneWidget();
|
||||
|
||||
QPaintEngine* paintEngine() const;
|
||||
|
||||
void setNavigationMode (NavigationMode mode);
|
||||
|
||||
private:
|
||||
void paintEvent(QPaintEvent* e);
|
||||
void resizeEvent(QResizeEvent* e);
|
||||
|
|
|
@ -32,20 +32,21 @@ CSVWorld::SceneSubView::SceneSubView (const CSMWorld::UniversalId& id, CSMDoc::D
|
|||
layout2->setContentsMargins (QMargins (0, 0, 0, 0));
|
||||
|
||||
SceneToolbar *toolbar = new SceneToolbar (48, this);
|
||||
// test
|
||||
SceneToolMode *tool = new SceneToolMode (toolbar);
|
||||
tool->addButton (":door.png", "a");
|
||||
tool->addButton (":GMST.png", "b");
|
||||
tool->addButton (":Info.png", "c");
|
||||
toolbar->addTool (tool);
|
||||
toolbar->addTool (new SceneToolMode (toolbar));
|
||||
toolbar->addTool (new SceneToolMode (toolbar));
|
||||
toolbar->addTool (new SceneToolMode (toolbar));
|
||||
|
||||
// navigation mode
|
||||
SceneToolMode *tool = new SceneToolMode (toolbar);
|
||||
tool->addButton (":door.png", "1st"); /// \todo replace icons
|
||||
tool->addButton (":GMST.png", "free");
|
||||
tool->addButton (":Info.png", "orbit");
|
||||
toolbar->addTool (tool);
|
||||
connect (tool, SIGNAL (modeChanged (const std::string&)),
|
||||
this, SLOT (selectNavigationMode (const std::string&)));
|
||||
|
||||
layout2->addWidget (toolbar, 0);
|
||||
|
||||
CSVRender::SceneWidget* sceneWidget = new CSVRender::SceneWidget(this);
|
||||
mScene = new CSVRender::SceneWidget(this);
|
||||
|
||||
layout2->addWidget (sceneWidget, 1);
|
||||
layout2->addWidget (mScene, 1);
|
||||
|
||||
layout->insertLayout (0, layout2, 1);
|
||||
|
||||
|
@ -76,3 +77,13 @@ void CSVWorld::SceneSubView::setStatusBar (bool show)
|
|||
{
|
||||
mBottom->setStatusBar (show);
|
||||
}
|
||||
|
||||
void CSVWorld::SceneSubView::selectNavigationMode (const std::string& mode)
|
||||
{
|
||||
if (mode=="1st")
|
||||
mScene->setNavigationMode (CSVRender::SceneWidget::NavigationMode_1stPerson);
|
||||
else if (mode=="free")
|
||||
mScene->setNavigationMode (CSVRender::SceneWidget::NavigationMode_Free);
|
||||
else if (mode=="orbit")
|
||||
mScene->setNavigationMode (CSVRender::SceneWidget::NavigationMode_Orbit);
|
||||
}
|
||||
|
|
|
@ -10,6 +10,11 @@ namespace CSMDoc
|
|||
class Document;
|
||||
}
|
||||
|
||||
namespace CSVRender
|
||||
{
|
||||
class SceneWidget;
|
||||
}
|
||||
|
||||
namespace CSVWorld
|
||||
{
|
||||
class Table;
|
||||
|
@ -21,6 +26,7 @@ namespace CSVWorld
|
|||
Q_OBJECT
|
||||
|
||||
TableBottomBox *mBottom;
|
||||
CSVRender::SceneWidget *mScene;
|
||||
|
||||
public:
|
||||
|
||||
|
@ -31,6 +37,10 @@ namespace CSVWorld
|
|||
virtual void updateEditorSetting (const QString& key, const QString& value);
|
||||
|
||||
virtual void setStatusBar (bool show);
|
||||
|
||||
private slots:
|
||||
|
||||
void selectNavigationMode (const std::string& mode);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue