Re: get_key problem in DOS fullscreen
- Posted by Greg Haberek <ghaberek at ssoe.com> Jun 19, 2007
- 523 views
Donald, What I would suggest here to slow down the loop, is to make use of the built-in tasking features of Euphoria. Here is a quick example I mocked up.
procedure check_key() while 1 do if get_key() = ' ' then -- user pressed space bar exit end if task_yield() end while -- simpler version: --while get_key() != ' ' do -- task_yield() --end while end procedure integer check_key_task -- create the task, no parameters required check_key_task = task_create( routine_id("check_key"), {} ) -- adjust timing here: -- (this would be one hald to a whole second) task_schedule( check_key_task, {0.50,1.00} ) -- loop while the task is 'active' while task_status(check_key_task) = 1 do -- do important stuff here, -- this loop will automatically exit -- when the user presses the space bar task_yield() end while
-Greg