123
-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|93|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
Socoder -> JSE -> Controller Commands

Fri, 30 Apr 2021, 04:15
Jayenkai

Controller Commands


Having added the MouseX/MouseY/MouseDown commands to JSE yesterday, I figured it might be a good idea to start thinking about controller code, but with the myriad of possibilities (but also keeping simplicity in mind) I've decided to ask you guys what sort of commands you'd like to have available.

I'm thinking something like a Gamepad() function with values for left, right, up, down, and a few default face-buttons..
That would hook up to either a physical gamepad, or default keys, much like how I have the Browsercade set up.

So Gamepad(0) = Up, Gamepad(1)=Right, Gamepad(2)=Down, Gamepad(3)=Left..
But.. Would that account for Sticks, too? Would the values be 0.0->1.0 or simply 0/1?
Or should the sticks be separate commands?
And what about the right thumbstick?
And ports, too? Do the keyboard buttons get sent as their own joystick port, or are they combined with Port 0, for ease of use??
It gets easily mangled!!

What would YOUR preferred command list be?!

(Assume, of course, that there'll also be a separate set of keyboard input functions!)

Basically... How would you expect to code something that makes use of a gamepad?

-=-=-
''Load, Next List!''
Fri, 30 Apr 2021, 13:21
Dan
Hmmm.


How about to copy the BlitzBasic syntax for your engine ?

It has JoyX(port), y,z,u and JoyV for the stick data in -1.0 to 1.0 format and

JoyXdir(port), y,z,u and JoyVdir in -1 to 1 format.

Then the programmer can choose which one fits the best.




Do the keyboard buttons get sent as their own joystick port, or are they combined with Port 0, for ease of use??


The problem which i encounter here, on the web based Fantasy consoles, is, when they use Joypads with Keyboard input as alternative (in case you do not have a joypad).

Usually the two fire buttons (e.g. on pico 8) are set to z and x.

If you have an UK keyboard (driver), then z and x are at the bottom left side near each other.
But if you have, like i have here, a german keyboard layout, then the bottom left keys are y and x. (because of the qwertz layout).

So, actually, i have to press the y key (seen from the uk's qwerty layout) to use the fire button ... which is not comfortable at all ...

(luckily pico 8 guys have set the alternative buttons to c and v as well, which some other FC's do not have.)


Anyway,

You could do something similar with the FSE, that, in case of GamePad use, some of the keyboard keys are set up as an alternative.


Edit: I guess, the best way would be to check the Pad/Hat as GamePad(port,side)
Fri, 30 Apr 2021, 14:13
Jayenkai
"Apparently" there's a new function set which "should" help with the layout thing.
One of the events return a Key, not a Character. I'm currently looking into how that works, and trying to find a way to use it without the necessary insane levels of string manipulation that it seems to require. There's already enough of that going on, here!!

Quite why they can't just give me sodding numbers instead of strings, I don't know.
Bah, humbug..

That's to come, once I can wrap my head around it..

For now, though, I've opted to go for a single Gamepad command with a set of constants to point to the various buttons..
Gamepad(ButtonUp), Gamepad(StickLX), Gamepad(ButtonA) and so on, with an added (,Port) to account for different devices.

I'll have to write a complicated explanation as to how it all works, but.. So far it does at least seem to be working.

-=-=-
''Load, Next List!''