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