• Order of the Butterfly
    Order of the Butterfly
    Posts: 436 from 2003/2/25
    From: France
    Many SDL games work by polling (ie reading all the time) the event queue.


    The example code shows the ugly. while(1) { SDL_PollEvent(...); }

    It kills any CPU class.

    Better main loop would be with SDL_WaitEvent/SDL_WaitEventTimeout


    At least, those calls shouldn't eat all the CPU.

    A quick search with G**gle on GitHub :

    SDL_PollEvent site:github.com -> about 9500 results
    SDL_WaitEvent site:github.com -> about 2200 results
    SDL_WaitEventTimeout site:github.com -> about 300 results

    See the disaster. :)
    Quelque soit le chemin que tu prendras dans la vie, sache que tu auras des ampoules aux pieds.
    I need to practice my Kung Fu.
  • »18.01.17 - 15:21
    Profile Visit Website