IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

C# Discussion :

probleme d'affichage fenetre joystick


Sujet :

C#

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre averti
    Profil pro
    Inscrit en
    Novembre 2006
    Messages
    16
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2006
    Messages : 16
    Par défaut probleme d'affichage fenetre joystick
    bonjour,

    j'ai un problème bizarre, en effet je code un programme simple utilisant un joystick, mais des que j’écris la ligne suivant et que je lance le programme, la fenêtre ne veut pas s’ouvrir

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    foreach (DeviceInstance di in Manager.GetDevices(DeviceClass.GameControl, EnumDevicesFlags.AttachedOnly))
    Je viens de ré-installer mon PC, et j'utilise des DLL pour Direcxt. J'ai passe des heures a chercher sur internet afin de comprendre ce dysfonctionnement. Pour l'utilisation du joystick, j'ai trouve des code sur les forums.

    Je ne comprend vraiment pas pourquoi ma fenêtre ne veux pas s'afficher, d'autant qu'il n'y a pas d'erreur de compilation.

    Merci

    PAscal

  2. #2
    Membre Expert
    Avatar de PixelJuice
    Homme Profil pro
    Ingénieur .NET & Game Designer
    Inscrit en
    Janvier 2014
    Messages
    667
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Moselle (Lorraine)

    Informations professionnelles :
    Activité : Ingénieur .NET & Game Designer
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Janvier 2014
    Messages : 667
    Par défaut
    Bonjour,

    il serait possible d'avoir la boucle complète ?

  3. #3
    Membre averti
    Homme Profil pro
    Étudiant
    Inscrit en
    Février 2014
    Messages
    26
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Moselle (Lorraine)

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Électronique et micro-électronique

    Informations forums :
    Inscription : Février 2014
    Messages : 26
    Par défaut
    Bonjour,
    je trouve ça une très bonne coïncidence parce que moi aussi j'ai le même problème avec mon joystick side winder Force feedback II. et c'est éxactement la ligne ou mon programme s'arrete aussi. mais je comprends pas, tu attends quelle fenêtre pour s'ouvrir?
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    using UnityEngine;
    using System;
    using System.Linq;
    using System.Text;
    using System.Collections;
    using Microsoft.DirectX.DirectInput;
    using Microsoft.DirectX;
     
    public class JoystickTest : MonoBehaviour {
     
    	Device joystick = null;
     
    	void Start ()
    	{
    		Debug.Log ("hello");
    		DeviceList listeDesGamesController = Manager.GetDevices (DeviceClass.GameControl, EnumDevicesFlags.ForceFeeback);
    	}
     
    	void Update () {
     
    	}
    }
    MissingMethodException: Method contains unsupported native
    code
    Microsoft.DirectX.DirectInput.Manager.InternalCreate (IntPtr phInst)

    Microsoft.DirectX.DirectInput.Manager..cctor ()

    Rethrow as TypeInitializationException: An exception was thrown by the type initializer for Microsoft.DirectX.DirectInput.Manager

    JoystickTest.Start () (at Assets/JoystickTest.cs:23)

  4. #4
    Membre averti
    Profil pro
    Inscrit en
    Novembre 2006
    Messages
    16
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2006
    Messages : 16
    Par défaut Pixel, voic le code. Merci
    Pixel,


    Voici le code.. J'ai encore verifier a l'instant, c'est vraiment la ligne avec FOREACH qui empeche la fenetre de s'afficher.


    Merci

    Pascal

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
     
     
    using System.Data;                       // pour l'utisation du joystick
    using System.Collections;                // utilise pour le type Hashtable
    using Microsoft.DirectX;
    using Microsoft.DirectX.DirectInput; 
     
    namespace test_joystick
    {
        public partial class Form1 : Form
        {
     
            int variable;
            private Hashtable joy; 	// v pour le joystick
     
            public Form1()
            {
                InitializeComponent();
     
     
         Device joystick = null;      // Pour l'acquisition des boutons
                joy = new Hashtable();   //private Hashtable joy; 	// v pour le joystick
                int i = 0;
     
         foreach (DeviceInstance di in Manager.GetDevices(DeviceClass.GameControl, EnumDevicesFlags.AttachedOnly))// C'est cette ligne qui me pose un probleme
              {
                   joy.Add(i, new Device(di.InstanceGuid));
                    i++;
              }
     
               if (joy.Count == 0)
               {
                  MessageBox.Show("pas de manettes");
                }
     
     
     
     
     
                // fin de la detection du joystick	
     
     
     
            }
     
            private void Form1_Load(object sender, EventArgs e)
            {
     
            }
        }
    }

  5. #5
    Membre éclairé Avatar de stolx_10
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Juillet 2006
    Messages
    374
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Juillet 2006
    Messages : 374
    Par défaut
    Bonjour

    peut être que c'est à cause de cela :
    http://stackoverflow.com/questions/2...etection-error

    sinon je passe la main

  6. #6
    Membre averti
    Profil pro
    Inscrit en
    Novembre 2006
    Messages
    16
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2006
    Messages : 16
    Par défaut foreach
    Re- Salut,

    J'ai fait un test, et le problème viens de l'instruction ,

    donc de la ligne :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    foreach (DeviceInstance di in Manager.GetDevices(DeviceClass.GameControl, EnumDevicesFlags.AttachedOnly))// C'est cette ligne qui me pose un probleme

    Est ce que tout les instructions s sont dans les using suivant :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
     
     
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
     
     
    using System.Data;                       // pour l'utisation du joystick
    using System.Collections;                // utilise pour le type Hashtable
    using Microsoft.DirectX;
    using Microsoft.DirectX.DirectInput;
     
     
     
     
     
    using System.ComponentModel;
    using Microsoft.DirectX.AudioVideoPlayback;

    Merci.

    Pascal

Discussions similaires

  1. Probleme d'affichage boutons joystick, DirectX
    Par cutprod dans le forum VB.NET
    Réponses: 1
    Dernier message: 12/05/2010, 19h32
  2. Probleme d'affichage dans les titres des fenetres
    Par pierrot10 dans le forum Windows XP
    Réponses: 4
    Dernier message: 24/01/2008, 09h01
  3. probleme d'affichage caractere mode fenetre
    Par john93 dans le forum C++
    Réponses: 3
    Dernier message: 10/09/2007, 20h17
  4. Probleme d'affichage d'image dans une fenetre
    Par cgregueusse dans le forum MFC
    Réponses: 1
    Dernier message: 03/08/2005, 11h08

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo