-
Member
Delving into PowerDraw
I must say, I'm very impressed with it so far. I'm going to convert what I can of a game I am making from using DelphiX to Powerdraw. I'm just doing the direct input now, and PowerDraw handles it with class! Of course, some questions are arising...
How do I clear the input buffer? I have a menu that the user can traverse with keys or joystick, but if the user holds down a key or joystick direction (or even just taps it), it flips thru a bunch of options at once; with DelphiX you could just do something like this:
DXInput1.States = DXInput.States - DXInput.States;
How can I accomplish the same thing with PowerDraw?
I tried PowerInput.Keys[DIK_UP] := False for instance, but it's a read-only property.
More questions to come for sure - and I will be writing some tips/howtos/tutorials along the way, since I've noticed a definate lack of such things for PowerDraw.
Thanks
Fitz
-
Member
Delving into PowerDraw
Hmp, perhaps no one uses Powerdraw..
-
Super Member
Delving into PowerDraw
Instead of Keys use on KeyPress and KeyRelease variables.
-
Member
Delving into PowerDraw
Doh, silly me, how did I not see those?
Thanks Lifepower.
Did I read somewhere that PowerDraw 3.0 is going to include a sprite engine component as well? It's the only reason I'm not switching completely over to it.
Another musing... is it posible to use the powerdraw font component on a DelphiX surface, and if so, how?
-
Super Member
Delving into PowerDraw
So far as I know it is not possible to use a PowerDraw font component with a DelphiX surface. However, there is a similar component available for DelphiX, which is included with UnDelphiX, though I can't find any reference to it on the site. I still have it if you can't get hold of it.
-
Member
Delving into PowerDraw
is it TPowerFont ? Yeah I have it, and it's not bad actually, but it bares little resemblence to one included with PowerDraw. Thanks though.
-
Member
Delving into PowerDraw
LifePower,
It would seem that my powerinput component isn't working unless I used the .Keys property - .KeyReleased and .KeyPressed don't seem to work. Any idea?
-
Super Member
Delving into PowerDraw
Greetz... remember to set DoKeyboard to true and use PowerInput.Update before you use any variables. If you still have problems, please give more information on how do you use PowerInput and maybe some code...
-
Member
Delving into PowerDraw
hey Life,
the DOKeyboard is set to true, and I am polling and update right before I check the key... for instance..
Form1.PowerInput1.Update;
if (Form1.PowerInput1.KeyPressed[DIK_SPACE] = True) then ...
does not work, nor does
Form1.PowerInput1.Update;
if (Form1.PowerInput1.KeyReleased[DIK_SPACE] = True) then ...
but
Form1.PowerInput1.Update;
if (Form1.PowerInput1.Keys[DIK_SPACE] = True) then ...
does work..
but i'm looking for single key presses. I've done a work around which is rather ugly, but..
Form1.PowerInput1.Update;
if (Form1.PowerInput1.Keys[DIK_SPACE] = False) then SpaceLock = False;
if ((SpaceLock = false) AND (Form1.PowerInput1.Keys[DIK_SPACE] = True)) then SpaceLock := True;
that basically locks it after the first time it's pressed until it's released.
Any clue why those first 2 things arn't working though?
-
Super Member
Delving into PowerDraw
That's exactly how PowerDraw emulated KeyPress & KeyRelease events. It keeps two key buffers, the current and the previous one. If a key wasn't pressed in last buffer but is pressed in new one - KeyPressed will return true. The problem might occur if you call Update somewhere else in your code which will update the current buffer. You'd try to have only one Update call per frame or processing cycle.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
http://flippulseimages.com/Anime/