SDL_Flip und s_delay in Multiplayer

origin
stpohle 23 years ago
parent dd79ad9655
commit 1a62649c9b

@ -6,8 +6,8 @@ RunInTerminal=false
ShowLocals=true ShowLocals=true
[filenumbers] [filenumbers]
0=1028 0=11
1=10 1=1
2=7 2=7
3=477 3=477
4=33 4=33
@ -31,6 +31,10 @@ ShowLocals=true
9= 9=
10= 10=
[filelist]
0=/home/steffen/Daten/Programmierung/Linux/bomberclone/src/pkgcache.c
1=/home/steffen/Daten/Programmierung/Linux/bomberclone/ChangeLog
[replace_text] [replace_text]
0=fieldsize 0=fieldsize
1=(struct _net_addr *addr 1=(struct _net_addr *addr

@ -224,7 +224,6 @@ wait_for_players ()
{ {
SDL_Event event; SDL_Event event;
Uint8 *keys; Uint8 *keys;
Uint32 timeloop1 = SDL_GetTicks ();
int done = 0, int done = 0,
ready = 0, ready = 0,
keypressed = 0, keypressed = 0,
@ -255,15 +254,18 @@ wait_for_players ()
ready = 0; ready = 0;
/* draw the screeninformations */ /* draw the screeninformations */
if (bman.p_nr == -1) /* we have no connect yet */ if (bman.p_nr == -1) { /* we have no connect yet */
mw_wait_for_connect (); mw_wait_for_connect ();
SDL_Flip (gfx.screen);
}
else { /* we have a connect so draw status */ else { /* we have a connect so draw status */
mw_draw_status (); mw_draw_status ();
mw_draw_gfxselect (selgfx); mw_draw_gfxselect (selgfx);
gfx_AddUpdateRect (0 ,0 ,gfx.res.x , mw_y);
mw_draw_chat (); mw_draw_chat ();
} }
SDL_Flip (gfx.screen); gfx_UpdateRects ();
/* do the keyboard handling */ /* do the keyboard handling */
if (SDL_PollEvent (&event) != 0) if (SDL_PollEvent (&event) != 0)
@ -348,13 +350,7 @@ wait_for_players ()
keypressed = 1; keypressed = 1;
/* calculate time sync. */ /* calculate time sync. */
s_delay (1000); s_delay (50);
timeloop1 = SDL_GetTicks ();
while (timeloop1 - timestamp >= 0 && timeloop1 - timestamp < 20) {
s_delay (timeloop1 - timestamp - 1);
timeloop1 = SDL_GetTicks ();
}
timestamp = timeloop1;
} }
mw_shutdown (); mw_shutdown ();

Loading…
Cancel
Save