Color struct. Reorg.

This commit is contained in:
Matt Thorson
2020-05-07 20:11:20 -07:00
parent 8a06819ddd
commit 0d907209a2
10 changed files with 170 additions and 18 deletions

View File

@ -1,26 +0,0 @@
using System;
using System.Diagnostics;
namespace Strawberry
{
static public class Calc
{
[Inline]
static public float Approach(float value, float target, float maxDelta)
{
return value > target ? Math.Max(value - maxDelta, target) : Math.Min(value + maxDelta, target);
}
static public void Log()
{
Debug.WriteLine("***");
}
static public void Log<T>(T v)
{
String string = scope String;
v.ToString(string);
Debug.WriteLine(string);
}
}
}

View File

@ -1,16 +0,0 @@
namespace Strawberry
{
static public class Draw
{
static public void Rect(int x, int y, int w, int h, SDL2.SDL.Color color)
{
SDL2.SDL.SetRenderDrawColor(Game.Renderer, color.r, color.g, color.b, color.a);
SDL2.SDL.RenderFillRect(Game.Renderer, &SDL2.SDL.Rect((int32)x, (int32)y, (int32)w, (int32)h));
}
static public void Rect(Rect rect, SDL2.SDL.Color color)
{
Rect(rect.X, rect.Y, rect.Width, rect.Height, color);
}
}
}

View File

@ -1,23 +0,0 @@
namespace Strawberry
{
static public class Time
{
static public float Elapsed;
static public float PreviousElapsed;
static public float Rate = 1f;
static public float Freeze;
static public float RawDelta => (1 / 60f);
static public float Delta => RawDelta * Rate;
static public bool OnInterval(float interval, float offset = 0)
{
return (int)((Elapsed - offset) / interval) != (int)((PreviousElapsed - offset) / interval);
}
static public bool BetweenInterval(float interval, float offset = 0)
{
return (Elapsed - offset) % (interval * 2) >= interval;
}
}
}