Log In  

Cart #btnwut-0 | 2024-04-07 | Embed ▽ | License: CC4-BY-NC-SA
1

I cannot figure out what's happening with btn(). It seems totally random. I made this cart so you can see. I thought it was supposed to imitate PICO-8's btn() function, but that's clearly not happening.

Also, if anyone knows how to get data from different controllers, please share. Usually I would do something like btn(btn_num, controller_num) but with btn() acting the way it is... 🤷😂

P#146003 2024-04-07 22:56 ( Edited 2024-04-08 00:30)

1

Okay, figured it out. Thanks to @Waporwave on the Discord server, I checked to see if I had a controller plugged in. And I did! That was messing with all my values. Unplugged the controller and now it works fine, as expected.

BUT! Also kind of weird that just having the controller plugged in (not being pressed or anything) totally bugged out the arrow keys. So, still something to debug there.

P#146010 2024-04-08 00:29 ( Edited 2024-04-08 00:29)

I think picotron is returning raw controller values, and expecting you to deal with the deadzone. It might be nice if the deadzone were a configurable poke value, to avoid this happening by default

P#146011 2024-04-08 00:39

Using this program I can see now why I can't properly read my Switch Pro D-Pad.

P#146015 2024-04-08 02:00

You can usually fix the issue by rotating your control stick in a circle a couple of times, and induce it by doing that while also playing around with the D-pad/arrow keys, which makes me think it's some kind of automatic calibration issue.

P#146017 2024-04-08 02:27
1

the other thing I mentioned is that with keyboard only, diagonals still return not 255 but 181. this seems to be emulating a joystick to keep the vector normalized! maybe could be useful quick way to add that kinda movement to your game

P#146103 2024-04-08 20:37
5

This is fixed for 0.1.0f -- and yes, it was broken deadzone code.

The btn() calls process the raw values in two ways:

  1. the magnitude of x,y sticks is clamped to 1.0: more often than not what you want when paying attention to analogue values, and

  2. holding left and right cancel each other out -- reduce the number of carts that require pressing both L and R at the same time without realising it is impossible on some installations

It will still be possible to grab raw values from @5400 though if needed.

P#146142 2024-04-09 09:33

[Please log in to post a comment]