Mouse Input...DirectInput versus Windows...
Hi all,
Is there any way in straight Windows messaging to mirror the functionality of DirectInput...Since the typical DirectX developer download is around 227,000(+) MB...Seems a little ''huge'' just to capture mouse events...
thx in advance,
adym
Exactly what are you trying to do?
All mouse messages ment for your app can be picked up in the windproc. If you wanted to track the mouse when it is outside your window try using this windows api:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinUI/WindowsUserInterface/UserInput/MouseInput/MouseInputReference/MouseInputFunctions/SetCapture.asp
All mouse messages ment for your app can be picked up in the windproc. If you wanted to track the mouse when it is outside your window try using this windows api:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinUI/WindowsUserInterface/UserInput/MouseInput/MouseInputReference/MouseInputFunctions/SetCapture.asp
Check out WM_MOUSEMOVE...
MouseX = LOWORD(lParam);
MouseY = LOWORD(lParam);
Also, check out:
WM_LBUTTONDOWN,WM_RBUTTONDOWN,WM_LBUTTONUP,WM_RBUTTONUP... and you can use WM_KEYDOWN and WM_KEYUP for your keyboard input. This is how all of my programs work, since I don''t use DX for anything else, I found it pointless to download the entire SDK for a few simple things.
MouseX = LOWORD(lParam);
MouseY = LOWORD(lParam);
Also, check out:
WM_LBUTTONDOWN,WM_RBUTTONDOWN,WM_LBUTTONUP,WM_RBUTTONUP... and you can use WM_KEYDOWN and WM_KEYUP for your keyboard input. This is how all of my programs work, since I don''t use DX for anything else, I found it pointless to download the entire SDK for a few simple things.
Yup! I have all the common WM_ messages working...What I can''t seem to mirror is the ability to have the left-button or right-button produce a constant ''stream'' of input...
This is easy in directX, but doesn''t to work the same with straight windows messagin...
Also, while we''re on the subject...One other idea was to just utilize only the DirectInput piece of DirectX, but I haven''t been able to find any articles that talk about separating DirectInput from DirectX...
thx,
adym
This is easy in directX, but doesn''t to work the same with straight windows messagin...
Also, while we''re on the subject...One other idea was to just utilize only the DirectInput piece of DirectX, but I haven''t been able to find any articles that talk about separating DirectInput from DirectX...
thx,
adym
quote:
What I can''t seem to mirror is the ability to have the left-button or right-button produce a constant ''stream'' of input...
you can''t since its event driven, what you can do is have a ''bPressed'' variable that tells you if mouse button is pressed:
case WM_LBUTTONDOWN:
bPressed = true;
break;
case WM_LBUTTONUP:
bPressed = false;
break;
hope it helps
To be considered a genius you just have to say what everybody knows in a way very few understand
To be considered a genius you just have to say what everybody knows in a way very few understand
I've either been coding to long today or I'm thinking too hard on this...this seems too simple. Are we talking something like the following...
<snip>
LRESULT CALLBACK WndProc() {
// WINDOWS MESSAGE : Check for windows message(s)...
switch ( uMsg ) {
case WM_LBUTTONDOWN:
{
gblnLeftMouse = true/1;
}
case WM_LBUTTONUP:
{
gblnLeftMouse = false/0;
}
} // END : switch ()
}
int WINAPI WinMain() {
// LOOP : Main loop of the program...
while(!lblnDone) {
// MESSAGE(S) : Check for messages...
if (PeekMessage(&winMsg,NULL,0,0,PM_REMOVE)) {
// QUIT : Was the received message QUIT?
if (winMsg.message==WM_QUIT) {
lblnDone=TRUE; // outta here!!!!
}
else { // Deal with the message(s)
TranslateMessage(&winMsg); // Translate Msg
DispatchMessage(&winMsg); // Dispatch Msg
}
}
// KEYBOARD|MOUSE INPUT : Lets process some stuff...
else { // No messages...lets roll...
if (gblnLeftMouse) {
...do left mouse button stuff...
}
...all kinds of other keyboard input...
}
}
</snip>
[edited by - adymlincoln on February 5, 2003 10:09:58 PM]
[edited by - adymlincoln on February 5, 2003 10:13:24 PM]
[edited by - adymlincoln on February 5, 2003 10:17:38 PM]
<snip>
LRESULT CALLBACK WndProc() {
// WINDOWS MESSAGE : Check for windows message(s)...
switch ( uMsg ) {
case WM_LBUTTONDOWN:
{
gblnLeftMouse = true/1;
}
case WM_LBUTTONUP:
{
gblnLeftMouse = false/0;
}
} // END : switch ()
}
int WINAPI WinMain() {
// LOOP : Main loop of the program...
while(!lblnDone) {
// MESSAGE(S) : Check for messages...
if (PeekMessage(&winMsg,NULL,0,0,PM_REMOVE)) {
// QUIT : Was the received message QUIT?
if (winMsg.message==WM_QUIT) {
lblnDone=TRUE; // outta here!!!!
}
else { // Deal with the message(s)
TranslateMessage(&winMsg); // Translate Msg
DispatchMessage(&winMsg); // Dispatch Msg
}
}
// KEYBOARD|MOUSE INPUT : Lets process some stuff...
else { // No messages...lets roll...
if (gblnLeftMouse) {
...do left mouse button stuff...
}
...all kinds of other keyboard input...
}
}
</snip>
[edited by - adymlincoln on February 5, 2003 10:09:58 PM]
[edited by - adymlincoln on February 5, 2003 10:13:24 PM]
[edited by - adymlincoln on February 5, 2003 10:17:38 PM]
Sorry about being sorta off topic, but while we are talking about the DX 9 SDK, has anyone actually been able to download it? I''ve tried downloading it off Microsoft''s site using two different browsers and it stops about half way through every time... Are there any mirrors with the SDK on them?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement