mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-01-11 05:45:57 +00:00
[SDL] Fixed cursor support
SDL.CreateColorCursor takes 3 arguments, not 5.
This commit is contained in:
parent
48e21328c5
commit
d787656328
|
@ -83,7 +83,7 @@ namespace OpenTK.Platform.SDL2
|
|||
|
||||
[SuppressUnmanagedCodeSecurity]
|
||||
[DllImport(lib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_CreateColorCursor", ExactSpelling = true)]
|
||||
public static extern Cursor CreateColorCursor(Surface surface, int w, int h, int hot_x, int hot_y);
|
||||
public static extern Cursor CreateColorCursor(Surface surface, int hot_x, int hot_y);
|
||||
|
||||
[SuppressUnmanagedCodeSecurity]
|
||||
[DllImport(lib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_FreeCursor", ExactSpelling = true)]
|
||||
|
@ -242,6 +242,10 @@ namespace OpenTK.Platform.SDL2
|
|||
[DllImport(lib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetModState", ExactSpelling = true)]
|
||||
public static extern Keymod GetModState();
|
||||
|
||||
[SuppressUnmanagedCodeSecurity]
|
||||
[DllImport(lib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetMouseState", ExactSpelling = true)]
|
||||
public static extern ButtonFlags GetMouseState(out int hx, out int hy);
|
||||
|
||||
[SuppressUnmanagedCodeSecurity]
|
||||
[DllImport(lib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GetNumDisplayModes", ExactSpelling = true)]
|
||||
public static extern int GetNumDisplayModes(int displayIndex);
|
||||
|
|
|
@ -498,21 +498,29 @@ namespace OpenTK.Platform.SDL2
|
|||
IntPtr cursor_surface =
|
||||
SDL.CreateRGBSurfaceFrom(
|
||||
new IntPtr(pixels),
|
||||
cursor.Width,
|
||||
cursor.Height,
|
||||
value.Width,
|
||||
value.Height,
|
||||
32,
|
||||
cursor.Width * 4,
|
||||
value.Width * 4,
|
||||
0xff000000,
|
||||
0x00ff0000,
|
||||
0x0000ff00,
|
||||
0x000000ff);
|
||||
|
||||
sdl_cursor = SDL.CreateColorCursor(
|
||||
cursor_surface,
|
||||
cursor.Width,
|
||||
cursor.Height,
|
||||
cursor.X,
|
||||
cursor.Y);
|
||||
if (cursor_surface == IntPtr.Zero)
|
||||
{
|
||||
Debug.Print("[SDL2] Failed to create cursor surface. Error: {0}",
|
||||
SDL.GetError());
|
||||
return;
|
||||
}
|
||||
|
||||
sdl_cursor = SDL.CreateColorCursor(cursor_surface, value.X, value.Y);
|
||||
if (sdl_cursor == IntPtr.Zero)
|
||||
{
|
||||
Debug.Print("[SDL2] Failed to create cursor. Error: {0}",
|
||||
SDL.GetError());
|
||||
return;
|
||||
}
|
||||
|
||||
if (sdl_cursor != IntPtr.Zero)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue