diff --git a/RecrownedGTK.Tests/Graphics/Render/Shaders/ShaderTest.cs b/RecrownedGTK.Tests/Graphics/Render/Shaders/ShaderTest.cs new file mode 100644 index 0000000..e1fc74b --- /dev/null +++ b/RecrownedGTK.Tests/Graphics/Render/Shaders/ShaderTest.cs @@ -0,0 +1,20 @@ +using NUnit.Framework; +using RecrownedGTK.Graphics.Render.Shaders; +namespace RecrownedGTK.Tests +{ + [TestFixture] + public class ShaderTest + { + Shader currentShader; + + public void Setup() + { + } + + [Test] + public void Test() + { + Assert.DoesNotThrow(Shader.CreateBasicShader); + } + } +} \ No newline at end of file diff --git a/RecrownedGTK.Tests/RecrownedGTK.Tests.csproj b/RecrownedGTK.Tests/RecrownedGTK.Tests.csproj new file mode 100644 index 0000000..b74236b --- /dev/null +++ b/RecrownedGTK.Tests/RecrownedGTK.Tests.csproj @@ -0,0 +1,19 @@ + + + + net48 + + false + + + + + + + + + + + + + diff --git a/RecrownedGTK.Tools/src/CommandProcessor/CommandEngine.cs b/RecrownedGTK.Tools/CommandProcessor/CommandEngine.cs similarity index 100% rename from RecrownedGTK.Tools/src/CommandProcessor/CommandEngine.cs rename to RecrownedGTK.Tools/CommandProcessor/CommandEngine.cs diff --git a/RecrownedGTK.Tools/src/CommandProcessor/Commands/ClearConsoleCommand.cs b/RecrownedGTK.Tools/CommandProcessor/Commands/ClearConsoleCommand.cs similarity index 100% rename from RecrownedGTK.Tools/src/CommandProcessor/Commands/ClearConsoleCommand.cs rename to RecrownedGTK.Tools/CommandProcessor/Commands/ClearConsoleCommand.cs diff --git a/RecrownedGTK.Tools/src/CommandProcessor/Commands/HelpCommand.cs b/RecrownedGTK.Tools/CommandProcessor/Commands/HelpCommand.cs similarity index 100% rename from RecrownedGTK.Tools/src/CommandProcessor/Commands/HelpCommand.cs rename to RecrownedGTK.Tools/CommandProcessor/Commands/HelpCommand.cs diff --git a/RecrownedGTK.Tools/src/CommandProcessor/Commands/StopCommand.cs b/RecrownedGTK.Tools/CommandProcessor/Commands/StopCommand.cs similarity index 100% rename from RecrownedGTK.Tools/src/CommandProcessor/Commands/StopCommand.cs rename to RecrownedGTK.Tools/CommandProcessor/Commands/StopCommand.cs diff --git a/RecrownedGTK.Tools/src/CommandProcessor/EngineCommand.cs b/RecrownedGTK.Tools/CommandProcessor/EngineCommand.cs similarity index 100% rename from RecrownedGTK.Tools/src/CommandProcessor/EngineCommand.cs rename to RecrownedGTK.Tools/CommandProcessor/EngineCommand.cs diff --git a/RecrownedGTK.Tools/src/CommandProcessor/EngineCommandArgument.cs b/RecrownedGTK.Tools/CommandProcessor/EngineCommandArgument.cs similarity index 100% rename from RecrownedGTK.Tools/src/CommandProcessor/EngineCommandArgument.cs rename to RecrownedGTK.Tools/CommandProcessor/EngineCommandArgument.cs diff --git a/RecrownedGTK.Tools/src/ConsoleUtilities.cs b/RecrownedGTK.Tools/ConsoleUtilities.cs similarity index 100% rename from RecrownedGTK.Tools/src/ConsoleUtilities.cs rename to RecrownedGTK.Tools/ConsoleUtilities.cs diff --git a/RecrownedGTK.Tools/src/NinePatchTools/NinePatchCommand.cs b/RecrownedGTK.Tools/NinePatchTools/NinePatchCommand.cs similarity index 100% rename from RecrownedGTK.Tools/src/NinePatchTools/NinePatchCommand.cs rename to RecrownedGTK.Tools/NinePatchTools/NinePatchCommand.cs diff --git a/RecrownedGTK.Tools/src/RecrownedGTK.Tools.csproj b/RecrownedGTK.Tools/RecrownedGTK.Tools.csproj similarity index 100% rename from RecrownedGTK.Tools/src/RecrownedGTK.Tools.csproj rename to RecrownedGTK.Tools/RecrownedGTK.Tools.csproj diff --git a/RecrownedGTK.Tools/src/TextureAtlasTools/TexturePacker.cs b/RecrownedGTK.Tools/TextureAtlasTools/TexturePacker.cs similarity index 100% rename from RecrownedGTK.Tools/src/TextureAtlasTools/TexturePacker.cs rename to RecrownedGTK.Tools/TextureAtlasTools/TexturePacker.cs diff --git a/RecrownedGTK.Tools/src/TextureAtlasTools/TexturePackerCommand.cs b/RecrownedGTK.Tools/TextureAtlasTools/TexturePackerCommand.cs similarity index 100% rename from RecrownedGTK.Tools/src/TextureAtlasTools/TexturePackerCommand.cs rename to RecrownedGTK.Tools/TextureAtlasTools/TexturePackerCommand.cs diff --git a/RecrownedGTK.Tools/src/Tools.cs b/RecrownedGTK.Tools/Tools.cs similarity index 100% rename from RecrownedGTK.Tools/src/Tools.cs rename to RecrownedGTK.Tools/Tools.cs diff --git a/RecrownedGTK.code-workspace b/RecrownedGTK.code-workspace index a2be612..deb4dca 100644 --- a/RecrownedGTK.code-workspace +++ b/RecrownedGTK.code-workspace @@ -5,6 +5,12 @@ }, { "path": "RecrownedGTK.Tools" + }, + { + "path": "RecrownedGTK.Tests" + }, + { + "path": "RecrownedGTK.Tools.Tests" } ], "settings": {} diff --git a/RecrownedGTK/src/AssetsSystem/AssetLoader.cs b/RecrownedGTK/AssetsSystem/AssetLoader.cs similarity index 100% rename from RecrownedGTK/src/AssetsSystem/AssetLoader.cs rename to RecrownedGTK/AssetsSystem/AssetLoader.cs diff --git a/RecrownedGTK/src/AssetsSystem/AssetManager.cs b/RecrownedGTK/AssetsSystem/AssetManager.cs similarity index 100% rename from RecrownedGTK/src/AssetsSystem/AssetManager.cs rename to RecrownedGTK/AssetsSystem/AssetManager.cs diff --git a/RecrownedGTK/src/AssetsSystem/IAssetPathResolver.cs b/RecrownedGTK/AssetsSystem/IAssetPathResolver.cs similarity index 100% rename from RecrownedGTK/src/AssetsSystem/IAssetPathResolver.cs rename to RecrownedGTK/AssetsSystem/IAssetPathResolver.cs diff --git a/RecrownedGTK/src/AssetsSystem/NormalContentResolver.cs b/RecrownedGTK/AssetsSystem/NormalContentResolver.cs similarity index 100% rename from RecrownedGTK/src/AssetsSystem/NormalContentResolver.cs rename to RecrownedGTK/AssetsSystem/NormalContentResolver.cs diff --git a/RecrownedGTK/src/Game.cs b/RecrownedGTK/Game.cs similarity index 100% rename from RecrownedGTK/src/Game.cs rename to RecrownedGTK/Game.cs diff --git a/RecrownedGTK/src/Graphics/ElementBufferHandle.cs b/RecrownedGTK/Graphics/ElementBufferHandle.cs similarity index 100% rename from RecrownedGTK/src/Graphics/ElementBufferHandle.cs rename to RecrownedGTK/Graphics/ElementBufferHandle.cs diff --git a/RecrownedGTK/src/Graphics/Particles/Particle.cs b/RecrownedGTK/Graphics/Particles/Particle.cs similarity index 100% rename from RecrownedGTK/src/Graphics/Particles/Particle.cs rename to RecrownedGTK/Graphics/Particles/Particle.cs diff --git a/RecrownedGTK/src/Graphics/Render/IDrawable.cs b/RecrownedGTK/Graphics/Render/IDrawable.cs similarity index 76% rename from RecrownedGTK/src/Graphics/Render/IDrawable.cs rename to RecrownedGTK/Graphics/Render/IDrawable.cs index 2d89e1b..d3d22ee 100644 --- a/RecrownedGTK/src/Graphics/Render/IDrawable.cs +++ b/RecrownedGTK/Graphics/Render/IDrawable.cs @@ -3,10 +3,10 @@ namespace RecrownedGTK.Graphics.Render { public interface IDrawable { /// - /// Fills the parameters with the information needed to draw this texture.!-- + /// Fills the parameters with the information needed to draw this texture. /// /// The vertices in pairs of 3 normalized in the order x, y, and z. /// The texture data to be used. Can be null. - void Draw(out VertexInformation[] vertices, out TextureData textureData); + void Draw(out VertexInformation[] vertices, out uint[] indices, out TextureData textureData); } } \ No newline at end of file diff --git a/RecrownedGTK/src/Graphics/Render/RectTexture.cs b/RecrownedGTK/Graphics/Render/RectTexture.cs similarity index 85% rename from RecrownedGTK/src/Graphics/Render/RectTexture.cs rename to RecrownedGTK/Graphics/Render/RectTexture.cs index a55e3df..faa7013 100644 --- a/RecrownedGTK/src/Graphics/Render/RectTexture.cs +++ b/RecrownedGTK/Graphics/Render/RectTexture.cs @@ -2,6 +2,7 @@ using RecrownedGTK.Types; using OpenTK.Graphics; namespace RecrownedGTK.Graphics.Render { public class RectTexture : Rectangle, IDrawable { + private uint[] indices; private VertexInformation[] vertices; private TextureData textureData; public Color4 Color { @@ -55,8 +56,13 @@ namespace RecrownedGTK.Graphics.Render { } public RectTexture(TextureData textureData) { this.textureData = textureData; + + vertices = new VertexInformation[4]; + indices = new uint[] {0, 1, 3, + 1, 2, 3}; } - public void Draw(out VertexInformation[] vertices, out TextureData textureData) { + public void Draw(out VertexInformation[] vertices, out uint[] indices, out TextureData textureData) { + indices = this.indices; vertices = this.vertices; textureData = this.textureData; } diff --git a/RecrownedGTK/src/Graphics/Render/Shader/Shader.cs b/RecrownedGTK/Graphics/Render/Shaders/Shader.cs similarity index 98% rename from RecrownedGTK/src/Graphics/Render/Shader/Shader.cs rename to RecrownedGTK/Graphics/Render/Shaders/Shader.cs index 9a23c36..731f4b1 100644 --- a/RecrownedGTK/src/Graphics/Render/Shader/Shader.cs +++ b/RecrownedGTK/Graphics/Render/Shaders/Shader.cs @@ -2,7 +2,7 @@ using System; using System.IO; using System.Text; using OpenTK.Graphics.OpenGL; -namespace RecrownedGTK.Graphics.Render.Shader { +namespace RecrownedGTK.Graphics.Render.Shaders { public class Shader : IDisposable { int handle; public bool IsDisposed { diff --git a/RecrownedGTK/src/Graphics/Render/Shader/default.frag b/RecrownedGTK/Graphics/Render/Shaders/default.frag similarity index 100% rename from RecrownedGTK/src/Graphics/Render/Shader/default.frag rename to RecrownedGTK/Graphics/Render/Shaders/default.frag diff --git a/RecrownedGTK/src/Graphics/Render/Shader/default.vert b/RecrownedGTK/Graphics/Render/Shaders/default.vert similarity index 100% rename from RecrownedGTK/src/Graphics/Render/Shader/default.vert rename to RecrownedGTK/Graphics/Render/Shaders/default.vert diff --git a/RecrownedGTK/src/Graphics/Render/TextureBatch.cs b/RecrownedGTK/Graphics/Render/TextureBatch.cs similarity index 100% rename from RecrownedGTK/src/Graphics/Render/TextureBatch.cs rename to RecrownedGTK/Graphics/Render/TextureBatch.cs diff --git a/RecrownedGTK/src/Graphics/TextureData.cs b/RecrownedGTK/Graphics/TextureData.cs similarity index 93% rename from RecrownedGTK/src/Graphics/TextureData.cs rename to RecrownedGTK/Graphics/TextureData.cs index 9325422..04a64a4 100644 --- a/RecrownedGTK/src/Graphics/TextureData.cs +++ b/RecrownedGTK/Graphics/TextureData.cs @@ -7,7 +7,7 @@ namespace RecrownedGTK.Graphics { public class TextureData : IDisposable { private bool disposed; int handle; - + public readonly int width, height; public TextureWrapMode textureWrapModeWidth, textureWrapModeHeight; public Color4 borderColor; public TextureMinFilter textureMinFilter; @@ -25,7 +25,8 @@ namespace RecrownedGTK.Graphics { height = bitmap.Height; } } - + this.width = width; + this.height = height; GenerateTexture(textureData, width, height); } @@ -34,7 +35,8 @@ namespace RecrownedGTK.Graphics { textureWrapModeWidth = TextureWrapMode.ClampToBorder; textureMinFilter = TextureMinFilter.LinearMipmapLinear; textureMagFilter = TextureMagFilter.Linear; - + this.width = width; + this.height = height; GenerateTexture(textureData, width, height); } diff --git a/RecrownedGTK/src/Graphics/VertexAttributesArrayHandle.cs b/RecrownedGTK/Graphics/VertexAttributesArrayHandle.cs similarity index 96% rename from RecrownedGTK/src/Graphics/VertexAttributesArrayHandle.cs rename to RecrownedGTK/Graphics/VertexAttributesArrayHandle.cs index dfe0750..785875a 100644 --- a/RecrownedGTK/src/Graphics/VertexAttributesArrayHandle.cs +++ b/RecrownedGTK/Graphics/VertexAttributesArrayHandle.cs @@ -1,7 +1,7 @@ using System; using OpenTK.Graphics.OpenGL; using OpenTK; -using RecrownedGTK.Graphics.Render.Shader; +using RecrownedGTK.Graphics.Render.Shaders; namespace RecrownedGTK.Graphics { public class VertexAttributesArrayHandle : IDisposable { private bool disposed; @@ -18,7 +18,7 @@ namespace RecrownedGTK.Graphics { /// Creates a basic vertex attributes object handle that takes in vertices, texture coordinates, and a color. /// First 3 values are normalized vertex position (x, y, z), second two are texture coordinates, and last 4 are color values. /// - /// The shader program used. Default is the one created from . + /// The shader program used. Default is the one created from . /// The name of the attribute for the vertex's position in the shader. Default is "aPosition". /// The name of the attribute for the texture's coordinate. Default is "aTexture". /// The name of the attribute for color mixture. Default is "aColor". diff --git a/RecrownedGTK/src/Graphics/VertexBufferArrayHandle.cs b/RecrownedGTK/Graphics/VertexBufferArrayHandle.cs similarity index 100% rename from RecrownedGTK/src/Graphics/VertexBufferArrayHandle.cs rename to RecrownedGTK/Graphics/VertexBufferArrayHandle.cs diff --git a/RecrownedGTK/src/Graphics/VertexInformation.cs b/RecrownedGTK/Graphics/VertexInformation.cs similarity index 87% rename from RecrownedGTK/src/Graphics/VertexInformation.cs rename to RecrownedGTK/Graphics/VertexInformation.cs index eb92347..f60fa02 100644 --- a/RecrownedGTK/src/Graphics/VertexInformation.cs +++ b/RecrownedGTK/Graphics/VertexInformation.cs @@ -3,7 +3,6 @@ using OpenTK.Graphics; namespace RecrownedGTK.Graphics { public struct VertexInformation { public Vector3 coords; - public uint[] indices; public Color4 color; public Vector2 textureCoords; } diff --git a/RecrownedGTK/src/Persistence/PreferencesManager.cs b/RecrownedGTK/Persistence/PreferencesManager.cs similarity index 100% rename from RecrownedGTK/src/Persistence/PreferencesManager.cs rename to RecrownedGTK/Persistence/PreferencesManager.cs diff --git a/RecrownedGTK/src/RecrownedGTK.csproj b/RecrownedGTK/RecrownedGTK.csproj similarity index 100% rename from RecrownedGTK/src/RecrownedGTK.csproj rename to RecrownedGTK/RecrownedGTK.csproj diff --git a/RecrownedGTK/src/Types/Extensions.cs b/RecrownedGTK/Types/Extensions.cs similarity index 100% rename from RecrownedGTK/src/Types/Extensions.cs rename to RecrownedGTK/Types/Extensions.cs diff --git a/RecrownedGTK/src/Types/IRectangleDrawable.cs b/RecrownedGTK/Types/IRectangleDrawable.cs similarity index 100% rename from RecrownedGTK/src/Types/IRectangleDrawable.cs rename to RecrownedGTK/Types/IRectangleDrawable.cs diff --git a/RecrownedGTK/src/Types/Rectangle.cs b/RecrownedGTK/Types/Rectangle.cs similarity index 100% rename from RecrownedGTK/src/Types/Rectangle.cs rename to RecrownedGTK/Types/Rectangle.cs diff --git a/RecrownedGTK/src/Types/Resolution.cs b/RecrownedGTK/Types/Resolution.cs similarity index 100% rename from RecrownedGTK/src/Types/Resolution.cs rename to RecrownedGTK/Types/Resolution.cs