|
|
@ -3,10 +3,13 @@ using OpenTK.Mathematics; |
|
|
|
using OpenTK.Windowing.Common; |
|
|
|
using OpenTK.Windowing.Desktop; |
|
|
|
using OpenTK.Windowing.GraphicsLibraryFramework; |
|
|
|
using System.Runtime.CompilerServices; |
|
|
|
// https://docs.sixlabors.com/api/ImageSharp/SixLabors.ImageSharp.Image.html
|
|
|
|
using Image = SixLabors.ImageSharp.Image; |
|
|
|
using SixLabors.Fonts; |
|
|
|
using SixLabors.ImageSharp.Metadata.Profiles.Exif; |
|
|
|
using SixLabors.ImageSharp.Drawing.Processing; |
|
|
|
using SixLabors.ImageSharp.Drawing; |
|
|
|
using System.Runtime.CompilerServices; |
|
|
|
|
|
|
|
namespace SemiColinGames; |
|
|
|
|
|
|
@ -164,10 +167,15 @@ public class Photo { |
|
|
|
|
|
|
|
public Texture Texture() { |
|
|
|
if (texture == placeholder && image != null) { |
|
|
|
Console.WriteLine("making texture for " + file); |
|
|
|
texture = new Texture(image); |
|
|
|
image.Dispose(); |
|
|
|
image = null; |
|
|
|
IPath yourPolygon = new Star(x: 2000.0f, y: 1000.0f, prongs: 5, innerRadii: 20.0f, outerRadii: 50.0f, angle: Util.PI); |
|
|
|
image.Mutate(x => x.Fill(Color.White, yourPolygon)); |
|
|
|
Font font = SystemFonts.CreateFont("Consolas", 120); |
|
|
|
string text = "oh no i made a memegen"; |
|
|
|
image.Mutate(x => x.DrawText(text, font, Color.White, new PointF(800, 10))); |
|
|
|
Console.WriteLine("making texture for " + file); |
|
|
|
texture = new Texture(image); |
|
|
|
image.Dispose(); |
|
|
|
image = null; |
|
|
|
} |
|
|
|
return texture; |
|
|
|
} |
|
|
@ -245,6 +253,8 @@ public class UiGeometry { |
|
|
|
} |
|
|
|
|
|
|
|
public static class Util { |
|
|
|
public const float PI = (float) Math.PI; |
|
|
|
|
|
|
|
public static Box2i makeBox(int left, int top, int width, int height) { |
|
|
|
return new Box2i(left, top, left + width, top + height); |
|
|
|
} |
|
|
@ -384,8 +394,8 @@ public class Game : GameWindow { |
|
|
|
GL.VertexAttribPointer(texCoordLocation, 2, VertexAttribPointerType.Float, false, 5 * sizeof(float), 3 * sizeof(float)); |
|
|
|
|
|
|
|
// Load textures from JPEGs.
|
|
|
|
// string[] files = Directory.GetFiles(@"c:\users\colin\desktop\photos-test\");
|
|
|
|
string[] files = Directory.GetFiles(@"c:\users\colin\pictures\photos\2023\07\14\"); |
|
|
|
string[] files = Directory.GetFiles(@"c:\users\colin\desktop\photos-test\"); |
|
|
|
// string[] files = Directory.GetFiles(@"c:\users\colin\pictures\photos\2023\07\14\");
|
|
|
|
// string[] files = Directory.GetFiles(@"C:\Users\colin\Pictures\photos\2018\06\23");
|
|
|
|
// string[] files = Directory.GetFiles(@"C:\Users\colin\Desktop\Germany all\104D7000");
|
|
|
|
|
|
|
|