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 / Direct input

Author
Message
Mr Squishy
18
Years of Service
User Offline
Joined: 25th Feb 2006
Location:
Posted: 2nd Mar 2006 00:43
I need to capture input not as button pressed, but as if they where charecters.

like:
if a button was down, but now its up, then add that character to the string

I was thinking why not just use direct input
the problem is to initialize it i need to have an hwnd and hinstance
i have seen that you can get the hwnd with


if anyone could provide more info about getting the hwnd, or any info about obtaining the hinstance, or why direct input is a good or bad choice for capturing input in dbsdk it would be greatly appreciated.
OSX Using Happy Dude
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 2nd Mar 2006 12:37
DirectInput wont get button presses as characters anyway - it treats it all as binary numbers.

Your easiest way would be something like :



Barnski
18
Years of Service
User Offline
Joined: 26th Jan 2006
Location: Switzerland, Zurich
Posted: 2nd Mar 2006 12:51
Doesn't DarkSDK use DirectInput anyways?!

so when using dbMouseClick() or dbScanCode() then it uses DirectInput functions to determine the result, or?

-- I just started with DarkSDK, by translating DBP Projects. --
OSX Using Happy Dude
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 2nd Mar 2006 12:58
Yes, it does...

Mr Squishy
18
Years of Service
User Offline
Joined: 25th Feb 2006
Location:
Posted: 2nd Mar 2006 14:20
what if i just mapped every key like:


Some days the cascading moments which constitute my experience dissolve to reveal a sense of clarity which transcends reasoning.
And then there are days like today.
zao420
21
Years of Service
User Offline
Joined: 5th Aug 2003
Location: Canada
Posted: 5th Mar 2006 07:26 Edited at: 5th Mar 2006 07:27
you could do it kinda like this it is a function for my item editor i was making in dgsdk but i am now making it right in c++. anyways the function looks like this works pretty good now.




edit the memory leak i think is fixed by using
free() instead of GetBuffer = NULL;

IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 6th Mar 2006 14:00 Edited at: 6th Mar 2006 14:04
@Mr Squishy,

You can translate scancodes to ascii without lookup tables. Here's a link : http://www.gamedev.net/reference/articles/article842.asp

[edit]Looking at your original post, you can also get the instance from the globstruct - it's called hInstance.

@zao240,

The input buffer can contain more than one keypress, so you need to deal with that in your code by looping through the whole array you get from dbGetEntry()

For free Plug-ins and source code http://www.matrix1.demon.co.uk
zao420
21
Years of Service
User Offline
Joined: 5th Aug 2003
Location: Canada
Posted: 8th Mar 2006 01:30
after rereading the oginal post i see i though he was talking about collecting the string of keys pressed i was mistaken.

Login to post a reply

Server time is: 2024-11-19 04:17:04
Your offset time is: 2024-11-19 04:17:04