player arrow

actorid
scrawl 13 years ago
parent 8e299bd25b
commit 9c3e1f48f0

@ -73,6 +73,7 @@ namespace MWGui
setCellName("No Cell Loaded");
getWidget(mMap, "Map");
getWidget(mPlayerArrow, "Compass");
MyGUI::Button* button;
getWidget(button, "WorldButton");
@ -137,10 +138,16 @@ namespace MWGui
{
if (mVisible) return;
MyGUI::IntSize size = mMap->getCanvasSize();
MyGUI::IntPoint middle = MyGUI::IntPoint(x*size.width,y*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::IntPoint pos(0.5*viewsize.width - middle.left, 0.5*viewsize.height - middle.top);
mMap->setViewOffset(pos);
mPlayerArrow->setPosition(MyGUI::IntPoint(x*512-16, y*512-16));
MyGUI::ISubWidget* main = mPlayerArrow->getSubWidgetMain();
MyGUI::RotatingSkin* rotatingSubskin = main->castType<MyGUI::RotatingSkin>();
rotatingSubskin->setAngle(3.141 * 0.5);
}
void onDragStart(MyGUI::Widget* _sender, int _left, int _top, MyGUI::MouseButton _id)
@ -167,6 +174,7 @@ namespace MWGui
private:
std::string mPrefix;
MyGUI::ScrollView* mMap;
MyGUI::ImageBox* mPlayerArrow;
MyGUI::IntPoint mLastDragPos;
int mCurX, mCurY;
bool mInterior;

@ -275,7 +275,7 @@ void LocalMap::setPlayerPosition (const Ogre::Vector3& position)
texName = mInteriorName + "_" + coordStr(x,y);
}
mEnvironment->mWindowManager->setPlayerPos(1/3.f + u/3.f, 1/3.f + v/3.f);
mEnvironment->mWindowManager->setPlayerPos(u, v);
// explore radius (squared)
const float sqrExploreRadius = 0.01 * sFogOfWarResolution*sFogOfWarResolution;

@ -14,4 +14,7 @@
<BasisSkin type="MainSkin" offset = "0 0 16 16"/>
</Skin>
<Skin name = "RotatingSkin" size = "16 16">
<BasisSkin type="RotatingSkin" offset="0 0 16 16" align="Stretch"/>
</Skin>
</MyGUI>

@ -23,7 +23,10 @@
</Widget>
<Widget type="ImageBox" skin="ImageBox" position="512 512 512 512" align="ALIGN_TOP ALIGN_LEFT" name="Map_1_1">
<Widget type="ImageBox" skin="ImageBox" position="0 0 512 512" align="ALIGN_TOP ALIGN_LEFT" name="Map_1_1_fog"/>
<Widget type="ImageBox" skin="ImageBox" position="0 0 512 512" align="ALIGN_TOP ALIGN_LEFT" name="Map_1_1_fog">
<!-- Player arrow -->
<Widget type="ImageBox" skin="RotatingSkin" position="0 0 32 32" align="ALIGN_TOP ALIGN_LEFT" name="Compass"/>
</Widget>
</Widget>
<Widget type="ImageBox" skin="ImageBox" position="1024 512 512 512" align="ALIGN_TOP ALIGN_LEFT" name="Map_2_1">
@ -42,9 +45,6 @@
<Widget type="ImageBox" skin="ImageBox" position="0 0 512 512" align="ALIGN_TOP ALIGN_LEFT" name="Map_2_2_fog"/>
</Widget>
<!-- positioned and rotated in code -->
<Widget type="ImageBox" skin="ImageBox" position="0 0 32 32" align="ALIGN_TOP ALIGN_LEFT" name="Compass"/>
<Widget type="Button" skin="" position="0 0 1536 1536" name="EventBox" align="ALIGN_STRETCH"/>
</Widget>
<Widget type="Button" skin="MW_Button" position="213 233 61 22" align="ALIGN_BOTTOM ALIGN_RIGHT" name="WorldButton"/>

Loading…
Cancel
Save