Click outside the windowed mode problems

Started by Baguettator, Sat 20/03/2021 14:57:03

Previous topic - Next topic

Baguettator

Hi !

I encounter a problem : when in windowed mode, if I click outside the game (so outside the window of the game), it results in an event I scripted in on_key_press : "if (keycode==eKeyS)".

Normally, if I put the S key, it shows a message at the screen (it is like a cheat code for play-testing). And when I click outside of the screen of the game, this message appears.

An idea ?

Crimson Wizard

Never heard of such problem before. AGS is not supposed to even receive any key presses when the input focus is elsewhere.

Does the message appear right after you click or when you alt+tab back to AGS window?

Have you tried giving it out for testing to someone else to see if it happens there too?

Baguettator

Sorry for delay for answering, I got some other people testing this issue, and at the moment I don't know if AGS reacts to a key press when it is ALT TAB, or when someone clicks elsewhere the window mode... I didn't get the issue, another people said it to me. I'm going to inspect it deeper :)

Baguettator

Hi there !

I have noticed something that could be linked to my past problem (see first message of this thread).

I have a script in the on_keypress function :

if (keycode==eKeyCtrlH) Display("Something");

The thing is that when I hit the "delete" key (the arrow pointing to the left on the keyboard, used to remove characters in a text), this function is called (I see the "Something" message).

Any ideas of why ?

Khris

#4
Looks like AGS uses 1-26 for Ctrl+Letter, so Ctrl+A = 1, Ctrl+B = 2, CtrlH = 8, etc.

ASCII code 8 is indeed backspace, so they're the same keypress to AGS. This is listed in the manual btw, eKeyCtrlH == eKeyBackspace == 8.
Could be considered a bug actually.

Here's a workaround:

Code: ags
  bool ctrl = IsKeyPressed(405) || IsKeyPressed(406);
  
  if (keycode == eKeyCtrlH && ctrl) Display("Something");
  if (keycode == eKeyBackspace && !ctrl) Display("Backspace");


(However, none of this is related to the weird "clicking outside the window issue" as far as I can tell)

SMF spam blocked by CleanTalk