mirror of
https://github.com/MaddyThorson/StrawberryBF.git
synced 2025-12-15 13:27:06 +08:00
Cleaned up entity tracking. Scene.Camera. Matrix struct.
This commit is contained in:
@ -4,10 +4,12 @@ namespace Strawberry
|
||||
{
|
||||
static public class Draw
|
||||
{
|
||||
static public Point Camera => Game.Scene != null ? Game.Scene.Camera.Round() : Point.Zero;
|
||||
|
||||
static public void Rect(int x, int y, int w, int h, Color color)
|
||||
{
|
||||
SDL.SetRenderDrawColor(Game.Renderer, color.R, color.G, color.B, color.A);
|
||||
SDL.RenderFillRect(Game.Renderer, &SDL.Rect((int32)x, (int32)y, (int32)w, (int32)h));
|
||||
SDL.RenderFillRect(Game.Renderer, &SDL.Rect((int32)(x - Camera.X), (int32)(y - Camera.Y), (int32)w, (int32)h));
|
||||
}
|
||||
|
||||
static public void Rect(Rect rect, Color color)
|
||||
@ -18,7 +20,7 @@ namespace Strawberry
|
||||
static public void HollowRect(int x, int y, int w, int h, Color color)
|
||||
{
|
||||
SDL.SetRenderDrawColor(Game.Renderer, color.R, color.G, color.B, color.A);
|
||||
SDL.RenderDrawRect(Game.Renderer, &SDL.Rect((int32)x, (int32)y, (int32)w, (int32)h));
|
||||
SDL.RenderDrawRect(Game.Renderer, &SDL.Rect((int32)(x - Camera.X), (int32)(y - Camera.Y), (int32)w, (int32)h));
|
||||
}
|
||||
|
||||
static public void HollowRect(Rect rect, Color color)
|
||||
@ -28,8 +30,11 @@ namespace Strawberry
|
||||
|
||||
static public void Line(Point from, Point to, Color color)
|
||||
{
|
||||
let fromn = (Point)(from - Camera);
|
||||
let ton = (Point)(to - Camera);
|
||||
|
||||
SDL.SetRenderDrawColor(Game.Renderer, color.R, color.G, color.B, color.A);
|
||||
SDL.RenderDrawLine(Game.Renderer, (int32)from.X, (int32)from.Y, (int32)to.X, (int32)to.Y);
|
||||
SDL.RenderDrawLine(Game.Renderer, (int32)fromn.X, (int32)fromn.Y, (int32)ton.X, (int32)ton.Y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user