|
1 | 1 | using RaylibNET; |
2 | 2 | using static RaylibNET.Raylib; |
3 | 3 | using Hexa.NET.ImGui; |
| 4 | +using System.Numerics; |
4 | 5 |
|
| 6 | + |
| 7 | +SetConfigFlags( |
| 8 | + (int)(ConfigFlags.FLAG_WINDOW_HIGHDPI) |
| 9 | +); |
5 | 10 | InitWindow(800, 600, "Raylib.NET.ImGui - Example"); |
6 | 11 | SetTargetFPS(60); |
7 | 12 |
|
8 | | -RaylibNET.RlImGui.Setup(); |
| 13 | +RlImGui.Setup(); |
9 | 14 |
|
10 | 15 | int counter = 0; |
11 | 16 | bool showDemo = true; |
|
18 | 23 | // Start ImGui frame |
19 | 24 | RlImGui.Begin(); |
20 | 25 |
|
21 | | - if (ImGui.Button("Increment Counter")) |
| 26 | + // Demonstrate FontAwesome icons |
| 27 | + // Test icon-only display (matching C++ rlImGui example) |
| 28 | + ImGui.TextUnformatted(FontAwesome.Jedi); |
| 29 | + ImGui.SameLine(); |
| 30 | + ImGui.Text($"{FontAwesome.Rocket} Welcome to Raylib.NET.ImGui!"); |
| 31 | + ImGui.Separator(); |
| 32 | + |
| 33 | + // Button with icon |
| 34 | + if (ImGui.Button($"{FontAwesome.Plus} Increment Counter")) |
22 | 35 | { |
23 | 36 | counter++; |
24 | 37 | } |
25 | 38 | ImGui.SameLine(); |
26 | | - ImGui.Text($"Counter: {counter}"); |
| 39 | + ImGui.Text($"{FontAwesome.Hashtag} Counter: {counter}"); |
| 40 | + |
| 41 | + ImGui.Spacing(); |
| 42 | + |
| 43 | + // More icon examples |
| 44 | + ImGui.Text($"{FontAwesome.House} Home"); |
| 45 | + ImGui.SameLine(); |
| 46 | + ImGui.Text($"{FontAwesome.Gear} Settings"); |
| 47 | + ImGui.SameLine(); |
| 48 | + ImGui.Text($"{FontAwesome.Heart} Favorite"); |
| 49 | + ImGui.SameLine(); |
| 50 | + ImGui.Text($"{FontAwesome.Star} Rating"); |
| 51 | + |
| 52 | + ImGui.Spacing(); |
| 53 | + |
| 54 | + // Demonstrate color extensions |
| 55 | + var raylibColor = Color.RAYWHITE; |
| 56 | + var imguiColor = raylibColor.ToImGui(); |
| 57 | + ImGui.TextColored(imguiColor, "This text uses Raylib.RAYWHITE converted to ImGui color!"); |
| 58 | + |
| 59 | + var customImGuiColor = new Vector4(0.2f, 0.8f, 0.4f, 1.0f); |
| 60 | + var convertedBack = customImGuiColor.ToRaylib(); |
| 61 | + ImGui.Text($"Custom color RGB: {convertedBack.R}, {convertedBack.G}, {convertedBack.B}"); |
| 62 | + |
| 63 | + ImGui.Spacing(); |
| 64 | + ImGui.Separator(); |
27 | 65 |
|
28 | | - ImGui.Checkbox("Show ImGui Demo Window", ref showDemo); |
| 66 | + ImGui.Checkbox($"{FontAwesome.WindowMaximize} Show ImGui Demo Window", ref showDemo); |
29 | 67 | if (showDemo) |
30 | 68 | { |
31 | 69 | ImGui.ShowDemoWindow(ref showDemo); |
|
0 commit comments