Don't use std::format
This commit is contained in:
parent
9bdfd80a13
commit
0ac8674e39
@ -4,7 +4,6 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <format>
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include <GL/glew.h>
|
#include <GL/glew.h>
|
||||||
@ -293,13 +292,7 @@ int start() {
|
|||||||
int time = (int) (glfwGetTime() * 10);
|
int time = (int) (glfwGetTime() * 10);
|
||||||
if(time != prevTime) {
|
if(time != prevTime) {
|
||||||
int fps = (int) floor(1.0f / kekData.lastTimings.frameTime);
|
int fps = (int) floor(1.0f / kekData.lastTimings.frameTime);
|
||||||
std::string str = std::format("FPS: {} ({}) | Physics: {}, Lighting: {}, Render: {}, Idle: {}",
|
std::string str = "FPS: " + std::to_string(fps) + " (" + formatSeconds(kekData.lastTimings.frameTime) + ")" + " | Physics: " + formatSeconds(kekData.lastTimings.physicsTime) + ", Lighting: " + formatSeconds(kekData.lastTimings.lightingTime) + ", Render: " + formatSeconds(kekData.lastTimings.renderTime) + ", Idle: " + formatSeconds(kekData.lastTimings.idleTime);
|
||||||
std::to_string(fps),
|
|
||||||
formatSeconds(kekData.lastTimings.frameTime),
|
|
||||||
formatSeconds(kekData.lastTimings.physicsTime),
|
|
||||||
formatSeconds(kekData.lastTimings.lightingTime),
|
|
||||||
formatSeconds(kekData.lastTimings.renderTime),
|
|
||||||
formatSeconds(kekData.lastTimings.idleTime));
|
|
||||||
fpsText->setText(str);
|
fpsText->setText(str);
|
||||||
}
|
}
|
||||||
prevTime = time;
|
prevTime = time;
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <format>
|
#include <iomanip>
|
||||||
|
#include <sstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace kek {
|
namespace kek {
|
||||||
@ -26,7 +27,9 @@ class Timer {
|
|||||||
};
|
};
|
||||||
|
|
||||||
inline std::string formatSeconds(float seconds) {
|
inline std::string formatSeconds(float seconds) {
|
||||||
return std::format("{:.2f} ms", seconds * 1000);
|
std::ostringstream s;
|
||||||
|
s << std::fixed << std::setprecision(2) << (seconds * 1000) << " ms";
|
||||||
|
return s.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user