Add DJUI Font option
This commit is contained in:
parent
eb0dc496f9
commit
7ebe54681e
|
@ -148,8 +148,11 @@ SHOW_FPS = "Zobrazit FPS"
|
|||
[DJUI_THEMES]
|
||||
DJUI_THEME = "Téma DJUI"
|
||||
DJUI_SCALE = "Stupnice DJUI"
|
||||
DJUI_FONT = "DJUI Font"
|
||||
AUTO = "Automatický"
|
||||
CENTER = "Střed"
|
||||
FONT_NORMAL = "Normální"
|
||||
FONT_ALIASED = "Hladký"
|
||||
LIGHT_THEME = "Světlo"
|
||||
DARK_THEME = "Tmavý"
|
||||
MARIO_THEME = "Mario"
|
||||
|
|
|
@ -148,8 +148,11 @@ SHOW_FPS = "Toon FPS"
|
|||
[DJUI_THEMES]
|
||||
DJUI_THEME = "DJUI Thema"
|
||||
DJUI_SCALE = "DJUI Schaal"
|
||||
DJUI_FONT = "DJUI-lettertype"
|
||||
AUTO = "Automatisch"
|
||||
CENTER = "Centreren"
|
||||
FONT_NORMAL = "Normaal"
|
||||
FONT_ALIASED = "Glad"
|
||||
LIGHT_THEME = "Licht"
|
||||
DARK_THEME = "Donker"
|
||||
MARIO_THEME = "Mario"
|
||||
|
|
|
@ -148,8 +148,11 @@ SHOW_FPS = "Show FPS"
|
|||
[DJUI_THEMES]
|
||||
DJUI_THEME = "DJUI Theme"
|
||||
DJUI_SCALE = "DJUI Scale"
|
||||
DJUI_FONT = "DJUI Font"
|
||||
AUTO = "Auto"
|
||||
CENTER = "Center"
|
||||
FONT_NORMAL = "Normal"
|
||||
FONT_ALIASED = "Aliased"
|
||||
LIGHT_THEME = "Light"
|
||||
DARK_THEME = "Dark"
|
||||
MARIO_THEME = "Mario"
|
||||
|
|
|
@ -148,8 +148,11 @@ SHOW_FPS = "Afficher FPS"
|
|||
[DJUI_THEMES]
|
||||
DJUI_THEME = "Thème DJUI"
|
||||
DJUI_SCALE = "Échelle DJUI"
|
||||
DJUI_FONT = "Police DJUI"
|
||||
AUTO = "Automatique"
|
||||
CENTER = "Centrer"
|
||||
FONT_NORMAL = "Normal"
|
||||
FONT_ALIASED = "Lisse"
|
||||
LIGHT_THEME = "Lumière"
|
||||
DARK_THEME = "Sombre"
|
||||
MARIO_THEME = "Mario"
|
||||
|
|
|
@ -148,8 +148,11 @@ SHOW_FPS = "FPS anzeigen"
|
|||
[DJUI_THEMES]
|
||||
DJUI_THEME = "DJUI-Thema"
|
||||
DJUI_SCALE = "DJUI-Skala"
|
||||
DJUI_FONT = "DJUI-Schriftart"
|
||||
AUTO = "Automatisch"
|
||||
CENTER = "Zentrieren"
|
||||
FONT_NORMAL = "Normal"
|
||||
FONT_ALIASED = "Glatt"
|
||||
LIGHT_THEME = "Litch"
|
||||
DARK_THEME = "Dunkel"
|
||||
MARIO_THEME = "Mario"
|
||||
|
|
|
@ -146,8 +146,11 @@ SHOW_FPS = "Mostra FPS"
|
|||
[DJUI_THEMES]
|
||||
DJUI_THEME = "Tema DJUI"
|
||||
DJUI_SCALE = "Scala DJUI"
|
||||
DJUI_FONT = "Font DJUI"
|
||||
AUTO = "Automatico"
|
||||
CENTER = "Centrare"
|
||||
FONT_NORMAL = "Normale"
|
||||
FONT_ALIASED = "Liscio"
|
||||
LIGHT_THEME = "Luce"
|
||||
DARK_THEME = "Scuro"
|
||||
MARIO_THEME = "Mario"
|
||||
|
|
|
@ -148,8 +148,11 @@ SHOW_FPS = "Pokaż FPS"
|
|||
[DJUI_THEMES]
|
||||
DJUI_THEME = "Motyw DJUI"
|
||||
DJUI_SCALE = "Skala DJUI"
|
||||
DJUI_FONT = "Czcionka DJUI"
|
||||
AUTO = "Automatyczny"
|
||||
CENTER = "Środek"
|
||||
FONT_NORMAL = "Normalny"
|
||||
FONT_ALIASED = "Gładki"
|
||||
LIGHT_THEME = "Światło"
|
||||
DARK_THEME = "Ciemny"
|
||||
MARIO_THEME = "Mario"
|
||||
|
|
|
@ -148,8 +148,11 @@ SHOW_FPS = "Mostrar taxa de quadros"
|
|||
[DJUI_THEMES]
|
||||
DJUI_THEME = "Tema DJUI"
|
||||
DJUI_SCALE = "Tamanho da DJUI"
|
||||
DJUI_FONT = "Fonte DJUI"
|
||||
AUTO = "Automático"
|
||||
CENTER = "Centralizar"
|
||||
FONT_NORMAL = "Normal"
|
||||
FONT_ALIASED = "Suave"
|
||||
LIGHT_THEME = "Claro"
|
||||
DARK_THEME = "Escuro"
|
||||
MARIO_THEME = "Mario"
|
||||
|
|
|
@ -147,8 +147,11 @@ SHOW_FPS = "Показывать FPS"
|
|||
[DJUI_THEMES]
|
||||
DJUI_THEME = "Темы DJUI"
|
||||
DJUI_SCALE = "Шкала DJUI"
|
||||
DJUI_FONT = "Шрифт DJUI"
|
||||
AUTO = "Автоматический"
|
||||
CENTER = "Центр"
|
||||
FONT_NORMAL = "Обычный"
|
||||
FONT_ALIASED = "Гладкий"
|
||||
LIGHT_THEME = "Свет"
|
||||
DARK_THEME = "Темный"
|
||||
MARIO_THEME = "Mario"
|
||||
|
|
|
@ -148,8 +148,11 @@ SHOW_FPS = "Mostrar FPS"
|
|||
[DJUI_THEMES]
|
||||
DJUI_THEME = "Tema de DJUI"
|
||||
DJUI_SCALE = "Tamaño de DJUI"
|
||||
DJUI_FONT = "Fuente DJUI"
|
||||
AUTO = "Automático"
|
||||
CENTER = "Centrar"
|
||||
FONT_NORMAL = "Normal"
|
||||
FONT_ALIASED = "Alias"
|
||||
LIGHT_THEME = "Claro"
|
||||
DARK_THEME = "Oscuro"
|
||||
MARIO_THEME = "Mario"
|
||||
|
|
|
@ -13,11 +13,12 @@
|
|||
#include "gfx/gfx_window_manager_api.h"
|
||||
#include "controller/controller_api.h"
|
||||
#include "fs/fs.h"
|
||||
#include "pc/mods/mods.h"
|
||||
#include "pc/network/ban_list.h"
|
||||
#include "pc/crash_handler.h"
|
||||
#include "pc/network/moderator_list.h"
|
||||
#include "mods/mods.h"
|
||||
#include "network/ban_list.h"
|
||||
#include "crash_handler.h"
|
||||
#include "network/moderator_list.h"
|
||||
#include "debuglog.h"
|
||||
#include "djui/djui_hud_utils.h"
|
||||
|
||||
#define ARRAY_LEN(arr) (sizeof(arr) / sizeof(arr[0]))
|
||||
|
||||
|
@ -163,6 +164,7 @@ char configDestId[MAX_CONFIG_STRING] = "0";
|
|||
bool configFadeoutDistantSounds = false;
|
||||
unsigned int configDjuiTheme = DJUI_THEME_DARK;
|
||||
bool configDjuiThemeCenter = true;
|
||||
unsigned int configDjuiThemeFont = FONT_NORMAL;
|
||||
unsigned int configDjuiScale = 0;
|
||||
bool configGlobalPlayerModels = true;
|
||||
char configLastVersion[MAX_CONFIG_STRING] = "";
|
||||
|
@ -237,11 +239,11 @@ static const struct ConfigOption options[] = {
|
|||
{.name = "coop_network_system", .type = CONFIG_TYPE_UINT , .uintValue = &configNetworkSystem},
|
||||
{.name = "coop_player_interaction", .type = CONFIG_TYPE_UINT , .uintValue = &configPlayerInteraction},
|
||||
{.name = "coop_player_knockback_strength", .type = CONFIG_TYPE_UINT , .uintValue = &configPlayerKnockbackStrength},
|
||||
{.name = "coopdx_nametags", .type = CONFIG_TYPE_BOOL , .boolValue = &configNametags},
|
||||
{.name = "coopdx_bouncy_bounds", .type = CONFIG_TYPE_UINT , .uintValue = &configBouncyLevelBounds},
|
||||
{.name = "coop_nametags", .type = CONFIG_TYPE_BOOL , .boolValue = &configNametags},
|
||||
{.name = "coop_bouncy_bounds", .type = CONFIG_TYPE_UINT , .uintValue = &configBouncyLevelBounds},
|
||||
{.name = "coop_player_model", .type = CONFIG_TYPE_UINT , .uintValue = &configPlayerModel},
|
||||
{.name = "coop_player_name", .type = CONFIG_TYPE_STRING, .stringValue = (char*)&configPlayerName, .maxStringLength = MAX_PLAYER_STRING},
|
||||
{.name = "coopdx_menu_staff_roll", .type = CONFIG_TYPE_BOOL , .boolValue = &configMenuStaffRoll},
|
||||
{.name = "coop_menu_staff_roll", .type = CONFIG_TYPE_BOOL , .boolValue = &configMenuStaffRoll},
|
||||
{.name = "coop_menu_level", .type = CONFIG_TYPE_UINT , .uintValue = &configMenuLevel},
|
||||
{.name = "coop_menu_sound", .type = CONFIG_TYPE_BOOL , .boolValue = &configMenuSound},
|
||||
{.name = "coop_menu_random", .type = CONFIG_TYPE_BOOL , .boolValue = &configMenuRandom},
|
||||
|
@ -261,7 +263,7 @@ static const struct ConfigOption options[] = {
|
|||
{.name = "coop_custom_palette_skin", .type = CONFIG_TYPE_COLOR , .colorValue = &configCustomPalette.parts[SKIN]},
|
||||
{.name = "coop_custom_palette_cap", .type = CONFIG_TYPE_COLOR , .colorValue = &configCustomPalette.parts[CAP]},
|
||||
{.name = "coop_stay_in_level_after_star", .type = CONFIG_TYPE_UINT , .uintValue = &configStayInLevelAfterStar},
|
||||
{.name = "coopdx_global_player_models", .type = CONFIG_TYPE_BOOL , .boolValue = &configGlobalPlayerModels},
|
||||
{.name = "coop_global_player_models", .type = CONFIG_TYPE_BOOL , .boolValue = &configGlobalPlayerModels},
|
||||
{.name = "disable_popups", .type = CONFIG_TYPE_BOOL , .boolValue = &configDisablePopups},
|
||||
{.name = "lua_profiler", .type = CONFIG_TYPE_BOOL , .boolValue = &configLuaProfiler},
|
||||
#ifdef DEVELOPMENT
|
||||
|
@ -283,6 +285,7 @@ static const struct ConfigOption options[] = {
|
|||
{.name = "fade_distant_sounds", .type = CONFIG_TYPE_BOOL , .boolValue = &configFadeoutDistantSounds},
|
||||
{.name = "djui_theme", .type = CONFIG_TYPE_UINT , .uintValue = &configDjuiTheme},
|
||||
{.name = "djui_theme_center", .type = CONFIG_TYPE_BOOL , .boolValue = &configDjuiThemeCenter},
|
||||
{.name = "djui_theme_font", .type = CONFIG_TYPE_UINT , .uintValue = &configDjuiThemeFont},
|
||||
{.name = "djui_scale", .type = CONFIG_TYPE_UINT , .uintValue = &configDjuiScale},
|
||||
{.name = "last_version", .type = CONFIG_TYPE_STRING, .stringValue = (char*)&configLastVersion, .maxStringLength = MAX_CONFIG_STRING}
|
||||
};
|
||||
|
|
|
@ -120,6 +120,7 @@ extern char configDestId[];
|
|||
extern bool configFadeoutDistantSounds;
|
||||
extern unsigned int configDjuiTheme;
|
||||
extern bool configDjuiThemeCenter;
|
||||
extern unsigned int configDjuiThemeFont;
|
||||
extern unsigned int configDjuiScale;
|
||||
extern bool configGlobalPlayerModels;
|
||||
extern char configLastVersion[];
|
||||
|
|
|
@ -22,7 +22,7 @@ static void djui_font_normal_render_char(char* c) {
|
|||
static f32 djui_font_normal_char_width(char* c) {
|
||||
if (*c == ' ') { return 0.30f; }
|
||||
extern const f32 font_normal_widths[];
|
||||
return djui_unicode_get_sprite_width(c, font_normal_widths);
|
||||
return djui_unicode_get_sprite_width(c, font_normal_widths, 32.0f);
|
||||
}
|
||||
|
||||
static const struct DjuiFont sDjuiFontNormal = {
|
||||
|
@ -153,7 +153,7 @@ static void djui_font_aliased_render_char(char* c) {
|
|||
static f32 djui_font_aliased_char_width(char* c) {
|
||||
if (*c == ' ') { return 6 / 32.0f; }
|
||||
extern const f32 font_aliased_widths[];
|
||||
return djui_unicode_get_sprite_width(c, font_aliased_widths) / 32.0f;
|
||||
return djui_unicode_get_sprite_width(c, font_aliased_widths, 1.0f) / 32.0f;
|
||||
}
|
||||
|
||||
static const struct DjuiFont sDjuiFontAliased = {
|
||||
|
|
|
@ -81,7 +81,8 @@ void djui_panel_main_menu_create(struct DjuiBase* caller) {
|
|||
djui_selectionbox_create(body, DLANG(DJUI_THEMES, DJUI_THEME), themeChoices, DJUI_THEME_MAX, &configDjuiTheme, djui_panel_misc_djui_setting_change);
|
||||
char* djuiScaleChoices[5] = {DLANG(DJUI_THEMES, AUTO), "x0.5", "x0.85", "x1.0", "x1.5"};
|
||||
djui_selectionbox_create(body, DLANG(DJUI_THEMES, DJUI_SCALE), djuiScaleChoices, 5, &configDjuiScale, djui_panel_misc_djui_setting_change);
|
||||
|
||||
char* djuiFontChoices[2] = {DLANG(DJUI_THEMES, FONT_NORMAL), DLANG(DJUI_THEMES, FONT_ALIASED)};
|
||||
djui_selectionbox_create(body, DLANG(DJUI_THEMES, DJUI_FONT), djuiFontChoices, 2, &configDjuiThemeFont, djui_panel_misc_djui_setting_change);
|
||||
|
||||
if (gDjuiInMainMenu) {
|
||||
struct DjuiSelectionbox* selectionbox1 = djui_selectionbox_create(body, DLANG(MENU_OPTIONS, LEVEL), levelChoices, 18, &configMenuLevel, NULL);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include <string.h>
|
||||
#include "djui.h"
|
||||
#include "djui_unicode.h"
|
||||
#include "djui_hud_utils.h"
|
||||
#include "game/segment2.h"
|
||||
|
||||
static u8 sSavedR = 0;
|
||||
|
@ -389,7 +390,7 @@ struct DjuiText* djui_text_create(struct DjuiBase* parent, const char* message)
|
|||
djui_base_init(parent, base, djui_text_render, djui_text_destroy);
|
||||
|
||||
text->message = NULL;
|
||||
djui_text_set_font(text, gDjuiFonts[0]);
|
||||
djui_text_set_font(text, gDjuiFonts[configDjuiThemeFont == 0 ? FONT_NORMAL : FONT_ALIASED]);
|
||||
djui_text_set_font_scale(text, text->font->defaultFontScale);
|
||||
djui_text_set_text(text, message);
|
||||
djui_text_set_alignment(text, DJUI_HALIGN_LEFT, DJUI_VALIGN_TOP);
|
||||
|
|
|
@ -82,60 +82,60 @@ struct SmCodeGlyph sSmCodeGlyphs[] = {
|
|||
{ "ß", 'S', 0, 0 },
|
||||
|
||||
{ "¡", '!', 0, 0 },
|
||||
{ "¿", '?', 0, 0 },
|
||||
{ "¿", '?', 12, 0 },
|
||||
|
||||
{ "Б", 'B', 0, 0 },
|
||||
{ "Г", 'L', 0, 0 },
|
||||
{ "Д", 'A', 0, 0 },
|
||||
{ "Ж", 'X', 0, 0 },
|
||||
{ "З", '3', 0, 0 },
|
||||
{ "И", 'N', 0, 0 },
|
||||
{ "Й", 'N', 0, 0 },
|
||||
{ "Л", 'U', 0, 0 },
|
||||
{ "П", 'U', 0, 0 },
|
||||
{ "У", 'y', 0, 0 },
|
||||
{ "Ф", 'o', 0, 0 },
|
||||
{ "Ц", 'U', 0, 0 },
|
||||
{ "Ч", '4', 0, 0 },
|
||||
{ "Ш", 'W', 0, 0 },
|
||||
{ "Щ", 'W', 0, 0 },
|
||||
{ "Ъ", 'b', 0, 0 },
|
||||
{ "Ы", 'O', 0, 0 },
|
||||
{ "Ь", 'b', 0, 0 },
|
||||
{ "Ѣ", 'b', 0, 0 },
|
||||
{ "Э", '3', 0, 0 },
|
||||
{ "Ю", 'O', 0, 0 },
|
||||
{ "Я", 'R', 0, 0 },
|
||||
{ "Є", 'E', 0, 0 },
|
||||
{ "Б", 15, 0, 0 },
|
||||
{ "Г", 14, 0, 0 },
|
||||
{ "Д", 17, 0, 0 },
|
||||
{ "Ж", 17, 0, 0 },
|
||||
{ "З", 13, 0, 0 },
|
||||
{ "И", 15, 0, 0 },
|
||||
{ "Й", 15, 0, 0 },
|
||||
{ "Л", 13, 0, 0 },
|
||||
{ "П", 14, 0, 0 },
|
||||
{ "У", 12, 0, 0 },
|
||||
{ "Ф", 17, 0, 0 },
|
||||
{ "Ц", 14, 0, 0 },
|
||||
{ "Ч", 11, 0, 0 },
|
||||
{ "Ш", 17, 0, 0 },
|
||||
{ "Щ", 17, 0, 0 },
|
||||
{ "Ъ", 13, 0, 0 },
|
||||
{ "Ы", 17, 0, 0 },
|
||||
{ "Ь", 12, 0, 0 },
|
||||
{ "Ѣ", 14, 0, 0 },
|
||||
{ "Э", 13, 0, 0 },
|
||||
{ "Ю", 17, 0, 0 },
|
||||
{ "Я", 13, 0, 0 },
|
||||
{ "Є", 12, 0, 0 },
|
||||
|
||||
{ "а", 'a', 0, 0 },
|
||||
{ "б", '6', 0, 0 },
|
||||
{ "в", 'B', 0, 0 },
|
||||
{ "г", 'r', 0, 0 },
|
||||
{ "д", 'A', 0, 0 },
|
||||
{ "ж", 'x', 0, 0 },
|
||||
{ "з", '3', 0, 0 },
|
||||
{ "и", 'n', 0, 0 },
|
||||
{ "й", 'n', 0, 0 },
|
||||
{ "к", 'k', 0, 0 },
|
||||
{ "л", 'n', 0, 0 },
|
||||
{ "м", 'm', 0, 0 },
|
||||
{ "н", 'h', 0, 0 },
|
||||
{ "п", 'n', 0, 0 },
|
||||
{ "т", 't', 0, 0 },
|
||||
{ "ф", 'o', 0, 0 },
|
||||
{ "ц", 'u', 0, 0 },
|
||||
{ "ч", '4', 0, 0 },
|
||||
{ "ш", 'w', 0, 0 },
|
||||
{ "щ", 'w', 0, 0 },
|
||||
{ "ъ", 'b', 0, 0 },
|
||||
{ "ы", 'O', 0, 0 },
|
||||
{ "ь", 'b', 0, 0 },
|
||||
{ "ѣ", 'b', 0, 0 },
|
||||
{ "э", '3', 0, 0 },
|
||||
{ "ю", 'O', 0, 0 },
|
||||
{ "я", 'r', 0, 0 },
|
||||
{ "є", 'e', 0, 0 },
|
||||
{ "а", 13, 0, 0 },
|
||||
{ "б", 11, 0, 0 },
|
||||
{ "в", 11, 0, 0 },
|
||||
{ "г", 10, 0, 0 },
|
||||
{ "д", 12, 0, 0 },
|
||||
{ "ж", 15, 0, 0 },
|
||||
{ "з", 13, 0, 0 },
|
||||
{ "и", 12, 0, 0 },
|
||||
{ "й", 12, 0, 0 },
|
||||
{ "к", 9, 0, 0 },
|
||||
{ "л", 10, 0, 0 },
|
||||
{ "м", 11, 0, 0 },
|
||||
{ "н", 11, 0, 0 },
|
||||
{ "п", 11, 0, 0 },
|
||||
{ "т", 11, 0, 0 },
|
||||
{ "ф", 14, 0, 0 },
|
||||
{ "ц", 11, 0, 0 },
|
||||
{ "ч", 9, 0, 0 },
|
||||
{ "ш", 17, 0, 0 },
|
||||
{ "щ", 17, 0, 0 },
|
||||
{ "ъ", 14, 0, 0 },
|
||||
{ "ы", 17, 0, 0 },
|
||||
{ "ь", 12, 0, 0 },
|
||||
{ "ѣ", 13, 0, 0 },
|
||||
{ "э", 12, 0, 0 },
|
||||
{ "ю", 16, 0, 0 },
|
||||
{ "я", 12, 0, 0 },
|
||||
{ "є", 12, 0, 0 },
|
||||
|
||||
{ "Č", 'C', 0, 0 },
|
||||
{ "č", 'c', 0, 0 },
|
||||
|
@ -154,7 +154,7 @@ struct SmCodeGlyph sSmCodeGlyphs[] = {
|
|||
{ "Ň", 'N', 0, 0 },
|
||||
{ "ň", 'n', 0, 0 },
|
||||
{ "Ť", 'T', 0, 0 },
|
||||
{ "ť", 't', 0, 0 },
|
||||
{ "ť", 13, 0, 0 },
|
||||
|
||||
{ "ę", 'e', 0, 0 },
|
||||
{ "ń", 'n', 0, 0 },
|
||||
|
@ -285,10 +285,10 @@ u32 djui_unicode_get_sprite_index(char* text) {
|
|||
return (u8)'?' - SPRITE_INDEX_START_CHAR;
|
||||
}
|
||||
|
||||
f32 djui_unicode_get_sprite_width(char* text, const f32 font_widths[]) {
|
||||
f32 djui_unicode_get_sprite_width(char* text, const f32 font_widths[], f32 unicodeScale) {
|
||||
if (!text) { return 0; }
|
||||
|
||||
// check for ASCI
|
||||
// check for ASCII
|
||||
if ((u8)*text < 128) {
|
||||
// make sure it's in the valid range
|
||||
if ((u8)*text < SPRITE_INDEX_START_CHAR) {
|
||||
|
@ -307,10 +307,10 @@ f32 djui_unicode_get_sprite_width(char* text, const f32 font_widths[]) {
|
|||
if (glyph) {
|
||||
if (glyph->width) {
|
||||
// use the custom width
|
||||
return glyph->width;
|
||||
return glyph->width / unicodeScale;
|
||||
}
|
||||
if ((u8)glyph->base < (u8)'!') {
|
||||
return glyph->base;
|
||||
return glyph->base / unicodeScale;
|
||||
}
|
||||
// use the base width
|
||||
return font_widths[(u8)glyph->base - SPRITE_INDEX_START_CHAR];
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
void djui_unicode_init(void);
|
||||
u32 djui_unicode_get_sprite_index(char* text);
|
||||
f32 djui_unicode_get_sprite_width(char* text, const f32 font_widths[]);
|
||||
f32 djui_unicode_get_sprite_width(char* text, const f32 font_widths[], f32 unicodeScale);
|
||||
char* djui_unicode_next_char(char* text);
|
||||
char* djui_unicode_at_index(char* text, s32 index);
|
||||
size_t djui_unicode_len(char* text);
|
||||
|
|
Loading…
Reference in New Issue