mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 19:19:56 +00:00
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)
|
||||
, minimapBoxBaseRight(0)
|
||||
, mDragAndDrop(dragAndDrop)
|
||||
, mCellNameTimer(0.0f)
|
||||
, mCellNameBox(NULL)
|
||||
{
|
||||
setCoord(0,0, width, height);
|
||||
|
||||
|
@ -83,6 +85,8 @@ HUD::HUD(int width, int height, int fpsLevel, DragAndDrop* dragAndDrop)
|
|||
getWidget(minimap, "MiniMap");
|
||||
getWidget(compass, "Compass");
|
||||
|
||||
getWidget(mCellNameBox, "CellName");
|
||||
|
||||
getWidget(crosshair, "Crosshair");
|
||||
|
||||
setFpsLevel(fpsLevel);
|
||||
|
@ -324,3 +328,22 @@ void HUD::onMagicClicked(MyGUI::Widget* _sender)
|
|||
{
|
||||
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 setFpsLevel(const int level);
|
||||
|
||||
void onFrame(float dt);
|
||||
|
||||
void setCellName(const std::string& cellName);
|
||||
|
||||
MyGUI::ProgressPtr health, magicka, stamina;
|
||||
MyGUI::Widget *weapBox, *spellBox;
|
||||
MyGUI::ImageBox *weapImage, *spellImage;
|
||||
|
@ -34,6 +38,7 @@ namespace MWGui
|
|||
MyGUI::ScrollView* minimap;
|
||||
MyGUI::ImageBox* compass;
|
||||
MyGUI::ImageBox* crosshair;
|
||||
MyGUI::TextBox* mCellNameBox;
|
||||
|
||||
MyGUI::WidgetPtr fpsbox;
|
||||
MyGUI::TextBox* fpscounter;
|
||||
|
@ -48,6 +53,9 @@ namespace MWGui
|
|||
|
||||
DragAndDrop* mDragAndDrop;
|
||||
|
||||
std::string mCellName;
|
||||
float mCellNameTimer;
|
||||
|
||||
void onWorldClicked(MyGUI::Widget* _sender);
|
||||
void onWorldMouseOver(MyGUI::Widget* _sender, int x, int y);
|
||||
void onWorldMouseLostFocus(MyGUI::Widget* _sender, MyGUI::Widget* _new);
|
||||
|
|
|
@ -470,6 +470,8 @@ void WindowManager::onFrame (float frameDuration)
|
|||
mInventoryWindow->onFrame();
|
||||
|
||||
mStatsWindow->onFrame();
|
||||
|
||||
hud->onFrame(frameDuration);
|
||||
}
|
||||
|
||||
const ESMS::ESMStore& WindowManager::getStore() const
|
||||
|
@ -494,6 +496,7 @@ void WindowManager::changeCell(MWWorld::Ptr::CellStore* cell)
|
|||
}
|
||||
|
||||
map->setCellName( name );
|
||||
hud->setCellName( name );
|
||||
|
||||
map->setCellPrefix("Cell");
|
||||
hud->setCellPrefix("Cell");
|
||||
|
@ -503,6 +506,7 @@ void WindowManager::changeCell(MWWorld::Ptr::CellStore* cell)
|
|||
else
|
||||
{
|
||||
map->setCellName( cell->cell->name );
|
||||
hud->setCellName( cell->cell->name );
|
||||
map->setCellPrefix( cell->cell->name );
|
||||
hud->setCellPrefix( cell->cell->name );
|
||||
}
|
||||
|
|
|
@ -59,6 +59,14 @@
|
|||
name="Effect1"/>
|
||||
</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 -->
|
||||
<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">
|
||||
|
|
Loading…
Reference in a new issue