Re: SDL Event Help

new topic     » goto parent     » topic index » view thread      » older message » newer message
ChrisB said...

Hi

Me applying my dull brain

event is defined as an object, a sequence.

event is sent off to be filled by SDL_PollEvent, from the wiki

event : the SDL_Event structure to be filled with the next event from the queue, or NULL

this returns 1 or 0 for presence or not of an event, if there is an event, then event is the address of the event structure

again from the wiki SDL_Event A union that contains structures for the different event types.

This is where my brain starts to get fried

SDL_pollevent returns the pointer to the SDL_Event, and out of that you want to retrieve SDL_Event.type, and if that's SDL_QUIT then quit. Luckily it looks like it's the first element of the union, so just retrieve that! Simple (?!)

or, in C

 
SDL_Event e; 
for (;;) { 
    SDL_PollEvent(&e);                                                 --send address of structure, fill structure 
    if (e.type == SDL_QUIT) { 
        SDL_Log("Program quit after %i ticks", e.quit.timestamp); 
        break; 
    } 
} 

Cheers

ChrisProbablyNoHelpAtAllButCuriousAnyway

Thanks Chris. However I think the issue is from trying to assign the sequence value(event) to an atom value(SDL_QUIT). There is probably a work-around or something I'm missing, I just haven't figured it out, yet. You're on the right track though, I'm basiclly trying to convert that C code to Eu code.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu