diff --git a/Source/Core/Data/DataManager.cs b/Source/Core/Data/DataManager.cs index ce8e32fc..c828d3d8 100644 --- a/Source/Core/Data/DataManager.cs +++ b/Source/Core/Data/DataManager.cs @@ -147,19 +147,19 @@ namespace CodeImp.DoomBuilder.Data GC.SuppressFinalize(this); // Load special images - missingtexture3d = new ResourceImage("MissingTexture3D.png"); + missingtexture3d = new ResourceImage("CodeImp.DoomBuilder.Resources.MissingTexture3D.png"); missingtexture3d.LoadImage(); - unknowntexture3d = new ResourceImage("UnknownTexture3D.png"); + unknowntexture3d = new ResourceImage("CodeImp.DoomBuilder.Resources.UnknownTexture3D.png"); unknowntexture3d.LoadImage(); - hourglass3d = new ResourceImage("Hourglass3D.png"); + hourglass3d = new ResourceImage("CodeImp.DoomBuilder.Resources.Hourglass3D.png"); hourglass3d.LoadImage(); - crosshair = new ResourceImage("Crosshair.png"); + crosshair = new ResourceImage("CodeImp.DoomBuilder.Resources.Crosshair.png"); crosshair.LoadImage(); - crosshairbusy = new ResourceImage("CrosshairBusy.png"); + crosshairbusy = new ResourceImage("CodeImp.DoomBuilder.Resources.CrosshairBusy.png"); crosshairbusy.LoadImage(); - thingbox = new ResourceImage("ThingBox.png"); + thingbox = new ResourceImage("CodeImp.DoomBuilder.Resources.ThingBox.png"); thingbox.LoadImage(); - whitetexture = new ResourceImage("White.png"); + whitetexture = new ResourceImage("CodeImp.DoomBuilder.Resources.White.png"); whitetexture.UseColorCorrection = false; whitetexture.LoadImage(); whitetexture.CreateTexture(); @@ -1091,14 +1091,14 @@ namespace CodeImp.DoomBuilder.Data // Add some internal resources if(!internalsprites.ContainsKey("nothing")) { - ImageData img = new ResourceImage("Nothing.png"); + ImageData img = new ResourceImage("CodeImp.DoomBuilder.Resources.Nothing.png"); img.LoadImage(); internalsprites.Add("nothing", img); } if(!internalsprites.ContainsKey("unknownthing")) { - ImageData img = new ResourceImage("UnknownThing.png"); + ImageData img = new ResourceImage("CodeImp.DoomBuilder.Resources.UnknownThing.png"); img.LoadImage(); internalsprites.Add("unknownthing", img); } diff --git a/Source/Core/Data/ResourceImage.cs b/Source/Core/Data/ResourceImage.cs index 0e70d427..bddef9e9 100644 --- a/Source/Core/Data/ResourceImage.cs +++ b/Source/Core/Data/ResourceImage.cs @@ -20,6 +20,7 @@ using System; using System.Collections; using System.Collections.Generic; using System.Globalization; +using System.Reflection; using System.Text; using System.Drawing; using System.Drawing.Imaging; @@ -33,16 +34,26 @@ namespace CodeImp.DoomBuilder.Data { public class ResourceImage : ImageData { + #region ================== Variables + + // Image source + private Assembly assembly; + private string resourcename; + + #endregion + #region ================== Constructor / Disposer // Constructor public ResourceImage(string resourcename) { // Initialize + this.assembly = Assembly.GetCallingAssembly(); + this.resourcename = resourcename; SetName(resourcename); // Temporarily load resource from memory - Stream bitmapdata = General.ThisAssembly.GetManifestResourceStream("CodeImp.DoomBuilder.Resources." + Name); + Stream bitmapdata = assembly.GetManifestResourceStream(resourcename); Bitmap bmp = (Bitmap)Image.FromStream(bitmapdata); // Get width and height from image @@ -74,7 +85,7 @@ namespace CodeImp.DoomBuilder.Data // because the resources this loads are in the assembly. // Get resource from memory - bitmapdata = General.ThisAssembly.GetManifestResourceStream("CodeImp.DoomBuilder.Resources." + Name); + bitmapdata = assembly.GetManifestResourceStream(resourcename); if(bitmap != null) bitmap.Dispose(); bitmap = (Bitmap)Image.FromStream(bitmapdata); bitmapdata.Dispose(); diff --git a/Source/Core/Rendering/D3DDevice.cs b/Source/Core/Rendering/D3DDevice.cs index f5d87ee4..2540e22a 100644 --- a/Source/Core/Rendering/D3DDevice.cs +++ b/Source/Core/Rendering/D3DDevice.cs @@ -319,7 +319,7 @@ namespace CodeImp.DoomBuilder.Rendering // Font postfilter = Filter.Box; font = new TextFont(); - fonttexture = new ResourceImage("Font.png"); + fonttexture = new ResourceImage("CodeImp.DoomBuilder.Resources.Font.png"); fonttexture.LoadImage(); fonttexture.MipMapLevels = 2; fonttexture.CreateTexture(); diff --git a/Source/Core/Rendering/Renderer2D.cs b/Source/Core/Rendering/Renderer2D.cs index 0d0de346..9f89976c 100644 --- a/Source/Core/Rendering/Renderer2D.cs +++ b/Source/Core/Rendering/Renderer2D.cs @@ -154,7 +154,7 @@ namespace CodeImp.DoomBuilder.Rendering thingtexture = new ResourceImage[NUM_THING_TEXTURES]; for(int i = 0; i < NUM_THING_TEXTURES; i++) { - thingtexture[i] = new ResourceImage("Thing2D_" + i.ToString(CultureInfo.InvariantCulture) + ".png"); + thingtexture[i] = new ResourceImage("CodeImp.DoomBuilder.Resources.Thing2D_" + i.ToString(CultureInfo.InvariantCulture) + ".png"); thingtexture[i].UseColorCorrection = false; thingtexture[i].LoadImage(); thingtexture[i].CreateTexture();