The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
Confusion about custom events
Kamehameha


Joined: 21 Jun 2015
Posts: 2
Hi friends ☺ I can't seem to get custom events to work. I can get one to work, but no more than that. I have no idea what I'm doing wrong

[code]
Uint32 USR_MAIN = SDL_RegisterEvents(3);

Uint32 USR_LOAD,USR_DESTROY;

{
Uint32 i = USR_MAIN;
USR_LOAD = ++i;
USR_DESTROY = ++i;
}

SDL_Event event; event.type = USR_LOAD;
SDL_PushEvent(&event);

// Poll Event

case SDL_USEREVENT:

if(Ll_event.type == USR_MAIN) {
// This works
}
if(Ll_event.type == USR_LOAD) {
// This doesn't
}

break;
[\code]
Kamehameha


Joined: 21 Jun 2015
Posts: 2
Code:

Uint32 USR_MAIN = SDL_RegisterEvents(3);

Uint32 USR_LOAD,USR_DESTROY;

{
Uint32 i = USR_MAIN;
USR_LOAD = ++i;
USR_DESTROY = ++i;
}

SDL_Event event; event.type = USR_LOAD;
SDL_PushEvent(&event);

// Poll Event

case SDL_USEREVENT:

if(Ll_event.type == USR_MAIN) {
// This works
}
if(Ll_event.type == USR_LOAD) {
// This doesn't
}

break;