diff --git a/src/gaemstone.Bloxel/BlockPos.cs b/src/gaemstone.Bloxel/BlockPos.cs index 51d6ca3..cfb093e 100644 --- a/src/gaemstone.Bloxel/BlockPos.cs +++ b/src/gaemstone.Bloxel/BlockPos.cs @@ -16,7 +16,7 @@ public readonly struct BlockPos public void Deconstruct(out int x, out int y, out int z) => (x, y, z) = (X, Y, Z); public Vector3D GetOrigin() => new(X, Y, Z); - public Vector3D GetCenter() => new(X + 0.5F, Y + 0.5F, Z + 0.5F); + public Vector3D GetCenter() => new(X + 0.5f, Y + 0.5f, Z + 0.5f); public BlockPos Add(int x, int y, int z) => new(X + x, Y + y, Z + z); diff --git a/src/gaemstone.Bloxel/Components/CoreComponents.cs b/src/gaemstone.Bloxel/Components/CoreComponents.cs index 7651739..d1ea141 100644 --- a/src/gaemstone.Bloxel/Components/CoreComponents.cs +++ b/src/gaemstone.Bloxel/Components/CoreComponents.cs @@ -17,6 +17,6 @@ public partial class CoreComponents : ChunkPaletteStorage { public ChunkStoreBlocks() - : base(default) { } + : base(default) { } } } diff --git a/src/gaemstone.Bloxel/Systems/BasicWorldGenerator.cs b/src/gaemstone.Bloxel/Systems/BasicWorldGenerator.cs index 6b8c157..25bad8d 100644 --- a/src/gaemstone.Bloxel/Systems/BasicWorldGenerator.cs +++ b/src/gaemstone.Bloxel/Systems/BasicWorldGenerator.cs @@ -17,7 +17,7 @@ public class BasicWorldGenerator _noise.SetNoiseType(FastNoiseLite.NoiseType.OpenSimplex2); _noise.SetFractalType(FastNoiseLite.FractalType.Ridged); _noise.SetFractalOctaves(4); - _noise.SetFractalGain(0.6F); + _noise.SetFractalGain(0.6f); } [Tag] @@ -35,7 +35,7 @@ public class BasicWorldGenerator var gx = chunk.Position.X << ChunkBitShift | lx; var gy = chunk.Position.Y << ChunkBitShift | ly; var gz = chunk.Position.Z << ChunkBitShift | lz; - var bias = Math.Clamp(gy / 32.0F + 1.0F, 0.0F, 1.0F); + var bias = Math.Clamp(gy / 32.0f + 1.0f, 0.0f, 1.0f); if (_noise.GetNoise(gx, gy, gz) > bias) blocks[lx, ly, lz] = stone; } diff --git a/src/gaemstone.Client/Components/CameraComponents.cs b/src/gaemstone.Client/Components/CameraComponents.cs index cc7d0b8..ba553db 100644 --- a/src/gaemstone.Client/Components/CameraComponents.cs +++ b/src/gaemstone.Client/Components/CameraComponents.cs @@ -10,18 +10,18 @@ public class CameraComponents public struct Camera { public static readonly Camera Default2D = Create2D(); - public static readonly Camera Default3D = Create3D(80.0F); + public static readonly Camera Default3D = Create3D(80.0f); - public static Camera Create2D(float nearPlane = -100.0F, float farPlane = 100.0F) + public static Camera Create2D(float nearPlane = -100.0f, float farPlane = 100.0f) => new() { NearPlane = nearPlane, FarPlane = farPlane }; - public static Camera Create3D(float fieldOfView, float nearPlane = 0.1F, float farPlane = 200.0F) + public static Camera Create3D(float fieldOfView, float nearPlane = 0.1f, float farPlane = 200.0f) => new() { FieldOfView = fieldOfView, NearPlane = nearPlane, FarPlane = farPlane }; public float FieldOfView { get; set; } public float NearPlane { get; set; } public float FarPlane { get; set; } - public bool IsOrthographic => (FieldOfView == 0.0F); + public bool IsOrthographic => (FieldOfView == 0.0f); } [Component] diff --git a/src/gaemstone.Client/Components/RenderingComponents.cs b/src/gaemstone.Client/Components/RenderingComponents.cs index 1d019f1..1ab7603 100644 --- a/src/gaemstone.Client/Components/RenderingComponents.cs +++ b/src/gaemstone.Client/Components/RenderingComponents.cs @@ -48,15 +48,15 @@ public class RenderingComponents public static TextureCoords4 FromIntCoords(Size textureSize, Point origin, Size size) => FromIntCoords(textureSize, origin.X, origin.Y, size.Width, size.Height); public static TextureCoords4 FromIntCoords(Size textureSize, int x, int y, int width, int height) => new( - x / (float)textureSize.Width + 0.001F, - y / (float)textureSize.Height + 0.001F, - (x + width) / (float)textureSize.Width - 0.001F, - (y + height) / (float)textureSize.Height - 0.001F); + x / (float)textureSize.Width + 0.001f, + y / (float)textureSize.Height + 0.001f, + (x + width) / (float)textureSize.Width - 0.001f, + (y + height) / (float)textureSize.Height - 0.001f); public static TextureCoords4 FromGrid(int numCellsX, int numCellsY, int cellX, int cellY) => new( - cellX / (float)numCellsX + 0.001F, - cellY / (float)numCellsY + 0.001F, - (cellX + 1) / (float)numCellsX - 0.001F, - (cellY + 1) / (float)numCellsY - 0.001F); + cellX / (float)numCellsX + 0.001f, + cellY / (float)numCellsY + 0.001f, + (cellX + 1) / (float)numCellsX - 0.001f, + (cellY + 1) / (float)numCellsY - 0.001f); } } diff --git a/src/gaemstone.Client/Components/ResourceComponents.cs b/src/gaemstone.Client/Components/ResourceComponents.cs index 3bbd74d..5dd9fc7 100644 --- a/src/gaemstone.Client/Components/ResourceComponents.cs +++ b/src/gaemstone.Client/Components/ResourceComponents.cs @@ -10,7 +10,7 @@ public class ResourceComponents // Entities can have for example Texture as a tag, in which case // they're the actual resource holding the data or handle. - // + // // Entities can also have a (Texture, $T) pair where $T is a resource, // meaning the entity has that resource assigned as their texture. diff --git a/src/gaemstone.Client/Resources.cs b/src/gaemstone.Client/Resources.cs index cf901d5..0e4e055 100644 --- a/src/gaemstone.Client/Resources.cs +++ b/src/gaemstone.Client/Resources.cs @@ -40,10 +40,10 @@ public static class Resources { if (!path.IsAbsolute) throw new ArgumentException( $"Path '{path}' must be absolute", nameof(path)); - if (path.Count < 3 || path[1] != "Resources") throw new ArgumentException( + if ((path.Count < 3) || (path[1] != "Resources")) throw new ArgumentException( $"Path '{path}' must be in the format '/[domain]/Resources/...", nameof(path)); - var assembly = Assembly.Load(path[0].ToString()); + var assembly = Assembly.Load(path[0]); var builder = new StringBuilder(path[2]); for (var i = 3; i < path.Count; i++) builder.Append('.').Append(path[i]); diff --git a/src/gaemstone/ECS/Observer.cs b/src/gaemstone/ECS/Observer.cs index 5035d24..ae001d1 100644 --- a/src/gaemstone/ECS/Observer.cs +++ b/src/gaemstone/ECS/Observer.cs @@ -43,7 +43,7 @@ public static class ObserverExtensions Action iterAction; var param = method.GetParameters(); - if (param.Length == 1 && param[0].ParameterType == typeof(Iterator)) { + if ((param.Length == 1) && (param[0].ParameterType == typeof(Iterator))) { filter = new(expr ?? throw new Exception( "Observer must specify ExpressionAttribute")); if (method.IsStatic) instance = null; diff --git a/src/gaemstone/ECS/System.cs b/src/gaemstone/ECS/System.cs index 405ccf9..b708e2a 100644 --- a/src/gaemstone/ECS/System.cs +++ b/src/gaemstone/ECS/System.cs @@ -38,6 +38,7 @@ public static class SystemExtensions entity = universe.New((query.Name != null) ? new(query.Name) : null) .Add(phase).Add(phase).Build(), binding_ctx = (void*)CallbackContextHelper.Create(callback), + // TODO: Use binding_ctx_free to remove clear the context. run = new() { Data = new() { Pointer = &Run } }, }; return new(universe, new(ecs_system_init(universe, &desc))); @@ -72,7 +73,7 @@ public static class SystemExtensions QueryDesc query; Action callback; var param = method.GetParameters(); - if (param.Length == 1 && param[0].ParameterType == typeof(Iterator)) { + if ((param.Length == 1) && (param[0].ParameterType == typeof(Iterator))) { query = new(expr ?? throw new ArgumentException( "System must specify ExpressionAttribute", nameof(method))); callback = (Action)Delegate.CreateDelegate(typeof(Action), instance, method); diff --git a/src/gaemstone/Flecs/Core.cs b/src/gaemstone/Flecs/Core.cs index 887fc81..15b866f 100644 --- a/src/gaemstone/Flecs/Core.cs +++ b/src/gaemstone/Flecs/Core.cs @@ -15,12 +15,12 @@ public static class Core // Entities - [Entity] public struct World { } - [Entity("*")] public struct Wildcard { } - [Entity("_")] public struct Any { } - [Entity] public struct This { } - [Entity("$")] public struct Variable { } - [Entity] public struct Flag { } + [Entity] public struct World { } + [Entity("*")] public struct Wildcard { } + [Entity("_")] public struct Any { } + [Entity] public struct This { } + [Entity("$")] public struct Variable { } + [Entity] public struct Flag { } // Entity Relationships diff --git a/src/gaemstone/Utility/TypeWrapper.cs b/src/gaemstone/Utility/TypeWrapper.cs index daade3e..adbec18 100644 --- a/src/gaemstone/Utility/TypeWrapper.cs +++ b/src/gaemstone/Utility/TypeWrapper.cs @@ -55,7 +55,7 @@ public class TypeWrapper : ITypeWrapper public int Size { get; } = Unsafe.SizeOf(); public bool IsUnmanaged { get; } = !RuntimeHelpers.IsReferenceOrContainsReferences(); - private TypeWrapper() { } + private TypeWrapper() { } IFieldWrapper ITypeWrapper.GetFieldForAutoProperty(string propertyName) => GetFieldForAutoProperty(propertyName); IFieldWrapper ITypeWrapper.GetFieldForAutoProperty(PropertyInfo property) => GetFieldForAutoProperty(property);