-
August 1st, 2014, 04:14 PM
#16
Re: [win32] - about joystick
Code:
else if (b.dwXpos == 0 && b.dwYpos == 65535)
What is the type of b.dwYpos? Have you checked this value to see what it actually is?
All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!
C++23 Compiler: Microsoft VS2022 (17.6.5)
-
August 1st, 2014, 04:33 PM
#17
Re: [win32] - about joystick
Originally Posted by 2kaud
Code:
else if (b.dwXpos == 0 && b.dwYpos == 65535)
What is the type of b.dwYpos? Have you checked this value to see what it actually is?
the type is DWORD and that values was found with a VB6 code. but if isn't right, please tell me.
i use that line for see the joystick directions...
the MSDN is limited:
"
dwXpos Current X-coordinate.
dwYpos Current Y-coordinate.
dwZpos Current Z-coordinate.
dwRpos Current position of the rudder or fourth joystick axis.
dwUpos Current fifth axis position.
dwVpos Current sixth axis position."
like you see.
unless is the remark section(on bottom of page):
http://msdn.microsoft.com/en-us/libr...=vs.85%29.aspx
that tell us the directions const... but i don't understand 100% what says
Last edited by Cambalinho; August 1st, 2014 at 04:37 PM.
-
August 1st, 2014, 05:59 PM
#18
Re: [win32] - about joystick
Use the debugger (or display the values) of dwYpos, dwXpos etc to see what these values actually are - then you know what values to test for.
All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!
C++23 Compiler: Microsoft VS2022 (17.6.5)
-
August 2nd, 2014, 02:13 PM
#19
Re: [win32] - about joystick
Originally Posted by Cambalinho
sorry, but can i do something like these:
if(buttons==(JOY_BUTTON1 | JOY_BUTTON2))
//do something
???
i mean convert the b.dwButtons to buttons
The code
Code:
if (buttons == (BUTTON1 | BUTTON2) )
effectively tests for exactly the two buttons pressed simultaneously.
but the code
Code:
if (buttons & (BUTTON1 | BUTTON2) )
tests for any of the two being pressed no matter what other buttons state is.
Feel the difference.
Best regards,
Igor
-
August 2nd, 2014, 06:00 PM
#20
Re: [win32] - about joystick
thanks to both.. i had tested the dwYpos and dwXpos, but i can't test the others
maybe because my joystick don't have them. but see what MSDN says:
dwZpos Current Z-coordinate.
dwRpos Current position of the rudder or fourth joystick axis.
dwUpos Current fifth axis position.
dwVpos Current sixth axis position.
for me, that information don't make sence
can anyone explain to me what is 'axis', 'rudder' and 'Z'?
-
August 3rd, 2014, 03:59 AM
#21
Re: [win32] - about joystick
An axis is a physical manifest of an abstract dimension - so the six axis correlate to the six-dimensional space.
http://en.wikipedia.org/wiki/Six-dimensional_space
All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!
C++23 Compiler: Microsoft VS2022 (17.6.5)
-
August 3rd, 2014, 04:28 PM
#22
Re: [win32] - about joystick
-
August 22nd, 2014, 12:39 PM
#23
Re: [win32] - about joystick
i need more advices:
1 - how can i change these loop for detect the joystick by ID?
Code:
´lse if(wParam==JoystickTimer)
{
JOYINFOEX b;
b.dwSize=sizeof(JOYINFOEX );
b.dwFlags=JOY_RETURNALL;
//cicle all possible joysticks
for (int i=0; i<16; i++)
{
int direction=0;
if(joyGetPosEx(i,&b)!= JOYERR_NOERROR) //if theres any error then continue to next joystick
{
if(i==0)
inst->Joystick(-1, -1,-1);
else
inst->Joystick(0, -1,-1);
break;
}
like you see, i use a for loop for all possible joystick ID's. but these loop can be changed?
what i mean is testing all connected joysticks and detect their ID's.
2 - imagine that i have using 2 joysticks, in same time, and i wan't do the joystickdown() event\message. how can i save the values, in static way, for not lose all joystick buttons?
maybe using a vector?(instead the normal array)
3 - i can get the X and Y axis values. but how can i get the angle values(in degrees)?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|