Jump to content
  • Advertisement
Sign in to follow this  
anonuser

Getting Started With DirectInput.

This topic is 4916 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Okay I'm guessing for developing games DirectInput is the way to go for fast input . Can anyone point me in the right direction to get started with this. I have the DXSDK downloaded, and its in the includes of the project. I am assuming it works. Anyway to get Intellisense to work with it? Because life without intellisense isn't worth living ;D

Share this post


Link to post
Share on other sites
Advertisement
I'm not sure what intellisense is but as for Directinput being faster, I'm not to sure of that. I honestly couldn't imagine the Directinput being much faster then a windows message system (if done right). DirectInput in addition is more complex, but can do more. And Don't get me started on the fact that directinput can't do absolute coordinates for mice, (it's only realitve) though that allows a bit more power it also means you have to do a bit more work to get it to look nice. And you'll still need to check windows Messages.

That's not to say it's not a good system, it is good and it has more specialized functions for games, especially on key reads and mouse reads, and the big bad joystick system.

To get started check out your MSDN (if your using Visual Studio, just go to the index of your help) and check out "directinput tutorials" Then "directinput samples' use both of these (I had to alternate to understand it) and you'll get the code going

Basically it' a very simple system there's apparently not too much more then that that can be done with it. (if you want a direct link to the samples it should be "c:\Program Files\Microsoft DirectX 9.0 SDK (December 2004)\Samples\C++\DirectInput\" unless you installed a different version of the SDK, or to a specialized location.

Share this post


Link to post
Share on other sites
well its perfect for what i want it for, mouse delta's is what I care about as for mouse coords i could careless since i'll be working in exclusive mode ( i think that's the mode I want ).


And i've looked over the DX C++ samples, I am trying to get my thing to complie. I would like to have code hinting available though. Because It won't by default look up the DX functions.

Share this post


Link to post
Share on other sites
Quote:
Original post by kinglink
Don't get me started on the fact that directinput can't do absolute coordinates for mice, (it's only realitve) though that allows a bit more power it also means you have to do a bit more work to get it to look nice. And you'll still need to check windows Messages.

It's a bit unfair to slate a whole API based on the whole absolute/relative thing... It really isn't very difficult to convert between the two and/or maintain the mouse coordinates under whichever coordinate space you wish to work in.

Also, what do you mean about checking windows messages? Granted, it's been a while since I had to dig into DInput so I could be forgetting stuff, but I was pretty sure that you didn't need to bother with the Win32 message pump once you had DInput up and running...

Quote:
Original post by anonuser
Can anyone point me in the right direction to get started with this. I have the DXSDK downloaded, and its in the includes of the project. I am assuming it works.

The SDK samples are pretty good these days, getting basic keyboard/mouse code working is amazingly simple - you can, for the most part, copy-n-paste the sample code into your own project. Have a read through the samples, try it out, if you get stuck on anything specific you can always post back here with a more specific problem/question...

It gets more complicated when you start dealing with ActionMaps (which is one of the coolest things about DInput [smile]), but the samples/documentation were sufficient last time I had a play around with such things.

Quote:
Original post by anonuser
i've looked over the DX C++ samples, I am trying to get my thing to complie. I would like to have code hinting available though. Because It won't by default look up the DX functions.

This is a setting in your IDE - nothing specifically to do with DirectX. I never did anything specifically to configure it, but my VS2002 will find intellisense for most (but not all) DirectX related code.

Check the various settings, make sure that it has help files installed and is looking in the correct folders.

hth
Jack

Share this post


Link to post
Share on other sites
Direct Input while good as far as I know will not tell you if the window is resized, if the game has lost scope, or such. For that you need to use Windows messages, for some games it's not crucial but for others it's sorta important. I'm still a novice, but I've read this on a couple tutorials.

And I don't hate the Direct Input, it's a very easy system, I just loath the fact that I have to sorta rewrite a mouse handler for my application to get a decent one working (unless I use a bit from both DirectInput and Windows APIs) But as such I have yet to find a reason to use direct input unless you want more functionality than the Windows API. (it works about the same for just the keyboard)

I just realized what you meant by intellisense. I thought you meant some kinda new "smart device" that logitech had released or something, hehe.

Intellisense should work perfectly with it. It works fine for mine right out of the box (it does take a couple seconds to get the current list sometimes though) and I'm using VS 2003 .net (C++ non-.net project in it) and I am also using DirectX (December 2004) version. I'd check your options as jollyjeffers meantioned. But unless you changed something radically it should work. Does your programs with DirectX functions and objectzs compile when including the correct libraries and headers?

Share this post


Link to post
Share on other sites
Quote:
Original post by kinglink
Direct Input while good as far as I know will not tell you if the window is resized, if the game has lost scope, or such. For that you need to use Windows messages

Yup, this is very true - our game engine does monitor quite a large number of windows messages so it can track it's current state/lifetime. I was assuming that you meant using BOTH Win32 and DirectInput code to get information about any mouse/keyboard events - which doesn't make much sense!

Quote:
Original post by kinglink
I just realized what you meant by intellisense. I thought you meant some kinda new "smart device" that logitech had released or something, hehe.

"Intellisense" is a Microsoft specific name (trademark, copyright, patent..??) for the technology that most other IDE's refer to as "content assist" or "context sensitive information" (or something similar).

Quote:
Original post by anonuser
it compiles no problem, but I have no code hinting available. It is quite odd.

This is a bit of a long shot - but try two things:

1. delete any "ncb" files in your solution's directories, this is the intellisense database for your project; if it's missing then VStudio usually tries to rebuild it. Might well trigger it to look up the DX stuff properly.

2. when you type "->" or "(" watch the status bar at the bottom of the IDE, if it's got a problem finding stuff it'll usually tell you "unable to provide further information on ___". Doesn't really solve anything, but it should at least confirm that it's just having problems finding the right information.

hth
Jack

Share this post


Link to post
Share on other sites
Quote:
Original post by kinglink
I'm not sure what intellisense is but as for Directinput being faster, I'm not to sure of that. I honestly couldn't imagine the Directinput being much faster then a windows message system (if done right).
You're right, it's not about speed. It's about access. I mean, how do you access a joystick, or steering wheel, or auxilliary pedals using the windows message queue?

Quote:
And Don't get me started on the fact that directinput can't do absolute coordinates for mice, (it's only realitve)...
I'm not sure about that. The c_dfDIMouse and c_dfDIMouse2 constants may have relative axes, but the DIDATAFORMAT member allows you to specify DIDF_ABSAXIS and call IDirectInputDevice8::SetDataFormat. Are you sure about that assertion?

Quote:
Direct Input while good as far as I know will not tell you if the window is resized, if the game has lost scope, or such.
And GDI won't render your DirectX Graphics content.

Breathe.

It's really not that serious. You have to handle windows messages if you're programming in Win32, unless you use an abstraction toolkit that does it for you, so that's hardly a pertinent argument against DirectInput.

Share this post


Link to post
Share on other sites
i see. Intellisense works fine when dealing with the classes but the DX functions

like
DirectInput8Create() will not give me anything.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!