mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-22 21:47:23 +00:00
[client] rename fps variables to be more correct
This commit is contained in:
parent
b927f991d6
commit
5fe2db7e56
@ -117,7 +117,7 @@ typedef bool (* LG_RendererOnMouseEvent)(void * opaque, const bool visib
|
|||||||
typedef bool (* LG_RendererOnFrameEvent)(void * opaque, const LG_RendererFormat format, const uint8_t * data);
|
typedef bool (* LG_RendererOnFrameEvent)(void * opaque, const LG_RendererFormat format, const uint8_t * data);
|
||||||
typedef void (* LG_RendererOnAlert )(void * opaque, const LG_RendererAlert alert, const char * message, bool ** closeFlag);
|
typedef void (* LG_RendererOnAlert )(void * opaque, const LG_RendererAlert alert, const char * message, bool ** closeFlag);
|
||||||
typedef bool (* LG_RendererRender )(void * opaque, SDL_Window *window);
|
typedef bool (* LG_RendererRender )(void * opaque, SDL_Window *window);
|
||||||
typedef void (* LG_RendererUpdateFPS )(void * opaque, const float avgFPS, const float renderFPS);
|
typedef void (* LG_RendererUpdateFPS )(void * opaque, const float avgUPS, const float avgFPS);
|
||||||
|
|
||||||
typedef struct LG_Renderer
|
typedef struct LG_Renderer
|
||||||
{
|
{
|
||||||
|
@ -210,13 +210,13 @@ int renderThread(void * unused)
|
|||||||
|
|
||||||
if (state.renderTime > 1e9)
|
if (state.renderTime > 1e9)
|
||||||
{
|
{
|
||||||
const float avgFPS = 1000.0f / (((float)state.renderTime / state.frameCount ) / 1e6f);
|
const float avgUPS = 1000.0f / (((float)state.renderTime / state.frameCount ) / 1e6f);
|
||||||
const float renderFPS = 1000.0f / (((float)state.renderTime / state.renderCount) / 1e6f);
|
const float avgFPS = 1000.0f / (((float)state.renderTime / state.renderCount) / 1e6f);
|
||||||
state.renderTime = 0;
|
state.renderTime = 0;
|
||||||
state.frameCount = 0;
|
state.frameCount = 0;
|
||||||
state.renderCount = 0;
|
state.renderCount = 0;
|
||||||
|
|
||||||
state.lgr->update_fps(state.lgrData, avgFPS, renderFPS);
|
state.lgr->update_fps(state.lgrData, avgUPS, avgFPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
const uint64_t total = microtime() - start;
|
const uint64_t total = microtime() - start;
|
||||||
|
@ -339,13 +339,13 @@ bool egl_render(void * opaque, SDL_Window * window)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void egl_update_fps(void * opaque, const float avgFPS, const float renderFPS)
|
void egl_update_fps(void * opaque, const float avgUPS, const float avgFPS)
|
||||||
{
|
{
|
||||||
struct Inst * this = (struct Inst *)opaque;
|
struct Inst * this = (struct Inst *)opaque;
|
||||||
if (!this->params.showFPS)
|
if (!this->params.showFPS)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
egl_fps_update(this->fps, avgFPS, renderFPS);
|
egl_fps_update(this->fps, avgUPS, avgFPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_opt_vsync(void * opaque, const char *value)
|
static void handle_opt_vsync(void * opaque, const char *value)
|
||||||
|
@ -28,5 +28,5 @@ typedef struct EGL_FPS EGL_FPS;
|
|||||||
bool egl_fps_init(EGL_FPS ** fps, const LG_Font * font, LG_FontObj fontObj);
|
bool egl_fps_init(EGL_FPS ** fps, const LG_Font * font, LG_FontObj fontObj);
|
||||||
void egl_fps_free(EGL_FPS ** fps);
|
void egl_fps_free(EGL_FPS ** fps);
|
||||||
|
|
||||||
void egl_fps_update(EGL_FPS * fps, const float avgFPS, const float renderFPS);
|
void egl_fps_update(EGL_FPS * fps, const float avgUPS, const float avgFPS);
|
||||||
void egl_fps_render(EGL_FPS * fps, const float screenWidth, const float screenHeight);
|
void egl_fps_render(EGL_FPS * fps, const float screenWidth, const float screenHeight);
|
@ -622,14 +622,14 @@ bool opengl_render(void * opaque, SDL_Window * window)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void opengl_update_fps(void * opaque, const float avgFPS, const float renderFPS)
|
void opengl_update_fps(void * opaque, const float avgUPS, const float avgFPS)
|
||||||
{
|
{
|
||||||
struct Inst * this = (struct Inst *)opaque;
|
struct Inst * this = (struct Inst *)opaque;
|
||||||
if (!this->params.showFPS)
|
if (!this->params.showFPS)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
char str[128];
|
char str[128];
|
||||||
snprintf(str, sizeof(str), "UPS: %8.4f, FPS: %8.4f", avgFPS, renderFPS);
|
snprintf(str, sizeof(str), "UPS: %8.4f, FPS: %8.4f", avgUPS, avgFPS);
|
||||||
|
|
||||||
LG_FontBitmap *textSurface = NULL;
|
LG_FontBitmap *textSurface = NULL;
|
||||||
if (!(textSurface = this->font->render(this->fontObj, 0xffffff00, str)))
|
if (!(textSurface = this->font->render(this->fontObj, 0xffffff00, str)))
|
||||||
|
Loading…
Reference in New Issue
Block a user