Skip to content

Commit

Permalink
Mostly at parity now
Browse files Browse the repository at this point in the history
  • Loading branch information
flibitijibibo committed Oct 1, 2024
1 parent 51885b3 commit 7b27b2b
Show file tree
Hide file tree
Showing 5 changed files with 108 additions and 98 deletions.
16 changes: 8 additions & 8 deletions src/FNAPlatform/FNAPlatform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,8 @@ static FNAPlatform()
GetCurrentDisplayMode = SDL2_FNAPlatform.GetCurrentDisplayMode;
GetKeyFromScancode = SDL2_FNAPlatform.GetKeyFromScancode;
IsTextInputActive = SDL2_FNAPlatform.IsTextInputActive;
StartTextInput = SDL2.SDL.SDL_StartTextInput;
StopTextInput = SDL2.SDL.SDL_StopTextInput;
StartTextInput = SDL2_FNAPlatform.StartTextInput;
StopTextInput = SDL2_FNAPlatform.StopTextInput;
SetTextInputRectangle = SDL2_FNAPlatform.SetTextInputRectangle;
GetMouseState = SDL2_FNAPlatform.GetMouseState;
SetMousePosition = SDL2.SDL.SDL_WarpMouseInWindow;
Expand Down Expand Up @@ -337,16 +337,16 @@ ref bool textInputSuppress
public delegate Keys GetKeyFromScancodeFunc(Keys scancode);
public static readonly GetKeyFromScancodeFunc GetKeyFromScancode;

public delegate bool IsTextInputActiveFunc();
public delegate bool IsTextInputActiveFunc(IntPtr window);
public static readonly IsTextInputActiveFunc IsTextInputActive;

public delegate void StartTextInputFunc();
public delegate void StartTextInputFunc(IntPtr window);
public static readonly StartTextInputFunc StartTextInput;

public delegate void StopTextInputFunc();
public delegate void StopTextInputFunc(IntPtr window);
public static readonly StopTextInputFunc StopTextInput;

public delegate void SetTextInputRectangleFunc(Rectangle rectangle);
public delegate void SetTextInputRectangleFunc(IntPtr window, Rectangle rectangle);
public static readonly SetTextInputRectangleFunc SetTextInputRectangle;

public delegate void GetMouseStateFunc(
Expand All @@ -371,10 +371,10 @@ int y
public delegate void OnIsMouseVisibleChangedFunc(bool visible);
public static readonly OnIsMouseVisibleChangedFunc OnIsMouseVisibleChanged;

public delegate bool GetRelativeMouseModeFunc();
public delegate bool GetRelativeMouseModeFunc(IntPtr window);
public static readonly GetRelativeMouseModeFunc GetRelativeMouseMode;

public delegate void SetRelativeMouseModeFunc(bool enable);
public delegate void SetRelativeMouseModeFunc(IntPtr window, bool enable);
public static readonly SetRelativeMouseModeFunc SetRelativeMouseMode;

public delegate GamePadCapabilities GetGamePadCapabilitiesFunc(int index);
Expand Down
21 changes: 16 additions & 5 deletions src/FNAPlatform/SDL2_FNAPlatform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -852,7 +852,7 @@ private static string INTERNAL_StripBadChars(string path)
return stripChars;
}

public static void SetTextInputRectangle(Rectangle rectangle)
public static void SetTextInputRectangle(IntPtr window, Rectangle rectangle)
{
SDL.SDL_Rect rect = new SDL.SDL_Rect();
rect.x = rectangle.X;
Expand Down Expand Up @@ -1395,7 +1395,7 @@ public static void GetMouseState(
out ButtonState x2
) {
uint flags;
if (GetRelativeMouseMode())
if (GetRelativeMouseMode(window))
{
flags = SDL.SDL_GetRelativeMouseState(out x, out y);
}
Expand Down Expand Up @@ -1424,12 +1424,12 @@ public static void OnIsMouseVisibleChanged(bool visible)
SDL.SDL_ShowCursor(visible ? 1 : 0);
}

public static bool GetRelativeMouseMode()
public static bool GetRelativeMouseMode(IntPtr window)
{
return SDL.SDL_GetRelativeMouseMode() == SDL.SDL_bool.SDL_TRUE;
}

public static void SetRelativeMouseMode(bool enable)
public static void SetRelativeMouseMode(IntPtr window, bool enable)
{
SDL.SDL_SetRelativeMouseMode(
enable ?
Expand Down Expand Up @@ -2405,11 +2405,22 @@ public static int GetNumTouchFingers()
#endregion

#region TextInput Methods
public static bool IsTextInputActive()

public static bool IsTextInputActive(IntPtr window)
{
return SDL.SDL_IsTextInputActive() != 0;
}

public static void StartTextInput(IntPtr window)
{
SDL.SDL_StartTextInput();
}

public static void StopTextInput(IntPtr window)
{
SDL.SDL_StopTextInput();
}

#endregion

#region SDL2<->XNA Key Conversion Methods
Expand Down
Loading

0 comments on commit 7b27b2b

Please sign in to comment.