Page 1 of 1
KEYS.BSF
Posted: Tue Apr 16, 2013 7:37 am
by enric
In this file there is a function for debug
FUNCTION KEYBOARD_DEBUG(me, key,tilex,tiley)
but tilex, tiley always return 0
is there a way to know where the cursor position is?
Re: KEYS.BSF
Posted: Tue Apr 23, 2013 4:47 pm
by pipfromslitherine
KEYBOARD_ functions only get passed in the me and key values. I'm not sure why that debug function has the other params, but they will always be zero, as you see.
Cheers
Pip
Re: KEYS.BSF
Posted: Mon Apr 29, 2013 3:16 pm
by enric
is there a way the catch the pressed key when there no unit selected?
Re: KEYS.BSF
Posted: Mon Apr 29, 2013 3:20 pm
by pipfromslitherine
I don't think so. It would be too easy to interfere with the main UI key handling.
Cheers
Pip
Re: KEYS.BSF
Posted: Mon Apr 29, 2013 4:18 pm
by enric
but in fact, with no unit selected, you can push N or TAB and goes to the first unit id.
Re: KEYS.BSF
Posted: Mon Apr 29, 2013 4:48 pm
by pipfromslitherine
You can attach a key to a UI object, yes. If you have your own UI control active then you can attach keys to them in the same way as BattleAdvancedPanel for example.
Cheers
Pip
Re: KEYS.BSF
Posted: Mon Apr 29, 2013 5:26 pm
by enric
I already put a
COMMAND KEY 4 (for example in the button:
[BAPAFVUnitsButton]
type button
x 300
y 3
width 54
height 54
file IPOD_AFV.tga
sfxfocus 7
sfx 5
COMMAND KEY 4
tooltip IDS_BAP_AFV
The UI_OBJ_HANDLE(data, event, id) works with, or without, a unit selected, but the shortcut "4" works only if catch it in the Keys.bsf
example:
if( IsUIObject(id, "BAPAFVUnitsButton") == 1 )
{
printHeader ("AFV");
printUnits(GetCurrentSide(), 1);
}
this works when the button in the advanced panel is clicked, with or without a unit selected.
but the "4" don't. I need to put in KEYS:
if(key == 52)
{
// number 4 keyboard
printHeader ("AFV");
printUnits(GetCurrentSide(), 1);
}
Re: KEYS.BSF
Posted: Mon Apr 29, 2013 7:31 pm
by pipfromslitherine
Ah - right. I remember now (I think!) it's actually a way for a UI control to trigger a key press (e.g. the 1 key was being used prior to the (iPad) bar of additional controls. So the button press triggers a key event. Hence the behaviour you are seeing.
Hmmm - not sure if there is any way around it that without a code change.
Cheers
Pip
Re: KEYS.BSF
Posted: Tue Apr 30, 2013 5:17 am
by enric
pipfromslitherine wrote:Ah - right. I remember now (I think!) it's actually a way for a UI control to trigger a key press (e.g. the 1 key was being used prior to the (iPad) bar of additional controls. So the button press triggers a key event. Hence the behaviour you are seeing.
Hmmm - not sure if there is any way around it that without a code change.
Cheers
Pip
But there is a different behaviour between the 1 key and the N key, in the first case the code triggered is in KEY.BSF but in the second case no (I could not find it for now. This second case is the clue, because it is triggered even without a unit selected.
Re: KEYS.BSF
Posted: Tue Apr 30, 2013 2:45 pm
by pipfromslitherine
The N key is captured in code, it's one of the main game key shortcuts. The button just triggers the same keypress so that we don't have to have two flows into the logic.
Cheers
Pip
Re: KEYS.BSF
Posted: Tue Apr 30, 2013 3:17 pm
by enric
Tha's was I thought, just wanted to be sure.