Example #1
0
        static void CreateDebugWindow(Game game)
        {
            var debugWindow = new DebugWindow <Game>(game);

            debugWindow.Add(g => $"Mouse pos {g.GetMousePosition()}");
            debugWindow.Add(g => $"Sqr distance from each other {g.SqrDistanceFromEachOther}");
            debugWindow.Add(g => $"Sqr radius combined {g.SqrRadius}");
            debugWindow.Add(g => $"Colliding {g.Colliding}");
            debugWindow.Show();
        }
Example #2
0
        static void DebugWindow(Game game)
        {
            var debug = new DebugWindow <Game>(game);

            debug.Add(g => $"FPS: {Timer.Fps}");
            debug.Add(g => $"Particles colliding: {g.Particles.Count(x => x.Colliding)}");
            debug.Add(g => $"Largest cluster: {g.LargestCluster}");
            // debug.Add(g => $"Interactive particles position: {g.InteractiveParticle.Position}");
            // debug.Add(g => $"Interactive Colliding: {g.InteractiveParticle.Colliding}");
            // debug.Add(g => $"Interactive particles radius: {g.InteractiveParticle.Radius}");
            debug.Show();
        }
Example #3
0
        static void Main(string[] args)
        {
            _window = WindowFactory.CreateDefault();
            _game   = new Game(_window);

            _window.KeyPressed += OnKeyPress;


            var debugWindow = new DebugWindow <Game>(_game);

            debugWindow.Add(g => $"Intersection: {g.Intersection}");


            debugWindow.Add(g => $"Num1: IntersectionMode X");
            debugWindow.Add(g => $"Num2: IntersectionMode Y");
            debugWindow.Add(g => $"Intersection Mode: {g.IntersectionMode.ToString()}");
            debugWindow.Show();

            _game.Initialize();
            _game.Start();
        }
Example #4
0
        static void Main(string[] args)
        {
            var window = WindowFactory.CreateDefault(1200, 950);

            window.SetTitle("Fireworks");
            var game = new Game(window);

            window.KeyPressed += (sender, eventArgs) =>
            {
                if (eventArgs.Code == Keyboard.Key.R)
                {
                    game.SpawnRocket();
                }
                if (eventArgs.Code == Keyboard.Key.Tab)
                {
                    game.ExplosionParticleFadeMode = game.ExplosionParticleFadeMode == ParticleFade.Exponential ? ParticleFade.Linear : ParticleFade.Exponential;
                }
            };


            var debug = new DebugWindow <Game>(game);

            debug.Add(g => $"CurrentSpawnTimer: {g.CurrentSpawnTimer}");
            debug.Add(g => $"CurrentSpawnTimeAccumulator: {g.CurrentSpawnTimeAccumulator}");
            debug.Add(g => $"Rocket count: {g.RocketCount}");
            debug.Add(g => $"Explosion count: {g.ExplosionCount}");
            debug.Add(g => $"Explosion Particle Fade Mode: {g.ExplosionParticleFadeMode.ToString()}");

            // debug.Add(g => $"Rocket pos : {g.Rocket?.Position}");
            // debug.Add(g => $"Rocket vel : {g.Rocket?.Velocity}");
            // debug.Add(g => $"Rocket acl : {g.Rocket?.Acceleration}");
            // debug.Add(g => $"Rocket dir : {g.Rocket?.Direction}");
            // debug.Add(g => $"Rocket fuel: {g.Rocket?.Fuel}");
            // debug.Add(g => $"Rocket force: {g.Rocket.Fuel}");
            debug.Show();


            game.Initialize();
            game.Start();
        }
Example #5
0
        static void Main(string[] args)
        {
            var window = WindowFactory.CreateDefault();
            var game   = new Game(window);

            var debug = new DebugWindow <Game>(game);

            debug.Add(g => g.Balls.Select(x => x.Position + "\n"));
            debug.Show();


            game.Initialize();
            game.Start();
        }
