Author Topic: Updating GameInput API (previous wanted to check Switch)  (Read 1150 times)

Offline spacefractal

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 4078
    • View Profile
    • Space Fractal
Code: (glbasic) [Select]
Remap on a [ps4 fun controller]|Hold [Down] with your primary [Left Stick/Pad]
Remap Controller: [ps4 fun controller]|Dont touch any Sticks/buttons
Remap on a [ps4 fun controller]|Hold [Face Bottom] Button|wait [5] to end mapping
Remap on a [ps4 fun controller]|Hold [Face Bottom] Button|wait [4] to end mapping
Remap Controller: [ps4 fun controller]|Dont touch any Sticks/buttons
Remap on a [ps4 fun controller]|Hold [Face Right] Button|wait [5] to end mapping
Remap Controller: [ps4 fun controller]|Dont touch any Sticks/buttons
Remap on a [ps4 fun controller]|Hold [Face Left] Button|wait [5] to end mapping
Remap Controller: [ps4 fun controller]|Dont touch any Sticks/buttons
Remap on a [ps4 fun controller]|Hold [Face Up] Button|wait [5] to end mapping
Remap Controller: [ps4 fun controller]|Dont touch any Sticks/buttons
Remap on a [ps4 fun controller]|Hold [Back Left Top] Button|wait [5] to end mapping
Remap Controller: [ps4 fun controller]|Dont touch any Sticks/buttons
Remap on a [ps4 fun controller]|Hold [Back Right Top] Button|wait [5] to end mapping
Remap Controller: [ps4 fun controller]|Dont touch any Sticks/buttons
Remap on a [ps4 fun controller]|Hold [Back Left Bottom] Button|wait [5] to end mapping
Remap Controller: [ps4 fun controller]|Dont touch any Sticks/buttons
Remap on a [ps4 fun controller]|Hold [Back Right Bottom] Button|wait [5] to end mapping
Remap Controller: [ps4 fun controller]|Dont touch any Sticks/buttons
Remap on a [ps4 fun controller]|Hold [Dpad Down] Button|wait [5] to end mapping
Remap on a [ps4 fun controller]|Hold [Dpad Down] Button|wait [4] to end mapping
Remap Controller: [ps4 fun controller]|Dont touch any Sticks/buttons
FINISH

Also if dpad was used as a stick, the stick will been skipped (only uses as a hat), as im asume the controller dont have such of one.

Would works like this. Currectly working from logcat. Still working on it. Should show Key rather than button when on keyboard. hihi.
« Last Edit: 2022-Nov-15 by spacefractal »
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation and The beagle Jam.

Offline bigsofty

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 2795
    • View Profile
Yeah, logically you can just treat the keyboard as a controller but with a lot of buttons.  :S Confusing the matter slightly is that of international keyboards, where KEY() does not equate to a certain ascii character. So any game default keyboard have to take this into consideration when informing the user what key to press for what action.

Looking good so far Spacefractal!  :good:
« Last Edit: 2022-Nov-16 by bigsofty »
Cheers,

Ian.

“It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration.”
(E. W. Dijkstra)

Offline spacefractal

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 4078
    • View Profile
    • Space Fractal
Im should here possible to return which key that is used for a partical button, then up to the game to uses it.

Anyway, far from all glbasic games uses a fulll game controller. Most games only uses few input, so you dont need to remap a full controller, if its not needed by the game.

etc example a stick/dpad and 2 buttons.

Same with keyboard. Games that uses all buttons, would property been a keyboard/mouse game. Mouse is not used by the gameinput.

Powerup Elevation is example a case im dont uses gameinput for the keyboard (can been checked), if a player is a keyboard or not. This is due nature of the game.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation and The beagle Jam.

Offline spacefractal

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 4078
    • View Profile
    • Space Fractal
now im is forced to break the sdl style database, so im could extends it a bit, when you doing remapping. etc example combination of keyboard and arcade controller. The way we using on Android is also a little bit different as we need to scan the controller using KEY() anyway. No idea how its worked with android sdl throught.

The only one that is fixed by now on keyboard, that is the ESCAPE button. That is allways on Back. Im is still missing to do a example, get a interface to start/finish it, get the save done. But the main thing, the main thing seens working, a least on Windows.

