Small ui fix

This commit is contained in:
Willem Cazander 2022-02-01 00:26:21 +01:00
parent a31757a349
commit 69fc75b1af
2 changed files with 10 additions and 6 deletions

View file

@ -43,9 +43,9 @@ public class ImGuiSetup {
} }
private static void initFonts(final ImGuiIO io) { 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().getGlyphRangesDefault());
rangesBuilder.addRanges(io.getFonts().getGlyphRangesCyrillic()); rangesBuilder.addRanges(io.getFonts().getGlyphRangesCyrillic());
rangesBuilder.addRanges(io.getFonts().getGlyphRangesJapanese()); rangesBuilder.addRanges(io.getFonts().getGlyphRangesJapanese());
@ -68,8 +68,8 @@ public class ImGuiSetup {
} }
} }
final ImFontConfig fontConfig = new ImFontConfig(); ImFontConfig fontConfig = new ImFontConfig();
fontConfig.setMergeMode(true); // Enable merge mode to merge cyrillic, japanese and icons with default font fontConfig.setMergeMode(true);
final short[] glyphRanges = rangesBuilder.buildRanges(); final short[] glyphRanges = rangesBuilder.buildRanges();
io.getFonts().addFontFromMemoryTTF(Gdx.files.internal("font/NotoSansCJKjp-Medium.otf").readBytes(), 14, fontConfig, glyphRanges); io.getFonts().addFontFromMemoryTTF(Gdx.files.internal("font/NotoSansCJKjp-Medium.otf").readBytes(), 14, fontConfig, glyphRanges);

View file

@ -46,8 +46,12 @@ public class MusicPlayerRenderer extends ImGuiRendererMain {
ImGui.text(currentSong.getName()); ImGui.text(currentSong.getName());
} }
ImGui.separator(); ImGui.separator();
if (ImGui.button("Play")) { if (currentSong != null) {
main.music.play(currentSong); if (ImGui.button("Play")) {
main.music.play(currentSong);
}
} else {
ImGui.text("Play");
} }
ImGui.sameLine(); ImGui.sameLine();
if (ImGui.button("<")) { if (ImGui.button("<")) {