From 69fc75b1af458ba76d18bc08686d62de24f3338f Mon Sep 17 00:00:00 2001 From: Willem Cazander Date: Tue, 1 Feb 2022 00:26:21 +0100 Subject: [PATCH] Small ui fix --- core/src/love/distributedrebirth/demo4d/ImGuiSetup.java | 8 ++++---- .../demo4d/music/MusicPlayerRenderer.java | 8 ++++++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/core/src/love/distributedrebirth/demo4d/ImGuiSetup.java b/core/src/love/distributedrebirth/demo4d/ImGuiSetup.java index 00a8587b..fa04050b 100644 --- a/core/src/love/distributedrebirth/demo4d/ImGuiSetup.java +++ b/core/src/love/distributedrebirth/demo4d/ImGuiSetup.java @@ -43,9 +43,9 @@ public class ImGuiSetup { } private static void initFonts(final ImGuiIO io) { - io.getFonts().addFontDefault(); // Add default font for latin glyphs + io.getFonts().addFontDefault(); - final ImFontGlyphRangesBuilder rangesBuilder = new ImFontGlyphRangesBuilder(); // Glyphs ranges provide + ImFontGlyphRangesBuilder rangesBuilder = new ImFontGlyphRangesBuilder(); rangesBuilder.addRanges(io.getFonts().getGlyphRangesDefault()); rangesBuilder.addRanges(io.getFonts().getGlyphRangesCyrillic()); rangesBuilder.addRanges(io.getFonts().getGlyphRangesJapanese()); @@ -68,8 +68,8 @@ public class ImGuiSetup { } } - final ImFontConfig fontConfig = new ImFontConfig(); - fontConfig.setMergeMode(true); // Enable merge mode to merge cyrillic, japanese and icons with default font + ImFontConfig fontConfig = new ImFontConfig(); + fontConfig.setMergeMode(true); final short[] glyphRanges = rangesBuilder.buildRanges(); io.getFonts().addFontFromMemoryTTF(Gdx.files.internal("font/NotoSansCJKjp-Medium.otf").readBytes(), 14, fontConfig, glyphRanges); diff --git a/core/src/love/distributedrebirth/demo4d/music/MusicPlayerRenderer.java b/core/src/love/distributedrebirth/demo4d/music/MusicPlayerRenderer.java index 7e1c3e5b..2644250d 100644 --- a/core/src/love/distributedrebirth/demo4d/music/MusicPlayerRenderer.java +++ b/core/src/love/distributedrebirth/demo4d/music/MusicPlayerRenderer.java @@ -46,8 +46,12 @@ public class MusicPlayerRenderer extends ImGuiRendererMain { ImGui.text(currentSong.getName()); } ImGui.separator(); - if (ImGui.button("Play")) { - main.music.play(currentSong); + if (currentSong != null) { + if (ImGui.button("Play")) { + main.music.play(currentSong); + } + } else { + ImGui.text("Play"); } ImGui.sameLine(); if (ImGui.button("<")) {