Page 2 of 2 FirstFirst 12
Results 11 to 12 of 12

Thread: Delving into PowerDraw

  1. #11

    Delving into PowerDraw

    Hmm, i dont think that's the problem, i'm only calling it once. Donno, it just doesn't work as far as I can see.

  2. #12

    Delving into PowerDraw

    Of course I don't know how your really code works, but we've also made some mistakes using the powerinput. I assume you're using both the PTimer.Onprocess and PTimer.OnRender events? Make sure you only call the Update-function in one of those functions. Preferably in the Onprocess event, because that way you can set the update speed to a constant rate (in the PowerTimer.FPS property) and don't have your character (or whatever you move with your Pinput-events) running like maniacs on higher framerates

    Maybe an insight on our PTimer.OnProcess will help. Ours roughly works as follows:

    - PInput.update; // Updates the input-events
    - Handle the pressed keys
    - do other stuff

    This should work fine, the tricky part is in the part where we handle the keypressed events. For this procedure we use our own variable 'KeyPressed' that's set to true when the user presses a key for the first time. For example, when you want to catch a single space-bar key-event, it roughly works as follows:

    if KeyPressed and (PInput.KeyReleased[DIK_SPACE]) then
    Keypressed:=false; // The spacebar is released

    if Pinput.keys[DIK_SPACE] and not Keypressed then
    begin
    KeyPressed:=true; // The spacebar key is pressed

    // do something that should happen when you press the space-bar
    end;

    This is the way we handle our key-events using PowerInput, and it works for us... We also think it can be done in a more effecient way avoiding the use of an extra variable, but we haven't really figured out how.

    I hope this helps for you. If anyone has any suggestions on doing this without using this extra variable, we hope hearing from you!

    Coen
    Check our RPG-project 'Cataclysm', download the beta v0.11 of the game engine and let us know what you think on our forum!
    <br />http://cataclysm.servegame.com

Page 2 of 2 FirstFirst 12

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •