Use SDL_WaitEvent instead of Pool Even otherwhise

the menu handling is like an active loop and
this is not GOOD  for the CPU :). We have
the same pb for the Game Loop where SDL_PoolEven
is used to lookup the key to move the player...
Maybe create a thread to look for the key ?
origin
ob1kenewb 23 years ago
parent 33569c58c5
commit 18928c0dbf

@ -1,4 +1,4 @@
/* $Id: menu.c,v 1.20 2003/05/10 00:36:03 patty21 Exp $ */
/* $Id: menu.c,v 1.21 2003/05/10 21:14:04 ob1kenewb Exp $ */
/* menu's for the game */
#include <SDL.h>
@ -127,7 +127,7 @@ menu_loop (char *menutitle, _menu menu[], int lastselect)
if (bman.gametype == GT_multi && bman.sock != -1)
network_loop ();
if (SDL_PollEvent (&event) != 0)
if (SDL_WaitEvent (&event) != 0)
switch (event.type) {
case (SDL_QUIT):
menuselect = -1;
@ -240,7 +240,7 @@ menu_get_text (char *title, char *text, int len)
if (bman.gametype == GT_multi && bman.sock != -1)
network_loop ();
if (SDL_PollEvent (&event) != 0)
if (SDL_WaitEvent (&event) != 0)
switch (event.type) {
case (SDL_QUIT):
bman.state = GS_quit;
@ -346,7 +346,7 @@ menu_displaymessage (char *title, char *text)
if (bman.gametype == GT_multi && bman.sock != -1)
network_loop ();
if (SDL_PollEvent (&event) != 0)
if (SDL_WaitEvent (&event) != 0)
switch (event.type) {
case (SDL_QUIT):
done = 1;
@ -460,7 +460,7 @@ char *menu_dir_select (char *title, char *path, signed char dirflags) {
if (bman.gametype == GT_multi && bman.sock != -1)
network_loop ();
if (SDL_PollEvent (&event) != 0)
if (SDL_WaitEvent (&event) != 0)
switch (event.type) {
case (SDL_QUIT):
sel = -1;

Loading…
Cancel
Save