Add pivot offset for rotations.
This commit is contained in:
@@ -78,9 +78,10 @@ namespace DaggerFramework.Rendering
|
||||
Raylib.DrawCircle((int)_position.X, (int)_position.Y, radius, DaggerColorToRaylibColor(color));
|
||||
}
|
||||
|
||||
public override void SetTransform(Vector2 position, float rotation)
|
||||
public override void SetTransform(Vector2 position, Vector2 offset, float rotation = 0)
|
||||
{
|
||||
_position = position;
|
||||
_offset = offset;
|
||||
_rotation = rotation;
|
||||
}
|
||||
|
||||
@@ -153,7 +154,7 @@ namespace DaggerFramework.Rendering
|
||||
y = _position.Y,
|
||||
width = size.X,
|
||||
height = size.Y
|
||||
}, Vector2.Zero, _rotation, DaggerColorToRaylibColor(color));
|
||||
}, _offset, _rotation, DaggerColorToRaylibColor(color));
|
||||
}
|
||||
|
||||
public override void DrawDebugText(string text, int fontSize, Color color)
|
||||
@@ -203,7 +204,7 @@ namespace DaggerFramework.Rendering
|
||||
|
||||
private List<Texture2D> _texturePool = new();
|
||||
private List<Raylib_cs.Font> _fontPool = new();
|
||||
private Vector2 _position;
|
||||
private Vector2 _position, _offset;
|
||||
private float _rotation;
|
||||
private Vector2 _windowSize;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user