microstudio icon indicating copy to clipboard operation
microstudio copied to clipboard

alt-tabbing out of the game locks ALT in pressed state

Open Skaruts opened this issue 1 year ago • 3 comments

When you alt-tab out of the game, both keyboard.ALT and keyboard.ALT_LEFT get locked in pressed state. This happens both in the browser and in the standalone version.

I'm on windows 7, using Brave browser.

It's easy to replicate:

update = function()
  print(keyboard.ALT)
end

Do that, run the game and alt-tab away, and when you come back the console will be printing 1.

(Also happens with the game paused.)

Skaruts avatar Mar 24 '23 16:03 Skaruts

This isn't fixable on microstudio's end, I don't believe, it happens to everything (that is, holding down a key when you switch to a different tab causes the key to stay held). The way to fix it is just to hit alt again. However, if the print statement is activating while the game is paused, that seems like a real bug? Unless I misunderstood what you are saying, which is likely XD

JmeJuniper avatar Mar 25 '23 02:03 JmeJuniper

I was thinking there might be something in JS that detects when the game loses focus, and if so, maybe it can then make sure input isn't being wrongly received. I could be wrong. Usually engines can detect that, but I've no idea when it comes to JS.

(In fact, not just alt-tabbing, you can hold any key and click outside the game view, and that key will be locked in pressed state.)

About the pause thing, I'm not quite being able to reproduce it now. But just to be clear, I was talking about when you pause it in the code tab.

Skaruts avatar Mar 25 '23 19:03 Skaruts

This also happens in the sprite editor, when you alt-tab away. When you get back, sometimes you are stuck in the eye dropper tool until you press alt to get rid of it.

Skaruts avatar Mar 25 '23 22:03 Skaruts