Description:
Add image to dialog window (DialogInterface).
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r423:ef53046b3561 -

@@ -195,10 +195,6
195
195
196 }
196 }
197
197
198
199
200
201
202 foreach(var entity in ReadEntities<WindowTypeComponent>())
198 foreach(var entity in ReadEntities<WindowTypeComponent>())
203 {
199 {
204 var type = GetComponent<WindowTypeComponent>(entity).type;
200 var type = GetComponent<WindowTypeComponent>(entity).type;
@@ -233,7 +229,6
233 }
229 }
234 }
230 }
235
231
236
237 this.messages.Clear();
232 this.messages.Clear();
238 this.typeMessages.Clear();
233 this.typeMessages.Clear();
239 this.contractStatusMessages.Clear();
234 this.contractStatusMessages.Clear();
@@ -70,7 +70,7
70 if (EntityExists(windowMessage.Entity) && entity.ID == windowMessage.Entity.ID)
70 if (EntityExists(windowMessage.Entity) && entity.ID == windowMessage.Entity.ID)
71 {
71 {
72 var visibilityComponent = GetComponent<VisibilityComponent>(entity);
72 var visibilityComponent = GetComponent<VisibilityComponent>(entity);
73 AddComponent(entity, new VisibilityComponent { visible = !visibilityComponent.visible });
73 SetComponent(entity, new VisibilityComponent { visible = !visibilityComponent.visible });
74
74
75 }
75 }
76 }
76 }
@@ -82,6 +82,7
82 private DebugWindow debugWindow;
82 private DebugWindow debugWindow;
83
83
84 public ImGuiImageMap imageMap;
84 public ImGuiImageMap imageMap;
85 public ImGuiImageMap portraitsMap;
85
86
86 public bool show_another_window;
87 public bool show_another_window;
87
88
@@ -194,10 +195,14
194 var imageMapTexture = Content.Load<Texture2D>(@"photos_converted3");
195 var imageMapTexture = Content.Load<Texture2D>(@"photos_converted3");
195 this.imageMap = new ImGuiImageMap(500, 400, imageMapTexture, _imGuiRenderer);
196 this.imageMap = new ImGuiImageMap(500, 400, imageMapTexture, _imGuiRenderer);
196
197
198 var portraitMapTexture = Content.Load<Texture2D>(@"portraits");
199 this.portraitsMap = new ImGuiImageMap(500, 400, portraitMapTexture, _imGuiRenderer);
200
197 Line.initialize(GraphicsDevice);
201 Line.initialize(GraphicsDevice);
198 Quad.Initialize(GraphicsDevice, texture);
202 Quad.Initialize(GraphicsDevice, texture);
199 Logging.Success("Initialized Quad texture.");
203 Logging.Success("Initialized Quad texture.");
200 ContractWindow.LoadContent(this._imGuiRenderer, this.imageMap);
204 ContractWindow.LoadContent(this._imGuiRenderer, this.imageMap);
205 DialogInterface.LoadContent(this._imGuiRenderer, this.portraitsMap);
201
206
202 //Must be done before SetFontMessage is sent
207 //Must be done before SetFontMessage is sent
203 var bakedMono = TtfFontBaker.Bake(File.OpenRead(@"Content/iosevka-term-extendedmedium.ttf"),
208 var bakedMono = TtfFontBaker.Bake(File.OpenRead(@"Content/iosevka-term-extendedmedium.ttf"),
@@ -1,5 +1,6
1
1
2 using System;
2 using System;
3 using System.Diagnostics;
3
4
4 using Num = System.Numerics;
5 using Num = System.Numerics;
5 using Microsoft.Xna.Framework;
6 using Microsoft.Xna.Framework;
@@ -16,7 +17,9
16 public ImGuiImageMap(int tileWidth, int tileHeight, Texture2D ImageMapTexture, ImGuiRenderer renderer) : base(tileWidth, tileHeight, ImageMapTexture)
17 public ImGuiImageMap(int tileWidth, int tileHeight, Texture2D ImageMapTexture, ImGuiRenderer renderer) : base(tileWidth, tileHeight, ImageMapTexture)
17
18
18 {
19 {
19 this.ImGuiTexture = renderer.BindTexture(this.ImageMapTexture);
20 Logging.Info("Constructed ImGuiImageMap.");
21 this.ImGuiTexture = renderer.BindTexture(ImageMapTexture);
22 Debug.Assert(this.ImGuiTexture != null);
20 }
23 }
21 }
24 }
22 }
25 }
@@ -1,4 +1,4
1
1 using System.Diagnostics;
2
2
3 using Num = System.Numerics;
3 using Num = System.Numerics;
4 using Microsoft.Xna.Framework;
4 using Microsoft.Xna.Framework;
@@ -17,6 +17,11
17 {
17 {
18 this.TileHeight = tileHeight;
18 this.TileHeight = tileHeight;
19 this.TileWidth = tileWidth;
19 this.TileWidth = tileWidth;
20 this.ImageMapTexture = ImageMapTexture;
21 Debug.Assert(ImageMapTexture != null);
22 Debug.Assert(tileHeight != null);
23 Debug.Assert(tileWidth != null);
24 Logging.Info("Constructed ImageMap.");
20 }
25 }
21
26
22 public Rectangle GetSourceRectangle(int tileIndex)
27 public Rectangle GetSourceRectangle(int tileIndex)
@@ -2,6 +2,7
2 using System.Linq;
2 using System.Linq;
3 using System.Collections.Generic;
3 using System.Collections.Generic;
4 using ImGuiNET;
4 using ImGuiNET;
5 using ImGuiNET.SampleProgram.XNA;
5 using isometricparkfna.Utils;
6 using isometricparkfna.Utils;
6 using TraceryNet;
7 using TraceryNet;
7 using Num = System.Numerics;
8 using Num = System.Numerics;
@@ -112,6 +113,18
112 {
113 {
113
114
114 public static bool hadFocus = false;
115 public static bool hadFocus = false;
116
117 public static ImGuiImageMap map;
118 private static IntPtr _imGuiTexture;
119
120 public static void LoadContent(ImGuiRenderer _imGuiRenderer,
121 ImGuiImageMap map)
122 {
123 DialogInterface.map = map;
124 var _xnaTexture = map.ImageMapTexture;
125 DialogInterface._imGuiTexture = _imGuiRenderer.BindTexture(_xnaTexture);
126 }
127
115 public static void RenderDialog(Entity entity,
128 public static void RenderDialog(Entity entity,
116 ImGuiWindowBridgeEngine bridgeEngine, ref bool show, ref bool paused, ImFontPtr font, DialogComponent dialogComponent)
129 ImGuiWindowBridgeEngine bridgeEngine, ref bool show, ref bool paused, ImFontPtr font, DialogComponent dialogComponent)
117 {
130 {
@@ -135,6 +148,12
135 }
148 }
136 DialogInterface.hadFocus = ImGui.IsWindowFocused();
149 DialogInterface.hadFocus = ImGui.IsWindowFocused();
137
150
151 ImGui.Columns(2);
152
153 Widgets.MapImage(DialogInterface.map, new Num.Vector2(150, 100), 1);
154
155 ImGui.NextColumn();
156
138
157
139 if (dialogComponent.CurrentDialog != null)
158 if (dialogComponent.CurrentDialog != null)
140 {
159 {
@@ -142,6 +161,8
142 ImGui.TextWrapped(messageText);
161 ImGui.TextWrapped(messageText);
143 }
162 }
144
163
164 ImGui.Columns(1);
165
145 if ((dialogComponent.Options != null) && dialogComponent.Options.Count > 0)
166 if ((dialogComponent.Options != null) && dialogComponent.Options.Count > 0)
146 {
167 {
147 for(int i = 0; i < dialogComponent.Options.Count; i++)
168 for(int i = 0; i < dialogComponent.Options.Count; i++)
@@ -95,6 +95,9
95 <None Include="Content\solid_tileset.png">
95 <None Include="Content\solid_tileset.png">
96 <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
96 <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
97 </None>
97 </None>
98 <None Include="Content\portraits.png">
99 <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
100 </None>
98 <None Include="Content\iosevka-medium.ttf">
101 <None Include="Content\iosevka-medium.ttf">
99 <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
102 <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
100 </None>
103 </None>
You need to be logged in to leave comments. Login now