From 5697f606d550c347b04ac3d9b52fa861d0e0fe6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20L=C3=BCbe=C3=9F?= Date: Fri, 13 Nov 2020 19:44:45 +0100 Subject: [PATCH] Added Position- and Size-properties to Windpw --- .../src/Platform/Windows/WindowsWindow.bf | 31 +++++++++++++++++++ GlitchyEngine/src/Window.bf | 12 ++++++- 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/GlitchyEngine/src/Platform/Windows/WindowsWindow.bf b/GlitchyEngine/src/Platform/Windows/WindowsWindow.bf index 367bfc2..06e4521 100644 --- a/GlitchyEngine/src/Platform/Windows/WindowsWindow.bf +++ b/GlitchyEngine/src/Platform/Windows/WindowsWindow.bf @@ -8,6 +8,7 @@ using GlitchyEngine.Events; using System.Diagnostics; using imgui_beef; using GlitchyEngine.Platform.DX11; +using GlitchyEngine.Math; using static System.Windows; namespace GlitchyEngine @@ -63,6 +64,20 @@ namespace GlitchyEngine.Platform.Windows set => _minMaxInfo.MaximumTrackingSize.y = value; } + // + // Size + // + public override Point Size + { + get => *(Point*)&_clientRect.Width; + + set + { + *(Point*)&_clientRect.Width = value; + ApplyRectangle(); + } + } + public override int32 Width { get => _clientRect.Width; @@ -84,6 +99,20 @@ namespace GlitchyEngine.Platform.Windows ApplyRectangle(); } } + + // + // Position + // + public override Point Position + { + get => *(Point*)&_clientRect; + + set + { + *(Point*)&_clientRect = value; + ApplyRectangle(); + } + } public override int32 PositionX { @@ -107,6 +136,8 @@ namespace GlitchyEngine.Platform.Windows } } + + public override StringView Title { get diff --git a/GlitchyEngine/src/Window.bf b/GlitchyEngine/src/Window.bf index 8372569..c6720d1 100644 --- a/GlitchyEngine/src/Window.bf +++ b/GlitchyEngine/src/Window.bf @@ -1,5 +1,6 @@ using System; using GlitchyEngine.Events; +using GlitchyEngine.Math; namespace GlitchyEngine { @@ -50,7 +51,11 @@ namespace GlitchyEngine * Gets or Sets the maximum height of the window. */ public abstract int32 MaxHeight {get; set;} - + + /** + * Gets or Sets the width and height of the window. + */ + public abstract Point Size {get; set;} /** * Gets or Sets the width of the window. */ @@ -59,6 +64,11 @@ namespace GlitchyEngine * Gets or Sets the height of the window. */ public abstract int32 Height {get; set;} + + /** + * Gets or Sets the position of the upper-left corner of the client area of the window. + */ + public abstract Point Position {get; set;} /** * Gets or Sets the x-coordinate of the upper-left corner of the client area of the window.