Description:
Make ImageMap and ImGuiImageMap no longer static.
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
@@ -193,9 +193,8 | |||||
|
193 | Tile.TileSetTexture = Content.Load<Texture2D>(@"part4_tileset"); |
|
193 | Tile.TileSetTexture = Content.Load<Texture2D>(@"part4_tileset"); |
|
194 | var texture = Content.Load<Texture2D>(@"solid_tileset"); |
|
194 | var texture = Content.Load<Texture2D>(@"solid_tileset"); |
|
195 |
|
195 | ||
|
196 |
|
|
196 | var imageMapTexture = Content.Load<Texture2D>(@"photos_converted3"); |
|
197 | ImGuiImageMap.ImGuiTexture = _imGuiRenderer.BindTexture(ImageMap.ImageMapTexture); |
|
197 | this.imageMap = new ImGuiImageMap(500, 400, imageMapTexture, _imGuiRenderer); |
|
198 | this.imageMap = new ImGuiImageMap(500, 400); |
|
||
|
199 |
|
198 | ||
|
200 | Line.initialize(GraphicsDevice); |
|
199 | Line.initialize(GraphicsDevice); |
|
201 | Quad.Initialize(GraphicsDevice, texture); |
|
200 | Quad.Initialize(GraphicsDevice, texture); |
@@ -4,17 +4,19 | |||||
|
4 | using Num = System.Numerics; |
|
4 | using Num = System.Numerics; |
|
5 | using Microsoft.Xna.Framework; |
|
5 | using Microsoft.Xna.Framework; |
|
6 | using Microsoft.Xna.Framework.Graphics; |
|
6 | using Microsoft.Xna.Framework.Graphics; |
|
|
7 | using ImGuiNET.SampleProgram.XNA; //for renderer | ||
|
|
8 | |||
|
7 |
|
9 | ||
|
8 | namespace isometricparkfna |
|
10 | namespace isometricparkfna |
|
9 | { |
|
11 | { |
|
10 | public class ImGuiImageMap : ImageMap |
|
12 | public class ImGuiImageMap : ImageMap |
|
11 | { |
|
13 | { |
|
12 |
public |
|
14 | public IntPtr ImGuiTexture; |
|
13 |
|
15 | ||
|
14 | public ImGuiImageMap(int tileWidth, int tileHeight) : base(tileWidth, tileHeight) |
|
16 | public ImGuiImageMap(int tileWidth, int tileHeight, Texture2D ImageMapTexture, ImGuiRenderer renderer) : base(tileWidth, tileHeight, ImageMapTexture) |
|
|
17 | |||
|
15 | { |
|
18 | { |
|
|
19 | this.ImGuiTexture = renderer.BindTexture(this.ImageMapTexture); | ||
|
16 | } |
|
20 | } |
|
17 |
|
|||
|
18 |
|
|||
|
19 | } |
|
21 | } |
|
20 | } |
|
22 | } |
@@ -8,12 +8,12 | |||||
|
8 | { |
|
8 | { |
|
9 | public class ImageMap |
|
9 | public class ImageMap |
|
10 | { |
|
10 | { |
|
11 |
|
|
11 | public Texture2D ImageMapTexture; |
|
12 |
|
12 | ||
|
13 | public int TileWidth; |
|
13 | public int TileWidth; |
|
14 | public int TileHeight; |
|
14 | public int TileHeight; |
|
15 |
|
15 | ||
|
16 | public ImageMap(int tileWidth, int tileHeight ) |
|
16 | public ImageMap(int tileWidth, int tileHeight, Texture2D ImageMapTexture) |
|
17 | { |
|
17 | { |
|
18 | this.TileHeight = tileHeight; |
|
18 | this.TileHeight = tileHeight; |
|
19 | this.TileWidth = tileWidth; |
|
19 | this.TileWidth = tileWidth; |
@@ -61,8 +61,5 | |||||
|
61 | return new Rectangle(tileX * TileWidth, tileY * TileHeight, TileWidth, TileHeight*height); |
|
61 | return new Rectangle(tileX * TileWidth, tileY * TileHeight, TileWidth, TileHeight*height); |
|
62 | } |
|
62 | } |
|
63 |
|
63 | ||
|
64 |
|
|||
|
65 |
|
|||
|
66 |
|
|||
|
67 | } |
|
64 | } |
|
68 | } |
|
65 | } |
@@ -40,7 +40,7 | |||||
|
40 | { |
|
40 | { |
|
41 | ContractWindow.map = map; |
|
41 | ContractWindow.map = map; |
|
42 |
|
42 | ||
|
43 |
var _xnaTexture = |
|
43 | var _xnaTexture = map.ImageMapTexture; |
|
44 | ContractWindow._imGuiTexture = _imGuiRenderer.BindTexture(_xnaTexture); |
|
44 | ContractWindow._imGuiTexture = _imGuiRenderer.BindTexture(_xnaTexture); |
|
45 | } |
|
45 | } |
|
46 |
|
46 |
@@ -85,7 +85,7 | |||||
|
85 |
|
85 | ||
|
86 |
|
86 | ||
|
87 | this.map = map; |
|
87 | this.map = map; |
|
88 |
_xnaTexture = |
|
88 | _xnaTexture = map.ImageMapTexture; |
|
89 | // _xnaTexture = CreateTexture(graphicsDevice, 300, 150, pixel => |
|
89 | // _xnaTexture = CreateTexture(graphicsDevice, 300, 150, pixel => |
|
90 | // { |
|
90 | // { |
|
91 | // var red = (pixel % 300) / 2; |
|
91 | // var red = (pixel % 300) / 2; |
You need to be logged in to leave comments.
Login now