• Advertisement
Sign in to follow this  

Joypad control

This topic is 4429 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

hi guys~ i wonder if this is a DirectX question as i think so. i built a simple window program which can only receive keydown actions for now, i'd like it may accept joypad commands(up, down, A and B button etc), i think DirectX may do this but have no idea how to, any help ?

Share this post


Link to post
Share on other sites
Advertisement
tks jollyjeffers.

below is what i found in joystick sample link:

Description
The Joystick sample program obtains and displays joystick data.

Path
Source: (SDK root)\Samples\C++\DirectInput\Joystick
Executable: (SDK root)\Samples\C++\DirectInput\Bin\Joystick.exe

where could i find that source file ? i dont want to download full DirectX SDK if possible, u know its size too large. tks again.

Share this post


Link to post
Share on other sites
Quote:
Original post by blackgame
where could i find that source file ? i dont want to download full DirectX SDK if possible, u know its size too large. tks again.

Nope, you don't get that file unless you get the SDK.

If you're really worried about the download size then you have three options as I see it:

1. Find a friend/colleague with a fast(er) net connection and a CD burner. Be nice to them and ask them to download it for you.

2. Download the October 2005 SDK instead of the December 2005 SDK. The latter has the Direct3D 10 parts included and is nearly twice the size of the former. DInput hasn't changed since DirectX8, so it shouldn't make any difference.

3. Find a book in a library (or buy one!) that includes the SDK and sample code on a CD. As with #2 above, DInput hasn't changed much so it shouldn't matter how old the book is so long as it's within the last 3-4 years.

hth
Jack

Share this post


Link to post
Share on other sites
Alternately, since it sounds like you aren't already using DirectX in your program you might want to check out the Windows Multimedia API for Joysticks. You can more or less just copy and paste the section about using joysticks into your program.

Share this post


Link to post
Share on other sites
tks jollyjeffers, i'll try to find someone with faster connections.

to SiCrane: tks for that, but i get some errors when trying to compile sample code here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/multimed/htm/_win32_joysetcapture.asp

my VC compiler report errors as below:

main.obj : error LNK2001: unresolved external symbol __imp__joyGetNumDevs@0
Debug/Project1.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

Project1.exe - 2 error(s), 0 warning(s)


how to fix it pls ?

Share this post


Link to post
Share on other sites
Quote:
Original post by SiCrane
Did you link against Winmm.lib?


i checked VC folders and found both Mmsystem.h and Winmm.lib in include and lib folder. strange it can not be linked properly...

Share this post


Link to post
Share on other sites
Yes, but did you add to the list of libraries to be linked against in your project properties?

Share this post


Link to post
Share on other sites
Quote:
Original post by SiCrane
Yes, but did you add to the list of libraries to be linked against in your project properties?


wor the prob get sorted ! i'm not using VC for a long time, tks !!!

Share this post


Link to post
Share on other sites
shame i failed using samples here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/multimed/htm/_win32_using_joysticks.asp

and one thing, i heard from someone that almost all Windows comes with DirectX in itself ? is that true ? and how to get DirectX version of my OS pls ? i'm with WinXP, tks.

Share this post


Link to post
Share on other sites
Quote:
Original post by blackgame
shame i failed using samples here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/multimed/htm/_win32_using_joysticks.asp

How do you mean you "failed"? another configuration/setup error, or you simply don't understand a bit of the code/technology?

You could always try asking again (although, for Win32 questions you might get a better response from the Game Programming forum).

Quote:
Original post by blackgame
i heard from someone that almost all Windows comes with DirectX in itself ?

Yes, this is true.

From here:
Quote:
Windows 98 Gold DirectX 5.2
Windows 98 SE DirectX 6.1a
Windows 2000 DirectX 7.0
Windows Millenium Edition DirectX 7.1
Windows XP DirectX 8.1


I'm not sure about XP-SP1, but XP-SP2 included DirectX 9.0c. Thus, any reasonably new machine should have the latest-n-greatest version included.

Quote:
Original post by blackgame
and how to get DirectX version of my OS pls ?

As an end-user, you should try running dxdiag from your start->run dialog. It'll give you all the vital statistics.

From your source code, you should be looking into DirectSetup.

hth
Jack

Share this post


Link to post
Share on other sites
However, the DirectX Software Development Kit (SDK) is a separate entity from the DirectX runtimes that are included in Windows.

Share this post


Link to post
Share on other sites
to jollyjeffers:
that code seems to be abit old and get me confused, several hours ago i decided to use DirectInput instead which i heard has better efficiency.

Share this post


Link to post
Share on other sites
Quote:
Original post by blackgame
that code seems to be abit old and get me confused

You mean the DirectSetup stuff? i'm not sure exactly how old it is - but it is up to date. Not a lot has changed on that front, hence whatever resources you find will probably be appropriately old...

Quote:
Original post by blackgame
several hours ago i decided to use DirectInput instead which i heard has better efficiency.

DirectInput does give you more direct access to the underlying hardware, but I'm not entirely sure if it is actually that more efficient in all cases. I forget the details now, but I'm sure I heard one of the DirectX developers say that parts of it were built on top of standard Windows Messages...

hth
Jack

Share this post


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

  • Advertisement