Window.SetPosition

what_if_no_video_threads
cosmonaut 2024-03-05 23:19:07 -08:00
parent cba6ca59d3
commit 099c07aa39
1 changed files with 17 additions and 0 deletions

View File

@ -21,6 +21,15 @@ namespace MoonWorks
public bool Claimed { get; internal set; } public bool Claimed { get; internal set; }
public MoonWorks.Graphics.TextureFormat SwapchainFormat { get; internal set; } public MoonWorks.Graphics.TextureFormat SwapchainFormat { get; internal set; }
public (int, int) Position
{
get
{
SDL.SDL_GetWindowPosition(Handle, out var x, out var y);
return (x, y);
}
}
private bool IsDisposed; private bool IsDisposed;
private static Dictionary<uint, Window> idLookup = new Dictionary<uint, Window>(); private static Dictionary<uint, Window> idLookup = new Dictionary<uint, Window>();
@ -113,6 +122,14 @@ namespace MoonWorks
} }
} }
/// <summary>
/// Sets the window position.
/// </summary>
public void SetPosition(int x, int y)
{
SDL.SDL_SetWindowPosition(Handle, x, y);
}
internal static Window Lookup(uint windowID) internal static Window Lookup(uint windowID)
{ {
return idLookup.ContainsKey(windowID) ? idLookup[windowID] : null; return idLookup.ContainsKey(windowID) ? idLookup[windowID] : null;