Keyboard Flush (flushchars?)

About Monkey 2 Forums Monkey 2 Programming Help Keyboard Flush (flushchars?)

This topic contains 3 replies, has 3 voices, and was last updated by  Pakz 2 years, 4 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #5660

    Pakz
    Participant

    I just noticed that when using the keyboard that there is no working method to flush the keys after they have been pressed. I have a game loop where I check keyreleased space to open/close a window(rect) but if I use FlushChars() the last key is not erased.

    Is Flushchars the right command for this?

    #5672

    nerobot
    Participant

    Try to store keyreleased state into your own variable and use it inside of loop logic.

    Next loop step keys should be flushed by monkey’s event system.

    #5699

    Mark Sibly
    Keymaster

    KeyPressed() will return true if the given key has been been pressed *since the last ‘render’* – you cannot manually clear it, it will be automatically cleared after the next render.

    Some people are used to KeyPressed auto-clearing itself after it’s called but that is not the case in mx2 – no matter which way I go here I manage to piss off someone so sorry if that turns out to be you!

    For GUI stuff, I really recommend using OnKeyEvent, OnMouseEvent etc as these will generally give you much more precise results.

    #5707

    Pakz
    Participant

    No biggy.

    I like monkey 2 very much so far after trying the last binary release. The best language I ever used. I like the features that I learned about.

    I hope to be able to not spend to much (need 2 new laptops soon since my current ones are 2 and 3 years old already) so I can try and use paypal to donate. I have never used it before so I am a little bit afraid of it still.

    I did this last night. Switching from lists to stacks was no problem either.

    http://cromdesi.home.xs4all.nl/emscripten/maze/Untitled1.html

    (The code is on my github repo.)

    Monkey 2 Rocks !!

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.