1
0
mirror of synced 2025-01-31 03:53:44 +01:00

sys: Only display FPS in debug builds

This commit is contained in:
WerWolv 2022-09-05 22:37:28 +02:00
parent 2d5f77730b
commit 95a3104a56
4 changed files with 26 additions and 15 deletions

View File

@ -190,15 +190,26 @@ namespace hex {
curl_mimepart *part = curl_mime_addpart(mime);
auto fileName = filePath.filename().string();
curl_mime_data_cb(
part, file.getSize(), [](char *buffer, size_t size, size_t nitems, void *arg) -> size_t {
curl_mime_data_cb(part, file.getSize(),
[](char *buffer, size_t size, size_t nitems, void *arg) -> size_t {
auto file = static_cast<FILE*>(arg);
return fread(buffer, size, nitems, file); }, [](void *arg, curl_off_t offset, int origin) -> int {
return fread(buffer, size, nitems, file);
},
[](void *arg, curl_off_t offset, int origin) -> int {
auto file = static_cast<FILE*>(arg);
fseek(file, offset, origin);
return CURL_SEEKFUNC_OK; }, [](void *arg) {
if (fseek(file, offset, origin) != 0)
return CURL_SEEKFUNC_CANTSEEK;
else
return CURL_SEEKFUNC_OK;
},
[](void *arg) {
auto file = static_cast<FILE*>(arg);
fclose(file); }, file.getHandle());
fclose(file);
},
file.getHandle());
curl_mime_filename(part, fileName.c_str());
curl_mime_name(part, "file");

View File

@ -212,14 +212,16 @@ namespace hex::plugin::builtin {
});
}
ContentRegistry::Interface::addFooterItem([] {
static float framerate = 0;
if (ImGui::HasSecondPassed()) {
framerate = 1.0F / ImGui::GetIO().DeltaTime;
}
#if defined(DEBUG)
ContentRegistry::Interface::addFooterItem([] {
static float framerate = 0;
if (ImGui::HasSecondPassed()) {
framerate = 1.0F / ImGui::GetIO().DeltaTime;
}
ImGui::TextFormatted("FPS {0:2}.{1:02}", u32(framerate), u32(framerate * 100) % 100);
});
ImGui::TextFormatted("FPS {0:2}.{1:02}", u32(framerate), u32(framerate * 100) % 100);
});
#endif
ContentRegistry::Interface::addFooterItem([] {
auto taskCount = TaskManager::getRunningTaskCount();

View File

@ -133,7 +133,6 @@ namespace hex::plugin::builtin {
{ "hex.builtin.menu.view", "Ansicht" },
{ "hex.builtin.menu.layout", "Layout" },
{ "hex.builtin.menu.view.fps", "FPS anzeigen" },
{ "hex.builtin.menu.view.demo", "ImGui Demo anzeigen" },
{ "hex.builtin.menu.help", "Hilfe" },

View File

@ -136,7 +136,6 @@ namespace hex::plugin::builtin {
{ "hex.builtin.menu.view", "" },
{ "hex.builtin.menu.layout", "레이아웃" },
{ "hex.builtin.menu.view.fps", "FPS 표시하기" },
{ "hex.builtin.menu.view.demo", "ImGui Demo 표시하기" },
{ "hex.builtin.menu.help", "도움말" },