mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-09 21:25:19 -05:00
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:
parent
a398aa49dd
commit
4681e09aac
1 changed files with 80 additions and 52 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue