Пример #1
0
        protected override void LoadContent()
        {
            Police = Game.Content.Load <SpriteFont>("Fonts/" + NomPolice);
            Vector2 dimension = Police.MeasureString(Message);

            Position = new Vector2(Position.X - dimension.X / 2,
                                   Position.Y - dimension.Y / 2);
            GestionSprites         = Game.Services.GetService(typeof(SpriteBatch)) as SpriteBatch;
            GestionnaireDeTextures = Game.Services.GetService(typeof(RessourcesManager <Texture2D>)) as RessourcesManager <Texture2D>;
            Texture     = GestionnaireDeTextures.Find(NomTexture);
            Destination = new Rectangle((int)Position.X, (int)Position.Y, (int)dimension.X, (int)dimension.Y);
        }
Пример #2
0
        public override void Initialize()
        {
            int hauteurBouton = RectangleDestination.Height / (NB_ZONES_DIALOGUE + 1);

            Police = Game.Content.Load <SpriteFont>("Fonts/" + "Arial20");

            Vector2 positionBouton = new Vector2(RectangleDestination.X + RectangleDestination.Width / 2f, (NB_ZONES_DIALOGUE - 2) * hauteurBouton);

            BtnJouer           = new BoutonDeCommande(Game, "Jouer", "Arial20", "BoutonRouge", "BoutonRouge", positionBouton, true, Jouer, INTERVALLE_MAJ_STANDARD);
            BtnJouer.DrawOrder = (int)OrdreDraw.AVANT_PLAN;

            positionBouton          = new Vector2(RectangleDestination.X + RectangleDestination.Width / 2f, (NB_ZONES_DIALOGUE - 1) * hauteurBouton);
            BtnInventaire           = new BoutonDeCommande(Game, "Inventaire", "Arial20", "BoutonRouge", "BoutonRouge", positionBouton, true, Inventaire, INTERVALLE_MAJ_STANDARD);
            BtnInventaire.DrawOrder = (int)OrdreDraw.AVANT_PLAN;

            Vector2 dimensionBouton = Police.MeasureString("Quitter");

            positionBouton       = new Vector2(dimensionBouton.X / 2, Game.Window.ClientBounds.Height - dimensionBouton.Y / 2);
            BtnQuitter           = new BoutonDeCommande(Game, "Quitter", "Arial20", "BoutonRouge", "BoutonRouge", positionBouton, true, Quitter, INTERVALLE_MAJ_STANDARD);
            BtnQuitter.DrawOrder = (int)OrdreDraw.AVANT_PLAN;

            dimensionBouton  = Police.MeasureString("Jeu de bataille");
            NomJeu           = new TexteCentré(Game, "Jeu de bataille", "Arial20", new Rectangle(100, 100, (int)dimensionBouton.X, (int)dimensionBouton.Y), Color.White, 0);
            NomJeu.DrawOrder = (int)OrdreDraw.AVANT_PLAN;

            dimensionBouton     = Police.MeasureString("Retour au menu");
            positionBouton      = new Vector2(Game.Window.ClientBounds.Width - dimensionBouton.X / 2, Game.Window.ClientBounds.Height - dimensionBouton.Y / 2);
            BtnRetour           = new BoutonDeCommande(Game, "Retour au menu", "Arial20", "BoutonRouge", "BoutonRouge", positionBouton, true, Retour, INTERVALLE_MAJ_STANDARD);
            BtnRetour.DrawOrder = (int)OrdreDraw.AVANT_PLAN;
            BtnRetour.Enabled   = false;
            BtnRetour.Visible   = false;

            Game.Components.Add(BtnJouer);
            Game.Components.Add(BtnInventaire);
            Game.Components.Add(BtnQuitter);
            Game.Components.Add(NomJeu);
            Game.Components.Add(BtnRetour);
        }