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

View File

@ -24,12 +24,12 @@ namespace RecrownedAthenaeum.Camera
/// </summary> /// </summary>
public Matrix Matrix { get; private set; } public Matrix Matrix { get; private set; }
private GraphicsDevice graphicsDevice = Setup.graphicsDeviceManager.GraphicsDevice; private GraphicsDevice graphicsDevice = Configuration.graphicsDeviceManager.GraphicsDevice;
/// <summary> /// <summary>
/// Constructs 2D camera. /// Constructs 2D camera.
/// </summary> /// </summary>
/// <param name="graphicsDevice">The graphics device to use. Will use graphics device from <see cref="Setup"/>'s graphics device manager if this is null which it is by default.</param> /// <param name="graphicsDevice">The graphics device to use. Will use graphics device from <see cref="Configuration"/>'s graphics device manager if this is null which it is by default.</param>
public Camera2D(GraphicsDevice graphicsDevice = null) public Camera2D(GraphicsDevice graphicsDevice = null)
{ {
if (graphicsDevice != null) this.graphicsDevice = graphicsDevice; if (graphicsDevice != null) this.graphicsDevice = graphicsDevice;

View File

@ -5,7 +5,7 @@ namespace RecrownedAthenaeum
/// <summary> /// <summary>
/// All variables here should be for RecrownedAthenaeum to use when needed and thus eliminates unessecary passing. /// All variables here should be for RecrownedAthenaeum to use when needed and thus eliminates unessecary passing.
/// </summary> /// </summary>
public static class Setup public static class Configuration
{ {
/// <summary> /// <summary>
/// The graphics device that will be used by default. /// The graphics device that will be used by default.

View File

@ -15,7 +15,7 @@ namespace RecrownedAthenaeum.ContentReaders
Texture2D texture; Texture2D texture;
using (MemoryStream stream = new MemoryStream(input.ReadBytes(input.ReadInt32()))) using (MemoryStream stream = new MemoryStream(input.ReadBytes(input.ReadInt32())))
{ {
texture = Texture2D.FromStream(Setup.graphicsDeviceManager.GraphicsDevice, stream); texture = Texture2D.FromStream(Configuration.graphicsDeviceManager.GraphicsDevice, stream);
} }
NinePatchData ninePatchData = JsonConvert.DeserializeObject<NinePatchData>(Encoding.ASCII.GetString(input.ReadBytes(input.ReadInt32()))); NinePatchData ninePatchData = JsonConvert.DeserializeObject<NinePatchData>(Encoding.ASCII.GetString(input.ReadBytes(input.ReadInt32())));
NinePatch ninePatch = new NinePatch(texture, ninePatchData.left, ninePatchData.right, ninePatchData.bottom, ninePatchData.top); NinePatch ninePatch = new NinePatch(texture, ninePatchData.left, ninePatchData.right, ninePatchData.bottom, ninePatchData.top);

View File

@ -16,7 +16,7 @@ namespace RecrownedAthenaeum.ContentReaders
Texture2D atlasTexture; Texture2D atlasTexture;
using (MemoryStream stream = new MemoryStream(input.ReadBytes(input.ReadInt32()))) using (MemoryStream stream = new MemoryStream(input.ReadBytes(input.ReadInt32())))
{ {
atlasTexture = Texture2D.FromStream(Setup.graphicsDeviceManager.GraphicsDevice, stream); atlasTexture = Texture2D.FromStream(Configuration.graphicsDeviceManager.GraphicsDevice, stream);
} }
string serialized = Encoding.ASCII.GetString(input.ReadBytes(input.ReadInt32())); string serialized = Encoding.ASCII.GetString(input.ReadBytes(input.ReadInt32()));
atlasData = JsonConvert.DeserializeObject<TextureAtlasData>(serialized); atlasData = JsonConvert.DeserializeObject<TextureAtlasData>(serialized);

View File

@ -58,7 +58,7 @@
<Compile Include="ContentSystem\ContentResolvers\ResolutionContentResolver.cs" /> <Compile Include="ContentSystem\ContentResolvers\ResolutionContentResolver.cs" />
<Compile Include="ContentSystem\IContentPathModifier.cs" /> <Compile Include="ContentSystem\IContentPathModifier.cs" />
<Compile Include="ContentSystem\ContentResolvers\NormalContentResolver.cs" /> <Compile Include="ContentSystem\ContentResolvers\NormalContentResolver.cs" />
<Compile Include="Setup.cs" /> <Compile Include="Configuration.cs" />
<Compile Include="SpecialTypes\ISpecialDrawable.cs" /> <Compile Include="SpecialTypes\ISpecialDrawable.cs" />
<Compile Include="SpecialTypes\NinePatch.cs" /> <Compile Include="SpecialTypes\NinePatch.cs" />
<Compile Include="SpecialTypes\Resolution.cs" /> <Compile Include="SpecialTypes\Resolution.cs" />

View File

@ -20,7 +20,7 @@ namespace RecrownedAthenaeum.Render
BasicEffect basicEffect; BasicEffect basicEffect;
PrimitiveType primitiveType; PrimitiveType primitiveType;
int verticesPerPrimitive; int verticesPerPrimitive;
GraphicsDevice graphicsDevice = Setup.graphicsDeviceManager.GraphicsDevice; GraphicsDevice graphicsDevice = Configuration.graphicsDeviceManager.GraphicsDevice;
bool began; bool began;
bool disposed; bool disposed;
@ -28,7 +28,7 @@ namespace RecrownedAthenaeum.Render
/// Creates a batch used to draw primitives. /// Creates a batch used to draw primitives.
/// </summary> /// </summary>
/// <param name="camera">The current camera being used.</param> /// <param name="camera">The current camera being used.</param>
/// <param name="graphicsDevice">The graphics device used to draw the primitives. Will be using <see cref="Setup"/>'s graphics device from graphics device manager if null. Default is null.</param> /// <param name="graphicsDevice">The graphics device used to draw the primitives. Will be using <see cref="Configuration"/>'s graphics device from graphics device manager if null. Default is null.</param>
/// <param name="verticesPerBatch">The amount of vertices every batch can hold before flushing. Default is 450. Should be changed to be the most optimal number if possible to prevent unnecessary resizing. Especially if using strip primitive types.</param> /// <param name="verticesPerBatch">The amount of vertices every batch can hold before flushing. Default is 450. Should be changed to be the most optimal number if possible to prevent unnecessary resizing. Especially if using strip primitive types.</param>
public PrimitiveBatch(Camera2D camera, GraphicsDevice graphicsDevice = null, int verticesPerBatch = 500) public PrimitiveBatch(Camera2D camera, GraphicsDevice graphicsDevice = null, int verticesPerBatch = 500)
{ {

View File

@ -23,7 +23,7 @@ namespace RecrownedAthenaeum.ScreenSystem
/// Called when the first loading screen is done, and needs to show the landing screen. /// Called when the first loading screen is done, and needs to show the landing screen.
/// </summary> /// </summary>
public event ShowFirstScreen ShowFirstScreenEvent; public event ShowFirstScreen ShowFirstScreenEvent;
private GraphicsDeviceManager graphics = Setup.graphicsDeviceManager; private GraphicsDeviceManager graphics = Configuration.graphicsDeviceManager;
private Screen previousScreen; private Screen previousScreen;
private RenderTarget2D previousScreenRenderTarget; private RenderTarget2D previousScreenRenderTarget;
private Screen currentScreen; private Screen currentScreen;

View File

@ -65,11 +65,11 @@ namespace RecrownedAthenaeum.SpecialTypes
/// Creates or obtains a previously created texture of a region. /// Creates or obtains a previously created texture of a region.
/// </summary> /// </summary>
/// <param name="name">Name of region.</param> /// <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> /// <returns>The texture from the region.</returns>
public Texture2D ObtainRegionAsTexture(string name, GraphicsDevice graphicsDevice = null) 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); return dictionaryOfRegions[name].AsTexture2D(graphicsDevice);
} }
@ -175,7 +175,7 @@ namespace RecrownedAthenaeum.SpecialTypes
/// <summary> /// <summary>
/// Create or obtains a previously created texture of this region. /// Create or obtains a previously created texture of this region.
/// </summary> /// </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> /// <returns>The texture of the region.</returns>
public Texture2D AsTexture2D(GraphicsDevice graphicsDevice = null) public Texture2D AsTexture2D(GraphicsDevice graphicsDevice = null)
{ {
@ -184,7 +184,7 @@ namespace RecrownedAthenaeum.SpecialTypes
if (regionTexture == null) if (regionTexture == null)
{ {
Color[] data = new Color[sourceRectangle.Width * sourceRectangle.Height]; 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); regionTexture = new Texture2D(graphicsDevice, sourceRectangle.Width, sourceRectangle.Height);
atlasTexture.GetData(0, sourceRectangle, data, 0, sourceRectangle.Width * sourceRectangle.Height); atlasTexture.GetData(0, sourceRectangle, data, 0, sourceRectangle.Width * sourceRectangle.Height);
regionTexture.SetData(data); regionTexture.SetData(data);

View File

@ -106,12 +106,12 @@ namespace RecrownedAthenaeum.UI.Skin
/// <summary> /// <summary>
/// loads a skin asynchronously. /// loads a skin asynchronously.
/// </summary> /// </summary>
/// <param name="graphicsDevice">Graphics device to use for texture creation. Uses graphics device from <see cref="Setup"/>by default.</param> /// <param name="graphicsDevice">Graphics device to use for texture creation. Uses graphics device from <see cref="Configuration"/>by default.</param>
/// <param name="skinData">The data to generate from.</param> /// <param name="skinData">The data to generate from.</param>
/// <param name="path">The path pointing to the file with the extension "<see cref="EXTENSION"/>".</param> /// <param name="path">The path pointing to the file with the extension "<see cref="EXTENSION"/>".</param>
public void LoadSkin(SkinData skinData, string path, GraphicsDevice graphicsDevice = null) public void LoadSkin(SkinData skinData, string path, GraphicsDevice graphicsDevice = null)
{ {
if (graphicsDevice == null) graphicsDevice = Setup.graphicsDeviceManager.GraphicsDevice; if (graphicsDevice == null) graphicsDevice = Configuration.graphicsDeviceManager.GraphicsDevice;
action = Action.LOAD; action = Action.LOAD;
this.graphicsDevice = graphicsDevice; this.graphicsDevice = graphicsDevice;
this.selectedSkinPath = path; this.selectedSkinPath = path;