Example #6
0
        static void Main(string[] args)
        {
            var win = WindowFactory.CreateDefault();

            win.SetTitle("Circle Packing");
            var game = new Game(win);

            var debug = new DebugWindow <Game>(game);

            debug.Add(g => $"Circle count {g.CircleCount} of max {Game.MaxNumberOfElements}");
            debug.Show();

            game.Initialize();
            game.Start();
        }
Example #7
0
        public static void StartDebugScreen(FlockingBehaviour flockingBehaviour)
        {
            var debugWindow = new DebugWindow <FlockingBehaviour>(flockingBehaviour)
            {
                Width = 300,
            };

            debugWindow.Add(g => $"FPS: {Timer.Fps}");
            debugWindow.Add(g => $"(S-D) Agents {g.Agents.Count}");
            debugWindow.Add(g => $"(Y) Use QuadTree {g.UseQuadTree}");
            debugWindow.Add(g => $"(T) Render QuadTree {g.RenderQuadTree}");
            debugWindow.Add(g => $"(<>) Quad tree capacity {g.QuadTreeCapacity}");
            debugWindow.Add(g => $"(^v) Render AgentSpeed {g.AgentSpeed}");
            debugWindow.Add(g => $"(C) Render Show Collider {g.ShowCollider}");
            debugWindow.Add(g => $"(N) Render Show Neighborhood {g.ShowNeighborhood}");


            debugWindow.Show();
        }
Example #8
0
        static void Main(string[] args)
        {
            var window = WindowFactory.CreateDefault();
            var game   = new Game(window);

            var debug = new DebugWindow <Game>(game);

            debug.Add(g => $"Pos: {g.Skater.Position}");
            debug.Add(g => $"Acl: {g.Skater.Acceleration}");
            debug.Add(g => $"Vel: {g.Skater.Velocity}");
            debug.Add(g => $"Str: {g.Skater.Strength}");
            debug.Add(g => $"Mass: {g.Skater.Mass}");
            debug.Add(g => $"Direction: {g.Skater.Velocity.Normalize()}");
            debug.Show();

            game.Initialize();
            game.Start();
        }
Example #9
0
        /// <summary>
        /// Draw
        /// NOTE : PlotQuilt uses `Task.Factory` parallel routine and fills Texture framebuffer on completion.
        /// </summary>
        /// <param name="gameTime"></param>
        protected override void Draw(GameTime gameTime)
        {
            FPS++;

            if (TValues != null && TValues[0] != null)
            {
                for (int i = 0; i < TValues.Length; i++)
                {
                    DebugWindow.Add("Tval" + TValues[i].qid.ToString(), TValues[i].running);
                }
            }
            DebugWindow.Update();

            if (Update_Catmul())
            {
            }

            GraphicsDevice.SetRenderTarget(null);

            GraphicsDevice.Clear(Color.Transparent);

            spriteBatch.Begin();

            switch (programState)
            {
            case ProgramState.menu:
                QuiltOutline();
                DrawQuilt();
                DisplaySampleData();
                switch (quiltType)
                {
                case QuiltType.Square:
                    MenuText(Quilt, gameTime);
                    break;

                case QuiltType.Hexagon:
                    MenuText(Hexgn, gameTime);
                    break;

                case QuiltType.Icon:
                    MenuText(Icon1, gameTime);
                    break;

                case QuiltType.Icon3:
                    MenuText(Icon3, gameTime);
                    break;

                default:
                    break;
                }
                Draw_Colour_Band(5);
                break;

            case ProgramState.iterate:
                QuiltOutline();
                DrawQuilt();

                IterateText();
                if (isPaused)
                {
                    Draw_Colour_Band(_screenHit - 32);
                    DisplaySampleData();
                    Paused();
                }
                break;

            case ProgramState.sampling:
                Draw_Colour_Band(_screenHit - 32);
                DoSampling(_screenHit - 36);
                DrawQuilt();
                SamplingText();
                break;

            default:
                break;
            }

            Catmul_Spline.Draw(ref spriteBatch);

            Vector2 pos = new Vector2(800, 20);

            foreach (var line in DebugText)
            {
                spriteBatch.DrawString(font, line, pos, Color.White);
                pos.Y += 20;
            }

            DebugWindow.Draw();

            spriteBatch.End();

            base.Draw(gameTime);
        }