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