forked from mirror/openmw-tes3mp
Show a label on the HUD with the cell name when it changes (visible for a few seconds) - like Morrowind
This commit is contained in:
parent
313a8e55b7
commit
63213b36bf
4 changed files with 43 additions and 0 deletions
|
@ -41,6 +41,8 @@ HUD::HUD(int width, int height, int fpsLevel, DragAndDrop* dragAndDrop)
|
||||||
, effectBoxBaseRight(0)
|
, effectBoxBaseRight(0)
|
||||||
, minimapBoxBaseRight(0)
|
, minimapBoxBaseRight(0)
|
||||||
, mDragAndDrop(dragAndDrop)
|
, mDragAndDrop(dragAndDrop)
|
||||||
|
, mCellNameTimer(0.0f)
|
||||||
|
, mCellNameBox(NULL)
|
||||||
{
|
{
|
||||||
setCoord(0,0, width, height);
|
setCoord(0,0, width, height);
|
||||||
|
|
||||||
|
@ -83,6 +85,8 @@ HUD::HUD(int width, int height, int fpsLevel, DragAndDrop* dragAndDrop)
|
||||||
getWidget(minimap, "MiniMap");
|
getWidget(minimap, "MiniMap");
|
||||||
getWidget(compass, "Compass");
|
getWidget(compass, "Compass");
|
||||||
|
|
||||||
|
getWidget(mCellNameBox, "CellName");
|
||||||
|
|
||||||
getWidget(crosshair, "Crosshair");
|
getWidget(crosshair, "Crosshair");
|
||||||
|
|
||||||
setFpsLevel(fpsLevel);
|
setFpsLevel(fpsLevel);
|
||||||
|
@ -324,3 +328,22 @@ void HUD::onMagicClicked(MyGUI::Widget* _sender)
|
||||||
{
|
{
|
||||||
MWBase::Environment::get().getWindowManager()->toggleVisible(GW_Magic);
|
MWBase::Environment::get().getWindowManager()->toggleVisible(GW_Magic);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void HUD::setCellName(const std::string& cellName)
|
||||||
|
{
|
||||||
|
if (mCellName != cellName)
|
||||||
|
{
|
||||||
|
mCellNameTimer = 5.0f;
|
||||||
|
mCellName = cellName;
|
||||||
|
|
||||||
|
mCellNameBox->setCaption(mCellName);
|
||||||
|
mCellNameBox->setVisible(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void HUD::onFrame(float dt)
|
||||||
|
{
|
||||||
|
mCellNameTimer -= dt;
|
||||||
|
if (mCellNameTimer < 0)
|
||||||
|
mCellNameBox->setVisible(false);
|
||||||
|
}
|
||||||
|
|
|
@ -25,6 +25,10 @@ namespace MWGui
|
||||||
void setBottomRightVisibility(bool effectBoxVisible, bool minimapVisible);
|
void setBottomRightVisibility(bool effectBoxVisible, bool minimapVisible);
|
||||||
void setFpsLevel(const int level);
|
void setFpsLevel(const int level);
|
||||||
|
|
||||||
|
void onFrame(float dt);
|
||||||
|
|
||||||
|
void setCellName(const std::string& cellName);
|
||||||
|
|
||||||
MyGUI::ProgressPtr health, magicka, stamina;
|
MyGUI::ProgressPtr health, magicka, stamina;
|
||||||
MyGUI::Widget *weapBox, *spellBox;
|
MyGUI::Widget *weapBox, *spellBox;
|
||||||
MyGUI::ImageBox *weapImage, *spellImage;
|
MyGUI::ImageBox *weapImage, *spellImage;
|
||||||
|
@ -34,6 +38,7 @@ namespace MWGui
|
||||||
MyGUI::ScrollView* minimap;
|
MyGUI::ScrollView* minimap;
|
||||||
MyGUI::ImageBox* compass;
|
MyGUI::ImageBox* compass;
|
||||||
MyGUI::ImageBox* crosshair;
|
MyGUI::ImageBox* crosshair;
|
||||||
|
MyGUI::TextBox* mCellNameBox;
|
||||||
|
|
||||||
MyGUI::WidgetPtr fpsbox;
|
MyGUI::WidgetPtr fpsbox;
|
||||||
MyGUI::TextBox* fpscounter;
|
MyGUI::TextBox* fpscounter;
|
||||||
|
@ -48,6 +53,9 @@ namespace MWGui
|
||||||
|
|
||||||
DragAndDrop* mDragAndDrop;
|
DragAndDrop* mDragAndDrop;
|
||||||
|
|
||||||
|
std::string mCellName;
|
||||||
|
float mCellNameTimer;
|
||||||
|
|
||||||
void onWorldClicked(MyGUI::Widget* _sender);
|
void onWorldClicked(MyGUI::Widget* _sender);
|
||||||
void onWorldMouseOver(MyGUI::Widget* _sender, int x, int y);
|
void onWorldMouseOver(MyGUI::Widget* _sender, int x, int y);
|
||||||
void onWorldMouseLostFocus(MyGUI::Widget* _sender, MyGUI::Widget* _new);
|
void onWorldMouseLostFocus(MyGUI::Widget* _sender, MyGUI::Widget* _new);
|
||||||
|
|
|
@ -470,6 +470,8 @@ void WindowManager::onFrame (float frameDuration)
|
||||||
mInventoryWindow->onFrame();
|
mInventoryWindow->onFrame();
|
||||||
|
|
||||||
mStatsWindow->onFrame();
|
mStatsWindow->onFrame();
|
||||||
|
|
||||||
|
hud->onFrame(frameDuration);
|
||||||
}
|
}
|
||||||
|
|
||||||
const ESMS::ESMStore& WindowManager::getStore() const
|
const ESMS::ESMStore& WindowManager::getStore() const
|
||||||
|
@ -494,6 +496,7 @@ void WindowManager::changeCell(MWWorld::Ptr::CellStore* cell)
|
||||||
}
|
}
|
||||||
|
|
||||||
map->setCellName( name );
|
map->setCellName( name );
|
||||||
|
hud->setCellName( name );
|
||||||
|
|
||||||
map->setCellPrefix("Cell");
|
map->setCellPrefix("Cell");
|
||||||
hud->setCellPrefix("Cell");
|
hud->setCellPrefix("Cell");
|
||||||
|
@ -503,6 +506,7 @@ void WindowManager::changeCell(MWWorld::Ptr::CellStore* cell)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
map->setCellName( cell->cell->name );
|
map->setCellName( cell->cell->name );
|
||||||
|
hud->setCellName( cell->cell->name );
|
||||||
map->setCellPrefix( cell->cell->name );
|
map->setCellPrefix( cell->cell->name );
|
||||||
hud->setCellPrefix( cell->cell->name );
|
hud->setCellPrefix( cell->cell->name );
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,6 +59,14 @@
|
||||||
name="Effect1"/>
|
name="Effect1"/>
|
||||||
</Widget>
|
</Widget>
|
||||||
|
|
||||||
|
<!-- Cell name display when cell changes -->
|
||||||
|
<Widget type="TextBox" skin="SandText" position="0 89 288 24" name="CellName" align="Left Bottom HStretch">
|
||||||
|
<Property key="Visible" value="false"/>
|
||||||
|
<Property key="TextAlign" value="Right"/>
|
||||||
|
<Property key="TextShadow" value="true"/>
|
||||||
|
<Property key="TextShadowColour" value="0 0 0"/>
|
||||||
|
</Widget>
|
||||||
|
|
||||||
<!-- Map box -->
|
<!-- Map box -->
|
||||||
<Widget type="Button" skin="" position="223 123 65 65" name="MiniMapBox" align="Right Bottom">
|
<Widget type="Button" skin="" position="223 123 65 65" name="MiniMapBox" align="Right Bottom">
|
||||||
<Widget type="Widget" skin="HUD_Box" position="0 0 65 65" align="Center">
|
<Widget type="Widget" skin="HUD_Box" position="0 0 65 65" align="Center">
|
||||||
|
|
Loading…
Reference in a new issue