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.

Dark GDK / getchar() with Dark GDK?

Author
Message
Skmist
12
Years of Service
User Offline
Joined: 1st Mar 2012
Location:
Posted: 1st Mar 2012 18:52
Is there any way to use getchar() with Dark GDK? I really want to use the w, a, s, and d keys for input.
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 1st Mar 2012 20:02
Use the scan codes. Look up dbScanCode(...) in the input section of the help.

The fastest code is the code never written.
Gonefar
12
Years of Service
User Offline
Joined: 28th Feb 2012
Location:
Posted: 4th Mar 2012 08:34
You can try like including "iostream.h" or "string.h" and so on. If you include the standard io head files, you can make it I think.

No pains, no gains
Kerl
User Banned
Posted: 10th Mar 2012 12:22
If(dbKeyState(17)==1)
{
dbMoveSprite(1,1);
}

That's the w key I'm pretty sure
Mister Fuzzy
13
Years of Service
User Offline
Joined: 27th Feb 2011
Location: XNA
Posted: 11th Mar 2012 21:01
Yeah, use

and in place of "KeyCode," put the corresponding ASCII code in. ASCII tables are easy enough to find online, but for laziness' sake, here's one anyway.

Tunnel vision yet? Have a carrot!
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 11th Mar 2012 22:42
Ah, the good old days of ASCII.... What about BAUDOT? Who decided it was obsolete?!! Maybe I'm getting old....

The problem with dbScanCode() is that it returns only one value (either the first or the last in sequence.... Don't remember). It won't accurately reflect true if more than one key is pressed at the same time. Use "int dbKeyState ( int iScanCode )" instead. You have to make a map of the keys on your keyboard that you want to use, but that's not a big deal. Almost all games have a keymapping option now (unless it's very simple).

The fastest code is the code never written.

Login to post a reply

Server time is: 2024-11-19 03:19:43
Your offset time is: 2024-11-19 03:19:43