Re: problem with wait_key() and arrows

new topic     » goto parent     » topic index » view thread      » older message » newer message
jimcbrown said...

Perhaps we should consider get_key() and wait_key() low-level enough that they return platform specific values.

But then we should also enhance your workaround into a better new_key() and new_wait_key() (perhaps to go into std/console.e) and in that stdlib file have the Euphoria code define and return a cross-platform set of symbolic keycodes.

That way, people who need to see the low level values (or those who don't care what they get and only want speed - e.g. a wait_key() to pause the program) can do so, but those who want the ease of knowing what key is pressed regardless of platform will be able to get that from the stdlib as well.

IIRC, even old versions of Euphoria (e.g. 2.3) never had a unified set of keycode values, so adding this into the stdlib would be a first.

In those days, euphoria was using ncurses, which does its own translation. You're correct, however, that the values were different from windows key codes.

I doubt that speed is really a big issue here. Either way, both of these are built-in (well, wait key is a MACHINE_FUNC, but same thing). I guess that for wait_key(), we'd have to differentiate between actually typing ESC vs getting the escape sequences, but I don't think that's a big problem.

But, yes, the "low level" aspect is part of why I'm not really sure how to proceed. I think the code I posted is basically something that people can use until a better, more permanent solution is devised. And that code only captures the arrow codes.

Matt

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu