Skip to main content
gamedev.net
🔒 Locked

Directinput issues

Started by lurkie 2 replies 400+ views
Original Post
lurkie
lurkie
...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...
SiCrane
SiCrane
You still need a WinProc function, but you can just pass the default window procedure to the create function. (DefWindowProc)
Sven Vermeulen
Sven Vermeulen
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).
DekuTree64
DekuTree64
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^_^)

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.