Re-enabled FPS display, fix other display issues
This commit is contained in:
@@ -33,6 +33,7 @@
|
||||
#include "image.hpp"
|
||||
#include "button.hpp"
|
||||
#include "tile_sheet.hpp"
|
||||
#include "text_line.hpp"
|
||||
|
||||
//common
|
||||
#include "frame_rate.hpp"
|
||||
@@ -146,6 +147,7 @@ private:
|
||||
Button disconnectButton;
|
||||
Button shutdownButton;
|
||||
FrameRate fps;
|
||||
TextLine fpsTextLine;
|
||||
|
||||
//the camera structure
|
||||
struct {
|
||||
|
||||
@@ -185,13 +185,15 @@ void World::RenderFrame(SDL_Renderer* renderer) {
|
||||
//draw UI
|
||||
disconnectButton.DrawTo(renderer);
|
||||
shutdownButton.DrawTo(renderer);
|
||||
std::ostringstream msg;
|
||||
//TODO: FPS
|
||||
// msg << fps.GetFrameRate();
|
||||
// font.DrawStringTo(msg.str(), screen, 0, 0);
|
||||
|
||||
//FPS
|
||||
fps.Calculate();
|
||||
fpsTextLine.DrawTo(renderer, 0, 0);
|
||||
int fpsRet = fps.Calculate();
|
||||
if (fpsRet != -1) {
|
||||
std::ostringstream msg;
|
||||
msg << "FPS: " << fpsRet;
|
||||
fpsTextLine.SetText(renderer, font, msg.str(), {255, 255, 255, 255});
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------
|
||||
|
||||
Reference in New Issue
Block a user