public void Add(string text, int line = -1)
 {
     TextSprite n = new TextSprite(AssetName, _windowSize, new Rectangle(), Color, text);
     n.LoadContent(SpriteFont);
     n.Direction = Direction;
     n.Vitesse = Vitesse;
     if (line < 0)
         _elements.Add(n);
     else
         _elements.Insert(line, n);
     SetLayout();
     SetShowedCharacters(-1);
 }
 public HUD(Rectangle windowsize)
 {
     //"game/HUD", "game/life_mob", "game/mana", "game/xp", "SpriteFont1"
     LifeLevel = 0;
     _background = new Sprite(new Rectangle(0, 0, windowsize.Width, windowsize.Height / 5), windowsize, "game/HUD");
     _life = new AnimatedSprite(new Rectangle(278, 20, 300, 10), windowsize, "game/life_mob");
     _mana = new AnimatedSprite(new Rectangle(278, 50, 300, 10), windowsize, "game/mana");
     _xp = new AnimatedSprite(new Rectangle(278, 80, 300, 10), windowsize, "game/xp");
     _levelText = new TextSprite("SpriteFont1", windowsize, new Rectangle(600, 20, 50, 20), "Level", Color.Gold);
     _level = new TextSprite("SpriteFont1", windowsize, new Rectangle(600, 40, 50, 70), "1", Color.Gold);
     _ennemiesLeftText = new TextSprite("SpriteFont1", windowsize, new Rectangle(700, 20, 60, 20), "Ennemies", Color.DarkRed);
     _ennemiesLeft = new TextSprite("SpriteFont1", windowsize, new Rectangle(700, 40, 60, 70), "--", Color.DarkRed);
     _portrait = new AnimatedSprite(new Rectangle(10, 10, 175, 90), windowsize, "game/persoPortrait");
 }
        public SceneOptions(Rectangle windowSize, KeyboardState keyboardState, MouseState mouseState)
        {
            _windowSize = windowSize;
            _keyboardState = keyboardState;
            _mouseState = mouseState;

            _wallpaper = new Sprite(new Rectangle(0, 0, _windowSize.Width, _windowSize.Height), _windowSize, "menu/wallpaper");
            _mouse = new AnimatedSprite(new Rectangle(-100, -100, 80, 100), windowSize, "sprites/cursorFire_8x4r", 8, 4, 40);
            _textMusic = new Sprite(new Rectangle(70, 433, 110, 40), _windowSize, "menu/soundMusic");
            _textEffects = new Sprite(new Rectangle(150, 490, 110, 40), _windowSize, "menu/soundEffect");
            _soundMusic = new Sprite(new Rectangle(180, 423, 110, 55), _windowSize, "menu/soundBars");
            _soundEffect = new Sprite(new Rectangle(260, 480, 110, 55), _windowSize, "menu/soundBars");
            _checkUpdate = new TextSprite("SpriteFont1", _windowSize, new Rectangle(530, 450, 170, 50), Color.Goldenrod, INFO.ENG?"Check Updates":"Mise a jour");
            _serverConfig = new TextSprite("SpriteFont1", _windowSize, new Rectangle(560, 500, 200, 50), Color.Goldenrod, INFO.ENG?"Server Settings":"Options du serveur");
            _fullScreen = new TextSprite("SpriteFont1", _windowSize, new Rectangle(500, 400, 150, 50), Color.Goldenrod, INFO.ENG ? "Fullscreen" : "Plein ecran");
            _language = new TextSprite("SpriteFont1", _windowSize, new Rectangle(590,550,210,80),Color.Goldenrod, INFO.ENG?"Language : English":"Langage : Francais");
            _version = new TextSprite("SpriteFont1", _windowSize, new Rectangle(15, _windowSize.Height - 30, 100, 30), Color.Goldenrod, "Version : " + INFO.version);
        }
 public HUD(Rectangle windowsize)
 {
     this.LifeLevel = 0.0f;
     this._weapons = new List<Tip>();
     this._background = new Sprite(new Rectangle(0, 0, windowsize.Width, windowsize.Height / 5), windowsize, "game/HUD");
     this._life = new AnimatedSprite(new Rectangle(278, 20, 300, 10), windowsize, "game/life_mob", 1, 1, 30, 1, -1, -1, false);
     this._mana = new AnimatedSprite(new Rectangle(278, 50, 300, 10), windowsize, "game/mana", 1, 1, 30, 1, -1, -1, false);
     this._xp = new AnimatedSprite(new Rectangle(278, 80, 300, 10), windowsize, "game/xp", 1, 1, 30, 1, -1, -1, false);
     this._level = new TextSprite("SpriteFont1", windowsize, new Rectangle(600, 40, 50, 70), Color.Gold, "1");
     this._ennemiesLeft = new TextSprite("SpriteFont1", windowsize, new Rectangle(700, 40, 60, 70), Color.DarkRed, "--");
     this._portrait = new AnimatedSprite(new Rectangle(10, 10, 175, 90), windowsize, "game/persoPortrait", 1, 1, 30, 1, -1, -1, false);
     this._sprites = new List<Sprite>();
     this._sprites.Add((Sprite)new TextSprite("SpriteFont1", windowsize, new Rectangle(600, 20, 50, 20), Color.Gold, INFO.ENG?"Level":"Niveau"));
     this._sprites.Add((Sprite)new TextSprite("SpriteFont1", windowsize, new Rectangle(700, 20, 60, 20), Color.DarkRed, INFO.ENG ? "Enemies" : "Ennemis"));
     this._sprites.Add((Sprite)new TextSprite("SpriteFont1", windowsize, new Rectangle(215, 15, 45, 20), Color.Red, INFO.ENG ? "Life" : "Vie"));
     this._sprites.Add((Sprite)new TextSprite("SpriteFont1", windowsize, new Rectangle(215, 45, 45, 20), Color.CornflowerBlue, INFO.ENG ? "Mana" : "Mana"));
     this._sprites.Add((Sprite)new TextSprite("SpriteFont1", windowsize, new Rectangle(215, 75, 45, 20), Color.Gold, INFO.ENG ? "Exp": "Exp"));
 }
 public Tip(Rectangle winsize, Rectangle position, string imageAssetName, string spriteFont, string text, Color color)
     : base(position, winsize, imageAssetName)
 {
     this._text = new TextSprite(spriteFont, winsize, position, color, text);
 }
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            if (EugLib.IO.FileStream.readFile("files/language") == "")
                EugLib.IO.FileStream.writeFile("files/language", "e");
            INFO.ENG = EugLib.IO.FileStream.readFile("files/language")[0] == 'e';

            List<String> ws = EugLib.IO.Tools.toArgv(EugLib.IO.FileStream.readFile("files/WinSize"));
            int a, b;
            if (ws.Count >= 2 && int.TryParse(ws.ElementAt(0), out a) && int.TryParse(ws.ElementAt(1), out b))
            {
                graphics.PreferredBackBufferWidth = a;
                graphics.PreferredBackBufferHeight = b;
            }
            else
            {
                graphics.PreferredBackBufferWidth = 900;
                graphics.PreferredBackBufferHeight = 600;
                EugLib.IO.FileStream.writeFile("files/WinSize", graphics.PreferredBackBufferWidth.ToString() + " " + graphics.PreferredBackBufferHeight.ToString());
            }
            graphics.ApplyChanges();
            //this.Window.AllowUserResizing = true;
            System.Windows.Forms.Form.FromHandle(Window.Handle).MinimumSize = new System.Drawing.Size(400, 400);//taille minimale
            Rectangle winsize = Window.ClientBounds;
            keyboardState = Keyboard.GetState();
            mouseState = Mouse.GetState();

            son = new Son();

            scenes = new Dictionary<Scene, AbstractScene>();
            scenes.Add(Scene.InGame, new InGame(winsize, keyboardState, mouseState));
            scenes.Add(Scene.MainMenu, new MainMenu(winsize, keyboardState, mouseState));
            scenes.Add(Scene.Extra, new SceneExtras(winsize, keyboardState, mouseState));
            scenes.Add(Scene.Credit, new SceneCredit(winsize, keyboardState, mouseState));
            scenes.Add(Scene.Titre, new SceneTitre(winsize, keyboardState, mouseState));
            scenes.Add(Scene.Options, new SceneOptions(winsize, keyboardState, mouseState));
            scenes.Add(Scene.IntroVid, new VideoReader("general/introduction_trods", Scene.IntroHistoire));

            Animation anim = new Animation(winsize, Scene.Titre);
            anim.Add("game/game_over", new Rectangle(0, 0, winsize.Width, winsize.Height), new Rectangle(0, 0, winsize.Width, winsize.Height), 0, 5000, true, 200, true, 700);
            anim.Add(new TextSprite("SpriteFont1", winsize, new Rectangle(), Color.DarkRed, INFO.ENG ? "Quest FAILED..." : "Echec de la mission"),
                new Rectangle(300, 500, 300, 100),
                new Rectangle(330, 600, 240, 60),
                500, 4500, true, 700, true, 1000);
            scenes.Add(Scene.GameOver, anim);
            //intro
            anim = new Animation(winsize, Scene.Titre, Musiques.Intro);
            anim.Add("animation/intro/1", new Rectangle(0, 0, winsize.Width, winsize.Height), 500, 24000, 2000, 1500);
            MultipleTextSprite ts = new MultipleTextSprite("SpriteFont1", winsize, new Rectangle(50, 100, 300, 400), Color.Honeydew);
            ts.Add(EugLib.IO.FileStream.readFileLines("Content/animation/intro/" + (INFO.ENG ? "1a.txt" : "1.txt")));
            ts.StartShowing(0, 30);
            anim.Add(ts, new Rectangle(50, 100, 350, 400), new Rectangle(50, 100, 350, 400), 4000, 19000, true, 0, true, 1000);
            TextSprite tss = new TextSprite("SpriteFont1", winsize, new Rectangle(200, 250, 500, 100), Color.Honeydew, EugLib.IO.FileStream.readFile("Content/animation/intro/" + (INFO.ENG ? "2a.txt" : "2 - Ecran noir.txt")));
            anim.Add(tss, new Rectangle(200, 250, 500, 100), new Rectangle(100, 250, 700, 400), 24000, 4000, true, 400, true, 500);
            anim.Add("animation/intro/3", new Rectangle(0, 0, winsize.Width, winsize.Height), 28500, 28000, 100, 1000);
            ts = new MultipleTextSprite("SpriteFont1", winsize, new Rectangle(100, 300, 700, 800), Color.DarkRed);
            ts.Add(EugLib.IO.FileStream.readFileLines("Content/animation/intro/" + (INFO.ENG ? "3a.txt" : "3.txt")));
            ts.StartShowing(0, 30);
            anim.Add(ts, new Rectangle(100, 300, 700, 800), new Rectangle(100, -500, 700, 800), 29000, 27500, false, 0, true, 1000);
            anim.Add("animation/intro/4", new Rectangle(0, 0, winsize.Width, winsize.Height), 57500, 16000, 400, 1000);
            ts = new MultipleTextSprite("SpriteFont1", winsize, new Rectangle(100, 300, 700, 800), Color.DarkRed);
            ts.Add(EugLib.IO.FileStream.readFileLines("Content/animation/intro/" + (INFO.ENG ? "4a.txt" : "4.txt")));
            ts.StartShowing(0, 30);
            anim.Add(ts, new Rectangle(250, 100, 450, 400), new Rectangle(250, 100, 450, 400), 58000, 15000, true, 400, true, 400);
            scenes.Add(Scene.IntroHistoire, anim);
            //intro LateX
            anim = new Animation(winsize, Scene.InGame, Musiques.IntroLateX);
            ts = new MultipleTextSprite("SpriteFont1", winsize, new Rectangle(100, 100, 700, 800), Color.DarkRed);
            ts.Add(EugLib.IO.FileStream.readFileLines("Content/animation/LateX/" + (INFO.ENG ? "1a.txt" : "1 - Arrivée.txt")));
            ts.StartShowing(0, 30);
            anim.Add("animation/LateX/1 - 0", new Rectangle(0, 0, winsize.Width, winsize.Height), 0, 9500, 1500, 1000);
            anim.Add("animation/LateX/1 - 1", new Rectangle(0, 0, winsize.Width, winsize.Height), 8500, 9500, 1000, 1500);
            anim.Add(ts, new Rectangle(250, 20, 400, 500), new Rectangle(250, 20, 400, 500), 1000, 16500, true, 500, true, 700);
            scenes.Add(Scene.IntroLateX, anim);
            //LateX Eradicated
            anim = new Animation(winsize, Scene.InGame, Musiques.TransitionLateX);
            ts = new MultipleTextSprite("SpriteFont1", winsize, new Rectangle(100, 250, 400, 500), Color.Honeydew);
            ts.Add(EugLib.IO.FileStream.readFileLines("Content/animation/LateX/" + (INFO.ENG ? "2a.txt" : "2.txt")));
            ts.StartShowing(0, 30);
            anim.Add("animation/LateX/2", new Rectangle(0, 0, winsize.Width, winsize.Height), 0, 16000, 1500, 1000);
            anim.Add(ts, new Rectangle(250, 250, 400, 500), new Rectangle(250, -250, 400, 500), 1000, 15000, true, 500, true, 700);
            scenes.Add(Scene.LateXEradicated, anim);
            //Before LateX's King Fight
            anim = new Animation(winsize, Scene.InGame, Musiques.TransitionLateX);
            ts = new MultipleTextSprite("SpriteFont1", winsize, new Rectangle(100, 250, 400, 500), Color.Honeydew);
            ts.Add(EugLib.IO.FileStream.readFileLines("Content/animation/LateX/" + (INFO.ENG ? "3a.txt" : "3.txt")));
            ts.StartShowing(0, 30);
            anim.Add("animation/LateX/3", new Rectangle(0, 0, winsize.Width, winsize.Height), 0, 16000, 1500, 1000);
            anim.Add(ts, new Rectangle(350, 100, 350, 350), new Rectangle(350, 100, 350, 350), 1000, 15000, true, 500, true, 700);
            scenes.Add(Scene.BeforeKingFight, anim);
            //After LateX's King Fight + come back to OpenEdge
            anim = new Animation(winsize, Scene.InGame, Musiques.TransitionLateX);
            ts = new MultipleTextSprite("SpriteFont1", winsize, new Rectangle(100, 250, 400, 500), Color.DarkRed);
            ts.Add(EugLib.IO.FileStream.readFileLines("Content/animation/LateX/" + (INFO.ENG ? "4a.txt" : "4.txt")));
            ts.StartShowing(0, 30);
            anim.Add("animation/LateX/4", new Rectangle(0, 0, winsize.Width, winsize.Height), 0, 18000, 1500, 1000);
            anim.Add(ts, new Rectangle(100, 20, 700, 200), new Rectangle(100, 20, 700, 200), 500, 17000, true, 500, true, 700);
            ts = new MultipleTextSprite("SpriteFont1", winsize, new Rectangle(100, 250, 400, 500), Color.DarkRed);
            ts.Add(EugLib.IO.FileStream.readFileLines("Content/animation/OpenEdge/" + (INFO.ENG ? "1a.txt" : "1.txt")));
            ts.StartShowing(0, 30);
            anim.Add("animation/OpenEdge/1-0", new Rectangle(0, 0, winsize.Width, winsize.Height), 19000, 9500, 1500, 1000);
            anim.Add("animation/OpenEdge/1", new Rectangle(0, 0, winsize.Width, winsize.Height), 27500, 9500, 1000, 1000);
            anim.Add(ts, new Rectangle(100, 300, 700, 200), new Rectangle(100, 300, 700, 200), 20000, 17000, true, 500, true, 700);
            scenes.Add(Scene.AfterKingFight, anim);
            //Last EPIC fight
            anim = new Animation(winsize, Scene.InGame, Musiques.TransitionLateX);
            ts = new MultipleTextSprite("SpriteFont1", winsize, new Rectangle(100, 250, 400, 500), Color.Honeydew);
            ts.Add(EugLib.IO.FileStream.readFileLines("Content/animation/OpenEdge/" + (INFO.ENG ? "2a.txt" : "2.txt")));
            ts.StartShowing(0, 30);
            anim.Add("animation/OpenEdge/2", new Rectangle(0, 0, winsize.Width, winsize.Height), 0, 16000, 1500, 1000);
            anim.Add(ts, new Rectangle(50, 150, 400, 300), new Rectangle(50, 150, 400, 300), 1000, 14500, true, 500, true, 700);
            scenes.Add(Scene.LastFight, anim);

            currentScene = Scene.IntroVid;
        }