Closed wn2000 closed 11 months ago
If you comment out these lines, you won't be able to interact with the keyboard with ImGui. Since this works on all other cases (pi, ubuntu, fedora, wsl...), it is something specific to Oregon Trail.
Try to understand why ImGui always wants to capture the keyboard, comparing to one of the above working cases.
Just a thought: Since in the ImGui version you're using ImGui::Image()
to draw the game screen, that might make ImGui think it's always activated.
Maybe just use glDrawElements
to draw a quad for the game screen, and only use ImGui for settings?
Have you tried to comment it out and see if it works better?
Worth putting a question to the ImGui
people as well. Since it works everywhere else, all obvious things have already been sorted.
Hey there - thanks for porting this to Linux. I'm trying the libretro core and can't get the keyboard to work for Oregon Trail either. Other titles do work. Any ideas to why? Switching to the sdl2 input driver has no effect. This is on a raspberry pi 3. I don't think ImGui would be used in the libretro core?
Did some digging on the libretro end. In the keyboard callback function, which is called by RetroArch: https://github.com/audetto/AppleWin/blob/ac394dfbf8826a092ce7770a299dbe348005c5af/source/frontends/libretro/game.cpp#L129
Pressing 1
on the keyboard gives the following:
sdl2
driver
keycode = 49, character = 49
udev
driver
keycode = 49, character = 0
Now in this switch
for keycode
,
https://github.com/audetto/AppleWin/blob/ac394dfbf8826a092ce7770a299dbe348005c5af/source/frontends/libretro/game.cpp#L149
only a
to z
are processed but not keys like 0
to 9
etc., which are only processed for character
.
So the fix seems to be also processing 0
to 9
etc. for keycode
.
That's a great find. I'll need to try numeric characters on the apps where the keyboard worked. I've also noticed that the space bar does not work and it does appear to be missing from the switch statement.
I take this is no longer a sa2
issue then.
I have tried all the input drivers I could find (x, wayland, sdl2, udev, linuxraw) and cant get that behaviour.
But if it happens...
Basically we need to decide if we use the actual keyboard layout or the Apple ][ keyboard layout.
I have clearly decided to use the actual layout.
I have implemented something, but it is not complete. I will use the keycodes for those ranges if the character is 0.
If I always use it, then my #
produces a keycode = RETROK_BACKSLASH
which makes it harder for me to type.
I guess I could add an option, and people decide.
See if this is better for you, and I will implement the Apple ][ layout for these ranges, (if character
is 0 for now).
Thanks! The commit looks good to me.
I take this is no longer a
sa2
issue then.
sa2 with imgui still has the issue. Taking another look there, I see that the handler for SDL_KeyboardEvent
only processes a
to z
, those other keys like 0
to 9
and space
etc are handled only for the SDL_TextInputEvent
.
This worked for the non-imgui version but not for the imgui one.
ok, could you please re-open a new imgui-only issue with all the updated information. I am not sure any longer what happens.
we keep this one open only for libretro to implement the missing Shift-Ctrl modifiers if character = 0.
Hey there - thanks for porting this to Linux. I'm trying the libretro core and can't get the keyboard to work for Oregon Trail either. Other titles do work. Any ideas to why? Switching to the sdl2 input driver has no effect. This is on a raspberry pi 3. I don't think ImGui would be used in the libretro core?
Also tried Raft Away River and it is not registering keyboard input, so it's not limited to Oregon Trail
There has been a lot of noise on this issue with libretro and imgui mixed together. If this is an issue for libretro, please check again and report back, otherwise open a new issue.
@audetto - I can confirm the changes you made in the latest commit allows me to use my keyboard in Oregon Trail and Raft Away River. Numeric characters and spacebar work perfectly! Thanks
I've added the ability to use the original keyboard layout. If you frontend does not produce character codes, it should make no difference, but give it a go.
UPDATE: keyboard input works with
--no-imgui
.I'm trying Oregon Trail but keyboard input does not work in the sa2 version. This is after I've commented out the following two lines: https://github.com/audetto/AppleWin/blob/eb550570203aa6a5fe82701959f0b582a4b78624/source/frontends/sdl/imgui/sdlimguiframe.cpp#L248-L249
Keyboard works otherwise for F1, Shift-F2 etc., just cannot enter the choices in game.
Keyboard works in Oregon Trail using the libretro version, with
sdl2
input driver in RetroArch (evdev
driver does not work).