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.

DarkBASIC Discussion / DarkBASIC Keyboard Controls

Author
Message
Tomo2000
16
Years of Service
User Offline
Joined: 22nd Apr 2009
Location:
Posted: 22nd Apr 2009 13:19
I'm fairly new to using darkBASIC and was wondering if anybody could tell me the keyboard controls (e.g. if controlkey()) for the + and - buttons.

And if it wasn't any trouble; does anybody have an entire keyboard control list?

-Thanks in advance
Tomo2000
That1Smart Guy
16
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 22nd Apr 2009 15:45
go into the help files, go to the command section and in the input section select the return value=scancode() command

view this help file, it works well

There are only 10 kinds of people in the world, those who understand binary and those who dont
LBFN
18
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 22nd Apr 2009 17:04 Edited at: 22nd Apr 2009 17:14
I forget who made this, but it is an excellent pic for showing the keyboard values using the KEYSTATE command.
http://www.mediafire.com/imageview.php?quickkey=2jm2dqmtz5a&thumb=6

Attachments

Login to view attachments
Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 22nd Apr 2009 17:25
Every key on your keyboard is mapped out like LBFN's pic, even if some of your keys have different symbols on them to the ones in the pic that doesnt matter, it is the position of the keys the numbers are assigned to.

The keystate command will tell you the state of any key on the keyboard (1=pressed 0=up), all you have to do is supply the function with the number that represents the key you want to check. i.e. keystate(12) would return the state of "-" and keystate(13) of "+".

I'm guessing you are using these keys to increase/decrease a variable; because of the speed at which the computer executes your code it is near impossible to register a single key press, for this you will have to write your own routine.
A simple switch can be implemented like so...


can't read?
Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 22nd Apr 2009 17:30
[sorry text limit have to double]
By storing the old inputs before we get the new input we can analyse the change in input.
Only if the key is pressed and wasn't pressed before will the program perform the inc/dec action. INC and DEC stand for increment and decrement (or increase decrease if thats easier), they give a quick way to adjust a variable; by default they will adjust by 1 but you can supply a value: i.e. INC x,5

Hope this helps.

can't read?

Login to post a reply

Server time is: 2025-06-08 05:51:53
Your offset time is: 2025-06-08 05:51:53