diff --git a/isometric-park-fna/FNAGame.cs b/isometric-park-fna/FNAGame.cs --- a/isometric-park-fna/FNAGame.cs +++ b/isometric-park-fna/FNAGame.cs @@ -193,9 +193,8 @@ Tile.TileSetTexture = Content.Load(@"part4_tileset"); var texture = Content.Load(@"solid_tileset"); - ImageMap.ImageMapTexture = Content.Load(@"photos_converted3"); - ImGuiImageMap.ImGuiTexture = _imGuiRenderer.BindTexture(ImageMap.ImageMapTexture); - this.imageMap = new ImGuiImageMap(500, 400); + var imageMapTexture = Content.Load(@"photos_converted3"); + this.imageMap = new ImGuiImageMap(500, 400, imageMapTexture, _imGuiRenderer); Line.initialize(GraphicsDevice); Quad.Initialize(GraphicsDevice, texture); diff --git a/isometric-park-fna/ImGuiImageMap.cs b/isometric-park-fna/ImGuiImageMap.cs --- a/isometric-park-fna/ImGuiImageMap.cs +++ b/isometric-park-fna/ImGuiImageMap.cs @@ -4,17 +4,19 @@ using Num = System.Numerics; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ImGuiNET.SampleProgram.XNA; //for renderer + namespace isometricparkfna { public class ImGuiImageMap : ImageMap { - public static IntPtr ImGuiTexture; + public IntPtr ImGuiTexture; - public ImGuiImageMap(int tileWidth, int tileHeight) : base(tileWidth, tileHeight) + public ImGuiImageMap(int tileWidth, int tileHeight, Texture2D ImageMapTexture, ImGuiRenderer renderer) : base(tileWidth, tileHeight, ImageMapTexture) + { + this.ImGuiTexture = renderer.BindTexture(this.ImageMapTexture); } - - } } diff --git a/isometric-park-fna/ImageMap.cs b/isometric-park-fna/ImageMap.cs --- a/isometric-park-fna/ImageMap.cs +++ b/isometric-park-fna/ImageMap.cs @@ -8,12 +8,12 @@ { public class ImageMap { - static public Texture2D ImageMapTexture; + public Texture2D ImageMapTexture; public int TileWidth; public int TileHeight; - public ImageMap(int tileWidth, int tileHeight ) + public ImageMap(int tileWidth, int tileHeight, Texture2D ImageMapTexture) { this.TileHeight = tileHeight; this.TileWidth = tileWidth; @@ -61,8 +61,5 @@ return new Rectangle(tileX * TileWidth, tileY * TileHeight, TileWidth, TileHeight*height); } - - - } } diff --git a/isometric-park-fna/UI/ContractWindow.cs b/isometric-park-fna/UI/ContractWindow.cs --- a/isometric-park-fna/UI/ContractWindow.cs +++ b/isometric-park-fna/UI/ContractWindow.cs @@ -40,7 +40,7 @@ { ContractWindow.map = map; - var _xnaTexture = ImageMap.ImageMapTexture; + var _xnaTexture = map.ImageMapTexture; ContractWindow._imGuiTexture = _imGuiRenderer.BindTexture(_xnaTexture); } diff --git a/isometric-park-fna/UI/DebugWindow.cs b/isometric-park-fna/UI/DebugWindow.cs --- a/isometric-park-fna/UI/DebugWindow.cs +++ b/isometric-park-fna/UI/DebugWindow.cs @@ -85,7 +85,7 @@ this.map = map; - _xnaTexture = ImageMap.ImageMapTexture; + _xnaTexture = map.ImageMapTexture; // _xnaTexture = CreateTexture(graphicsDevice, 300, 150, pixel => // { // var red = (pixel % 300) / 2;