mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-22 03:55:11 +00:00
simple fps display in top left corner (#527)
* simple fps display in top left corner * added other languages thank you to everyone in #translation-station, and to Google translate (some languages may need revisiting later) * render from left not center, grey fps text
This commit is contained in:
parent
47ef0668ca
commit
13c0e693f8
18 changed files with 78 additions and 3 deletions
|
@ -139,6 +139,7 @@ DYNOS_PACKS = "DynOS packy"
|
|||
ANTIALIASING = "Anti-aliasing"
|
||||
OFF = "Vypnuto"
|
||||
MUST_RESTART = "Musíte restartovat hru pro aplikování změn."
|
||||
SHOW_FPS = "Zobrazit FPS"
|
||||
|
||||
[DJUI_THEMES]
|
||||
DJUI_THEMES = "TÉMATA DJUI"
|
||||
|
|
|
@ -139,6 +139,7 @@ DYNOS_PACKS = "DynOS Packs"
|
|||
ANTIALIASING = "Anti-aliasing"
|
||||
OFF = "UIT"
|
||||
MUST_RESTART = "Je moet de game opnieuw opstarten voor sommige veranderingen om effect te hebben."
|
||||
SHOW_FPS = "Toon FPS"
|
||||
|
||||
[DJUI_THEMES]
|
||||
DJUI_THEMES = "DJUI THEMA'S"
|
||||
|
|
|
@ -139,6 +139,7 @@ DYNOS_PACKS = "DynOS Packs"
|
|||
ANTIALIASING = "Anti-aliasing"
|
||||
OFF = "Off"
|
||||
MUST_RESTART = "Restart the game to apply changes."
|
||||
SHOW_FPS = "Show FPS"
|
||||
|
||||
[DJUI_THEMES]
|
||||
DJUI_THEMES = "DJUI THEMES"
|
||||
|
|
|
@ -140,6 +140,7 @@ DYNOS_PACKS = "Packs DynOS"
|
|||
ANTIALIASING = "Anti-aliasing"
|
||||
OFF = "Désactivé"
|
||||
MUST_RESTART = "Vous devez relancer le jeu pour que certains changements prennent effet."
|
||||
SHOW_FPS = "Afficher FPS"
|
||||
|
||||
[DJUI_THEMES]
|
||||
DJUI_THEMES = "THÈMES DJUI"
|
||||
|
|
|
@ -139,6 +139,7 @@ DYNOS_PACKS = "DynOS-Pakete"
|
|||
ANTIALIASING = "Kantenglättung"
|
||||
OFF = "Aus"
|
||||
MUST_RESTART = "Um einige Änderungen zu übernehmen, muss das Spiel neugestartet werden."
|
||||
SHOW_FPS = "FPS anzeigen"
|
||||
|
||||
[DJUI_THEMES]
|
||||
DJUI_THEMES = "DJUI-THEMEN"
|
||||
|
|
|
@ -137,6 +137,7 @@ DYNOS_PACKS = "Pacchetti DynOS"
|
|||
ANTIALIASING = "Anti-aliasing"
|
||||
OFF = "Off"
|
||||
MUST_RESTART = "You must restart the game for some changes to take effect."
|
||||
SHOW_FPS = "Mostra FPS"
|
||||
|
||||
[DJUI_THEMES]
|
||||
DJUI_THEMES = "TEMI DJUI"
|
||||
|
|
|
@ -139,6 +139,7 @@ DYNOS_PACKS = "Paczki DynOS"
|
|||
ANTIALIASING = "Anti-aliasing"
|
||||
OFF = "Wylaczone"
|
||||
MUST_RESTART = "Musisz zrestartowac gre, aby zmiany zaczely obowiazywac."
|
||||
SHOW_FPS = "Pokaż FPS"
|
||||
|
||||
[DJUI_THEMES]
|
||||
DJUI_THEMES = "TEMATY DJUI"
|
||||
|
|
|
@ -139,6 +139,7 @@ DYNOS_PACKS = "DynOS Packs"
|
|||
ANTIALIASING = "Anti-aliasing"
|
||||
OFF = "Desligado"
|
||||
MUST_RESTART = "Você precisará reiniciar o jogo para algumas alterações serem aplicadas."
|
||||
SHOW_FPS = "Mostrar FPS"
|
||||
|
||||
[DJUI_THEMES]
|
||||
DJUI_THEMES = "TEMAS DJUI"
|
||||
|
@ -152,7 +153,7 @@ FILE_SELECT_THEME = "Seleção de arquivo"
|
|||
|
||||
[DYNOS]
|
||||
DYNOS = "DYNOS"
|
||||
|
||||
|
||||
[HOST_MESSAGE]
|
||||
INFO_TITLE = "INFO"
|
||||
WARN_DISCORD = "Convide amigos clicando com o botão direito do mouse no nome deles no Discord e clicando em\n'\\#d0d0ff\\convidar para o jogo\\#dcdcdc\\'.\n\n Você também pode convidar canais de servidores clicando em \\#d0d0ff\\mais\\#dcdcdc\\ botão ao lado do local onde você entra no chat.\n\nGame Activity \\#ffa0a0\\precisa estar\\#dcdcdc\\ ativado nas suas\n configurações do discord.\n\n status offline\\#ffa0a0\\vai prevenir\\#dcdcdc\\ convites de serem enviados."
|
||||
|
|
|
@ -138,6 +138,7 @@ DYNOS_PACKS = "Пакеты DynOS"
|
|||
ANTIALIASING = "Анизотропная фильтрация"
|
||||
OFF = "Выкл"
|
||||
MUST_RESTART = "Перезапустите игру, чтобы изменения вступили в силу"
|
||||
SHOW_FPS = "Показывать FPS"
|
||||
|
||||
[DJUI_THEMES]
|
||||
DJUI_THEMES = "ТЕМЫ DJUI"
|
||||
|
|
|
@ -139,6 +139,7 @@ DYNOS_PACKS = "Packs de DynOS"
|
|||
ANTIALIASING = "Anti-aliasing"
|
||||
OFF = "Desactivado"
|
||||
MUST_RESTART = "Tienes que reiniciar el juego para que algunos cambios surtan efecto."
|
||||
SHOW_FPS = "Mostrar FPS"
|
||||
|
||||
[DJUI_THEMES]
|
||||
DJUI_THEMES = "TEMAS de DJUI"
|
||||
|
|
|
@ -137,6 +137,7 @@ bool configMenuRandom = false;
|
|||
bool configMenuDemos = false;
|
||||
struct PlayerPalette configPlayerPalette = {{{ 0x00, 0x00, 0xff }, { 0xff, 0x00, 0x00 }, { 0xff, 0xff, 0xff }, { 0x72, 0x1c, 0x0e }, { 0x73, 0x06, 0x00 }, { 0xfe, 0xc1, 0x79 }, { 0xff, 0x00, 0x00 }}};
|
||||
struct PlayerPalette configCustomPalette = {{{ 0x00, 0x00, 0xff }, { 0xff, 0x00, 0x00 }, { 0xff, 0xff, 0xff }, { 0x72, 0x1c, 0x0e }, { 0x73, 0x06, 0x00 }, { 0xfe, 0xc1, 0x79 }, { 0xff, 0x00, 0x00 }}};
|
||||
bool configShowFPS = false;
|
||||
bool configUncappedFramerate = true;
|
||||
unsigned int configFrameLimit = 60;
|
||||
unsigned int configDrawDistance = 5;
|
||||
|
@ -218,6 +219,7 @@ static const struct ConfigOption options[] = {
|
|||
{.name = "debug_offset", .type = CONFIG_TYPE_U64 , .u64Value = &gPcDebug.bhvOffset},
|
||||
{.name = "debug_tags", .type = CONFIG_TYPE_U64 , .u64Value = gPcDebug.tags},
|
||||
// coop-specific
|
||||
{.name = "show_fps", .type = CONFIG_TYPE_BOOL , .boolValue = &configShowFPS},
|
||||
{.name = "uncapped_framerate", .type = CONFIG_TYPE_BOOL , .boolValue = &configUncappedFramerate},
|
||||
{.name = "frame_limit" , .type = CONFIG_TYPE_UINT , .uintValue = &configFrameLimit},
|
||||
{.name = "amount_of_players", .type = CONFIG_TYPE_UINT , .uintValue = &configAmountofPlayers},
|
||||
|
|
|
@ -96,6 +96,7 @@ extern bool configMenuRandom;
|
|||
extern bool configMenuDemos;
|
||||
extern struct PlayerPalette configPlayerPalette;
|
||||
extern struct PlayerPalette configCustomPalette;
|
||||
extern bool configShowFPS;
|
||||
extern bool configUncappedFramerate;
|
||||
extern unsigned int configFrameLimit;
|
||||
extern unsigned int configDrawDistance;
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "djui_panel_pause.h"
|
||||
#include "djui_panel_join.h"
|
||||
#include "djui_panel_join_message.h"
|
||||
#include "djui_fps_display.h"
|
||||
#include "../debuglog.h"
|
||||
#include "pc/cliopts.h"
|
||||
#include "game/level_update.h"
|
||||
|
@ -81,6 +82,9 @@ void djui_init(void) {
|
|||
djui_panel_playerlist_create(NULL);
|
||||
|
||||
djui_console_create();
|
||||
|
||||
djui_fps_display_create();
|
||||
|
||||
sDjuiInited = true;
|
||||
}
|
||||
|
||||
|
@ -140,6 +144,8 @@ void djui_render(void) {
|
|||
djui_base_render(&gDjuiRoot->base);
|
||||
}
|
||||
|
||||
djui_fps_display_render();
|
||||
|
||||
if (sDjuiLuaErrorTimeout > 0) {
|
||||
sDjuiLuaErrorTimeout--;
|
||||
if (sDjuiLuaErrorTimeout == 0) {
|
||||
|
|
47
src/pc/djui/djui_fps_display.c
Normal file
47
src/pc/djui/djui_fps_display.c
Normal file
|
@ -0,0 +1,47 @@
|
|||
#include "djui.h"
|
||||
#include "../pc_main.h"
|
||||
|
||||
struct DjuiFpsDisplay {
|
||||
struct DjuiText *text;
|
||||
struct DjuiBase base;
|
||||
};
|
||||
|
||||
struct DjuiFpsDisplay *sFpsDisplay = NULL;
|
||||
|
||||
void djui_fps_display_update(s16 fps) {
|
||||
if (configShowFPS) {
|
||||
char fpsText[30] = "";
|
||||
snprintf(fpsText, 30, "\\#dcdcdc\\FPS \\#ffffff\\%d", fps);
|
||||
djui_text_set_text(sFpsDisplay->text, fpsText);
|
||||
}
|
||||
}
|
||||
|
||||
void djui_fps_display_render(void) {
|
||||
if (configShowFPS) {
|
||||
djui_rect_render(&sFpsDisplay->base);
|
||||
djui_base_render(&sFpsDisplay->base);
|
||||
}
|
||||
}
|
||||
|
||||
void djui_fps_display_create(void) {
|
||||
struct DjuiFpsDisplay *fpsDisplay = malloc(sizeof(struct DjuiFpsDisplay));
|
||||
struct DjuiBase* base = &fpsDisplay->base;
|
||||
djui_base_init(NULL, base, NULL, NULL);
|
||||
djui_base_set_size(base, 150, 50);
|
||||
djui_base_set_color(base, 0, 0, 0, 240);
|
||||
djui_base_set_border_color(base, 0, 0, 0, 200);
|
||||
djui_base_set_border_width(base, 8);
|
||||
djui_base_set_padding(base, 16, 16, 16, 16);
|
||||
|
||||
{
|
||||
// FPS text
|
||||
struct DjuiText *text = djui_text_create(base, "");
|
||||
djui_base_set_size_type(&text->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
||||
djui_base_set_size(&text->base, 1.0f, text->fontScale * 2);
|
||||
djui_base_set_location(&text->base, 0, -text->fontScale / 2);
|
||||
|
||||
fpsDisplay->text = text;
|
||||
}
|
||||
|
||||
sFpsDisplay = fpsDisplay;
|
||||
}
|
6
src/pc/djui/djui_fps_display.h
Normal file
6
src/pc/djui/djui_fps_display.h
Normal file
|
@ -0,0 +1,6 @@
|
|||
#pragma once
|
||||
#include "djui.h"
|
||||
|
||||
void djui_fps_display_update(s16 fps);
|
||||
void djui_fps_display_render(void);
|
||||
void djui_fps_display_create(void);
|
|
@ -28,7 +28,7 @@ struct DjuiBase* djui_panel_find_first_interactable(struct DjuiBaseChild* child)
|
|||
}
|
||||
|
||||
// If we didn't find anything at all. Return NULL.
|
||||
LOG_ERROR("Failed to find a interactable for child %p.", child);
|
||||
// LOG_ERROR("Failed to find a interactable for child %p.", child);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -64,6 +64,7 @@ void djui_panel_display_create(struct DjuiBase* caller) {
|
|||
|
||||
djui_checkbox_create(body, DLANG(DISPLAY, FORCE_4BY3), &configForce4By3, djui_panel_display_apply);
|
||||
|
||||
djui_checkbox_create(body, DLANG(DISPLAY, SHOW_FPS), &configShowFPS, NULL);
|
||||
djui_checkbox_create(body, DLANG(DISPLAY, VSYNC), &configWindow.vsync, djui_panel_display_apply);
|
||||
djui_checkbox_create(body, DLANG(DISPLAY, UNCAPPED_FRAMERATE), &configUncappedFramerate, djui_panel_display_uncapped_change);
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
#include "pc/djui/djui_unicode.h"
|
||||
#include "pc/djui/djui_panel.h"
|
||||
#include "pc/djui/djui_panel_modlist.h"
|
||||
#include "pc/djui/djui_fps_display.h"
|
||||
#include "pc/debuglog.h"
|
||||
#include "pc/utils/misc.h"
|
||||
|
||||
|
@ -196,7 +197,8 @@ void produce_interpolation_frames_and_delay(void) {
|
|||
u32 fps = sFramesSinceFpsUpdate / ((f32)(sCurrentFpsUpdateTime - sLastFpsUpdateTime));
|
||||
sLastFpsUpdateTime = sCurrentFpsUpdateTime;
|
||||
sFramesSinceFpsUpdate = 0;
|
||||
// printf("fps: %u\n", fps);
|
||||
|
||||
djui_fps_display_update(floor(fps));
|
||||
}
|
||||
|
||||
sFrameTimeStart = sFrameTargetTime;
|
||||
|
|
Loading…
Reference in a new issue