Re-enabled FPS display, fix other display issues
This commit is contained in:
@@ -33,6 +33,7 @@
|
|||||||
#include "image.hpp"
|
#include "image.hpp"
|
||||||
#include "button.hpp"
|
#include "button.hpp"
|
||||||
#include "tile_sheet.hpp"
|
#include "tile_sheet.hpp"
|
||||||
|
#include "text_line.hpp"
|
||||||
|
|
||||||
//common
|
//common
|
||||||
#include "frame_rate.hpp"
|
#include "frame_rate.hpp"
|
||||||
@@ -146,6 +147,7 @@ private:
|
|||||||
Button disconnectButton;
|
Button disconnectButton;
|
||||||
Button shutdownButton;
|
Button shutdownButton;
|
||||||
FrameRate fps;
|
FrameRate fps;
|
||||||
|
TextLine fpsTextLine;
|
||||||
|
|
||||||
//the camera structure
|
//the camera structure
|
||||||
struct {
|
struct {
|
||||||
|
|||||||
@@ -185,13 +185,15 @@ void World::RenderFrame(SDL_Renderer* renderer) {
|
|||||||
//draw UI
|
//draw UI
|
||||||
disconnectButton.DrawTo(renderer);
|
disconnectButton.DrawTo(renderer);
|
||||||
shutdownButton.DrawTo(renderer);
|
shutdownButton.DrawTo(renderer);
|
||||||
std::ostringstream msg;
|
|
||||||
//TODO: FPS
|
|
||||||
// msg << fps.GetFrameRate();
|
|
||||||
// font.DrawStringTo(msg.str(), screen, 0, 0);
|
|
||||||
|
|
||||||
//FPS
|
//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});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------
|
//-------------------------
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ void DisconnectedScreen::FrameEnd() {
|
|||||||
|
|
||||||
void DisconnectedScreen::RenderFrame(SDL_Renderer* renderer) {
|
void DisconnectedScreen::RenderFrame(SDL_Renderer* renderer) {
|
||||||
backButton.DrawTo(renderer);
|
backButton.DrawTo(renderer);
|
||||||
textLine.DrawTo(renderer, 50, 50);
|
textLine.DrawTo(renderer, 50, 30);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------
|
//-------------------------
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ void LobbyMenu::RenderFrame(SDL_Renderer* renderer) {
|
|||||||
|
|
||||||
//draw the server's info
|
//draw the server's info
|
||||||
serverVector[i].nameImage.DrawTo(renderer, boundingBox.x, boundingBox.y + boundingBox.h * i);
|
serverVector[i].nameImage.DrawTo(renderer, boundingBox.x, boundingBox.y + boundingBox.h * i);
|
||||||
serverVector[i].playerCountImage.DrawTo(renderer, boundingBox.x, boundingBox.y + boundingBox.h * i);
|
serverVector[i].playerCountImage.DrawTo(renderer, boundingBox.x+300, boundingBox.y + boundingBox.h * i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -242,7 +242,7 @@ void LobbyMenu::HandleBroadcastResponse(ServerPacket* const argPacket) {
|
|||||||
//fancy itoa
|
//fancy itoa
|
||||||
auto itoa_base10 = [](int i) -> std::string {
|
auto itoa_base10 = [](int i) -> std::string {
|
||||||
char str[20];
|
char str[20];
|
||||||
printf(str, "%d", i);
|
sprintf(str, "%d", i);
|
||||||
return std::string(str);
|
return std::string(str);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+1
-1
Submodule common updated: 03e643a17a...2dd2aead13
Reference in New Issue
Block a user