Beispiel #1
0
        public override void Draw()
        {
            GameHelper.GraphicsDevice.Clear(Color.Gray);

            GameHelper.SpriteBatch.Begin();

            GameHelper.SpriteBatch.DrawString(GameHelper.Font, "Evolution of Neural Networks through genetic algorithms", (GameHelper.Window.ClientBounds.Size.ToVector2() / 2f) + new Vector2(0, -100) + (-GameHelper.Font.MeasureString("Evolution of Neural Networks through genetic algorithms") / 2f), Color.White);

            btn_start.Draw();
            btn_exit.Draw();
            btn_start_withoutload.Draw();

            if (ScreenModal.isActive)
            {
                ScreenModal.Draw();
            }

            GameHelper.SpriteBatch.End();

            base.Draw();
        }
Beispiel #2
0
        public override void Draw()
        {
            GameHelper.GraphicsDevice.Clear(Color.Gray);

            GameHelper.SpriteBatch.Begin();

            GameHelper.SpriteBatch.DrawString(GameHelper.Font, "Loading...", new Vector2(GameHelper.GraphicsDevice.Viewport.Width / 2f, GameHelper.GraphicsDevice.Viewport.Height / 2f) - (GameHelper.Font.MeasureString("Loading...") / 2f), Color.White);
            GameHelper.DrawBar(new Rectangle((new Vector2(GameHelper.GraphicsDevice.Viewport.Width / 2f, GameHelper.GraphicsDevice.Viewport.Height / 2f) + new Vector2(-150, 50)).ToPoint(), new Point(300, 20)), GeneticAlgorithm.EvolviMaxAmount, GeneticAlgorithm.EvolviLoadedAmount, Color.Black, 1);
            GameHelper.SpriteBatch.DrawString(GameHelper.Font, Math.Round(((GeneticAlgorithm.EvolviLoadedAmount / (float)GeneticAlgorithm.EvolviMaxAmount) * 100)).ToString() + "%", new Vector2(GameHelper.GraphicsDevice.Viewport.Width / 2f, GameHelper.GraphicsDevice.Viewport.Height / 2f) + new Vector2(0, 62) - (GameHelper.Font.MeasureString(Math.Round(((GeneticAlgorithm.EvolviLoadedAmount / (float)GeneticAlgorithm.EvolviMaxAmount) * 100)).ToString() + "%") / 2f), Color.White);

            btn_cancel.Draw();

            if (ScreenModal.isActive)
            {
                ScreenModal.Draw();
            }

            GameHelper.SpriteBatch.End();

            base.Draw();
        }
Beispiel #3
0
        public override void Draw()
        {
            GameHelper.GraphicsDevice.Clear(backColor);

            // WORLD
            GameHelper.SpriteBatch.Begin(SpriteSortMode.Immediate, null, SamplerState.PointClamp, null, null, null, Camera.Instance.ViewMatrix);

            GameHelper.SpriteBatch.DrawString(GameHelper.Font, "TESTING", new Vector2(20, 20), Color.Black);
            GameHelper.SpriteBatch.DrawString(GameHelper.Font, Camera.Instance.Zoom.ToString(), new Vector2(20, 40), Color.Black);

            // Borders
            GameHelper.SpriteBatch.Draw(GameHelper.TextureManager["PIXEL"], Vector2.Zero, null, Color.DarkGray, 0f, Vector2.Zero, new Vector2(2000), SpriteEffects.None, 0.0001f);

            GameHelper.SpriteBatch.Draw(GameHelper.TextureManager["PIXEL"], Vector2.Zero, null, Color.Black, 0f, Vector2.Zero, new Vector2(4, 2000), SpriteEffects.None, 0.001f);
            GameHelper.SpriteBatch.Draw(GameHelper.TextureManager["PIXEL"], Vector2.Zero, null, Color.Black, 0f, Vector2.Zero, new Vector2(2000, 4), SpriteEffects.None, 0.001f);
            GameHelper.SpriteBatch.Draw(GameHelper.TextureManager["PIXEL"], new Vector2(2000, 0), null, Color.Black, 0f, Vector2.Zero, new Vector2(4, 2000), SpriteEffects.None, 0.001f);
            GameHelper.SpriteBatch.Draw(GameHelper.TextureManager["PIXEL"], new Vector2(0, 2000), null, Color.Black, 0f, Vector2.Zero, new Vector2(2000, 4), SpriteEffects.None, 0.001f);

            // DRAW SHIT HERE

            GeneticAlgorithm.Draw();

            if (SELECTED_EVOLVI != null)
            {
                SELECTED_EVOLVI.DrawSelected(selectedAngle);
            }

            GameHelper.SpriteBatch.End();

            // GUI
            GameHelper.SpriteBatch.Begin(SpriteSortMode.Immediate, null, SamplerState.PointClamp, null, null, null, null);

            GameHelper.SpriteBatch.Draw(GameHelper.TextureManager["PIXEL"], new Rectangle(0, 0, GameHelper.GraphicsDevice.Viewport.Width, 70), Color.DimGray * 0.7f);
            GameHelper.SpriteBatch.Draw(GameHelper.TextureManager["PIXEL"], new Rectangle(0, 70, GameHelper.GraphicsDevice.Viewport.Width, 2), Color.Black);

            GameHelper.SpriteBatch.Draw(GameHelper.TextureManager["PIXEL"], new Rectangle(0, GameHelper.GraphicsDevice.Viewport.Height - 70, GameHelper.GraphicsDevice.Viewport.Width, 70), Color.DimGray * 0.7f);
            GameHelper.SpriteBatch.Draw(GameHelper.TextureManager["PIXEL"], new Rectangle(0, GameHelper.GraphicsDevice.Viewport.Height - 72, GameHelper.GraphicsDevice.Viewport.Width, 2), Color.Black);


            GameHelper.SpriteBatch.DrawString(GameHelper.Font, "Generation: " + GeneticAlgorithm.Generation, new Vector2(10, GameHelper.GraphicsDevice.Viewport.Height - 70 + 15), Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);

            if (GeneticAlgorithm.GenerationTime != 0)
            {
                GameHelper.SpriteBatch.DrawString(GameHelper.Font, "Generation Lifetime: " + Math.Round(GeneticAlgorithm.ElapsedGenerationTime) + " / " + GeneticAlgorithm.GenerationTime, new Vector2(10, GameHelper.GraphicsDevice.Viewport.Height - 70 + 40), Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
            }
            else
            {
                GameHelper.SpriteBatch.DrawString(GameHelper.Font, "Generation Lifetime: " + Math.Round(GeneticAlgorithm.ElapsedGenerationTime) + " / INF", new Vector2(10, GameHelper.GraphicsDevice.Viewport.Height - 70 + 40), Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
            }

            GameHelper.SpriteBatch.DrawString(GameHelper.Font, "(" + GeneticAlgorithm.EvolutionSpeed + "x)", new Vector2(215, GameHelper.GraphicsDevice.Viewport.Height - 70 + 40), Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);

            btn_exit.Draw();
            btn_debug.Draw();
            btn_showNetwork.Draw();
            btn_evoSpeed_1.Draw();
            btn_evoSpeed_5.Draw();
            btn_evoSpeed_10.Draw();
            btn_pauseEvo.Draw();
            btn_autoSelectOnNewGeneration.Draw();
            btn_autoSelectBestPerformer.Draw();
            btn_openConsole.Draw();
            btn_openGrapher.Draw();
            btn_resumeEvolution.Draw();

            if (SHOW_NETWORK && SELECTED_EVOLVI != null)
            {
                DrawNetwork(SELECTED_EVOLVI.Network);
            }

            if (USING_CONSOLE)
            {
                MyConsole.Draw();
            }

            if (MyGrapher.IsActive)
            {
                MyGrapher.Draw();
            }

            if (MyIndividualViewer.IsActive)
            {
                MyIndividualViewer.Draw();
            }

            if (ScreenModal?.isActive == true)
            {
                ScreenModal.Draw();
            }

            GameHelper.SpriteBatch.End();

            base.Draw();
        }