Title selection & bug fixes

Added title selection
Fixed controller hotkeys for multiple connected controllers
Fixed ImGUI dialog box stacking
Added a new font for ImGUI
This commit is contained in:
Adrian
2023-01-15 23:23:43 +00:00
committed by Radosław Gliński
parent 459497f0b6
commit 504fb9f205
4 changed files with 135 additions and 34 deletions

View File

@@ -109,13 +109,29 @@ void ImGuiDrawer::Initialize() {
ImFontConfig font_config;
font_config.OversampleH = font_config.OversampleV = 1;
font_config.PixelSnapH = true;
// https://jrgraphix.net/r/Unicode/
static const ImWchar font_glyph_ranges[] = {
0x0020,
0x00FF, // Basic Latin + Latin Supplement
0x0020, 0x00FF, // Basic Latin + Latin Supplement
0x2000, 0x206F, // General Punctuation
0,
};
io.Fonts->AddFontFromMemoryCompressedBase85TTF(
kProggyTinyCompressedDataBase85, 10.0f, &font_config, font_glyph_ranges);
kProggyTinyCompressedDataBase85, 10.0f, &font_config,
io.Fonts->GetGlyphRangesDefault());
font_config.MergeMode = true;
const char* alt_font = "C:\\Windows\\Fonts\\segoeui.ttf";
if (std::filesystem::exists(alt_font)) {
io.Fonts->AddFontFromFileTTF(alt_font, 16.0f, &font_config,
font_glyph_ranges);
} else {
XELOGW(
"Unable to load Segoe UI; General Punctuation characters will be "
"boxes");
}
// TODO(benvanik): jp font on other platforms?
// https://github.com/Koruri/kibitaki looks really good, but is 1.5MiB.
const char* jp_font_path = "C:\\Windows\\Fonts\\msgothic.ttc";
@@ -328,6 +344,14 @@ void ImGuiDrawer::Draw(UIDrawContext& ui_draw_context) {
}
}
void ImGuiDrawer::ClearDialogs() {
size_t dialog_loop = 0;
while (dialog_loop < dialogs_.size()) {
RemoveDialog(dialogs_[dialog_loop++]);
}
}
void ImGuiDrawer::RenderDrawLists(ImDrawData* data,
UIDrawContext& ui_draw_context) {
ImGuiIO& io = ImGui::GetIO();

View File

@@ -51,6 +51,8 @@ class ImGuiDrawer : public WindowInputListener, public UIDrawer {
}
void Draw(UIDrawContext& ui_draw_context) override;
void ClearDialogs();
protected:
void OnKeyDown(KeyEvent& e) override;