/// <summary>
        /// Draws the control.
        /// </summary>
        protected override void Draw()
        {
            Thread.Sleep(33);
            if (ActiveMap != null)
            {
                double elapsed = Timer.Elapsed.TotalSeconds;
                Timer.Restart();

                ActiveMap.Update(new GameTime(TimeSpan.FromSeconds(elapsed), TimeSpan.FromSeconds(elapsed)));

                for (int S = ActiveMap.ListGameScreen.Count - 1; S >= 0; --S)
                {
                    ActiveMap.ListGameScreen[S].Update(new GameTime(TimeSpan.FromSeconds(elapsed), TimeSpan.FromSeconds(elapsed)));
                }
                // Clear to the default control background color.
                Color backColor = new Color(BackColor.R, BackColor.G, BackColor.B);

                GraphicsDevice.Clear(backColor);

                if (ViewerIndex == 2)
                {
                    Helper.DrawScripts();
                }
                else
                {
                    DrawMap();
                }
            }
        }
Example #2
0
        public static void StartMap(GameScreen Owner, GameTime gameTime)
        {
            Owner.RemoveAllScreens();

            Owner.ListGameScreen.Insert(0, NewMap);
            NewMap.Update(gameTime);

            for (int S = 0; S < ListGameScreenCreatedByMap.Count; ++S)
            {
                Owner.ListGameScreen.Insert(0, ListGameScreenCreatedByMap[S]);
                ListGameScreenCreatedByMap[S].Update(gameTime);
            }

            ListGameScreenCreatedByMap.Clear();
            NewMap = null;
        }