Why DirectInput in Tut 23
Hey thanks u guys(n gals?) for solving my problems in Tut23. I was wondering why we use DirectInput in Tut23. Doesnt the Win32API provide mouse handling functions?.
I think that there is no need to use DirectInput for mouse/keyboard handling.
----------------------
For mouse handling you can use
GetCursorPos(LPPOINT ppt)
SetCursorPos(LPPOINT ppt)
for buttons you can use keyboard functions like
WORD GetKeyState(BYTE vkey)
(if you shift it >>15 you get a ''BOOL'' that tells you if the key is down)
or
GetKeyboardState(BYTE* pKeyState)
(keyboard buffer will be copied into 256 byte array pKeyState)
Use
VK_LBUTTON left button virtual key code
VK_RBUTTON right button virtual key code
---------
And you can also use standard Window''s messages in your Window Proc...
----------------------
For mouse handling you can use
GetCursorPos(LPPOINT ppt)
SetCursorPos(LPPOINT ppt)
for buttons you can use keyboard functions like
WORD GetKeyState(BYTE vkey)
(if you shift it >>15 you get a ''BOOL'' that tells you if the key is down)
or
GetKeyboardState(BYTE* pKeyState)
(keyboard buffer will be copied into 256 byte array pKeyState)
Use
VK_LBUTTON left button virtual key code
VK_RBUTTON right button virtual key code
---------
And you can also use standard Window''s messages in your Window Proc...
IpSeDiXiT
My HomepageSome shoot to kill, others shoot to mame. I say clear the chamber and let the lord decide. - Reno 911
I think DirectInput allows you to read more than 2 key presses at a time, which is the windows standard, I believe. Don''t quote me on this or hold me to it, though....
Simply because, windows create an event WM_CHAR or something like that in the CallBack function. This is alot longer to perform than using directinput functions.
Unless you wan to reach the lowest frame rate or you want your program to run without directX, use it...
Unless you wan to reach the lowest frame rate or you want your program to run without directX, use it...
(you can find me on IRC : #opengl on undernet)
DirectInput supports Joysticks and other controls... While normally youd have to code that yourself..
-TipTup
TipTup.Com
-TipTup
TipTup.Com
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement