Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

lurkie

Directinput issues

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

...I decided to remove the WM_KEY functions from my game loop, and add DirectInput...so I looked in one of LaMothe''s books, the book claimed to use DX7 (the version I use).. when I looked at the code, it seemed more like DX5 code... well anyway I started to implement the stuff into my code, and everything worked fine until I came to this: typedef _DIKEYSTATE UCHAR[256]; _DIKEYSTATE keystate[256]; well... what is that thing.... first of all it dosn''t compile and it looks realy complicated.... I changed it into this: char keystate[256]; and the code compiled and everything worked fine... ...Another thing, as I now have DirectInput up and running, do I really need the WindProc anymore?.. is it possible to create a window without it? I tried this: (in the creation of the main window)... wc2.lpfnWndProc = NULL; //(WNDPROC) WindowProc; as expected it didn''t work..(got an error).. but is it possible to remove it? how?... lurkie...

Share this post


Link to post
Share on other sites
Advertisement
You still need a WinProc function, but you can just pass the default window procedure to the create function. (DefWindowProc)

Share this post


Link to post
Share on other sites
About the typdef thing:
This says ''here''s a new datatype and it''s called DIKEYSTATE. But in reality, it''s nothing special, it''s just a UCHAR datatype''.

Why define a new name then for a UCHAR ??
So that the compiler does type-checking (if a function takes a DIKEYSTATE as parameter, for example, and you put in a simple CHAR, it complains).

Share this post


Link to post
Share on other sites
Actually, that was a typedef for an array of 256 UCHARs, which should''ve worked fine except for this:
_DIKEYSTATE keystate[256];
which is declaring an array of 256 arrays of 256 UCHARs^^
Come to think of it, that should just make a 2D array.. Oh well, I just use an array of plain chars for mine.



-Deku-chan

DK Art (my site, which has little programming-related stuff on it, but you should go anyway^_^)

Share this post


Link to post
Share on other sites

  • 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!