Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use CSFML 2.6.1 and add missing WindowBase functions #249

Merged
merged 1 commit into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion SFML.Module.props
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CSFML" Version="2.6.0" />
<PackageReference Include="CSFML" Version="2.6.1" />
</ItemGroup>

</Project>
23 changes: 16 additions & 7 deletions src/SFML.Window/WindowBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ public virtual void SetMouseCursorVisible(bool show)
/// Grab or release the mouse cursor
/// </summary>
/// <param name="grabbed">True to grab, false to release</param>
///
///
/// <remarks>
/// If set, grabs the mouse cursor inside this window's client
/// area so it may no longer be moved outside its bounds.
Expand All @@ -220,7 +220,7 @@ public virtual void SetMouseCursorGrabbed(bool grabbed)
////////////////////////////////////////////////////////////
/// <summary>
/// Set the displayed cursor to a native system cursor
///
///
/// Upon window creation, the arrow cursor is used by default.
/// </summary>
/// <param name="cursor">Native system cursor type to display</param>
Expand All @@ -233,11 +233,11 @@ public virtual void SetMouseCursor(Cursor cursor)
////////////////////////////////////////////////////////////
/// <summary>
/// Enable or disable automatic key-repeat.
///
///
/// If key repeat is enabled, you will receive repeated
/// <see cref="KeyPressed"/> 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
/// </summary>
/// <param name="enable">True to enable, false to disable</param>
Expand Down Expand Up @@ -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);
}

////////////////////////////////////////////////////////////
Expand All @@ -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);
}

////////////////////////////////////////////////////////////
Expand All @@ -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);
}

////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -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
}
}