Unix coder playing win32 programmer, added button_get_w_tmo() and it what

do you know, it might just work. There was no win32 programmer in sight.
How hard can it be? ;-P


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1580 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Daniel Stenberg 2002-08-07 09:17:21 +00:00
parent a398aa49dd
commit 4681e09aac

View file

@ -50,10 +50,7 @@ int button_set_release(int newmask)
return oldmask;
}
int button_get(bool block)
{
int btn = 0;
do
static int real_button_get(void)
{
if (bActive)
{
@ -101,10 +98,41 @@ int button_get(bool block)
last_key = 0 ;
}
}
}
while (btn == 0 && block);
Sleep (50);
return btn;
}
int button_get(bool block)
{
int btn;
do {
btn = real_button_get();
if(!btn)
/* prevent busy-looping */
Sleep (50); /* ms */
else
break;
} while (block);
return btn;
}
int button_get_w_tmo(int ticks)
{
int btn;
do {
btn = real_button_get();
if(!btn)
/* prevent busy-looping */
sleep(1); /* one tick! */
else
break;
} while (block);
return btn;
}