The example provided follows the SDL_key_repeat solution I explained below. It is implicit when creating the app. As an aside, my exaple is essentially exactly like theirs except I've got things split up into Moose classes and it's a bit more messy. It is hard to post code of that nature in any sort of intelligible way. It is entirely safe to assume my example is the same as the two squares example.

Following what their example is doing, the longer I hold an arrow key, the more events get pumped, the more the square moves. It is essentially a timed release of an event, by limiting how many key_repeat signals get translated into events.

This satisfies my need for some things. Maybe my question is more a timer question then, since I would like to have a certain event only happen at specific intervals. With the above example and solution, I could only have one specific delay for many events. Imagine I wanted to shoot bullets frontwards at my key_repeat speed, but then fire one backwards every 2*key_repeat. I don't have a way to do that with the built in key_repeat functions, and am also just as clueless about how to use a timer without blocking.

With these things being called "callbacks" is this non-blicking by default? I've only used callbacks in a Net::SNMP non-blocking context. Are these essentially the same types of things? Is SDLx already trying to make things this easy for me?

Thanks for your quick reply

Ransom

In reply to Re^2: SDLx::App event loop by Ransom
in thread SDLx::App event loop by Ransom

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.