More nullable fixes, make SetTransform a part of base Renderer.

This commit is contained in:
2024-01-21 17:58:11 +01:00
parent 5f4e32e2e0
commit 5bb16350f3
8 changed files with 59 additions and 59 deletions

View File

@@ -107,14 +107,7 @@ namespace DaggerFramework.Rendering
public override void DrawCircle(float radius, Color color)
{
Raylib.DrawCircle((int)_position.X, (int)_position.Y, radius, DaggerColorToRaylibColor(color));
}
public override void SetTransform(Vector2 position, Vector2 offset, float rotation = 0)
{
_position = position;
_offset = offset;
_rotation = rotation;
Raylib.DrawCircle((int)transformPosition.X, (int)transformPosition.Y, radius, DaggerColorToRaylibColor(color));
}
public override void DrawTexture(Texture2d texture, Color tint)
@@ -124,7 +117,7 @@ namespace DaggerFramework.Rendering
LoadTexture(texture);
}
Raylib.DrawTextureV(_texturePool[texture.Handle], _position, DaggerColorToRaylibColor(tint));
Raylib.DrawTextureV(_texturePool[texture.Handle], transformPosition, DaggerColorToRaylibColor(tint));
}
public override void DrawRectangle(Vector2 size, Color color)
@@ -132,16 +125,16 @@ namespace DaggerFramework.Rendering
// Raylib.DrawRectangleV(_position, size, SystemColorToRaylibColor(color));
Raylib.DrawRectanglePro(new Rectangle()
{
x = _position.X,
y = _position.Y,
x = transformPosition.X,
y = transformPosition.Y,
width = size.X,
height = size.Y
}, _offset, _rotation, DaggerColorToRaylibColor(color));
}, transformOffset, transformRotation, DaggerColorToRaylibColor(color));
}
public override void DrawDebugText(string text, int fontSize, Color color)
{
Raylib.DrawText(text, (int)_position.X, (int)_position.Y, fontSize, DaggerColorToRaylibColor(color));
Raylib.DrawText(text, (int)transformPosition.X, (int)transformPosition.Y, fontSize, DaggerColorToRaylibColor(color));
}
public override void DrawSdfText(string text, int fontSize, Color color)
@@ -191,7 +184,7 @@ namespace DaggerFramework.Rendering
}
var rayFont = _fontPool[font.Handle];
Raylib.DrawTextPro(rayFont, text, _position, Vector2.Zero, _rotation, font.Size, 0.0f, DaggerColorToRaylibColor(color));
Raylib.DrawTextPro(rayFont, text, transformPosition, transformOffset, transformRotation, font.Size, 0.0f, DaggerColorToRaylibColor(color));
}
protected override int GetMonitorWidth(int monitorId)
@@ -266,8 +259,6 @@ namespace DaggerFramework.Rendering
private List<Texture2D> _texturePool = new();
private List<Raylib_cs.Font> _fontPool = new();
private Vector2 _position, _offset;
private float _rotation;
private Vector2 _windowSize;
private bool _vsync;
private string _windowTitle = string.Empty;