Description:
Add italics.
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
@@ -50,7 +50,7 | |||
|
50 | 50 | |
|
51 | 51 | |
|
52 | 52 | public ImGuiWindowBridgeEngine(DebugWindow debugWindow, |
|
53 | ImFontPtr font) | |
|
53 | ImFontPtr font, ImFontPtr italicFont) | |
|
54 | 54 | { |
|
55 | 55 | this.messages = new List<ToggleWindowMessage>(); |
|
56 | 56 | this.typeMessages = new List<ToggleWindowTypeMessage>(); |
@@ -64,6 +64,7 | |||
|
64 | 64 | |
|
65 | 65 | |
|
66 | 66 | this.font = font; |
|
67 | this.italicFont = italicFont; | |
|
67 | 68 | this.debugWindow = debugWindow; |
|
68 | 69 | |
|
69 | 70 | |
@@ -109,9 +110,14 | |||
|
109 | 110 | foreach(var message in this.fontMessages) |
|
110 | 111 | { |
|
111 | 112 | this.font = debugWindow.addFont(message.fontName, |
|
112 | message.fontSize); | |
|
113 | message.fontSize, false); | |
|
113 | 114 | |
|
114 | 115 | debugWindow.setMonoFont(this.font); |
|
116 | ||
|
117 | this.italicFont = debugWindow.addFont(message.fontName, | |
|
118 | message.fontSize, true); | |
|
119 | ||
|
120 | debugWindow.setItalicFont(this.italicFont); | |
|
115 | 121 | } |
|
116 | 122 | |
|
117 | 123 |
@@ -232,7 +232,7 | |||
|
232 | 232 | WorldBuilder.AddEngine(new GameStateEngine()); |
|
233 | 233 | WorldBuilder.AddEngine(this.simulation.BridgeEngine); |
|
234 | 234 | WorldBuilder.AddEngine(new CameraBridgeEngine(this.camera)); |
|
235 | this.imGuiWindowBridgeEngine = new ImGuiWindowBridgeEngine(this.debugWindow, debugWindow.monoFont); | |
|
235 | this.imGuiWindowBridgeEngine = new ImGuiWindowBridgeEngine(this.debugWindow, debugWindow.monoFont, debugWindow.italicFont); | |
|
236 | 236 | WorldBuilder.AddEngine(this.imGuiWindowBridgeEngine); |
|
237 | 237 | WorldBuilder.AddEngine(new ContractStatusEngine(this.simulation)); |
|
238 | 238 | |
@@ -493,7 +493,7 | |||
|
493 | 493 | if (keyboardCur.IsKeyDown(Keys.V) && keyboardPrev.IsKeyUp(Keys.V)) |
|
494 | 494 | { |
|
495 | 495 | // debugWindow.swap(); |
|
496 | debugWindow.setMonoFont(debugWindow.addFont("Roboto", 25)); | |
|
496 | debugWindow.setMonoFont(debugWindow.addFont("Roboto", 25, false)); | |
|
497 | 497 | } |
|
498 | 498 | #endregion misc_keys |
|
499 | 499 | #endregion input |
@@ -105,7 +105,7 | |||
|
105 | 105 | InGameMenu.Render(this.BridgeEngine.font, this.BridgeEngine, width); |
|
106 | 106 | break; |
|
107 | 107 | case Window.Options: |
|
108 | OptionsWindow.Render(this.BridgeEngine.font, this.italicFont, this.BridgeEngine, width); | |
|
108 | OptionsWindow.Render(this.BridgeEngine.font, this.BridgeEngine.italicFont, this.BridgeEngine, width); | |
|
109 | 109 | break; |
|
110 | 110 | default: |
|
111 | 111 | break; |
@@ -41,6 +41,9 | |||
|
41 | 41 | public static Dictionary<string, string> fonts = new Dictionary<String, string>{{"Roboto" , @"Content/Roboto-Regular.ttf"}, |
|
42 | 42 | {"RobotoMedium" , @"Content/Roboto-Medium.ttf"}, |
|
43 | 43 | {"Iosevka", @"Content/iosevka-term-extendedmedium.ttf"}}; |
|
44 | public static Dictionary<string, string> italicFonts = new Dictionary<String, string>{{"Roboto" , @"Content/Roboto-Italic.ttf"}, | |
|
45 | {"RobotoMedium" , @"Content/Roboto-Medium.ttf"}, | |
|
46 | {"Iosevka", @"Content/iosevka-term-extendedmediumitalic.ttf"}}; | |
|
44 | 47 | |
|
45 | 48 | |
|
46 | 49 | public DebugWindow(ImGuiRenderer _imGuiRenderer, GraphicsDevice graphicsDevice, ImageMap map) |
@@ -113,11 +116,19 | |||
|
113 | 116 | this.renderer.RebuildFontAtlas(); // Required so fonts are available for rendering |
|
114 | 117 | } |
|
115 | 118 | |
|
116 | public ImFontPtr addFont(String name, int size) | |
|
119 | public ImFontPtr addFont(String name, int size, bool italic) | |
|
117 | 120 | { |
|
118 | 121 | ImGuiIOPtr io = ImGui.GetIO(); |
|
122 | ImFontPtr font; | |
|
119 | 123 | |
|
120 | ImFontPtr font = io.Fonts.AddFontFromFileTTF(fonts[name], size); | |
|
124 | if (italic) | |
|
125 | { | |
|
126 | font = io.Fonts.AddFontFromFileTTF(italicFonts[name], size); | |
|
127 | } | |
|
128 | else | |
|
129 | { | |
|
130 | font = io.Fonts.AddFontFromFileTTF(fonts[name], size); | |
|
131 | } | |
|
121 | 132 | unsafe //god this sucks |
|
122 | 133 | { |
|
123 | 134 | ImFontConfigPtr config = ImGuiNative.ImFontConfig_ImFontConfig(); |
@@ -139,6 +150,11 | |||
|
139 | 150 | this.monoFont = font; |
|
140 | 151 | } |
|
141 | 152 | |
|
153 | public void setItalicFont(ImFontPtr font) | |
|
154 | { | |
|
155 | this.italicFont = font; | |
|
156 | } | |
|
157 | ||
|
142 | 158 | public static Texture2D CreateTexture(GraphicsDevice device, int width, int height, Func<int, Color> paint) |
|
143 | 159 | { |
|
144 | 160 | //initialize a texture |
@@ -56,7 +56,7 | |||
|
56 | 56 | { |
|
57 | 57 | ImGui.PopStyleColor(); |
|
58 | 58 | } |
|
59 |
|
|
|
59 | OptionsWindow.hadFocus = ImGui.IsWindowFocused(); | |
|
60 | 60 | |
|
61 | 61 | ImGui.PushFont(italicFont); |
|
62 | 62 | ImGui.Text("Graphics"); |
@@ -160,6 +160,9 | |||
|
160 | 160 | <None Include="Content\Roboto-Regular.ttf"> |
|
161 | 161 | <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> |
|
162 | 162 | </None> |
|
163 | <None Include="Content\Roboto-Italic.ttf"> | |
|
164 | <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | |
|
165 | </None> | |
|
163 | 166 | </ItemGroup> |
|
164 | 167 | <ItemGroup> |
|
165 | 168 | <Reference Include="System" /> |
You need to be logged in to leave comments.
Login now