mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-11 07:11:39 +00:00
This makes the editor quite a bit friendlier in terms of CPU usage. After checking for input, we wait for 1 ms if none was reported.
git-svn-id: https://svn.eduke32.com/eduke32@406 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
215e0fb0c6
commit
e7d1346248
6 changed files with 34 additions and 31 deletions
|
@ -69,6 +69,7 @@ void initprintf(const char *, ...);
|
|||
void debugprintf(const char *,...);
|
||||
|
||||
int handleevents(void);
|
||||
void idle(void);
|
||||
|
||||
typedef void (*KeyPressCallback)(long,long);
|
||||
typedef void (*MousePressCallback)(long,long);
|
||||
|
|
|
@ -397,8 +397,8 @@ CANCEL:
|
|||
keystatus[1] = 1;
|
||||
quitevent = 0;
|
||||
}
|
||||
}
|
||||
|
||||
} else idle();
|
||||
|
||||
OSD_DispatchQueued();
|
||||
|
||||
ExtPreCheckKeys();
|
||||
|
@ -433,7 +433,7 @@ CANCEL:
|
|||
quitflag = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else idle();
|
||||
|
||||
if (keystatus[0x15] != 0) {
|
||||
keystatus[0x15] = 0;
|
||||
|
@ -457,8 +457,9 @@ CANCEL:
|
|||
|
||||
while ((keystatus[1]|keystatus[0x1c]|keystatus[0x39]|keystatus[0x31]|keystatus[0x2e]) == 0)
|
||||
{
|
||||
if (handleevents()) if (quitevent) break; // like saying no
|
||||
|
||||
if (handleevents()) { if (quitevent) break; } // like saying no
|
||||
else idle();
|
||||
|
||||
if (keystatus[0x15] != 0) {
|
||||
keystatus[0x15] = 0;
|
||||
|
||||
|
@ -2500,7 +2501,7 @@ long gettile(long tilenum)
|
|||
|
||||
if (handleevents()) {
|
||||
if (quitevent) quitevent = 0;
|
||||
}
|
||||
} else idle();
|
||||
|
||||
synctics = totalclock-lockclock;
|
||||
lockclock += synctics;
|
||||
|
@ -2570,7 +2571,7 @@ long gettile(long tilenum)
|
|||
{
|
||||
if (handleevents()) {
|
||||
if (quitevent) quitevent = 0;
|
||||
}
|
||||
} else idle();
|
||||
|
||||
ch = bgetchar();
|
||||
|
||||
|
@ -2821,8 +2822,8 @@ void overheadeditor(void)
|
|||
keystatus[1] = 1;
|
||||
quitevent = 0;
|
||||
}
|
||||
}
|
||||
|
||||
} else idle();
|
||||
|
||||
OSD_DispatchQueued();
|
||||
|
||||
oldmousebstatus = bstatus;
|
||||
|
@ -5459,7 +5460,7 @@ CANCEL:
|
|||
if (quitevent) {
|
||||
quitevent = 0;
|
||||
}
|
||||
}
|
||||
} else idle();
|
||||
|
||||
ch = bgetchar();
|
||||
|
||||
|
@ -5481,7 +5482,7 @@ CANCEL:
|
|||
if (quitevent) {
|
||||
quitevent = 0;
|
||||
}
|
||||
}
|
||||
} else idle();
|
||||
|
||||
ch = bgetchar();
|
||||
|
||||
|
@ -5706,7 +5707,7 @@ CANCEL:
|
|||
|
||||
if (handleevents()) {
|
||||
if (quitevent) quitevent = 0;
|
||||
}
|
||||
} else idle();
|
||||
|
||||
ch = bgetchar();
|
||||
|
||||
|
@ -5798,7 +5799,7 @@ CANCEL:
|
|||
{
|
||||
if (handleevents()) {
|
||||
if (quitevent) quitevent = 0;
|
||||
}
|
||||
} else idle();
|
||||
|
||||
ch = bgetchar();
|
||||
|
||||
|
@ -5812,7 +5813,7 @@ CANCEL:
|
|||
{
|
||||
if (handleevents()) {
|
||||
if (quitevent) break; // like saying no
|
||||
}
|
||||
} else idle();
|
||||
|
||||
ch = bgetchar();
|
||||
|
||||
|
@ -6370,7 +6371,7 @@ long getnumber16(char namestart[80], long num, long maxnumber, char sign)
|
|||
{
|
||||
if (handleevents()) {
|
||||
if (quitevent) quitevent = 0;
|
||||
}
|
||||
} else idle();
|
||||
|
||||
ch = bgetchar();
|
||||
|
||||
|
@ -6415,7 +6416,7 @@ long getnumber256(char namestart[80], long num, long maxnumber, char sign)
|
|||
{
|
||||
if (handleevents()) {
|
||||
if (quitevent) quitevent = 0;
|
||||
}
|
||||
} else idle();
|
||||
|
||||
drawrooms(posx,posy,posz,ang,horiz,cursectnum);
|
||||
#ifdef SUPERBUILD
|
||||
|
@ -6571,7 +6572,7 @@ long menuselect(void)
|
|||
keystatus[1] = 1;
|
||||
quitevent = 0;
|
||||
}
|
||||
}
|
||||
} else idle();
|
||||
ch = bgetchar();
|
||||
{ // JBF 20040208: seek to first name matching pressed character
|
||||
CACHE1D_FIND_REC *seeker = currentlist ? findfiles : finddirs;
|
||||
|
|
|
@ -492,12 +492,8 @@ long initmultiplayerscycle(void)
|
|||
long i, k;
|
||||
extern long totalclock;
|
||||
|
||||
#ifdef _WIN32
|
||||
Sleep(1);
|
||||
#else
|
||||
usleep(1);
|
||||
#endif
|
||||
|
||||
idle();
|
||||
|
||||
getpacket(&i,0);
|
||||
|
||||
tims = GetTickCount();
|
||||
|
|
|
@ -1499,6 +1499,10 @@ int handleevents(void)
|
|||
return rv;
|
||||
}
|
||||
|
||||
void idle(void)
|
||||
{
|
||||
usleep(1);
|
||||
}
|
||||
|
||||
static int buildkeytranslationtable(void)
|
||||
{
|
||||
|
|
|
@ -528,9 +528,10 @@ int handleevents(void)
|
|||
return rv;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void idle(void)
|
||||
{
|
||||
Sleep(1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1626,7 +1626,7 @@ static int AskIfSure(void)
|
|||
retval = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else idle();
|
||||
if (keystatus[0x15] != 0)
|
||||
{
|
||||
keystatus[0x15] = 0;
|
||||
|
@ -4956,7 +4956,7 @@ static void EditSectorData(short sectnum)
|
|||
if (handleevents())
|
||||
{
|
||||
if (quitevent) quitevent = 0;
|
||||
}
|
||||
} else idle();
|
||||
printmessage16("Edit mode, press <Esc> to exit");
|
||||
if (keystatus[0xd0] > 0)
|
||||
{
|
||||
|
@ -5193,7 +5193,7 @@ static void EditWallData(short wallnum)
|
|||
if (handleevents())
|
||||
{
|
||||
if (quitevent) quitevent = 0;
|
||||
}
|
||||
} else idle();
|
||||
printmessage16("Edit mode, press <Esc> to exit");
|
||||
if (keystatus[0xd0] > 0)
|
||||
{
|
||||
|
@ -5327,7 +5327,7 @@ static void EditSpriteData(short spritenum)
|
|||
if (handleevents())
|
||||
{
|
||||
if (quitevent) quitevent = 0;
|
||||
}
|
||||
} else idle();
|
||||
printmessage16("Edit mode, press <Esc> to exit");
|
||||
if (keystatus[0xd0] > 0)
|
||||
{
|
||||
|
@ -5738,7 +5738,7 @@ static void FuncMenu(void)
|
|||
if (handleevents())
|
||||
{
|
||||
if (quitevent) quitevent = 0;
|
||||
}
|
||||
} else idle();
|
||||
printmessage16("Select an option, press <Esc> to exit");
|
||||
if (keystatus[0xd0] > 0)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue