diff --git a/MonoGame.Framework/Platform/Native/GameWindow.Native.cs b/MonoGame.Framework/Platform/Native/GameWindow.Native.cs index 3cb5daea4f7..1164db700e8 100644 --- a/MonoGame.Framework/Platform/Native/GameWindow.Native.cs +++ b/MonoGame.Framework/Platform/Native/GameWindow.Native.cs @@ -105,10 +105,11 @@ public unsafe NativeGameWindow(NativeGamePlatform platform, bool primaryWindow) var title = Title == null ? AssemblyHelper.GetDefaultWindowTitle() : Title; + // Create the window which size may be changed by the platform. _handle = MGP.Window_Create( platform.Handle, - _width, - _height, + ref _width, + ref _height, title); _windows[(nint)_handle] = this; diff --git a/MonoGame.Framework/Platform/Native/Platform.Interop.cs b/MonoGame.Framework/Platform/Native/Platform.Interop.cs index 833fe5f0e15..972ec0f4d91 100644 --- a/MonoGame.Framework/Platform/Native/Platform.Interop.cs +++ b/MonoGame.Framework/Platform/Native/Platform.Interop.cs @@ -269,8 +269,8 @@ internal static unsafe partial class MGP [LibraryImport(MonoGameNativeDLL, EntryPoint = "MGP_Window_Create", StringMarshalling = StringMarshalling.Utf8)] public static partial MGP_Window* Window_Create( MGP_Platform* platform, - int width, - int height, + ref int width, + ref int height, string title); [LibraryImport(MonoGameNativeDLL, EntryPoint = "MGP_Window_Destroy", StringMarshalling = StringMarshalling.Utf8)] @@ -289,11 +289,11 @@ internal static unsafe partial class MGP [LibraryImport(MonoGameNativeDLL, EntryPoint = "MGP_Window_SetAllowUserResizing", StringMarshalling = StringMarshalling.Utf8)] public static partial void Window_SetAllowUserResizing(MGP_Window* window, [MarshalAs(UnmanagedType.U1)] bool allow); - [LibraryImport(MonoGameNativeDLL, EntryPoint = "MGP_Window_GetIsBoderless", StringMarshalling = StringMarshalling.Utf8)] + [LibraryImport(MonoGameNativeDLL, EntryPoint = "MGP_Window_GetIsBorderless", StringMarshalling = StringMarshalling.Utf8)] [return: MarshalAs(UnmanagedType.U1)] public static partial bool Window_GetIsBorderless(MGP_Window* window); - [LibraryImport(MonoGameNativeDLL, EntryPoint = "MGP_Window_SetIsBoderless", StringMarshalling = StringMarshalling.Utf8)] + [LibraryImport(MonoGameNativeDLL, EntryPoint = "MGP_Window_SetIsBorderless", StringMarshalling = StringMarshalling.Utf8)] public static partial void Window_SetIsBorderless(MGP_Window* window, [MarshalAs(UnmanagedType.U1)] bool borderless); [LibraryImport(MonoGameNativeDLL, EntryPoint = "MGP_Window_SetTitle", StringMarshalling = StringMarshalling.Utf8)] diff --git a/native/monogame/include/api_MGP.h b/native/monogame/include/api_MGP.h index 232b664935e..032e1b5cf5e 100644 --- a/native/monogame/include/api_MGP.h +++ b/native/monogame/include/api_MGP.h @@ -27,14 +27,14 @@ MG_EXPORT mgbool MGP_Platform_BeforeDraw(MGP_Platform* platform); MG_EXPORT const char* MGP_Platform_MakePath(const char* location, const char* path); MG_EXPORT MGMonoGamePlatform MGP_Platform_GetPlatform(); MG_EXPORT MGGraphicsBackend MGP_Platform_GetGraphicsBackend(); -MG_EXPORT MGP_Window* MGP_Window_Create(MGP_Platform* platform, mgint width, mgint height, const char* title); +MG_EXPORT MGP_Window* MGP_Window_Create(MGP_Platform* platform, mgint& width, mgint& height, const char* title); MG_EXPORT void MGP_Window_Destroy(MGP_Window* window); MG_EXPORT void MGP_Window_SetIconBitmap(MGP_Window* window, mgbyte* icon, mgint length); MG_EXPORT void* MGP_Window_GetNativeHandle(MGP_Window* window); MG_EXPORT mgbool MGP_Window_GetAllowUserResizing(MGP_Window* window); MG_EXPORT void MGP_Window_SetAllowUserResizing(MGP_Window* window, mgbool allow); -MG_EXPORT mgbool MGP_Window_GetIsBoderless(MGP_Window* window); -MG_EXPORT void MGP_Window_SetIsBoderless(MGP_Window* window, mgbool borderless); +MG_EXPORT mgbool MGP_Window_GetIsBorderless(MGP_Window* window); +MG_EXPORT void MGP_Window_SetIsBorderless(MGP_Window* window, mgbool borderless); MG_EXPORT void MGP_Window_SetTitle(MGP_Window* window, const char* title); MG_EXPORT void MGP_Window_Show(MGP_Window* window, mgbool show); MG_EXPORT void MGP_Window_GetPosition(MGP_Window* window, mgint& x, mgint& y); diff --git a/native/monogame/sdl/MGP_sdl.cpp b/native/monogame/sdl/MGP_sdl.cpp index 03d3e76af93..1b26b30966f 100644 --- a/native/monogame/sdl/MGP_sdl.cpp +++ b/native/monogame/sdl/MGP_sdl.cpp @@ -662,8 +662,8 @@ mgbool MGP_Platform_BeforeDraw(MGP_Platform* platform) MGP_Window* MGP_Window_Create( MGP_Platform* platform, - mgint width, - mgint height, + mgint& width, + mgint& height, const char* title) { assert(platform != nullptr);