mirror of
https://bitbucket.org/CPMADevs/cnq3
synced 2024-11-26 05:50:57 +00:00
added adapter name and FPS to the GUI's main menu bar
This commit is contained in:
parent
fedfff191e
commit
dad7565aa0
3 changed files with 28 additions and 0 deletions
|
@ -170,6 +170,8 @@ void GUI_DrawMainMenu()
|
|||
}
|
||||
}
|
||||
|
||||
RE_DrawMainMenuBarInfo();
|
||||
|
||||
ImGui::EndMainMenuBar();
|
||||
}
|
||||
|
||||
|
|
|
@ -1896,3 +1896,28 @@ void R_ShutDownGUI()
|
|||
ClearShaderReplacements();
|
||||
ClearImageReplacements();
|
||||
}
|
||||
|
||||
void RE_DrawMainMenuBarInfo()
|
||||
{
|
||||
static uint32_t frameTimes[16];
|
||||
static uint32_t frameCount = 0;
|
||||
static int displayedFPS = 0;
|
||||
|
||||
frameTimes[frameCount++] = rhie.presentToPresentUS;
|
||||
if(frameCount == ARRAY_LEN(frameTimes))
|
||||
{
|
||||
uint32_t sum = 0;
|
||||
for(uint32_t i = 0; i < ARRAY_LEN(frameTimes); ++i)
|
||||
{
|
||||
sum += frameTimes[i];
|
||||
}
|
||||
sum /= ARRAY_LEN(frameTimes);
|
||||
displayedFPS = (int)((1000000 + (sum >> 1)) / sum);
|
||||
frameCount = 0;
|
||||
}
|
||||
|
||||
const char* const info = va("%s | %3d FPS", rhiInfo.adapter, displayedFPS);
|
||||
const float offset = ImGui::GetWindowWidth() - ImGui::CalcTextSize("___").x - ImGui::CalcTextSize(info).x;
|
||||
ImGui::SameLine(offset);
|
||||
ImGui::Text(info);
|
||||
}
|
||||
|
|
|
@ -179,6 +179,7 @@ typedef struct {
|
|||
qhandle_t RE_NK_CreateFontAtlas( vmIndex_t, byte * outBuf, int outSize, const byte* inBuf, int inSize ); // 1 call per VM at most
|
||||
void RE_UploadNuklear( void* vertexes, int numVertexBytes, void* indexes, int numIndexBytes );
|
||||
void RE_DrawNuklear( int firstIndex, int numIndexes, qhandle_t shader, const int* scissorRect );
|
||||
void RE_DrawMainMenuBarInfo();
|
||||
|
||||
//
|
||||
// these are the functions imported by the refresh module
|
||||
|
|
Loading…
Reference in a new issue