mirror of
https://github.com/k4zmu2a/SpaceCadetPinball.git
synced 2025-09-06 08:20:15 +02:00
Add font configuration (to be able to use non-latin languages)
This commit is contained in:
parent
aa58379c56
commit
95ed735269
8 changed files with 108 additions and 3 deletions
50
SpaceCadetPinball/font_selection.cpp
Normal file
50
SpaceCadetPinball/font_selection.cpp
Normal file
|
@ -0,0 +1,50 @@
|
|||
#include "pch.h"
|
||||
#include "font_selection.h"
|
||||
|
||||
#include "options.h"
|
||||
#include "pinball.h"
|
||||
#include "score.h"
|
||||
#include "winmain.h"
|
||||
|
||||
static const char* popupName = "Font Selection";
|
||||
bool font_selection::ShowDialog = false;
|
||||
char font_selection::DialogInputBuffer[512];
|
||||
|
||||
void font_selection::show_dialog()
|
||||
{
|
||||
ShowDialog = true;
|
||||
}
|
||||
|
||||
void font_selection::RenderDialog()
|
||||
{
|
||||
if (ShowDialog == true)
|
||||
{
|
||||
strncpy(DialogInputBuffer, options::Options.FontFileName.c_str(), sizeof(DialogInputBuffer));
|
||||
ShowDialog = false;
|
||||
if (!ImGui::IsPopupOpen(popupName))
|
||||
{
|
||||
ImGui::OpenPopup(popupName);
|
||||
}
|
||||
}
|
||||
|
||||
bool unused_open = true;
|
||||
if (ImGui::BeginPopupModal(popupName, &unused_open, ImGuiWindowFlags_AlwaysAutoResize))
|
||||
{
|
||||
ImGui::Text("Font file to use: ");
|
||||
ImGui::SameLine();
|
||||
ImGui::InputText("", DialogInputBuffer, IM_ARRAYSIZE(DialogInputBuffer));
|
||||
|
||||
if (ImGui::Button(pinball::get_rc_string(translation_id_e::HIGHSCORES_Ok)))
|
||||
{
|
||||
options::Options.FontFileName = DialogInputBuffer;
|
||||
ImGui::CloseCurrentPopup();
|
||||
winmain::Restart();
|
||||
}
|
||||
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button(pinball::get_rc_string(translation_id_e::HIGHSCORES_Cancel)))
|
||||
ImGui::CloseCurrentPopup();
|
||||
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue