Description:
Get image loaded into debug window.
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r123:61354cfb4d0e -

1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
@@ -191,7 +191,7
191 }
191 }
192 );
192 );
193
193
194 this.debugWindow = new DebugWindow(this._imGuiRenderer, GraphicsDevice);
194 this.debugWindow = new DebugWindow(this._imGuiRenderer, GraphicsDevice, this.imageMap);
195
195
196 var json2 = new FileInfo(@"Content/grammar.json");
196 var json2 = new FileInfo(@"Content/grammar.json");
197
197
@@ -628,18 +628,6
628 }
628 }
629 }
629 }
630
630
631 batch.Draw(
632 ImageMap.ImageMapTexture,
633 new Rectangle(
634 0, // screenx,
635 0, // screeny,
636 Tile.TileWidth, Tile.TileHeight),
637 imageMap.GetSourceRectangle(1),
638 Color.White,
639 0.0f,
640 Vector2.Zero,
641 SpriteEffects.None,
642 0.9f);
643 #endregion draw_tiles
631 #endregion draw_tiles
644
632
645 #region draw_gridlines
633 #region draw_gridlines
@@ -33,8 +33,10
33
33
34 public ImFontPtr monoFont;
34 public ImFontPtr monoFont;
35
35
36 public ImageMap map;
36
37
37 public DebugWindow(ImGuiRenderer _imGuiRenderer, GraphicsDevice graphicsDevice)
38
39 public DebugWindow(ImGuiRenderer _imGuiRenderer, GraphicsDevice graphicsDevice, ImageMap map)
38 {
40 {
39 ImGuiIOPtr io = ImGui.GetIO();
41 ImGuiIOPtr io = ImGui.GetIO();
40 //io.Fonts.AddFontFromFileTTF(@"Content/iosevka-term-medium.ttf", 15);
42 //io.Fonts.AddFontFromFileTTF(@"Content/iosevka-term-medium.ttf", 15);
@@ -65,12 +67,14
65 _imGuiRenderer.RebuildFontAtlas(); // Required so fonts are available for rendering
67 _imGuiRenderer.RebuildFontAtlas(); // Required so fonts are available for rendering
66
68
67
69
68 _xnaTexture = CreateTexture(graphicsDevice, 300, 150, pixel =>
70 this.map = map;
69 {
71 _xnaTexture = ImageMap.ImageMapTexture;
70 var red = (pixel % 300) / 2;
72 // _xnaTexture = CreateTexture(graphicsDevice, 300, 150, pixel =>
71 return new Color(red, 1, 1);
73 // {
72 });
74 // var red = (pixel % 300) / 2;
73
75 // return new Color(red, 1, 1);
76 // });
77 //
74 // Then, bind it to an ImGui-friendly pointer, that we can use during regular ImGui.** calls (see below)
78 // Then, bind it to an ImGui-friendly pointer, that we can use during regular ImGui.** calls (see below)
75 _imGuiTexture = _imGuiRenderer.BindTexture(_xnaTexture);
79 _imGuiTexture = _imGuiRenderer.BindTexture(_xnaTexture);
76 }
80 }
@@ -119,7 +123,7
119 ImGui.InputText("Text input", _textBuffer, 100);
123 ImGui.InputText("Text input", _textBuffer, 100);
120
124
121 ImGui.Text("Texture sample");
125 ImGui.Text("Texture sample");
122 ImGui.Image(_imGuiTexture, new Num.Vector2(300, 150), Num.Vector2.Zero, Num.Vector2.One, Num.Vector4.One, Num.Vector4.One); // Here, the previously loaded texture is used
126 // ImGui.Image(_imGuiTexture, new Num.Vector2(300, 150), Num.Vector2.Zero, map.GetSourceUV(1), Num.Vector4.One, Num.Vector4.One); // Here, the previously loaded texture is used
123 }
127 }
124 }
128 }
125
129
@@ -157,8 +161,13
157 {
161 {
158 ImGui.Text(string.Format("{0}: {1}", k, additionalInfo[k]));
162 ImGui.Text(string.Format("{0}: {1}", k, additionalInfo[k]));
159 }
163 }
164
165 ImGui.Text("Texture sample");
166 ImGui.Image(_imGuiTexture, new Num.Vector2(250, 200), map.GetSourceUVStart(1), map.GetSourceUVEnd(1), Num.Vector4.One, Num.Vector4.One); // Here, the previously loaded texture is used
167
160 ImGui.End();
168 ImGui.End();
161 }
169 }
170
162
171
163
172
164 if (this.show_test_window)
173 if (this.show_test_window)
You need to be logged in to leave comments. Login now