Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers AppGameKit Corner / "GetLastChar()" does not register [Enter]? (assuming it's ascii code #13)

Author
Message
JeZxLee
7
Years of Service
User Offline
Joined: 15th Mar 2017
Location: Long Island, New York, United States, Earth
Posted: 3rd May 2017 20:35
Hi,

I am trying to see if [Enter] key was pressed on Linux but I can't seem to get it working?
I use the following source code:
------------------------------------------------------------------
if GetLastChar() = 13
// Do something!
endif
------------------------------------------------------------------

Should the above work to detect [Enter] key on keyboard pressed?
Thanks!
JeZxLee
16BitSoft Inc.
Video Game Design Studio
http://www.16BitSoft.com
=PRoF=
21
Years of Service
User Offline
Joined: 17th Mar 2003
Location: Milton Keynes, UK
Posted: 3rd May 2017 21:01
If you are trying to detect [Enter] as a kind of 'Press Enter key to continue' thing, then you maybe better off using GetRawKeyState()
nz0
AGK Developer
16
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 5th May 2017 20:02
Enter is sometimes represented by cr + lf (carriage return plus line feed). This will be char(13) + char(10)

As Prof says, better to look at the key than any characters produced by pressing it.

Login to post a reply

Server time is: 2024-04-24 23:18:52
Your offset time is: 2024-04-24 23:18:52