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

XNA/Monogame Discussion :

comment installer la librairie xwinforms dans xna


Sujet :

XNA/Monogame

  1. #1
    Futur Membre du Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Juillet 2011
    Messages
    9
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Juillet 2011
    Messages : 9
    Points : 9
    Points
    9
    Par défaut comment installer la librairie xwinforms dans xna
    Bonsoir,
    Je voudrais savoir comment installer une librairie xwinforms dans xna. Je suis novice en xna, j'aimerais avoir les détails de cette opération. Je voudrais également savoir comment charger et afficher mes boutons, textbox etc... dans la fenêtre d'xna.

    Merci à vous.

  2. #2
    Membre averti
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Mai 2002
    Messages
    255
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 47
    Localisation : France, Bas Rhin (Alsace)

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Mai 2002
    Messages : 255
    Points : 445
    Points
    445
    Par défaut
    Salut Khaled,

    Essaie cette librairie, elle est pas mal:
    http://neoforce.codeplex.com/
    Installation:
    http://neoforce.codeplex.com/wikipag...itle=Tutorials

    Salutations.

  3. #3
    Membre à l'essai
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Novembre 2009
    Messages
    10
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 37
    Localisation : France, Gironde (Aquitaine)

    Informations professionnelles :
    Activité : Développeur .NET

    Informations forums :
    Inscription : Novembre 2009
    Messages : 10
    Points : 18
    Points
    18
    Par défaut
    Voilà qui devrai t'aider

    http://sourceforge.net/projects/xwin...a.zip/download

    Tu n'as plus qu'as ajouter le .dll en tant que référence dans ton projet et cela devrait fonctionner.

  4. #4
    Futur Membre du Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Juillet 2011
    Messages
    9
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Juillet 2011
    Messages : 9
    Points : 9
    Points
    9
    Par défaut Affichage textbox
    Bonsoir,

    J'ai enfin réussi à installer la librairie xwinforms dans xna, cependant je n'arrive pas à afficher une textbox dans ma fenêtre xna,

    j'ai ajouté le bref,

    je déclare un objet de type textbox
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    Textbox tx = new Textbox("bibi", new Vector2(0, 0), 30, 30, "test");
    dans Initialize()

    J'ajoute la ligne suivante:
    enfin dans le Draw:
    J'ai écrit tx.Draw(spriteBatch), j'utilise la méthode Draw qui prend en paramétre un objet de type spriteBatch, jusqu'ici tout me semble correct mais lorsque je compile une erreur sur la ligne tx.Draw(spriteBatch) m'ai signalé;, je ne comprends pas?

    erreur :
    Object reference not set to an instance of an object.
    pourtant j'ai l'objet instancié l'objet textbox en haut ?

    Pourriez vous m'aider s'il vous plait; Merci beaucoup

    PS : Fabiani en ce qui concerne Neoforce, je ne l'ai pas encore installé car j'espère m'en sortir avec xwinform pour l'instant. En ce qui concerne le chargement d'un objet je crains le même problème qu'avec la librairie xwinform, en tout cas Merci;

  5. #5
    Membre averti Avatar de yodaime
    Profil pro
    Développeur informatique
    Inscrit en
    Avril 2006
    Messages
    282
    Détails du profil
    Informations personnelles :
    Âge : 38
    Localisation : France, Loire Atlantique (Pays de la Loire)

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Avril 2006
    Messages : 282
    Points : 340
    Points
    340
    Par défaut
    Tu as bien déclaré le spriteBatch ?

    Tu peux poster ton code en entier ?

  6. #6
    Futur Membre du Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Juillet 2011
    Messages
    9
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Juillet 2011
    Messages : 9
    Points : 9
    Points
    9
    Par défaut Mon code
    Bonjour Yodaime,

    Voici mon code xna:


    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
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using Microsoft.Xna.Framework;
    using Microsoft.Xna.Framework.Audio;
    using Microsoft.Xna.Framework.Content;
    using Microsoft.Xna.Framework.GamerServices;
    using Microsoft.Xna.Framework.Graphics;
    using Microsoft.Xna.Framework.Input;
    using Microsoft.Xna.Framework.Media;
    using Microsoft.Xna.Framework.Net;
    using Microsoft.Xna.Framework.Storage;
    using xWinFormsLib;
     
     
    namespace Platformer2
    {
        public class Game1 : Microsoft.Xna.Framework.Game
        {
            GraphicsDeviceManager graphics;
            SpriteBatch spriteBatch;
     
            #region Loading
     
            Textbox tx = new Textbox("bibi", new Vector2(0, 0), 30, 30, "test");
     
            #endregion Loading
     
            public Game1()
            {
                graphics = new GraphicsDeviceManager(this);
                // this.graphics.ToggleFullScreen();
                this.graphics.PreferredBackBufferHeight = Constantes.m_screen_height;
                this.graphics.PreferredBackBufferWidth = Constantes.m_screen_width;
                Content.RootDirectory = "Content";
            }
     
            protected override void Initialize()
            {
                // TODO: Add your initialization logic here
                tx.Visible = true;
                base.Initialize();
            }
     
            protected override void LoadContent()
            {
                // Create a new SpriteBatch, which can be used to draw textures.
                spriteBatch = new SpriteBatch(GraphicsDevice);
            }
     
     
            protected override void UnloadContent()
            {
                // TODO: Unload any non ContentManager content here
            }
     
            protected override void Update(GameTime gameTime)
            {
                // Allows the game to exit
                if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
                    this.Exit();
     
                base.Update(gameTime);
            }
     
            protected override void Draw(GameTime gameTime)
            {
                GraphicsDevice.Clear(Color.Black);
     
                spriteBatch.Begin();
     
                tx.Draw(spriteBatch);
     
                spriteBatch.End();
     
                base.Draw(gameTime);
            }
        }
    }
    Merci beaucoup.

  7. #7
    Futur Membre du Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Juillet 2011
    Messages
    9
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Juillet 2011
    Messages : 9
    Points : 9
    Points
    9
    Par défaut
    J'ai finalement abandonner l'idée d'utiliser la librairie xwinform et j'ai téléchargé Neoforce qui est en réalité trés bien.

    Merci à tous.

  8. #8
    Membre averti
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Mai 2002
    Messages
    255
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 47
    Localisation : France, Bas Rhin (Alsace)

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Mai 2002
    Messages : 255
    Points : 445
    Points
    445
    Par défaut
    Salut Khaled,

    T'as bien raison!
    xwinforms n'est pas compatible xna 4.0 (ResolveTexture2D) et contient pas mal de coquilles (d'après un spécialiste de la librairie).
    Je crois que ton problème venait du fait qu'il faut d'abord créer une form (FormCollection) et ajouter le contrôle (controls.add(tx)) puis dans draw:formCollection.Render() suivi de formCollection.Draw().
    En appelant tx.draw explicitement tu avais une erreur dûe au fait que
    le spritebatch de la classe textbox est non initialisé (null).
    Avec Neoforce ça devrait mieux se passer.
    Sinon tu as un petit exemple de winforms avec xna ici:
    http://create.msdn.com/en-US/educati...forms_series_1
    http://create.msdn.com/en-US/educati...forms_series_2

    Salutations.

Discussions similaires

  1. Réponses: 3
    Dernier message: 18/09/2007, 14h54
  2. Réponses: 2
    Dernier message: 20/04/2007, 10h21
  3. Réponses: 2
    Dernier message: 09/01/2007, 14h30
  4. Réponses: 3
    Dernier message: 03/10/2006, 09h23
  5. Comment Installer la librairie JSDT pour eclipse
    Par TravelMate dans le forum Eclipse Java
    Réponses: 3
    Dernier message: 31/07/2006, 16h18

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