forked from mirror/openmw-tes3mp
gui changes
This commit is contained in:
parent
9c3e1f48f0
commit
770b0f2106
4 changed files with 45 additions and 23 deletions
|
@ -63,7 +63,7 @@ namespace MWGui
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MapWindow()
|
MapWindow()
|
||||||
: Layout("openmw_map_window_layout.xml")
|
: Layout("openmw_map_window_layout.xml"), mGlobal(false)
|
||||||
{
|
{
|
||||||
setCoord(500,0,320,300);
|
setCoord(500,0,320,300);
|
||||||
setText("WorldButton", "World");
|
setText("WorldButton", "World");
|
||||||
|
@ -72,12 +72,12 @@ namespace MWGui
|
||||||
// Obviously you should override this later on
|
// Obviously you should override this later on
|
||||||
setCellName("No Cell Loaded");
|
setCellName("No Cell Loaded");
|
||||||
|
|
||||||
getWidget(mMap, "Map");
|
getWidget(mLocalMap, "LocalMap");
|
||||||
|
getWidget(mGlobalMap, "GlobalMap");
|
||||||
getWidget(mPlayerArrow, "Compass");
|
getWidget(mPlayerArrow, "Compass");
|
||||||
|
|
||||||
MyGUI::Button* button;
|
getWidget(mButton, "WorldButton");
|
||||||
getWidget(button, "WorldButton");
|
mButton->eventMouseButtonClick += MyGUI::newDelegate(this, &MapWindow::onWorldButtonClicked);
|
||||||
button->eventMouseButtonClick += MyGUI::newDelegate(this, &MapWindow::onWorldButtonClicked);
|
|
||||||
|
|
||||||
MyGUI::Button* eventbox;
|
MyGUI::Button* eventbox;
|
||||||
getWidget(eventbox, "EventBox");
|
getWidget(eventbox, "EventBox");
|
||||||
|
@ -136,49 +136,62 @@ namespace MWGui
|
||||||
|
|
||||||
void setPlayerPos(const float x, const float y)
|
void setPlayerPos(const float x, const float y)
|
||||||
{
|
{
|
||||||
if (mVisible) return;
|
if (mGlobal || mVisible) return;
|
||||||
MyGUI::IntSize size = mMap->getCanvasSize();
|
MyGUI::IntSize size = mLocalMap->getCanvasSize();
|
||||||
MyGUI::IntPoint middle = MyGUI::IntPoint((1/3.f + x/3.f)*size.width,(1/3.f + y/3.f)*size.height);
|
MyGUI::IntPoint middle = MyGUI::IntPoint((1/3.f + x/3.f)*size.width,(1/3.f + y/3.f)*size.height);
|
||||||
MyGUI::IntCoord viewsize = mMap->getCoord();
|
MyGUI::IntCoord viewsize = mLocalMap->getCoord();
|
||||||
MyGUI::IntPoint pos(0.5*viewsize.width - middle.left, 0.5*viewsize.height - middle.top);
|
MyGUI::IntPoint pos(0.5*viewsize.width - middle.left, 0.5*viewsize.height - middle.top);
|
||||||
mMap->setViewOffset(pos);
|
mLocalMap->setViewOffset(pos);
|
||||||
|
|
||||||
mPlayerArrow->setPosition(MyGUI::IntPoint(x*512-16, y*512-16));
|
mPlayerArrow->setPosition(MyGUI::IntPoint(x*512-16, y*512-16));
|
||||||
|
|
||||||
MyGUI::ISubWidget* main = mPlayerArrow->getSubWidgetMain();
|
MyGUI::ISubWidget* main = mPlayerArrow->getSubWidgetMain();
|
||||||
MyGUI::RotatingSkin* rotatingSubskin = main->castType<MyGUI::RotatingSkin>();
|
MyGUI::RotatingSkin* rotatingSubskin = main->castType<MyGUI::RotatingSkin>();
|
||||||
rotatingSubskin->setAngle(3.141 * 0.5);
|
rotatingSubskin->setCenter(MyGUI::IntPoint(16,16));
|
||||||
|
rotatingSubskin->setAngle(3.141);
|
||||||
}
|
}
|
||||||
|
|
||||||
void onDragStart(MyGUI::Widget* _sender, int _left, int _top, MyGUI::MouseButton _id)
|
void onDragStart(MyGUI::Widget* _sender, int _left, int _top, MyGUI::MouseButton _id)
|
||||||
{
|
{
|
||||||
if (_id!=MyGUI::MouseButton::Left) return;
|
if (_id!=MyGUI::MouseButton::Left) return;
|
||||||
mLastDragPos = MyGUI::IntPoint(_left, _top);
|
if (!mGlobal)
|
||||||
|
mLastDragPos = MyGUI::IntPoint(_left, _top);
|
||||||
}
|
}
|
||||||
|
|
||||||
void onMouseDrag(MyGUI::Widget* _sender, int _left, int _top, MyGUI::MouseButton _id)
|
void onMouseDrag(MyGUI::Widget* _sender, int _left, int _top, MyGUI::MouseButton _id)
|
||||||
{
|
{
|
||||||
if (_id!=MyGUI::MouseButton::Left) return;
|
if (_id!=MyGUI::MouseButton::Left) return;
|
||||||
|
|
||||||
MyGUI::IntPoint diff = MyGUI::IntPoint(_left, _top) - mLastDragPos;
|
if (!mGlobal)
|
||||||
mMap->setViewOffset( mMap->getViewOffset() + diff );
|
{
|
||||||
|
MyGUI::IntPoint diff = MyGUI::IntPoint(_left, _top) - mLastDragPos;
|
||||||
|
mLocalMap->setViewOffset( mLocalMap->getViewOffset() + diff );
|
||||||
|
|
||||||
mLastDragPos = MyGUI::IntPoint(_left, _top);
|
mLastDragPos = MyGUI::IntPoint(_left, _top);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void onWorldButtonClicked(MyGUI::Widget* _sender)
|
void onWorldButtonClicked(MyGUI::Widget* _sender)
|
||||||
{
|
{
|
||||||
/// \todo
|
mGlobal = !mGlobal;
|
||||||
|
mGlobalMap->setVisible(mGlobal);
|
||||||
|
mLocalMap->setVisible(!mGlobal);
|
||||||
|
|
||||||
|
mButton->setCaption( mGlobal ? "Local" : "World" );
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string mPrefix;
|
std::string mPrefix;
|
||||||
MyGUI::ScrollView* mMap;
|
MyGUI::ScrollView* mLocalMap;
|
||||||
|
MyGUI::ScrollView* mGlobalMap;
|
||||||
MyGUI::ImageBox* mPlayerArrow;
|
MyGUI::ImageBox* mPlayerArrow;
|
||||||
|
MyGUI::Button* mButton;
|
||||||
MyGUI::IntPoint mLastDragPos;
|
MyGUI::IntPoint mLastDragPos;
|
||||||
int mCurX, mCurY;
|
int mCurX, mCurY;
|
||||||
bool mInterior;
|
bool mInterior;
|
||||||
bool mVisible;
|
bool mVisible;
|
||||||
|
|
||||||
|
bool mGlobal;
|
||||||
};
|
};
|
||||||
|
|
||||||
class MainMenu : public OEngine::GUI::Layout
|
class MainMenu : public OEngine::GUI::Layout
|
||||||
|
|
|
@ -197,7 +197,7 @@
|
||||||
<Child type="ScrollBar" skin="MW_VScroll" offset = "498 3 14 509" align = "ALIGN_RIGHT ALIGN_VSTRETCH" name = "VScroll">
|
<Child type="ScrollBar" skin="MW_VScroll" offset = "498 3 14 509" align = "ALIGN_RIGHT ALIGN_VSTRETCH" name = "VScroll">
|
||||||
</Child>
|
</Child>
|
||||||
|
|
||||||
<Child type="Widget" skin="ClientDefaultSkin" offset = "3 3 493 509" align = "ALIGN_STRETCH" name = "Client">
|
<Child type="Widget" skin="" offset = "3 3 493 509" align = "ALIGN_STRETCH" name = "Client">
|
||||||
</Child>
|
</Child>
|
||||||
|
|
||||||
<Child type="Widget" skin="IB_T" offset="2 0 512 2" align="ALIGN_TOP ALIGN_HSTRETCH"/>
|
<Child type="Widget" skin="IB_T" offset="2 0 512 2" align="ALIGN_TOP ALIGN_HSTRETCH"/>
|
||||||
|
@ -233,7 +233,7 @@
|
||||||
|
|
||||||
<Property key="SkinList" value = "MW_MultiSubList" />
|
<Property key="SkinList" value = "MW_MultiSubList" />
|
||||||
|
|
||||||
<Child type="Widget" skin="ClientDefaultSkin" offset = "3 3 516 516" align = "ALIGN_STRETCH" name = "Client">
|
<Child type="Widget" skin="" offset = "3 3 516 516" align = "ALIGN_STRETCH" name = "Client">
|
||||||
</Child>
|
</Child>
|
||||||
|
|
||||||
<Child type="Widget" skin="IB_T" offset="2 0 512 2" align="ALIGN_TOP ALIGN_HSTRETCH"/>
|
<Child type="Widget" skin="IB_T" offset="2 0 512 2" align="ALIGN_TOP ALIGN_HSTRETCH"/>
|
||||||
|
|
|
@ -2,7 +2,13 @@
|
||||||
|
|
||||||
<MyGUI type="Layout">
|
<MyGUI type="Layout">
|
||||||
<Widget type="Window" skin="MW_Window" layer="Windows" position="0 0 300 300" name="_Main">
|
<Widget type="Window" skin="MW_Window" layer="Windows" position="0 0 300 300" name="_Main">
|
||||||
<Widget type="ScrollView" skin="MW_MapView" position="0 0 284 264" align="ALIGN_STRETCH" name="Map">
|
|
||||||
|
<!-- Global map -->
|
||||||
|
<Widget type="ScrollView" skin="MW_MapView" position="0 0 284 264" align="ALIGN_STRETCH" name="GlobalMap">
|
||||||
|
</Widget>
|
||||||
|
|
||||||
|
<!-- Local map -->
|
||||||
|
<Widget type="ScrollView" skin="MW_MapView" position="0 0 284 264" align="ALIGN_STRETCH" name="LocalMap">
|
||||||
<Property key="CanvasSize" value="1536 1536"/>
|
<Property key="CanvasSize" value="1536 1536"/>
|
||||||
|
|
||||||
<!-- 3x3 maps, 1024x1024 each, but we will downsample to 512 to antialias them -->
|
<!-- 3x3 maps, 1024x1024 each, but we will downsample to 512 to antialias them -->
|
||||||
|
@ -46,7 +52,10 @@
|
||||||
</Widget>
|
</Widget>
|
||||||
|
|
||||||
<Widget type="Button" skin="" position="0 0 1536 1536" name="EventBox" align="ALIGN_STRETCH"/>
|
<Widget type="Button" skin="" position="0 0 1536 1536" name="EventBox" align="ALIGN_STRETCH"/>
|
||||||
</Widget>
|
</Widget>
|
||||||
|
|
||||||
|
<!-- World button -->
|
||||||
<Widget type="Button" skin="MW_Button" position="213 233 61 22" align="ALIGN_BOTTOM ALIGN_RIGHT" name="WorldButton"/>
|
<Widget type="Button" skin="MW_Button" position="213 233 61 22" align="ALIGN_BOTTOM ALIGN_RIGHT" name="WorldButton"/>
|
||||||
|
|
||||||
</Widget>
|
</Widget>
|
||||||
</MyGUI>
|
</MyGUI>
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
<MyGUI type="Skin">
|
<MyGUI type="Skin">
|
||||||
<Skin name="MW_MapView" size="516 516" texture="mwgui.png">
|
<Skin name="MW_MapView" size="516 516" texture="mwgui.png">
|
||||||
<Child type="Widget" skin="ClientDefaultSkin" offset="0 0 516 516" align="Stretch" name="Client"/>
|
<Child type="Widget" skin="" offset="0 0 516 516" align="Stretch" name="Client"/>
|
||||||
|
|
||||||
<!-- invisible scroll bars, needed for setting the view offset -->
|
<!-- invisible scroll bars, needed for setting the view offset -->
|
||||||
<Child type="ScrollBar" skin="ClientDefaultSkin" offset="498 3 14 509" align="ALIGN_RIGHT ALIGN_VSTRETCH" name="VScroll"/>
|
<Child type="ScrollBar" skin="" offset="498 3 14 509" align="ALIGN_RIGHT ALIGN_VSTRETCH" name="VScroll"/>
|
||||||
<Child type="ScrollBar" skin="ClientDefaultSkin" offset="3 498 489 14" align="ALIGN_BOTTOM ALIGN_HSTRETCH" name="HScroll"/>
|
<Child type="ScrollBar" skin="" offset="3 498 489 14" align="ALIGN_BOTTOM ALIGN_HSTRETCH" name="HScroll"/>
|
||||||
</Skin>
|
</Skin>
|
||||||
</MyGUI>
|
</MyGUI>
|
||||||
|
|
Loading…
Reference in a new issue