PDA

View Full Version : Some input problems



Yin
29-08-2009, 12:26 AM
I'm trying to use only the input part of Phoenix for a GLScene project... Is this possible?

I've created the phxInput and set a key...

Player := TphxInput.Create;
Player.Keyboard.KeyBindings[isButton1]:= KeyBinding(VK_SPACE);

And then in the GLScene timer(TGLCadencer), which is constantly triggering, I put:

Player.Update;
If isButton1 in Player.Keyboard.States Then ShowMessage('OMG');

Yet nothing happens.
If I write "Player.Keyboard.States := Player.Keyboard.States + [isButton1]" right before checking for the button, I get the ShowMessage.

I'm quite the noob to Phoenix(though I've used DelphiX quite a bit), so I'm probably making some simple mistake...

Yin
29-08-2009, 08:18 AM
BTW, I am using Turbo Delphi.

Andreaz
29-08-2009, 10:16 AM
You have to insert the input events with the Input.HandleEvent, so from the onkeydown etc you have to create the corresponding event and add it to the event queue:



uses phxEvents;

var Event: TPHXEvent;

Event.Keyboard.Event:= PHX_KEYBOARD_PRESSED;
Event.Keyboard.Key:= Key;

Events.Push(Event);


How come you are mixing glScene with phx?

Yin
30-08-2009, 07:34 PM
Thanks, I'll try that!

Well, I have a lot of experience with DelphiX so I'm really used to how the DXInput works, and I really like it. So I figured I'd use the Input from Phoenix(more clear license status over DX I believe?). I'm not even sure if GLScene has a component to handle input like this. It probably has, but why bother learn something new haha ::)