mirror of
https://github.com/VARCem/PDCurses.git
synced 2026-09-24 07:45:21 +00:00
Call PDC_update_rects() every 30 ms from PDC_check_key(). This takes
care of the nodelay() case, as long as the keyboard is still being checked.
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
|
||||
#include "pdcsdl.h"
|
||||
|
||||
RCSID("$Id: pdcdisp.c,v 1.29 2007/07/07 05:17:38 wmcbrine Exp $")
|
||||
RCSID("$Id: pdcdisp.c,v 1.30 2007/07/07 14:48:37 wmcbrine Exp $")
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -56,6 +56,8 @@ chtype acs_map[128] =
|
||||
|
||||
#endif
|
||||
|
||||
Uint32 pdc_lastupdate = 0;
|
||||
|
||||
#define MAXRECT 200 /* maximum number of rects to queue up before
|
||||
an update is forced; the number was chosen
|
||||
arbitrarily */
|
||||
@@ -79,6 +81,7 @@ void PDC_update_rects(void)
|
||||
else
|
||||
SDL_UpdateRects(pdc_screen, rectcount, uprect);
|
||||
|
||||
pdc_lastupdate = SDL_GetTicks();
|
||||
rectcount = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
#include "pdcsdl.h"
|
||||
|
||||
RCSID("$Id: pdckbd.c,v 1.16 2007/06/28 18:41:46 wmcbrine Exp $")
|
||||
RCSID("$Id: pdckbd.c,v 1.17 2007/07/07 14:48:37 wmcbrine Exp $")
|
||||
|
||||
/*man-start**************************************************************
|
||||
|
||||
@@ -119,6 +119,14 @@ void PDC_set_keyboard_binary(bool on)
|
||||
|
||||
bool PDC_check_key(void)
|
||||
{
|
||||
Uint32 current = SDL_GetTicks();
|
||||
|
||||
/* if 30 ms have passed without a screen update, or the timer
|
||||
has wrapped, update now */
|
||||
|
||||
if (current < pdc_lastupdate || ((current - pdc_lastupdate) > 30))
|
||||
PDC_update_rects();
|
||||
|
||||
return SDL_PollEvent(&event);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
#include "pdcsdl.h"
|
||||
|
||||
RCSID("$Id: pdcscrn.c,v 1.29 2007/07/07 06:51:31 wmcbrine Exp $")
|
||||
RCSID("$Id: pdcscrn.c,v 1.30 2007/07/07 14:48:37 wmcbrine Exp $")
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "deffont.h"
|
||||
@@ -91,7 +91,7 @@ int PDC_scr_open(int argc, char **argv)
|
||||
|
||||
if (pdc_own_screen)
|
||||
{
|
||||
if (SDL_Init(SDL_INIT_VIDEO) < 0)
|
||||
if (SDL_Init(SDL_INIT_VIDEO|SDL_INIT_TIMER) < 0)
|
||||
{
|
||||
fprintf(stderr, "Could not start SDL: %s\n",
|
||||
SDL_GetError());
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
* See the file maintain.er for details of the current maintainer. *
|
||||
************************************************************************/
|
||||
|
||||
/* $Id: pdcsdl.h,v 1.13 2007/07/07 05:18:00 wmcbrine Exp $ */
|
||||
/* $Id: pdcsdl.h,v 1.14 2007/07/07 14:48:37 wmcbrine Exp $ */
|
||||
|
||||
#include <curspriv.h>
|
||||
|
||||
@@ -33,6 +33,7 @@ extern bool pdc_own_screen; /* if pdc_screen was not set
|
||||
responsible for (owns) it */
|
||||
extern WINDOW *pdc_lastscr; /* how curscr looked when last
|
||||
updated -- only blit changes */
|
||||
extern Uint32 pdc_lastupdate; /* time of last update, in ticks */
|
||||
|
||||
void PDC_update_rects(void);
|
||||
void PDC_retile(void);
|
||||
|
||||
Reference in New Issue
Block a user