You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
783 B
38 lines
783 B
using System.Drawing; |
|
using gaemstone.ECS; |
|
using gaemstone.Flecs; |
|
using Silk.NET.OpenGL; |
|
using Silk.NET.Windowing; |
|
|
|
namespace gaemstone.Client.Systems; |
|
|
|
[Module] |
|
public partial class Windowing |
|
{ |
|
// TODO: Canvas and GameWindow should maybe not be Singleton? |
|
|
|
[Singleton] |
|
public class Canvas |
|
{ |
|
public GL GL { get; } |
|
public Canvas(GL gl) => GL = gl; |
|
|
|
public Size Size { get; set; } |
|
public Color BackgroundColor { get; set; } |
|
} |
|
|
|
[Singleton] |
|
public class GameWindow |
|
{ |
|
public IWindow Handle { get; } |
|
public GameWindow(IWindow handle) => Handle = handle; |
|
} |
|
|
|
[System] |
|
[DependsOn<Pipeline.PreFrame>] |
|
public static void ProcessWindow(GameWindow window, Canvas canvas) |
|
{ |
|
canvas.Size = new(window.Handle.Size.X, window.Handle.Size.Y); |
|
window.Handle.DoEvents(); |
|
} |
|
}
|
|
|