Notices


Reply
Thread Tools
Posts: 1 | Thanked: 0 times | Joined on Jul 2010
#1
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:

Code:
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;
                }
        }
}
 
Reply

Thread Tools

 
Forum Jump


All times are GMT. The time now is 04:11.