mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 19:19:56 +00:00
F10 hotkey toggle FPS
This commit is contained in:
parent
e16daeed23
commit
e3486931ae
5 changed files with 49 additions and 12 deletions
|
@ -67,17 +67,8 @@ HUD::HUD(int width, int height, int fpsLevel)
|
|||
|
||||
getWidget(crosshair, "Crosshair");
|
||||
|
||||
if ( fpsLevel == 2 ){
|
||||
getWidget(fpsbox, "FPSBoxAdv");
|
||||
fpsbox->setVisible(true);
|
||||
getWidget(fpscounter, "FPSCounterAdv");
|
||||
}else if ( fpsLevel == 1 ){
|
||||
getWidget(fpsbox, "FPSBox");
|
||||
fpsbox->setVisible(true);
|
||||
getWidget(fpscounter, "FPSCounter");
|
||||
}else{
|
||||
getWidget(fpscounter, "FPSCounter");
|
||||
}
|
||||
setFpsLevel(fpsLevel);
|
||||
|
||||
getWidget(trianglecounter, "TriangleCounter");
|
||||
getWidget(batchcounter, "BatchCounter");
|
||||
|
||||
|
@ -95,6 +86,28 @@ HUD::HUD(int width, int height, int fpsLevel)
|
|||
LocalMapBase::init(minimap, this);
|
||||
}
|
||||
|
||||
void HUD::setFpsLevel(int level)
|
||||
{
|
||||
MyGUI::Widget* fps;
|
||||
getWidget(fps, "FPSBoxAdv");
|
||||
fps->setVisible(false);
|
||||
getWidget(fps, "FPSBox");
|
||||
fps->setVisible(false);
|
||||
|
||||
if (level == 2)
|
||||
{
|
||||
getWidget(fpsbox, "FPSBoxAdv");
|
||||
fpsbox->setVisible(true);
|
||||
getWidget(fpscounter, "FPSCounterAdv");
|
||||
}
|
||||
else if (level == 1)
|
||||
{
|
||||
getWidget(fpsbox, "FPSBox");
|
||||
fpsbox->setVisible(true);
|
||||
getWidget(fpscounter, "FPSCounter");
|
||||
}
|
||||
}
|
||||
|
||||
void HUD::setFPS(float fps)
|
||||
{
|
||||
fpscounter->setCaption(boost::lexical_cast<std::string>((int)fps));
|
||||
|
|
|
@ -78,6 +78,7 @@ namespace MWGui
|
|||
void setPlayerPos(const float x, const float y);
|
||||
void setBottomLeftVisibility(bool hmsVisible, bool weapVisible, bool spellVisible);
|
||||
void setBottomRightVisibility(bool effectBoxVisible, bool minimapVisible);
|
||||
void setFpsLevel(const int level);
|
||||
|
||||
MyGUI::ProgressPtr health, magicka, stamina;
|
||||
MyGUI::Widget *weapBox, *spellBox;
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
#include "journalwindow.hpp"
|
||||
#include "charactercreation.hpp"
|
||||
|
||||
#include <components/settings/settings.hpp>
|
||||
|
||||
#include <assert.h>
|
||||
#include <iostream>
|
||||
#include <iterator>
|
||||
|
@ -472,3 +474,11 @@ void WindowManager::toggleFogOfWar()
|
|||
map->toggleFogOfWar();
|
||||
hud->toggleFogOfWar();
|
||||
}
|
||||
|
||||
int WindowManager::toggleFps()
|
||||
{
|
||||
showFPSLevel = (showFPSLevel+1)%3;
|
||||
hud->setFpsLevel(showFPSLevel);
|
||||
Settings::Manager::setInt("fps", "HUD", showFPSLevel);
|
||||
return showFPSLevel;
|
||||
}
|
||||
|
|
|
@ -159,6 +159,9 @@ namespace MWGui
|
|||
|
||||
void toggleFogOfWar();
|
||||
|
||||
int toggleFps();
|
||||
///< toggle fps display @return resulting fps level
|
||||
|
||||
void setInteriorMapTexture(const int x, const int y);
|
||||
///< set the index of the map texture that should be used (for interiors)
|
||||
|
||||
|
|
|
@ -68,6 +68,8 @@ namespace MWInput
|
|||
A_ToggleWeapon,
|
||||
A_ToggleSpell,
|
||||
|
||||
A_ToggleFps, // Toggle FPS display (this is temporary)
|
||||
|
||||
A_LAST // Marker for the last item
|
||||
};
|
||||
|
||||
|
@ -88,6 +90,11 @@ namespace MWInput
|
|||
|
||||
/* InputImpl Methods */
|
||||
|
||||
void toggleFps()
|
||||
{
|
||||
windows.toggleFps();
|
||||
}
|
||||
|
||||
void toggleSpell()
|
||||
{
|
||||
DrawState state = player.getDrawState();
|
||||
|
@ -235,6 +242,8 @@ namespace MWInput
|
|||
"Draw Weapon");
|
||||
disp->funcs.bind(A_ToggleSpell,boost::bind(&InputImpl::toggleSpell,this),
|
||||
"Ready hands");
|
||||
disp->funcs.bind(A_ToggleFps, boost::bind(&InputImpl::toggleFps, this),
|
||||
"Toggle FPS display");
|
||||
// Add the exit listener
|
||||
ogre.getRoot()->addFrameListener(&exit);
|
||||
|
||||
|
@ -281,6 +290,7 @@ namespace MWInput
|
|||
disp->bind(A_ToggleWalk, KC_C);
|
||||
disp->bind(A_ToggleWeapon,KC_F);
|
||||
disp->bind(A_ToggleSpell,KC_R);
|
||||
disp->bind(A_ToggleFps, KC_F10);
|
||||
|
||||
// Key bindings for polled keys
|
||||
// NOTE: These keys are constantly being polled. Only add keys that must be checked each frame.
|
||||
|
|
Loading…
Reference in a new issue