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 198 foreach(var entity in ReadEntities<WindowTypeComponent>())
203 199 {
204 200 var type = GetComponent<WindowTypeComponent>(entity).type;
@@ -233,7 +229,6
233 229 }
234 230 }
235 231
236
237 232 this.messages.Clear();
238 233 this.typeMessages.Clear();
239 234 this.contractStatusMessages.Clear();
@@ -70,7 +70,7
70 70 if (EntityExists(windowMessage.Entity) && entity.ID == windowMessage.Entity.ID)
71 71 {
72 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 82 private DebugWindow debugWindow;
83 83
84 84 public ImGuiImageMap imageMap;
85 public ImGuiImageMap portraitsMap;
85 86
86 87 public bool show_another_window;
87 88
@@ -194,10 +195,14
194 195 var imageMapTexture = Content.Load<Texture2D>(@"photos_converted3");
195 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 201 Line.initialize(GraphicsDevice);
198 202 Quad.Initialize(GraphicsDevice, texture);
199 203 Logging.Success("Initialized Quad texture.");
200 204 ContractWindow.LoadContent(this._imGuiRenderer, this.imageMap);
205 DialogInterface.LoadContent(this._imGuiRenderer, this.portraitsMap);
201 206
202 207 //Must be done before SetFontMessage is sent
203 208 var bakedMono = TtfFontBaker.Bake(File.OpenRead(@"Content/iosevka-term-extendedmedium.ttf"),
@@ -1,5 +1,6
1 1
2 2 using System;
3 using System.Diagnostics;
3 4
4 5 using Num = System.Numerics;
5 6 using Microsoft.Xna.Framework;
@@ -16,7 +17,9
16 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 3 using Num = System.Numerics;
4 4 using Microsoft.Xna.Framework;
@@ -17,6 +17,11
17 17 {
18 18 this.TileHeight = tileHeight;
19 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 27 public Rectangle GetSourceRectangle(int tileIndex)
@@ -2,6 +2,7
2 2 using System.Linq;
3 3 using System.Collections.Generic;
4 4 using ImGuiNET;
5 using ImGuiNET.SampleProgram.XNA;
5 6 using isometricparkfna.Utils;
6 7 using TraceryNet;
7 8 using Num = System.Numerics;
@@ -112,6 +113,18
112 113 {
113 114
114 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 128 public static void RenderDialog(Entity entity,
116 129 ImGuiWindowBridgeEngine bridgeEngine, ref bool show, ref bool paused, ImFontPtr font, DialogComponent dialogComponent)
117 130 {
@@ -135,6 +148,12
135 148 }
136 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 158 if (dialogComponent.CurrentDialog != null)
140 159 {
@@ -142,6 +161,8
142 161 ImGui.TextWrapped(messageText);
143 162 }
144 163
164 ImGui.Columns(1);
165
145 166 if ((dialogComponent.Options != null) && dialogComponent.Options.Count > 0)
146 167 {
147 168 for(int i = 0; i < dialogComponent.Options.Count; i++)
@@ -95,6 +95,9
95 95 <None Include="Content\solid_tileset.png">
96 96 <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
97 97 </None>
98 <None Include="Content\portraits.png">
99 <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
100 </None>
98 101 <None Include="Content\iosevka-medium.ttf">
99 102 <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
100 103 </None>
You need to be logged in to leave comments. Login now