Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / command for a joystick

Author
Message
bushido
16
Years of Service
User Offline
Joined: 4th Jan 2008
Location:
Posted: 13th Jan 2008 17:44
whats the camera command for a joystick (i have a logo tech atk 3 joystick works great with flight sim 10.) I want to move the camera with the joystick so what is the command something like dim device as or something like that (that command is from visual basic.net 2005 for direct X usually. well i want to move the camera around so basically thats what i want to do in a nutshell. Thank you for help especially tempicek who almost always helps me.

Real men don't need sigs
tempicek
16
Years of Service
User Offline
Joined: 27th Nov 2007
Location: Prague
Posted: 13th Jan 2008 18:07 Edited at: 13th Jan 2008 18:08
You can use the dbJoystick*() functions to obtain the current joystick state. Then you can use the returned values as an input to the common functions for rotating your camera as you do with mouse or keyboard. Unforunately I don't have joystick here so can not give you exact functional code. But you can let me know what you get from those functions, the rest will be easy in GDK.
bushido
16
Years of Service
User Offline
Joined: 4th Jan 2008
Location:
Posted: 13th Jan 2008 18:10
i mean like i push the joystick up and down with the joystick dbJoystick () then up key or push up what command?

Real men don't need sigs
bushido
16
Years of Service
User Offline
Joined: 4th Jan 2008
Location:
Posted: 13th Jan 2008 18:51
can you give me more commands then dbJoystick*() please thanks for help temp

Real men don't need sigs
John Goewert
16
Years of Service
User Offline
Joined: 1st Jan 2008
Location: Cornfield, MO
Posted: 13th Jan 2008 18:54
Open the Documentation->Information that came with the DarkGDK. They are all in there.

Blah - http://www.john.goewert.org
bushido
16
Years of Service
User Offline
Joined: 4th Jan 2008
Location:
Posted: 13th Jan 2008 18:57
wow i feel stupid thanks

Real men don't need sigs
tempicek
16
Years of Service
User Offline
Joined: 27th Nov 2007
Location: Prague
Posted: 13th Jan 2008 18:59 Edited at: 13th Jan 2008 19:00
Quote: "can you give me more commands then dbJoystick*() please thanks for help temp"


As John mentioned - you will find a description for most GDK functions in the accompanied documentation file. Open ther the "Input" section and you will find these commands:

dbJoystickUp : int dbJoystickUp ( void )
dbJoystickDown : int dbJoystickDown ( void )
dbJoystickLeft : int dbJoystickLeft ( void )
dbJoystickRight : int dbJoystickRight ( void )
dbJoystickX : int dbJoystickX ( void )
dbJoystickY : int dbJoystickY ( void )
dbJoystickZ : int dbJoystickZ ( void )
dbJoystickFireA : int dbJoystickFireA ( void )
dbJoystickFireB : int dbJoystickFireB ( void )
dbJoystickFireC : int dbJoystickFireC ( void )
dbJoystickFireD : int dbJoystickFireD ( void )
dbJoystickFireX : int dbJoystickFireX ( int iButton )
dbJoystickSliderA : int dbJoystickSliderA ( void )
dbJoystickSliderB : int dbJoystickSliderB ( void )
dbJoystickSliderC : int dbJoystickSliderC ( void )
dbJoystickSliderD : int dbJoystickSliderD ( void )
dbJoystickTwistX : int dbJoystickTwistX ( void )
dbJoystickTwistY : int dbJoystickTwistY ( void )
dbJoystickTwistZ : int dbJoystickTwistZ ( void )
dbJoystickHatAngle : int dbJoystickHatAngle ( int iHat )


EDIT: ha, you already have it, ok, i'm slow
bushido
16
Years of Service
User Offline
Joined: 4th Jan 2008
Location:
Posted: 13th Jan 2008 19:05
okay here my code is i know its wrong but here it is how i correct?


Real men don't need sigs
bushido
16
Years of Service
User Offline
Joined: 4th Jan 2008
Location:
Posted: 13th Jan 2008 19:40 Edited at: 13th Jan 2008 19:51
okay to be more specific i have NO idea what i am doing with the joystick okay i am having trouble figuring out almost everything how do i get the int numbers and dbMoveCamera ( 1 ) but it says i don't have enough arguments here is corrected code.
here is errors c:\documents and settings\proggramer\my documents\visual studio 2008\projects\joystick\joystick\main.cpp(20) : error C2660: 'dbJoystickUp' : function does not take 1 arguments
c:\documents and settings\proggramer\my documents\visual studio 2008\projects\joystick\joystick\main.cpp(22) : error C2660: 'dbJoystickDown' : function does not take 1 arguments

only warnings left what do i do now?
okay warnings are gone now i need to get rid of these so i need to get more than 1 agrument but how?

Real men don't need sigs
John Goewert
16
Years of Service
User Offline
Joined: 1st Jan 2008
Location: Cornfield, MO
Posted: 13th Jan 2008 19:51 Edited at: 13th Jan 2008 19:51
dbJoystickUp() returns 1 if the joystick is pressing up. 0 if it is not. (Reread the documentation)





Blah - http://www.john.goewert.org
tempicek
16
Years of Service
User Offline
Joined: 27th Nov 2007
Location: Prague
Posted: 13th Jan 2008 19:54 Edited at: 13th Jan 2008 19:55
dbJoystickUp() function has zero arguments:



and it returns int. So you use it this way:




EDIT: Use John's code, it's more reasonable, you can then set a custom step.
bushido
16
Years of Service
User Offline
Joined: 4th Jan 2008
Location:
Posted: 13th Jan 2008 19:54
wow thanks *gives Cookies to John*

Real men don't need sigs
bushido
16
Years of Service
User Offline
Joined: 4th Jan 2008
Location:
Posted: 13th Jan 2008 20:00 Edited at: 13th Jan 2008 20:02
okay what would be the parameters in camera to move left? and right? here is this i got so far


Real men don't need sigs
tempicek
16
Years of Service
User Offline
Joined: 27th Nov 2007
Location: Prague
Posted: 13th Jan 2008 20:41
Do you actually use more cameras? If not, you should use this code:

if (dbJoystickLeft () ) dbTurnCameraLeft ( 2 );
if (dbJoystickRight () ) dbTurnCameraRight ( 2 );

And you can play with the angle size of course, maybe 2 degrees won't be that fast.

Login to post a reply

Server time is: 2024-10-08 15:52:47
Your offset time is: 2024-10-08 15:52:47