Add Color record struct, small refactor, create a DaggerFramework.SceneGraph namespace.
This commit is contained in:
@@ -36,7 +36,7 @@ namespace DaggerFramework.Rendering
|
||||
|
||||
public override void ClearBackground(Color color)
|
||||
{
|
||||
_gl.ClearColor(color);
|
||||
_gl.ClearColor(color.ToSystemColor());
|
||||
_gl.Clear((uint)ClearBufferMask.ColorBufferBit);
|
||||
}
|
||||
|
||||
|
||||
@@ -51,9 +51,9 @@ namespace DaggerFramework.Rendering
|
||||
Raylib.EndDrawing();
|
||||
}
|
||||
|
||||
public override void ClearBackground(System.Drawing.Color color)
|
||||
public override void ClearBackground(Color color)
|
||||
{
|
||||
Raylib.ClearBackground(SystemColorToRaylibColor(color));
|
||||
Raylib.ClearBackground(DaggerColorToRaylibColor(color));
|
||||
}
|
||||
|
||||
public override double GetFrameTime()
|
||||
@@ -61,9 +61,9 @@ namespace DaggerFramework.Rendering
|
||||
return (double)Raylib.GetFrameTime();
|
||||
}
|
||||
|
||||
public override void DrawCircle(float radius, System.Drawing.Color color)
|
||||
public override void DrawCircle(float radius, Color color)
|
||||
{
|
||||
Raylib.DrawCircle((int)_position.X, (int)_position.Y, radius, SystemColorToRaylibColor(color));
|
||||
Raylib.DrawCircle((int)_position.X, (int)_position.Y, radius, DaggerColorToRaylibColor(color));
|
||||
}
|
||||
|
||||
public override void SetTransform(Vector2 position, float rotation)
|
||||
@@ -98,12 +98,12 @@ namespace DaggerFramework.Rendering
|
||||
return _texturePool.Count - 1;
|
||||
}
|
||||
|
||||
public override void DrawTexture(int id, System.Drawing.Color tint)
|
||||
public override void DrawTexture(int id, Color tint)
|
||||
{
|
||||
Raylib.DrawTextureV(_texturePool[id], _position, SystemColorToRaylibColor(tint));
|
||||
Raylib.DrawTextureV(_texturePool[id], _position, DaggerColorToRaylibColor(tint));
|
||||
}
|
||||
|
||||
public override void DrawRectangle(Vector2 size, System.Drawing.Color color)
|
||||
public override void DrawRectangle(Vector2 size, Color color)
|
||||
{
|
||||
// Raylib.DrawRectangleV(_position, size, SystemColorToRaylibColor(color));
|
||||
Raylib.DrawRectanglePro(new Rectangle()
|
||||
@@ -112,15 +112,15 @@ namespace DaggerFramework.Rendering
|
||||
y = _position.Y,
|
||||
width = size.X,
|
||||
height = size.Y
|
||||
}, Vector2.Zero, _rotation, SystemColorToRaylibColor(color));
|
||||
}, Vector2.Zero, _rotation, DaggerColorToRaylibColor(color));
|
||||
}
|
||||
|
||||
public override void DrawDebugText(Vector2 position, string text, int fontSize, System.Drawing.Color color)
|
||||
public override void DrawDebugText(Vector2 position, string text, int fontSize, Color color)
|
||||
{
|
||||
Raylib.DrawText(text, (int)position.X, (int)position.Y, fontSize, SystemColorToRaylibColor(color));
|
||||
Raylib.DrawText(text, (int)position.X, (int)position.Y, fontSize, DaggerColorToRaylibColor(color));
|
||||
}
|
||||
|
||||
public override void DrawSdfText(Vector2 position, string text, int fontSize, System.Drawing.Color color)
|
||||
public override void DrawSdfText(Vector2 position, string text, int fontSize, Color color)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
@@ -149,9 +149,9 @@ namespace DaggerFramework.Rendering
|
||||
Initialize(renderSettings);
|
||||
}
|
||||
|
||||
private Raylib_cs.Color SystemColorToRaylibColor(System.Drawing.Color color)
|
||||
private Raylib_cs.Color DaggerColorToRaylibColor(Color color)
|
||||
{
|
||||
return new Color { r = color.R, g = color.G, b = color.B, a = color.A };
|
||||
return new Raylib_cs.Color { r = (byte)Math.Round(color.R * 255f), g = (byte)Math.Round(color.G * 255f), b = (byte)Math.Round(color.B * 255f), a = (byte)Math.Round(color.A * 255f) };
|
||||
}
|
||||
|
||||
private List<Texture2D> _texturePool = new List<Texture2D>();
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
using System.Drawing;
|
||||
using System.Numerics;
|
||||
|
||||
namespace DaggerFramework.Rendering
|
||||
|
||||
Reference in New Issue
Block a user