zhx
2010-07-27, 08:04
Hi all,
I'm developing a game for n900. However, I think the question is general enough to be placed in the Applications category.
How do I catch system events (like lock screen switch turned on/off, screen gets locked automatically, or incoming call during game play)? Thanks!
The current codes are implemented in SDL. A typical event loop looks like:
SDL_Event event;
int running = 1;
*
while(running) {
while(SDL_PollEvent(&event)) {
switch(event.type){
case SDL_KEYDOWN:
case SDL_KEYUP:
DisplayState(&event.key);
DisplayModifiers(&event.key);
DisplayKey(&event.key);
break;
case SDL_QUIT:
running = 0;
break;
}
}
}
I'm developing a game for n900. However, I think the question is general enough to be placed in the Applications category.
How do I catch system events (like lock screen switch turned on/off, screen gets locked automatically, or incoming call during game play)? Thanks!
The current codes are implemented in SDL. A typical event loop looks like:
SDL_Event event;
int running = 1;
*
while(running) {
while(SDL_PollEvent(&event)) {
switch(event.type){
case SDL_KEYDOWN:
case SDL_KEYUP:
DisplayState(&event.key);
DisplayModifiers(&event.key);
DisplayKey(&event.key);
break;
case SDL_QUIT:
running = 0;
break;
}
}
}