Log In  


I have noticed an issue in some carts that if I switch between keyboard and mouse, then the keyboard no longer works correctly. In particular the cart "Dungeons & Diagrams PICO-8 Demake" by @choo-t ( https://www.lexaloffle.com/bbs/?pid=dungeons_and_diagrams-5 )

If you start it up and use the keys, you can move around the grid. As soon as you use the mouse to move, the arrow keys stop working. The work-around is to click on the browser tab, or the PICO-8 Window Title bar and then the keys start working again.

Running on Windows 10

P#127465 2023-03-22 16:49


I think it's the cart.

In the code where the move stuff is, they check for the button presses and then check for the mouse. So you can use the buttons to move, then the cursor will immediately be reset to where the mouse is, thus making it look like you didn't move at all by the time _draw() happens. I'm on Linux rather than Windows, but the button movement started working for me again as soon as I moved my OS mouse cursor out of bounds of the PICO-8 window. I didn't have to click anything.

On the web version, if you move your mouse out of the top or left side of the game play area only, the key controls come back. Not entirely sure why that is, but I'm guessing maybe stat(32) and stat(33) work differently in the web player than in the desktop app, so this statement:

    if(x > 8 and y > 8 and x < 128 and y < 128) then

returns true in the web player when leaving via the right/bottom edges. Totally guesswork on my part though.

P#127479 2023-03-22 17:54

@bitchuck Thanks a lot, you are right. The fact that the pointer is over the grid causes the selection to be reset to wherever the pointer is, regardless of key presses.

P#127504 2023-03-23 08:46

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2023-10-02 11:56:16 | 0.074s | Q:15