Keyboard doesnt work in OnUpdate using Timer?

About Monkey 2 Forums Monkey 2 Programming Help Keyboard doesnt work in OnUpdate using Timer?

This topic contains 6 replies, has 3 voices, and was last updated by  therevills 1 year, 7 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #10513

    therevills
    Participant

    What I’m I doing wrong this time?

    [/crayon]
    #10514

    AdamStrange
    Participant

    🙂

    #10515

    therevills
    Participant

    Thanks Adam, but really need a keyhit or keypressed solution.

    #10518

    Mark Sibly
    Keymaster

    Looks like KeyPressed is having problem inside a timer. Works OK inside OnRender so you’ll have to use that for now or KeyDown.

    Think I know what’s up, will look into this ASAP. Did it used to work in a timer? What version?

    #10519

    therevills
    Participant

    Thanks Mark – Currently using MX2 v1.1.07 (from itch)… dont know if it used to work, your space chimps example has the same issue when firing the laser sound and using a timer.

    #10526

    Mark Sibly
    Keymaster

    Ok, to fix this I’ll need to add Keyboard.Flush(), ala ye olde FlushKeys() in blitz3d. A bummer, but I can’t see any way around it if we want to be able to read keypresses asynchronously on timers.

    You will need to call Keyboard.Flush() to prevent any keys that have been recently pushed from being detected, eg: after loading screens etc.

    The previous system would only report keypress that occured in the same ‘frame’, which worked well if everything is synchronous, but it doesn’t work well with timers which can go off in future frames.

    In practice keyboard ‘polling’ is just reverting to how blitz3d and blitzmax used to do it.

    #10562

    therevills
    Participant

    Looks like you’ve had fun trying to fix this!

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

You must be logged in to reply to this topic.