Skip to content

Commit

Permalink
Update tests for new bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
smoogipoo committed Jul 17, 2024
1 parent 29a9f71 commit 12d09ea
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion SDL3-CS.Tests/MainCallbacksTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ protected virtual int Event(SDL_Event e)
case SDL_EventType.SDL_EVENT_QUIT:
case SDL_EventType.SDL_EVENT_WINDOW_CLOSE_REQUESTED:
case SDL_EventType.SDL_EVENT_TERMINATING:
case SDL_EventType.SDL_EVENT_KEY_DOWN when e.key.keysym.sym == SDL_Keycode.SDLK_ESCAPE:
case SDL_EventType.SDL_EVENT_KEY_DOWN when e.key.key == SDL_Keycode.SDLK_ESCAPE:
return TERMINATE_SUCCESS;
}

Expand Down
22 changes: 11 additions & 11 deletions SDL3-CS.Tests/MyWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ private int handleEventFromFilter(SDL_Event* e)

private void handleKeyFromFilter(SDL_KeyboardEvent e)
{
if (e.keysym.sym == SDL_Keycode.SDLK_f)
if (e.key == SDL_Keycode.SDLK_F)
{
flash = true;
}
Expand All @@ -102,14 +102,14 @@ private void handleEvent(SDL_Event e)
break;

case SDL_EventType.SDL_EVENT_KEY_DOWN:
switch (e.key.keysym.sym)
switch (e.key.key)
{
case SDL_Keycode.SDLK_r:
case SDL_Keycode.SDLK_R:
bool old = SDL_GetRelativeMouseMode() == SDL_bool.SDL_TRUE;
SDL_SetRelativeMouseMode(old ? SDL_bool.SDL_FALSE : SDL_bool.SDL_TRUE);
break;

case SDL_Keycode.SDLK_v:
case SDL_Keycode.SDLK_V:
string? text = SDL_GetClipboardText();
Console.WriteLine($"clipboard: {text}");
break;
Expand All @@ -122,7 +122,7 @@ private void handleEvent(SDL_Event e)
SDL_SetWindowFullscreen(sdlWindowHandle, SDL_bool.SDL_TRUE);
break;

case SDL_Keycode.SDLK_j:
case SDL_Keycode.SDLK_J:
{
using var gamepads = SDL_GetGamepads();

Expand All @@ -147,15 +147,15 @@ private void handleEvent(SDL_Event e)
}

case SDL_Keycode.SDLK_F1:
SDL_StartTextInput();
SDL_StartTextInput(sdlWindowHandle);
break;

case SDL_Keycode.SDLK_F2:
SDL_StopTextInput();
SDL_StopTextInput(sdlWindowHandle);
break;

case SDL_Keycode.SDLK_m:
SDL_Keymod mod = e.key.keysym.mod;
case SDL_Keycode.SDLK_M:
SDL_Keymod mod = e.key.mod;
Console.WriteLine(mod);
break;
}
Expand All @@ -172,9 +172,9 @@ private void handleEvent(SDL_Event e)

case SDL_EventType.SDL_EVENT_WINDOW_PEN_ENTER:
SDL_PenCapabilityInfo info;
var cap = (SDL_PEN_CAPABILITIES)SDL_GetPenCapabilities((SDL_PenID)e.window.data1, &info);
var cap = SDL_GetPenCapabilities((SDL_PenID)e.window.data1, &info);

if (cap.HasFlag(SDL_PEN_CAPABILITIES.SDL_PEN_AXIS_XTILT_MASK))
if (cap.HasFlag(SDL_PenCapabilityFlags.SDL_PEN_AXIS_XTILT_MASK))
Console.WriteLine("has pen xtilt axis");

Console.WriteLine(info.max_tilt);
Expand Down
8 changes: 4 additions & 4 deletions SDL3-CS.Tests/TestPositionalInputVisualisation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,17 +114,17 @@ protected override int Event(SDL_Event e)
break;

case SDL_EventType.SDL_EVENT_KEY_DOWN:
switch (e.key.keysym.sym)
switch (e.key.key)
{
case SDL_Keycode.SDLK_r:
case SDL_Keycode.SDLK_R:
SDL_SetRelativeMouseMode(SDL_GetRelativeMouseMode() == SDL_bool.SDL_TRUE ? SDL_bool.SDL_FALSE : SDL_bool.SDL_TRUE);
break;

case SDL_Keycode.SDLK_f:
case SDL_Keycode.SDLK_F:
SDL_SetWindowFullscreen(window, SDL_bool.SDL_TRUE);
break;

case SDL_Keycode.SDLK_w:
case SDL_Keycode.SDLK_W:
SDL_SetWindowFullscreen(window, SDL_bool.SDL_FALSE);
break;
}
Expand Down

0 comments on commit 12d09ea

Please sign in to comment.