X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fevents.c;h=088650b17f2242a38244c4ccd944c74ebd6f46d3;hb=e7f36cd97c8580345714b4a22d6b4ad291e50ed6;hp=e77b7510ea1c02ec2b30d74378ac34dc0cfc21ea;hpb=57562a0f29074feea1dc01ddf1b1d5e4e6d59730;p=rocksndiamonds.git diff --git a/src/events.c b/src/events.c index e77b7510..088650b1 100644 --- a/src/events.c +++ b/src/events.c @@ -62,6 +62,21 @@ void EventLoop(void) break; } } + + HandleNoXEvent(); + + /* don't use all CPU time when idle; the main loop while playing + has its own synchronization and is CPU friendly, too */ + + if (game_status != PLAYING) + { + XSync(display, FALSE); + Delay(10); + } + + + +#if 0 else /* got no event, but don't be lazy... */ { HandleNoXEvent(); @@ -75,6 +90,9 @@ void EventLoop(void) Delay(10); } } +#endif + + if (game_status == EXITGAME) return; @@ -314,7 +332,13 @@ void HandleButton(int mx, int my, int button) HandleSetupScreen(mx,my,0,0,button); break; case PLAYING: + + /* --> NoXEvent() will follow */ + + /* HandleGameActions(0); + */ + break; default: break; @@ -702,7 +726,8 @@ void HandleNoXEvent() return; } - HandleNetworking(); + if (network) + HandleNetworking(); switch(game_status) { @@ -730,11 +755,6 @@ void HandleJoystick() { int joystick = Joystick(); int keyboard = key_joystick_mapping; - - /* - int joy = (tape.playing ? TapePlayAction() : (joystick | keyboard)); - */ - int joy = (joystick | keyboard); int left = joy & JOY_LEFT; int right = joy & JOY_RIGHT;