From 5b6d2a91251ab2e3c7ddf464c942b518c911d89e Mon Sep 17 00:00:00 2001 From: Noel Berry Date: Tue, 14 Jan 2025 12:52:06 -0800 Subject: [PATCH] v0.1.20-alpha; updating to dotnet 9 --- Framework/Foster.Framework.csproj | 4 ++-- Framework/Graphics/DrawCommand.cs | 25 ++++++------------------- Framework/Images/Font.cs | 2 +- Framework/Images/Image.cs | 2 +- Framework/Storage/Content.cs | 2 +- README.md | 4 ++-- global.json | 2 +- 7 files changed, 14 insertions(+), 27 deletions(-) diff --git a/Framework/Foster.Framework.csproj b/Framework/Foster.Framework.csproj index fcec1b3..fe7f597 100644 --- a/Framework/Foster.Framework.csproj +++ b/Framework/Foster.Framework.csproj @@ -2,13 +2,13 @@ Library - net8.0 + net9.0 enable enable true Foster Foster - 0.1.19-alpha + 0.1.20-alpha Noel Berry A small 2D cross-platform Game Framework git diff --git a/Framework/Graphics/DrawCommand.cs b/Framework/Graphics/DrawCommand.cs index 6aa787d..2160f87 100644 --- a/Framework/Graphics/DrawCommand.cs +++ b/Framework/Graphics/DrawCommand.cs @@ -1,32 +1,32 @@ namespace Foster.Framework; -public struct DrawCommand() +public struct DrawCommand(Target? target, Mesh mesh, Material material) { /// /// Render Target. If not assigned, will target the Back Buffer /// - public Target? Target; + public Target? Target = target; /// /// Material to use /// - public Material Material; + public Material Material = material; /// /// Mesh to use /// - public Mesh Mesh; + public Mesh Mesh = mesh; /// /// The Index to begin rendering from the Mesh /// - public int MeshIndexStart; + public int MeshIndexStart = 0; /// /// The total number of Indices to draw from the Mesh /// - public int MeshIndexCount; + public int MeshIndexCount = mesh.IndexCount; /// /// The Render State Blend Mode @@ -58,19 +58,6 @@ public struct DrawCommand() /// public RectInt? Scissor = null; - /// - /// Creates a Draw Command based on the given mesh and material - /// - public DrawCommand(Target? target, Mesh mesh, Material material) - : this() - { - Target = target; - Mesh = mesh; - Material = material; - MeshIndexStart = 0; - MeshIndexCount = mesh.IndexCount; - } - public readonly void Submit() { Graphics.Submit(this); diff --git a/Framework/Images/Font.cs b/Framework/Images/Font.cs index 991d6de..7e6175b 100644 --- a/Framework/Images/Font.cs +++ b/Framework/Images/Font.cs @@ -50,7 +50,7 @@ private void Load(Stream stream) { // allocate enough room for the buffer byte[] buffer = new byte[stream.Length]; - stream.Read(buffer, 0, buffer.Length); + stream.ReadExactly(buffer, 0, buffer.Length); // pin the buffer dataHandle = GCHandle.Alloc(buffer, GCHandleType.Pinned); diff --git a/Framework/Images/Image.cs b/Framework/Images/Image.cs index d57b5d2..009c288 100644 --- a/Framework/Images/Image.cs +++ b/Framework/Images/Image.cs @@ -107,7 +107,7 @@ private unsafe void Load(Stream stream) { // get all the bytes var data = new byte[stream.Length - stream.Position]; - stream.Read(data); + stream.ReadExactly(data); // load image from byte data nint mem; diff --git a/Framework/Storage/Content.cs b/Framework/Storage/Content.cs index 8e02d89..56e0185 100644 --- a/Framework/Storage/Content.cs +++ b/Framework/Storage/Content.cs @@ -43,7 +43,7 @@ public byte[] ReadAllBytes(string path) { using var stream = OpenRead(path); byte[] buffer = new byte[stream.Length]; - stream.Read(buffer); + stream.ReadExactly(buffer); return buffer; } diff --git a/README.md b/README.md index 0948d78..59f028a 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ There is a [Samples](https://github.com/FosterFramework/Samples) repo which cont Check out [Discussons](https://github.com/FosterFramework/Foster/discussions) or [Discord](https://discord.gg/K7tdFuP3Bg) to get involved. ### Dependencies - - [dotnet 8.0](https://dotnet.microsoft.com/en-us/download/dotnet/8.0) and [C# 12](https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-12) + - [dotnet 9.0](https://dotnet.microsoft.com/en-us/download/dotnet/9.0) and [C# 13](https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-13) - [SDL2](https://github.com/libsdl-org/sdl) is the only external dependency, which is required by the [Platform library](https://github.com/FosterFramework/Foster/tree/main/Platform). By default this is statically compiled. ### Platform Library @@ -27,7 +27,7 @@ Check out [Discussons](https://github.com/FosterFramework/Foster/discussions) or ### Rendering - Implemented in OpenGL for Linux/Mac/Windows and D3D11 for Windows. - Separate Shaders are required depending on which rendering API you're targetting. - - Planning to replace the rendering implementation with [SDL3 GPU when it is complete](https://github.com/FosterFramework/Foster/issues/1). + - Replacing the rendering implementation with [SDL3 GPU](https://github.com/FosterFramework/Foster/tree/app-refactor) in the near ### Notes - Taken a lot of inspiration from other Frameworks and APIs, namely [FNA](https://fna-xna.github.io/). diff --git a/global.json b/global.json index 73ba56a..8c0a03c 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "8.0.100", + "version": "9.0.0", "rollForward": "latestFeature", "allowPrerelease": false }