This commit is contained in:
2019-01-21 22:18:22 -06:00
parent ea6b3cf9e3
commit 8c54d7e12d
9 changed files with 15 additions and 15 deletions

View File

@@ -65,11 +65,11 @@ namespace RecrownedAthenaeum.SpecialTypes
/// Creates or obtains a previously created texture of a region.
/// </summary>
/// <param name="name">Name of region.</param>
/// <param name="graphicsDevice">graphics device to be used. Default is null and will resort to using graphics device from <see cref="Setup"/>'s graphics device manager.</param>
/// <param name="graphicsDevice">graphics device to be used. Default is null and will resort to using graphics device from <see cref="Configuration"/>'s graphics device manager.</param>
/// <returns>The texture from the region.</returns>
public Texture2D ObtainRegionAsTexture(string name, GraphicsDevice graphicsDevice = null)
{
if (graphicsDevice == null) graphicsDevice = Setup.graphicsDeviceManager.GraphicsDevice;
if (graphicsDevice == null) graphicsDevice = Configuration.graphicsDeviceManager.GraphicsDevice;
return dictionaryOfRegions[name].AsTexture2D(graphicsDevice);
}
@@ -175,7 +175,7 @@ namespace RecrownedAthenaeum.SpecialTypes
/// <summary>
/// Create or obtains a previously created texture of this region.
/// </summary>
/// <param name="graphicsDevice">The graphics device to use to create the texture. Will use graphics device from <see cref="Setup"/>'s graphics device manager if left to null.</param>
/// <param name="graphicsDevice">The graphics device to use to create the texture. Will use graphics device from <see cref="Configuration"/>'s graphics device manager if left to null.</param>
/// <returns>The texture of the region.</returns>
public Texture2D AsTexture2D(GraphicsDevice graphicsDevice = null)
{
@@ -184,7 +184,7 @@ namespace RecrownedAthenaeum.SpecialTypes
if (regionTexture == null)
{
Color[] data = new Color[sourceRectangle.Width * sourceRectangle.Height];
if (graphicsDevice == null) graphicsDevice = Setup.graphicsDeviceManager.GraphicsDevice;
if (graphicsDevice == null) graphicsDevice = Configuration.graphicsDeviceManager.GraphicsDevice;
regionTexture = new Texture2D(graphicsDevice, sourceRectangle.Width, sourceRectangle.Height);
atlasTexture.GetData(0, sourceRectangle, data, 0, sourceRectangle.Width * sourceRectangle.Height);
regionTexture.SetData(data);