Skip to content

Commit 5a86922

Browse files
committed
[Example] Tweak fonts
1 parent d54e674 commit 5a86922

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

example/src/main/java/ExampleImNodes.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ public class ExampleImNodes {
1717
private static final ImInt LINK_A = new ImInt();
1818
private static final ImInt LINK_B = new ImInt();
1919

20+
static {
21+
ImNodes.createContext();
22+
}
23+
2024
public static void show(final ImBoolean showImNodesWindow, final Graph graph) {
2125
ImGui.setNextWindowSize(500, 400, ImGuiCond.Once);
2226
ImGui.setNextWindowPos(ImGui.getMainViewport().getPosX() + 100, ImGui.getMainViewport().getPosY() + 100, ImGuiCond.Once);

example/src/main/java/Main.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,14 @@ protected void initImGui(final Configuration config) {
3232
io.addConfigFlags(ImGuiConfigFlags.ViewportsEnable); // Enable Multi-Viewport / Platform Windows
3333
io.setConfigViewportsNoTaskBarIcon(true);
3434

35-
ImNodes.createContext();
36-
37-
// Example of fonts configuration
38-
// For more information read: https://github.com/ocornut/imgui/blob/33cdbe97b8fd233c6c12ca216e76398c2e89b0d8/docs/FONTS.md
35+
initFonts(io);
36+
}
3937

38+
/**
39+
* Example of fonts configuration
40+
* For more information read: https://github.com/ocornut/imgui/blob/33cdbe97b8fd233c6c12ca216e76398c2e89b0d8/docs/FONTS.md
41+
*/
42+
private void initFonts(final ImGuiIO io) {
4043
io.getFonts().addFontDefault(); // Add default font for latin glyphs
4144

4245
// You can use the ImFontGlyphRangesBuilder helper to create glyph ranges based on text input.
@@ -95,5 +98,6 @@ private static byte[] loadFromResources(String name) {
9598

9699
public static void main(final String[] args) {
97100
launch(new Main());
101+
System.exit(0);
98102
}
99103
}

0 commit comments

Comments
 (0)