Its would look like this when doing on a keyboard:
Code: (glbasic) [Select]
Remap Your [Keyboard]|Press [Movement Down] key
Remap Your [Keyboard]|Dont touch any keys on your keyboard
Remap Your [Keyboard]|Press [Movement Right] key|wait 10 to finish
Glbasic ImageLoad: Graphics/preview2.png
Remap Your [Keyboard]|Press [Movement Right] key|wait 10 to finish
Remap Your [Keyboard]|Dont touch any keys on your keyboard
Remap Your [Keyboard]|Press [Movement Left] key|wait 10 to finish
Remap Your [Keyboard]|Press [Movement Left] key|wait 10 to finish
Remap Your [Keyboard]|Dont touch any keys on your keyboard
Remap Your [Keyboard]|Press [Movement Up] key|wait 10 to finish
Remap Your [Keyboard]|Press [Movement Up] key|wait 10 to finish
Remap Your [Keyboard]|Dont touch any keys on your keyboard
Remap Your [Keyboard]|Press The [Jump] key|wait 10 to finish
Remap Your [Keyboard]|Press The [Jump] key|wait 9 to finish
Remap Your [Keyboard]|Press The [Jump] key|wait 8 to finish
Remap Your [Keyboard]|Dont touch any keys on your keyboard
Remap Your [Keyboard]|Press The [Turn] key|wait 10 to finish
Remap Your [Keyboard]|Dont touch any keys on your keyboard
Remap Your [Keyboard]|Press [Cursor Down] key|wait 10 to finish
Remap Your [Keyboard]|Press [Cursor Down] key|wait 9 to finish
Remap Your [Keyboard]|Dont touch any keys on your keyboard
Remap Your [Keyboard]|Press [Cursor Right] key|wait 10 to finish
Remap Your [Keyboard]|Press [Cursor Right] key|wait 10 to finish
Remap Your [Keyboard]|Dont touch any keys on your keyboard
Remap Your [Keyboard]|Press [Cursor Left] key|wait 10 to finish
Remap Your [Keyboard]|Press [Cursor Left] key|wait 10 to finish
Remap Your [Keyboard]|Dont touch any keys on your keyboard
Remap Your [Keyboard]|Press [Cursor Up] key|wait 10 to finish
Remap Your [Keyboard]|Dont touch any keys on your keyboard

The cursor keys was actuelly just a test, not need in that game, lol. hihi.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation and The beagle Jam.

Offline spacefractal

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 4078
    • View Profile
    • Space Fractal
and this one should been much easier to integrate than the old GameInput remapping system, which was qutie costumesome and actuelly limited.

In the old system, you was more or less needed to integrate that by you self, which is not need now, only require to call a init, and checking a string and checks when its finished.... that it.

Something like this:
Code: (glbasic) [Select]
LOCAL result=GameInput.Remap_ScanCode(0, "back:back/pause|*,start:start|*,leftx:Left Stick|Movement,a:Face Bottom|Jump,b:Face Right|Turn,x:Face Left|*,y:Face Up|*,leftshoulder:Back Left Top|*,rightshoulder:Back Right Top|*,LeftTrigger:Back Left Bottom|*,RightTrigger:Back Right Bottom|*,dpdown:Dpad Down|*,rightx:Right Stick|Cursor,dpright:Dpad Right|*,dpup:DPad Up|*,dpleft:DPad Left|*,leftstick:Left Stick|*,rightstick:Right Stick|*")
IF result=TRUE
DEPRINT(GameInput.Remapping$) // only for testing
DEPRINT("FINISH")
ELSE
DEPRINT(GameInput.RemapStatus$) // the output.
ENDIF

Still missing a way to init it (its start right way as its does now, not intended).
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation and The beagle Jam.

Offline bigsofty

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 2795
    • View Profile
Looks good, I like the nice short syntax.

I haven't used Android for years though, so I cant comment on do's and dont's for that input system I'm afraid.  :noggin:
Cheers,

Ian.

“It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration.”
(E. W. Dijkstra)

Offline spacefractal

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 4078
    • View Profile
    • Space Fractal
Android threat gamepads as keyboard and is even worse than the Windows does. You newer know which keys a button send. This was the main thing why im changed KEY() to use float rather than integer as its was needed for Android as im remember.

Im also reouted the sticks to been KEY(241) to 256 as well, and does also support multiple players (keys 0-255, 256-511 and so on).
« Last Edit: 2022-Nov-17 by spacefractal »
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation and The beagle Jam.

Offline erico

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 4453
    • View Profile
    • FUED
Great work! I recall trying to add psx joys were terrible :D

Offline spacefractal

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 4078
    • View Profile
    • Space Fractal
Im have annonced with full source code:
https://www.glbasic.com/forum/index.php?topic=11566.0


Yep PS4 and xbox has some differents. also if you checking the sld list, some controllers has id all the place, which is why im chossen to have a better remap system as main focus rather than implement the database.

Except some standard configuration.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation and The beagle Jam.