From a3b95daadb6b1722d00779563372d9caed1b9eeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20D=C3=BCrrenberger?= Date: Mon, 20 May 2024 01:04:57 +0200 Subject: [PATCH] Use CSFML 2.6.1 and add missing WindowBase functions --- SFML.Module.props | 2 +- src/SFML.Window/WindowBase.cs | 23 ++++++++++++++++------- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/SFML.Module.props b/SFML.Module.props index 0562e95d..3d6d0af1 100644 --- a/SFML.Module.props +++ b/SFML.Module.props @@ -17,7 +17,7 @@ - + diff --git a/src/SFML.Window/WindowBase.cs b/src/SFML.Window/WindowBase.cs index d5dd2d25..f02812b4 100644 --- a/src/SFML.Window/WindowBase.cs +++ b/src/SFML.Window/WindowBase.cs @@ -202,7 +202,7 @@ public virtual void SetMouseCursorVisible(bool show) /// Grab or release the mouse cursor /// /// True to grab, false to release - /// + /// /// /// If set, grabs the mouse cursor inside this window's client /// area so it may no longer be moved outside its bounds. @@ -220,7 +220,7 @@ public virtual void SetMouseCursorGrabbed(bool grabbed) //////////////////////////////////////////////////////////// /// /// Set the displayed cursor to a native system cursor - /// + /// /// Upon window creation, the arrow cursor is used by default. /// /// Native system cursor type to display @@ -233,11 +233,11 @@ public virtual void SetMouseCursor(Cursor cursor) //////////////////////////////////////////////////////////// /// /// Enable or disable automatic key-repeat. - /// + /// /// If key repeat is enabled, you will receive repeated /// events while keeping a key pressed. If it is /// disabled, you will only get a single event when the key is pressed. - /// + /// /// Automatic key-repeat is enabled by default /// /// True to enable, false to disable @@ -394,7 +394,7 @@ protected virtual bool WaitEvent(out Event eventToFill) //////////////////////////////////////////////////////////// protected internal virtual Vector2i InternalGetMousePosition() { - throw new NotImplementedException("Currently not available"); + return sfMouse_getPositionWindowBase(CPointer); } //////////////////////////////////////////////////////////// @@ -407,7 +407,7 @@ protected internal virtual Vector2i InternalGetMousePosition() //////////////////////////////////////////////////////////// protected internal virtual void InternalSetMousePosition(Vector2i position) { - throw new NotImplementedException("Currently not available"); + sfMouse_setPositionWindowBase(position, CPointer); } //////////////////////////////////////////////////////////// @@ -421,7 +421,7 @@ protected internal virtual void InternalSetMousePosition(Vector2i position) //////////////////////////////////////////////////////////// protected internal virtual Vector2i InternalGetTouchPosition(uint Finger) { - throw new NotImplementedException("Currently not available"); + return sfTouch_getPositionWindowBase(Finger, CPointer); } //////////////////////////////////////////////////////////// @@ -783,6 +783,15 @@ private void CallEventHandler(Event e) [DllImport(CSFML.window, CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] private static extern bool sfWindowBase_createVulkanSurface(IntPtr CPointer, IntPtr vkInstance, out IntPtr surface, IntPtr vkAllocator); + + [DllImport(CSFML.window, CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] + private static extern Vector2i sfMouse_getPositionWindowBase(IntPtr CPointer); + + [DllImport(CSFML.window, CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] + private static extern void sfMouse_setPositionWindowBase(Vector2i position, IntPtr CPointer); + + [DllImport(CSFML.window, CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] + private static extern Vector2i sfTouch_getPositionWindowBase(uint Finger, IntPtr RelativeTo); #endregion } }