Restructed project in preparation for unit testing.

This commit is contained in:
2020-02-20 16:13:26 -05:00
parent 0e9dd4047e
commit 4e56f2d51e
34 changed files with 0 additions and 0 deletions

View File

@@ -1,33 +0,0 @@
using System;
using OpenTK.Graphics;
using OpenTK;
namespace RecrownedGTK.Types {
public static class Color4Ext {
public static byte GetRedAsByte(this Color4 color) {
return (byte) (color.R * Byte.MaxValue);
}
public static byte GetGreenAsByte(this Color4 color) {
return (byte) (color.G * Byte.MaxValue);
}
public static byte GetBlueAsByte(this Color4 color) {
return (byte) (color.B * Byte.MaxValue);
}
public static byte GetAlphaAsByte(this Color4 color) {
return (byte) (color.A * Byte.MaxValue);
}
public static void MultiplyByFloat(this Color4 color, float val) {
color.A *= val;
color.R *= val;
color.G *= val;
color.B *= val;
}
public static Color4 ReturnMultipliedByFloat(this Color4 color, float val) {
Color4 output = new Color4(color.R * val, color.G * val, color.B * val, color.A * val);
return output;
}
public static void FromNonPremultiplied(ref Vector4 vector) {
//Premultiplied.
vector = new Vector4(vector.W * vector.X, vector.W * vector.Y, vector.W * vector.Z, vector.W);
}
}
}

View File

@@ -1,17 +0,0 @@
using RecrownedGTK.Graphics.Render;
namespace RecrownedGTK.Types
{
/// <summary>
/// A wrapper that makes sure anything implementing can be drawn with options.
/// </summary>
public interface IRectangleDrawable
{
byte[] ColorData {
get;
}
float[] vertices {
get;
}
}
}

View File

@@ -1,27 +0,0 @@
namespace RecrownedGTK.Types
{
public class Rectangle
{
public virtual float Width {set; get;}
public virtual float Height {set; get;}
public virtual float X {set; get;}
public virtual float Y {set; get;}
public float Area {
get {
return Width * Height;
}
}
public Rectangle() {
}
public Rectangle(float x, float y, float width, float height) {
Width = width;
Height = height;
X = x;
Y = y;
}
}
}

View File

@@ -1,54 +0,0 @@
using System;
namespace RecrownedGTK.Types
{
/// <summary>
/// Holds a width and height while allowing for easier comparison between other <see cref="Resolution"/>s.
/// </summary>
public struct Resolution : IComparable<Resolution>
{
/// <summary>
/// Dimensions of resolution.
/// </summary>
public int Width, Height;
/// <summary>
/// Constructs resolution given the dimensions.
/// </summary>
/// <param name="width">Width of resolution.</param>
/// <param name="height">Height of resolution.</param>
public Resolution(int width, int height)
{
Width = width;
Height = height;
}
/// <summary>
/// Compares area of this resolution to another.
/// </summary>
/// <param name="other">The other resolution to compare to.</param>
/// <returns>A value less than 0 for this being the smaller resolution, 0 for the two being the same in area, and larger for this being the larger in area.</returns>
public int CompareTo(Resolution other)
{
return Area() - other.Area();
}
/// <summary>
/// Gets a string representation of this resolution.
/// </summary>
/// <returns>"WidthxHeight"</returns>
public override string ToString()
{
return Width + "x" + Height;
}
/// <summary>
/// Calculates area of resolution.
/// </summary>
/// <returns>Area of resolution.</returns>
public int Area()
{
return Width * Height;
}
}
}