PS4Mono pour utiliser la Dual Shock 4 dans Monogame

1525 visiteurs sur le site | S'incrire

Accédez aux coordonnées de l’ensemble des techniciens professionnels recommandés par logic-sunrise 20 derniers dossiers et tutoriaux
Playstation 3 / 4
PS4Mono pour utiliser la Dual Shock 4 dans Monogame
Basé sur le language XNA développé par Microsoft pour la Xbox360, Monogame est une implémentation Open Source du framework Microsoft XNA 4.
 
Le but de cette implémentation est d'offrir la possibilité aux développeurs Xbox 360, Windows et Windows Phone, de porter leurs jeux sur iOS, Android, Mac OS X, Linux et Windows store. Totalement opensource, XNA a connu plus de 10 000 développeurs à sa belle époque.
 
 
 
 
 
 
 
Vous souhaitez développé un jeu, tentez l'expérience avec Monogame, une vidéo de présentation très intéressante est disponible ici.
 
 
 
 
 
 
 
 
 
Nombreux sont les tutoriels disponibles sur la toile pour s'essayer au développement d'un jeu sur Monogame, et bien sachez que si vous le souhaitez vous allez pouvoir utiliser votre Dual Shock 4 dans Monogame avec une librairie développée par Mystborn qui a libéré son code sur Github.
 


 
 
PS4Mono
 
Library for using PS4 Controllers in Monogame
 
To initialize the controllers, go to your game's initialize method and add this code:
 
PS4Mono.InputManager.Initialize(this)
 
Then in your game's update method go ahead and add this at the end:
 
PS4Mono.InputManager.Update()
 
That's all it needs to be set up. To actually use the code, call one of the various GampadCheck functions.
 
bool down = PS4Mono.InputManager.GamepadCheck(0, Buttons.A);
 
bool justPressed = PS4Mono.InputManager.GamepadCheckPressed(0, Buttons.A);
 
There's a special version of this that doesn't work on a frame by frame basis, so if you want to only check the buttons being pressed at the exact moment of time of the function call use:
 
PS4Mono.InputManager.GamepadCheckAsync(0, Buttons.A);
 
To set the deadzone used to check if the joystick is being held in a specific direction, you can set this property to a value between 0 and 1.
 
PS4Mono.InputManager.GamepadAxisDeadZone = value;
 
The prgram only looks for new controllers every 2 seconds, so dont expect your game to react to new input immediately. You can change this in the source code inside the RawInputDeviceManager class if it's an issue. It's just an arbitrary number.
 
Big thanks to www.pinvoke.net and https://github.com/a...rough/aenetmail
 

 

 

 
Téléchargement : PS4Mono Dual Shock 4
 
Lundi 27 Mars 2017, 09:54 par tralala
Source : github.com/mystborn/PS4Mono/
27 mars 2017, 12:05
Approuver ce commentaire (+1)
Merci
Répondre à ce commentaire
27 mars 2017, 20:54
Approuver ce commentaire (+1)
Merci
Répondre à ce commentaire
27 mars 2017, 22:29
Approuver ce commentaire (+1)
merci bien!
Répondre à ce commentaire
Cliquer ici pour continuer sur le forum
Envoyer