Esempio n. 1
0
        public Profiler(DebugView view)
            : base(view)
        {
            _window = new Window(30, 30, 60, 25, "Profiler");
            _window.Visible = false;
            View.Desktop.Add(_window);

            _profilerView = new ListView<ProfilerItem>(1, 1, 56, 19);
            _profilerView.Columns.Add(new ListView<ProfilerItem>.Column("Function", 43, p => p.Function));
            _profilerView.Columns.Add(new ListView<ProfilerItem>.Column("Samples", 11, p => p.Samples, true, p => string.Format("{0,11:P}", p.Samples / (float)_totalSamples)));
            _window.Add(_profilerView);

            _start = new Button(1, 21, 10, "Start");
            _start.Clicked += () =>
            {
                if (Target == null)
                    return;

                if (!_profiling)
                    Reset();

                _profiling = !_profiling;
            };

            _window.Add(_start);

            _message = new Label(13, 21, 40, 1, "Profiling requires debug information");
            _window.Add(_message);

            _profiling = false;
            _items = new Dictionary<string, ProfilerItem>();
            _totalSamples = 0;
        }
Esempio n. 2
0
        private void HandleTouchUpInside(object sender, EventArgs e)
        {
            Console.WriteLine ("HandleTouchUpInside");

            /*
            // Dont leak
            UIView v1 = new UIView ();
            UIView v2 = new UIView ();
            */

            /*
            // Dont leak
            UIView v1 = new DebugView ();
            UIView v2 = new UIView ();
            */

            /*
            // Leak
            UIView v1 = new UIView ();
            UIView v2 = new DebugView ();
            */

            // Leak
            UIView v1 = new DebugView ();
            UIView v2 = new DebugView ();

            v1.AddSubview (v2);
            View.AddSubview (v1);

            var sv = v2.Superview;			// cause of leak
            //v2.ResetSuperViewChache ();	// uncomment to fix

            v1.RemoveFromSuperview ();
        }
Esempio n. 3
0
 public Inputmanager(Contents contents, Camera camera, Player player, Keymanager keymanager, Cursor mouse, Enemymanager enemymanager, Windowmanager windowmanager, Backgroundmanager backgroundmanager, Backgrounddatabase backgrounddatabase, Objectmanager objectmanager, Objectdatabase objectdatabase, Eventmanager eventmanager, Levelmanager levelmanager, Levermanager levermanager, ContentManager contentmanager, Editor editor, DebugView DebugView, DepressionHandler Depression, Mathe mathe, Itemmanager itemmanager, BackgroundMusic bmus)
 {
     this.Contents = contents;
     this.Player = player;
     this.Keymanager = keymanager;
     this.Cursor = mouse;
     this.Enemymanager = enemymanager;
     this.Windowmanager = windowmanager;
     this.Backgroundmanager = backgroundmanager;
     this.Backgrounddatabase = backgrounddatabase;
     this.Objectmanager = objectmanager;
     this.Objectdatabase = objectdatabase;
     this.Eventmanager = eventmanager;
     this.Levelmanager = levelmanager;
     this.Levermanager = levermanager;
     this.Contentmanager = contentmanager;
     this.Editor = editor;
     this.Mathe = mathe;
     this.Keymanager.Windowmanager = windowmanager;
     this.Camera = camera;
     this.Itemmanager = itemmanager;
     this.DebugView = DebugView;
     this.Depression = Depression;
     this.bg = bmus;
 }
Esempio n. 4
0
        public FlappyBird(DebugView view)
            : base(view)
        {
            _window = new Window(25, 25, 100, 30, "Flappy Square");
            View.Desktop.Add(_window);

            var game = new Game(0, 0, 98, 28);
            _window.Add(game);
        }
Esempio n. 5
0
        public Game()
            : base(35, 0.075f)
        {
            _enemies = new List<Enemy>();

            _text = new Text("", Program.Font, 32);
            _wave = 1;
            _timer = 0.5f;

            _debug = new DebugView();
        }
Esempio n. 6
0
        protected override void LoadContent()
        {
            IsMouseVisible = true;
            spriteBatch    = new SpriteBatch(GraphicsDevice);
            graphics.PreferredBackBufferWidth  = 1000;
            graphics.PreferredBackBufferHeight = 700;
            graphics.ApplyChanges();
            world           = new World(GraphicsDevice);
            world.Permeable = true;
            camera          = new Camera(GraphicsDevice);
            camera.Position = new Vector2(0, 0);// GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height) / 2;

            debugView = new DebugView(GraphicsDevice, world);

            font = Content.Load <SpriteFont>("spritefont");

            Random gen = new Random();

            int taylorNumber = 2;

            //10000 seems to be the limit of just drawing and bouncing off the screen
            //so the upper limit for collision checking is 10000
            taylors = new Sprite[taylorNumber];
            Particle[] particles = new Particle[taylorNumber];
            for (int i = 0; i < taylorNumber; i++)
            {
                float radius = 10f;//gen.Next(1, 51);
                taylors[i] = new Sprite(
                    Content.Load <Texture2D>($"circle{gen.Next(1, 6)}"),
                    new Vector2(gen.Next(0, GraphicsDevice.Viewport.Width - (int)radius),
                                gen.Next(0, GraphicsDevice.Viewport.Height - (int)radius))
                    );

                taylors[i].SetCenterOrigin();

                particles[i] = //new Particle(taylors[i].Position, new Vector2(gen.Next(-4, 4), gen.Next(-4, 4)), 21, 1f);

                               new Rigidbody(
                    new Circle(radius)
                {
                    IsHollow = gen.Next(1, 1) == 1
                },
                    taylors[i].Position,
                    new Vector2(gen.Next(0, 1), gen.Next(0, 1)),
                    radius,
                    gen.Next(-2, 3),
                    1f
                    );

                taylors[i].Scale = new Vector2(radius * 2 / taylors[i].Texture.Width, radius * 2 / taylors[i].Texture.Height);
            }
            world.Items = particles;
        }
Esempio n. 7
0
 protected PhysicsDemoScreen()
 {
     TransitionOnTime    = TimeSpan.FromSeconds(0.4);
     TransitionOffTime   = TimeSpan.FromSeconds(0.3);
     HasCursor           = true;
     EnableCameraControl = true;
     _userAgent          = null;
     World       = null;
     Camera      = null;
     DebugView   = null;
     RenderDebug = true;
 }
        public override void Update(GameSettings settings, GameTime gameTime)
        {
            DrawString("SimpleWindForce | Mouse: Direction | Left-Click: Position | W/S: Variation");
            DrawString("Wind Strength:" + _simpleWind.Strength);
            DrawString("Variation:" + _simpleWind.Variation);

            DebugView.BeginCustomDraw(ref GameInstance.Projection, ref GameInstance.View);
            //DebugView.DrawSegment(SimpleWind.Position, SimpleWind.Direction-SimpleWind.Position, Color.Red);
            DrawPointForce();
            DebugView.EndCustomDraw();
            base.Update(settings, gameTime);
        }
        private void DrawVertices(Vertices vertices)
        {
            if (vertices.Count >= 1)
            {
                DebugView.DrawPolygon(vertices.ToArray(), vertices.Count, Color.Red);

                foreach (Vector2 vector2 in vertices)
                {
                    DebugView.DrawPoint(vector2, 0.1f, Color.Yellow);
                }
            }
        }
Esempio n. 10
0
        public override void Update(GameSettings settings, GameTime gameTime)
        {
            foreach (Vertices vertex in _polygons)
            {
                if (vertex != null)
                {
                    Vector2[] array = vertex.ToArray();
                    Color     col   = Color.SteelBlue;
                    if (!vertex.IsCounterClockWise())
                    {
                        col = Color.Aquamarine;
                    }
                    if (vertex == _selected)
                    {
                        col = Color.LightBlue;
                    }
                    if (vertex == _subject)
                    {
                        col = Color.Green;
                        if (vertex == _selected)
                        {
                            col = Color.LightGreen;
                        }
                    }
                    if (vertex == _clip)
                    {
                        col = Color.DarkRed;
                        if (vertex == _selected)
                        {
                            col = Color.IndianRed;
                        }
                    }
                    DebugView.BeginCustomDraw(ref GameInstance.Projection, ref GameInstance.View);
                    DebugView.DrawPolygon(array, vertex.Count, col);
                    for (int j = 0; j < vertex.Count; ++j)
                    {
                        DebugView.DrawPoint(vertex[j], .2f, Color.Red);
                    }
                    DebugView.EndCustomDraw();
                }
            }

            DrawString("A,S,D = Create Rectangle");
            DrawString("Q,W,E = Create Circle");
            DrawString("Click to Drag polygons");
            DrawString("1 = Select Subject while dragging [green]");
            DrawString("2 = Select Clip while dragging [red]");
            DrawString("Space = Union");
            DrawString("Backspace = Subtract");
            DrawString("Shift = Intersect");
            DrawString("Holes are colored light blue");
        }
Esempio n. 11
0
 public static void Open()
 {
     if (DebugView._instance == null)
     {
         DebugView  original   = ResourceManager.LoadPath <DebugView>("Prefab/UI/Common/DebugView", null, 0);
         DebugView  debugView  = UnityEngine.Object.Instantiate(original) as DebugView;
         GameObject gameObject = GameObject.Find("ViewRoot/Camera");
         debugView.transform.parent        = gameObject.transform;
         debugView.transform.localPosition = Vector3.zero;
         debugView.transform.localScale    = Vector3.one;
     }
     DebugView._instance.gameObject.SetActive(true);
 }
Esempio n. 12
0
 /// <summary>
 /// Inicializace všech objektů nutných pro existenci scény.
 /// </summary>
 public virtual void Load()
 {
     if (DebugView == null)
     {
         DebugView = new DebugView(Demo.World3D.World2D);
         DebugView.RemoveFlags(DebugViewFlags.Shape);
         DebugView.RemoveFlags(DebugViewFlags.Joint);
         DebugView.DefaultShapeColor  = Color.White;
         DebugView.SleepingShapeColor = Color.LightGray;
         DebugView.TextColor          = Color.Black;
         DebugView.LoadContent(Demo.GraphicsDevice, Demo.Content);
     }
 }
Esempio n. 13
0
        public DebugAdapter(System.IO.Stream @in,
                            System.IO.Stream @out,
                            Action <LogCategory, string>?logger,
                            DebugView defaultDebugView)
        {
            this.logger           = logger ?? ((_, __) => { });
            this.defaultDebugView = defaultDebugView;

            InitializeProtocolClient(@in, @out);
            Protocol.LogMessage += (sender, args) => this.logger(args.Category, args.Message);

            Protocol.RegisterRequestType <DebugViewRequest, DebugViewArguments>(a => HandleDebugViewRequest(a.Arguments));
        }
Esempio n. 14
0
    public void Awake()
    {
        Instance = this;

        DebugView.CreateGraph(PROCESSED, "Jobs Processed", "Frame", "Job Count in Frame", 1000);
        var time = DebugView.CreateGraph(TIME, "Jobs Execution Time", "Frame", "Total Job Time in Frame", 1000);

        if (time != null)
        {
            time.MinAutoScale = 10;
        }
        DebugView.CreateGraph(PENDING, "Pending Jobs", "Frame", "Total Pending Jobs", 1000);
    }
        public override void Update(GameSettings settings, GameTime gameTime)
        {
            DebugView.DrawString(50, TextLine, "Keys: left = a, brake = s, right = d, hz down = q, hz up = e");
            TextLine += 15;
            DebugView.DrawString(50, TextLine, "frequency = {0} hz, damping ratio = {1}", _hz, _zeta);
            TextLine += 15;
            DebugView.DrawString(50, TextLine, "actual speed = {0} rad/sec", _spring1.JointSpeed);
            TextLine += 15;

            GameInstance.ViewCenter = _car.Position;

            base.Update(settings, gameTime);
        }
        public override void Update(GameSettings settings, GameTime gameTime)
        {
            base.Update(settings, gameTime);

            DistanceInput input = new DistanceInput();

            input.ProxyA.Set(_polygonA, 0);
            input.ProxyB.Set(_polygonB, 0);
            input.TransformA = _transformA;
            input.TransformB = _transformB;
            input.UseRadii   = true;
            SimplexCache cache;

            cache.Count = 0;
            DistanceOutput output;

            Distance.ComputeDistance(out output, out cache, input);

            DebugView.DrawString(50, TextLine, "Distance = {0:n7}", output.Distance);
            TextLine += 15;

            DebugView.DrawString(50, TextLine, "Iterations = {0:n0}", output.Iterations);
            TextLine += 15;

            DebugView.BeginCustomDraw(ref GameInstance.Projection, ref GameInstance.View);
            {
                Color     color = new Color(0.9f, 0.9f, 0.9f);
                Vector2[] v     = new Vector2[Settings.MaxPolygonVertices];
                for (int i = 0; i < _polygonA.Vertices.Count; ++i)
                {
                    v[i] = MathUtils.Mul(ref _transformA, _polygonA.Vertices[i]);
                }
                DebugView.DrawPolygon(v, _polygonA.Vertices.Count, color);

                for (int i = 0; i < _polygonB.Vertices.Count; ++i)
                {
                    v[i] = MathUtils.Mul(ref _transformB, _polygonB.Vertices[i]);
                }
                DebugView.DrawPolygon(v, _polygonB.Vertices.Count, color);
            }

            Vector2 x1 = output.PointA;
            Vector2 x2 = output.PointB;


            DebugView.DrawPoint(x1, 0.5f, new Color(1.0f, 0.0f, 0.0f));
            DebugView.DrawPoint(x2, 0.5f, new Color(1.0f, 0.0f, 0.0f));

            DebugView.DrawSegment(x1, x2, new Color(1.0f, 1.0f, 0.0f));
            DebugView.EndCustomDraw();
        }
Esempio n. 17
0
        public override void Update(FarseerPhysicsGameSettings settings)
        {
            DebugView.DrawAABB(ref _terrainArea, Color.Red * 0.5f);


            DrawString("Left click and drag the mouse to destroy terrain!");
            DrawString("Right click and drag the mouse to create terrain!");
            DrawString("Middle click to create circles!");
            DrawString("Press t or y to cycle between decomposers: " + _terrain.Decomposer);
            TextLine += 25;
            DrawString("Press g or h to decrease/increase circle radius: " + _circleRadius);

            base.Update(settings);
        }
Esempio n. 18
0
        private static bool TraceMatch(IMatcher baseMatcher, IMatcher targetMatcher, int depth)
        {
            bool isMatch = baseMatcher.Matches(targetMatcher);

            DebugView.TraceEvent(IndentLevel.Matcher, () =>
                                 String.Format("{3}: {0} -> \"{1}\" {4} \"{2}\"",
                                               isMatch ? "Match" : "No match",
                                               targetMatcher.DebugView,
                                               baseMatcher.DebugView,
                                               depth == 0 ? "this" : "arg " + depth,
                                               isMatch ? "is" : "is not"));

            return(isMatch);
        }
Esempio n. 19
0
        public override void Update(GameSettings settings, GameTime gameTime)
        {
            //Draw the details of the QuadTree
            QuadTreeBroadPhase quadTreeBroadPhase = World.ContactManager.BroadPhase as QuadTreeBroadPhase;

            if (quadTreeBroadPhase != null)
            {
                DebugView.BeginCustomDraw(ref GameInstance.Projection, ref GameInstance.View);
                DrawTree(quadTreeBroadPhase.QuadTree);
                DebugView.EndCustomDraw();
            }

            base.Update(settings, gameTime);
        }
Esempio n. 20
0
 //Checks debugoptions and for each true value checks a option in debug screen
 private void CheckState(DebugView a_debugView)
 {
     for (int i = 0; i < a_debugView.m_debugOptions.m_options.Length; i++)
     {
         if (a_debugView.m_debugOptions.m_options[i])
         {
             m_checkBoxes[i].m_state = CheckBox.ChkState.Checked;
         }
         else if (!a_debugView.m_debugOptions.m_options[i])
         {
             m_checkBoxes[i].m_state = CheckBox.ChkState.Unchecked;
         }
     }
 }
Esempio n. 21
0
 private static void Log(string msg, int level)
 {
     //debugView
     DebugView.LogDebugger(msg);
     //Debugger.Log(0, null, $"{DateTime.Now}:{msg}");
     if (Level <= level)
     {
         Console.WriteLine($"{DateTime.Now}:{msg}");
         if (action != default)
         {
             action.BeginInvoke(msg, null, null);
         }
     }
 }
Esempio n. 22
0
        public void SetMethod(MethodBase method, bool checkCompatibility)
        {
            if (checkCompatibility)
            {
                if (method == typeof(object).GetConstructor(MockingUtil.EmptyTypes))
                {
                    DebugView.TraceEvent(Diagnostics.IndentLevel.Warning, () => "System.Object constructor will be intercepted only in 'new' expressions, i.e. 'new object()'.");
                }

                CheckMethodCompatibility(method);
                CheckInstrumentationAvailability(method);
            }
            this.method = method;
        }
Esempio n. 23
0
        public override void Update(GameSettings settings, GameTime gameTime)
        {
            DebugView.BeginCustomDraw(ref GameInstance.Projection, ref GameInstance.View);
            DebugView.DrawAABB(ref _terrainArea, Color.Red * 0.5f);
            DebugView.EndCustomDraw();

            DrawString("Left click and drag the mouse to destroy terrain!");
            DrawString("Right click and drag the mouse to create terrain!");
            DrawString("Middle click to create circles!");
            DrawString("Press t or y to cycle between decomposers: " + _terrain.Decomposer);
            TextLine += 25;
            DrawString("Press g or h to decrease/increase circle radius: " + _circleRadius);

            base.Update(settings, gameTime);
        }
Esempio n. 24
0
        private static void RunApp()
        {
            var app = new App(AppArgs.SpotifyArgs);

            app.InitializeComponent();

#if DEBUG
            DebugView.Launch();
#endif

            Core.Spotify.Instance.Connected -= Spotify_Connected;
            Core.Spotify.Instance.Connected += Spotify_Connected;

            app.Run();
        }
Esempio n. 25
0
        public override void Update(GameSettings settings, GameTime gameTime)
        {
            DebugView.DrawString(50, TextLine, "Left click and drag the mouse to destroy terrain!");
            TextLine += 15;
            DebugView.DrawString(50, TextLine, "Right click and drag the mouse to create terrain!");
            TextLine += 15;
            DebugView.DrawString(50, TextLine, "Middle click to create circles!");
            TextLine += 15;
            DebugView.DrawString(50, TextLine, "Press t or y to cycle between decomposers: " + _terrain.Decomposer);
            TextLine += 25;
            DebugView.DrawString(50, TextLine, "Press g or h to decrease/increase circle radius: " + _circleRadius);
            TextLine += 15;

            base.Update(settings, gameTime);
        }
Esempio n. 26
0
        public override void Update(GameSettings settings, GameTime gameTime)
        {
            base.Update(settings, gameTime);

            float ratio = _joint4.Ratio;
            float value = _joint1.JointAngle + ratio * _joint2.JointAngle;

            DebugView.DrawString(50, TextLine, "theta1 + {0} * theta2 = {1}", ratio, value);
            TextLine += 15;

            ratio = _joint5.Ratio;
            value = _joint2.JointAngle + ratio * _joint3.JointTranslation;
            DebugView.DrawString(50, TextLine, "theta2 + {0} * delta = {1}", ratio, value);
            TextLine += 15;
        }
Esempio n. 27
0
        public override void Update(GameSettings settings, GameTime gameTime)
        {
            DrawString("Press A,S,W,D move endpoint");

            DrawString("Press Enter to cut");

            DrawString("Press TAB to change endpoint");


            DebugView.BeginCustomDraw(ref GameInstance.Projection, ref GameInstance.View);
            DebugView.DrawSegment(_start, _end, Color.Red);
            DebugView.EndCustomDraw();

            List <Fixture> fixtures    = new List <Fixture>();
            List <Vector2> entryPoints = new List <Vector2>();
            List <Vector2> exitPoints  = new List <Vector2>();

            //Get the entry points
            World.RayCast((f, p, n, fr) =>
            {
                fixtures.Add(f);
                entryPoints.Add(p);
                return(1);
            }, _start, _end);

            //Reverse the ray to get the exitpoints
            World.RayCast((f, p, n, fr) =>
            {
                exitPoints.Add(p);
                return(1);
            }, _end, _start);

            DrawString("Fixtures: " + fixtures.Count);

            DebugView.BeginCustomDraw(ref GameInstance.Projection, ref GameInstance.View);
            foreach (Vector2 entryPoint in entryPoints)
            {
                DebugView.DrawPoint(entryPoint, 0.5f, Color.Yellow);
            }

            foreach (Vector2 exitPoint in exitPoints)
            {
                DebugView.DrawPoint(exitPoint, 0.5f, Color.PowderBlue);
            }
            DebugView.EndCustomDraw();

            base.Update(settings, gameTime);
        }
        public override void Update(GameSettings settings, GameTime gameTime)
        {
            DrawString("Loaded: " + _nextFileName + " - Press T for next");

            Vector2 offset = new Vector2(-6, 12);

            for (int i = 0; i < _names.Length; i++)
            {
                string title = string.Format("{0}: {1} ms - {2} triangles", _names[i], _timings[i], _bodies[i].FixtureList.Count);

                Vector2 screenPosition = GameInstance.ConvertWorldToScreen(_bodies[i].Position + offset);
                DebugView.DrawString((int)screenPosition.X, (int)screenPosition.Y, title);
            }

            base.Update(settings, gameTime);
        }
Esempio n. 29
0
        /// <summary>
        /// Renders all thge objects, and debug information
        /// </summary>
        /// <param name="renderer"></param>
        internal void OnDraw(QSpriteRenderer renderer)
        {
            renderer.Begin();
            Entities.SpriteObjects.For(s => s.OnDrawSprite(renderer));
            renderer.End();
            //normally ends here, debug renders here, laggy af
            if (Debug.DebugLevel < 2)
            {
                return;
            }
            var    c = Camera.Bounds;
            Matrix a = Matrix.CreateOrthographicOffCenter(c.Left.ToSim(), c.Right.ToSim(),
                                                          c.Bottom.ToSim(), c.Top.ToSim(), 0, 1);

            DebugView.RenderDebugData(ref a);
        }
Esempio n. 30
0
        public override void Update(GameSettings settings, float elapsedSeconds)
        {
            base.Update(settings, elapsedSeconds);

            DistanceInput input;

            input.ProxyA     = new DistanceProxy(_polygonA, 0);
            input.ProxyB     = new DistanceProxy(_polygonB, 0);
            input.TransformA = _transformA;
            input.TransformB = _transformB;
            input.UseRadii   = true;
            SimplexCache cache;

            cache.Count = 0;
            DistanceOutput output;

            Distance.ComputeDistance(out output, out cache, input);

            DrawString("Distance = " + output.Distance);
            DrawString("Iterations = " + output.Iterations);

            DebugView.BeginCustomDraw(ref GameInstance.Projection, ref GameInstance.View);
            {
                Color     color = ColorHelper.FromPercentages(0.9f, 0.9f, 0.9f);
                Vector2[] v     = new Vector2[Settings.MaxPolygonVertices];
                for (int i = 0; i < _polygonA.Vertices.Count; ++i)
                {
                    v[i] = Transform.Multiply(_polygonA.Vertices[i], ref _transformA);
                }
                DebugView.DrawPolygon(v, _polygonA.Vertices.Count, color);

                for (int i = 0; i < _polygonB.Vertices.Count; ++i)
                {
                    v[i] = Transform.Multiply(_polygonB.Vertices[i], ref _transformB);
                }
                DebugView.DrawPolygon(v, _polygonB.Vertices.Count, color);
            }

            Vector2 x1 = output.PointA;
            Vector2 x2 = output.PointB;

            DebugView.DrawPoint(x1, 0.5f, ColorHelper.FromPercentages(1.0f, 0.0f, 0.0f));
            DebugView.DrawPoint(x2, 0.5f, ColorHelper.FromPercentages(1.0f, 0.0f, 0.0f));

            DebugView.DrawSegment(x1, x2, ColorHelper.FromPercentages(1.0f, 1.0f, 0.0f));
            DebugView.EndCustomDraw();
        }
Esempio n. 31
0
        public override void Draw(GameTime gameTime)
        {
            ScreenManager.BatchEffect.View       = _view;
            ScreenManager.BatchEffect.Projection = _proj;
            ScreenManager.SpriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, RasterizerState.CullNone, ScreenManager.BatchEffect);
            _agent.Draw();
            _circles.Draw();
            _rectangles.Draw();
            _stars.Draw();
            _gears.Draw();
            ScreenManager.SpriteBatch.End();
            _border.Draw();


            //base.Draw(gameTime);
            DebugView.RenderDebugData(_proj, _view);
        }
Esempio n. 32
0
        public override void LoadContent()
        {
            base.LoadContent();

            // Make objects fall at 10 meters per second
            World.Gravity = Vector2.UnitY * 10;

            // Create some walls
            InitializeSpace();

            // Create our crate
            InitializeCrate();

            // Turn on debug view to draw entities
            DebugView.Enabled = true;
            DebugView.AppendFlags(DebugViewFlags.DebugPanel);
        }
Esempio n. 33
0
    public void Awake()
    {
        if (Instance == null)
        {
            Instance = this;
        }
        else
        {
            Destroy(this);
        }

        InvokeRepeating("DrainOne", 0f, DrainInterval);

        DebugView.CreateGraph(POOLED, "Pooled Objects", "Seconds Ago", "Object Count", 120);
        DebugView.CreateGraph(SPAWNED, "Pool Spawned Objects", "Frames Ago", "Spawn Count", 1000).MinAutoScale    = 20;
        DebugView.CreateGraph(BORROWED, "Pool Borrowed Objects", "Frames Ago", "Borrow Count", 1000).MinAutoScale = 20;
    }
        private MethodBase FindTestMethod(out int repoIdx, out RepositoryOperationsBase entryOps)
        {
            var stackTrace = new StackTrace();
            var q          = from method in stackTrace.EnumerateFrames()
                             where repoOperations.Any(repo => repo.MatchesMethod(method))
                             select method;

            var allTestMethods = q.Distinct().ToArray();

            if (allTestMethods.Length > 1)
            {
                var message = "Calling one test method from another could result in unexpected behavior and must be avoided. Extract common mocking logic to a non-test method. At:\n" + stackTrace;
                DebugView.DebugTrace(message);
            }
            var testMethod = allTestMethods.FirstOrDefault();

            if (testMethod != null)
            {
                var disableAttr = Attribute.GetCustomAttribute(testMethod, typeof(DisableAutomaticRepositoryResetAttribute)) as DisableAutomaticRepositoryResetAttribute;
                if (disableAttr != null &&
                    ProfilerInterceptor.IsProfilerAttached &&
                    !disableAttr.AllowMocking)
                {
                    throw new MockException("Using the mocking API in a test method decorated with DisableAutomaticRepositoryResetAttribute is unsafe. Read the documentation of the DisableAutomaticRepositoryResetAttribute class for further information and possible solutions.");
                }
            }

            repoIdx  = 0;
            entryOps = null;
            if (testMethod != null)
            {
                for (repoIdx = 0; repoIdx < this.repoOperations.Count; ++repoIdx)
                {
                    var ops = this.repoOperations[repoIdx];
                    if (ops.MatchesMethod(testMethod))
                    {
                        entryOps = ops;
                        break;
                    }
                }

                Debug.Assert(entryOps != null);
            }

            return(testMethod);
        }
Esempio n. 35
0
        /// <summary>
        /// Allows the screen to handle user input. Unlike Update, this method
        /// is only called when the screen is active, and not when some other
        /// screen has taken the focus.
        /// </summary>
        public virtual void HandleInput(InputState input)
        {
            //Keyboard Input
            if (!input.LastKeyboardState.IsKeyDown(Key.F1) && input.CurrentKeyboardState.IsKeyDown(Key.F1))
            {
                DebugViewEnabled           = !DebugViewEnabled;
                Settings.EnableDiagnostics = DebugViewEnabled;
                if (DebugViewEnabled == false)
                {
                    TxtDebug.Text = "";
                }
            }

            if (!input.LastKeyboardState.IsKeyDown(Key.Escape) && input.CurrentKeyboardState.IsKeyDown(Key.Escape))
            {
                ScreenManager.GoToMainMenu();
            }

            //Mouse
            Point   p        = Transform.Inverse.Transform(new Point(input.CurrentMouseState.X, input.CurrentMouseState.Y));
            Vector2 position = new Vector2((float)p.X, (float)p.Y);

            if (input.CurrentMouseState.IsLeftButtonDown == false && input.LastMouseState.IsLeftButtonDown)
            {
                MouseUp();
            }
            else if (input.CurrentMouseState.IsLeftButtonDown && input.LastMouseState.IsLeftButtonDown == false)
            {
                MouseDown(position);
            }

            MouseMove(position);

            //DebugView
            if (DebugView != null)
            {
                if (DebugViewEnabled)
                {
                    DebugView.AppendFlags(DebugViewFlags.DebugPanel);
                }
                else
                {
                    DebugView.RemoveFlags(DebugViewFlags.DebugPanel);
                }
            }
        }
Esempio n. 36
0
        public Options(DebugView view)
            : base(view)
        {
            #region Widget Creation
            _window = new Window(5, 5, 30, 5, "Options");
            _window.Visible = false;
            View.Desktop.Add(_window);

            var timeScaleLabel = new Label(1, 1, 13, 1, "TimeScale %:");
            _window.Add(timeScaleLabel);

            _timeScaleText = new NumericTextBox(14, 1, 13);
            _timeScaleText.Minimum = 0;
            _timeScaleText.Maximum = 200;
            _timeScaleText.Changed += () => Program.TimeScale = _timeScaleText.Value / 100f;

            _window.Add(_timeScaleText);
            #endregion
        }
Esempio n. 37
0
        public PhysicsManager(Game game)
        {
            _game = game;
            _world = new World(new Vector2(0, 9.8f));
            _debugView = new DebugView(_game, this);
            _rng = new Random(12345);

            BodyFactory.CreateRectangle(_world, 30f, 2f, 1f, new Vector2(0, 10));
            BodyFactory.CreateRectangle(_world, 30f, 2f, 1f, new Vector2(0, -10));
            BodyFactory.CreateRectangle(_world, 2f, 30f, 1f, new Vector2(13, 0));
            BodyFactory.CreateRectangle(_world, 2f, 30f, 1f, new Vector2(-13, 0));

            for (int i = 0; i < 50; i++)
            {
                bool isCircle = _rng.Next(0, 2) == 0;
                Vector2 position = new Vector2((float)(_rng.NextDouble() * 2 - 1), (float)(_rng.NextDouble() * 2 - 1)) * 8f;

                if (isCircle)
                {
                    float radius = (float)(_rng.NextDouble() + 0.4);
                    Body body = BodyFactory.CreateCircle(_world, radius, 1f, position);
                    int entityId = _game.entityManager.createEntity(body);

                    body.BodyType = BodyType.Dynamic;
                    body.UserData = entityId;
                    body.Restitution = 0.5f;
                }
                else
                {
                    float width = (float)(_rng.NextDouble() + 0.4);
                    float height = (float)(_rng.NextDouble() + 0.4);
                    Body body = BodyFactory.CreateRectangle(_world, width, height, 1f, position);
                    int entityId = _game.entityManager.createEntity(body);

                    body.Rotation = (float)(_rng.NextDouble() * 6.28 - 3.14);
                    body.BodyType = BodyType.Dynamic;
                    body.UserData = entityId;
                    body.Restitution = 0.5f;
                }
            }
        }
Esempio n. 38
0
        public Breakpoints(DebugView view)
            : base(view)
        {
            _window = new Window(15, 15, 60, 25, "Breakpoints");
            _window.Visible = false;
            View.Desktop.Add(_window);

            _breakpointList = new ListView<int>(1, 1, 56, 21);

            _breakpointList.Columns.Add(new ListView<int>.Column("Name", 43, null, false, addr =>
            {
                if (Target == null || Target.Code.DebugInfo == null)
                    return addr.ToString("X8");

                var debugInfo = Target.Code.DebugInfo;
                var symbol = debugInfo.FindSymbol(addr);
                if (!symbol.HasValue)
                    return addr.ToString("X8");

                return string.Format("{0}+0x{1}", symbol.Value.Name, addr - symbol.Value.Address);
            }));

            _breakpointList.Columns.Add(new ListView<int>.Column("Address", 11, null, false, addr => string.Format("{0,11:X8}", addr)));

            _breakpointList.Clicked += (addr, button) =>
            {
                if (Target == null)
                    return;

                if (button == Mouse.Button.Left)
                    View.Get<Cpu>().Goto(addr);
                else if (button == Mouse.Button.Right)
                    Target.RemoveBreakpoint(addr);
            };

            _window.Add(_breakpointList);
        }
Esempio n. 39
0
        public Target(DebugView view)
            : base(view)
        {
            _window = new Window(10, 10, 30, 7, "Target");
            _window.Visible = false;
            View.Desktop.Add(_window);

            var codeError = new Label(1, 1, 26, 2, "");
            _window.Add(codeError);

            _codeText = new TextBox(1, 3, 18);
            _window.Add(_codeText);

            var codeButton = new Button(20, 3, 7, "Load");
            codeButton.Clicked += () =>
            {
                if (Target == null || _codeText.Value.Length == 0)
                    return;

                try
                {
                    Target.Load(Assets.ReloadCode(_codeText.Value));
                    codeError.Caption = "";
                    _needUpdate = true;
                }
                catch
                {
                    codeError.Caption = "Failed to load code";
                }
            };
            _window.Add(codeButton);

            // TODO: put target stats in this window

            _needUpdate = true;
        }
Esempio n. 40
0
        public Symbols(DebugView view)
            : base(view)
        {
            _window = new Window(20, 20, 60, 25, "Symbols");
            _window.Visible = false;
            View.Desktop.Add(_window);

            _symbolList = new ListView<ShipDebug.Symbol>(1, 1, 56, 21);
            _symbolList.Columns.Add(new ListView<ShipDebug.Symbol>.Column("Name", 43, s => s.Name));
            _symbolList.Columns.Add(new ListView<ShipDebug.Symbol>.Column("Address", 11, s => s.Address, true, s => string.Format("{0,11:X8}", s.Address)));

            _symbolList.Clicked += (symbol, button) =>
            {
                if (Target == null)
                    return;

                if (button == Mouse.Button.Left)
                    View.Get<Cpu>().Goto(symbol.Address);
                else if (button == Mouse.Button.Right)
                    View.Get<Memory>().Goto(symbol.Address);
            };

            _window.Add(_symbolList);
        }
    public void DebugViewUpdate()
    {
        if (m_CurrentDebugView != m_DebugView) {
            m_CurrentDebugView = m_DebugView;
            m_DbgRenderMesh.Clear();

            switch (m_CurrentDebugView) {
                case DebugView.PolyMesh:
                    RcdtcsUnityUtils.ShowRecastNavmesh(m_DbgRenderMesh, m_System.m_pmesh, m_System.m_cfg);
                    break;
                case DebugView.NavMesh:
                    RcdtcsUnityUtils.ShowTilePolyDetails(m_DbgRenderMesh, m_System.m_navMesh, 0);
                    break;
                case DebugView.DetailMesh:
                    RcdtcsUnityUtils.ShowRecastDetailMesh(m_DbgRenderMesh, m_System.m_dmesh);
                    break;
                case DebugView.None:
                    m_DbgRenderMesh.Rebuild();
                    break;
                case DebugView.ContourSet:
                    RcdtcsUnityUtils.ShowContours(m_DbgRenderMesh, m_System.m_cset);
                    break;
                case DebugView.RawContourSet:
                    RcdtcsUnityUtils.ShowRawContours(m_DbgRenderMesh, m_System.m_cset);
                    break;
            }
        }
    }
Esempio n. 42
0
 protected DebugWindow(DebugView view)
 {
     View = view;
 }
Esempio n. 43
0
        public Watch(DebugView view)
            : base(view)
        {
            _window = new Window(25, 25, 80, 25, "Watch");
            _window.Visible = false;
            View.Desktop.Add(_window);

            _watchView = new ListView<WatchItem>(1, 1, 76, 19);
            _watchView.Columns.Add(new ListView<WatchItem>.Column("Name", 14, w => w.Name));
            _watchView.Columns.Add(new ListView<WatchItem>.Column("Expression", 40, w => w.Expression, false));
            _watchView.Columns.Add(new ListView<WatchItem>.Column("Value", 20, null, false, w =>
            {
                if (Target == null)
                    return "No Target";

                if (w.Error != null)
                    return w.Error;

                try
                {
                    var value = w.Function(Target);
                    return string.Format("{0:X8} {0,11}", value);
                }
                catch (WatchException e)
                {
                    return e.Message;
                }
                catch
                {
                    return "Error";
                }
            }));

            _watchView.Clicked += (item, button) =>
            {
                if (button == Mouse.Button.Right)
                {
                    _watchView.Items.Remove(item);
                }
                else if (button == Mouse.Button.Middle)
                {
                    _editing = item;
                    _name.Value = _editing.Name;
                    _expression.Value = _editing.Expression;
                }
            };

            _window.Add(_watchView);

            _name = new TextBox(1, 21, 13);
            _window.Add(_name);

            _expression = new TextBox(15, 21, 50);
            _window.Add(_expression);

            _button = new Button(66, 21, 11, "Add");
            _button.Clicked += () =>
            {
                if (_expression.Value.Length == 0)
                    return;

                WatchItem item;

                if (_editing == null)
                {
                    item = new WatchItem();
                    _watchView.Items.Add(item);
                }
                else
                {
                    item = _editing;
                }

                item.Name = _name.Value;
                item.Expression = _expression.Value;

                try
                {
                    item.Function = WatchExpression.Compile(item.Expression);
                    item.Error = null;
                }
                catch (WatchException e)
                {
                    item.Error = e.Message;
                }

                _name.Value = "";
                _expression.Value = "";
                _editing = null;
            };
            _window.Add(_button);
        }
Esempio n. 44
0
        public Memory(DebugView view)
            : base(view)
        {
            #region Widget Creation
            _window = new Window(15, 15, 81, 41, "Memory");
            _window.Visible = false;
            View.Desktop.Add(_window);

            _editor = new HexEditor(1, 1, 77, 36, 16);
            _window.Add(_editor);

            _offset = new Label(1, 38, 26, 1, "");
            _window.Add(_offset);

            var byteLabel = new Label(40, 38, 4, 1, "B");
            _window.Add(byteLabel);

            _byteText = new NumericTextBox(42, 38, 10);
            _byteText.Minimum = sbyte.MinValue;
            _byteText.Maximum = sbyte.MaxValue;
            _byteText.Changed += () =>
            {
                if (_editor.Buffer == null)
                    return;

                try
                {
                    var byteOffset = _editor.SelectedOffset / 2;
                    _editor.Buffer.WriteSByte(byteOffset, (sbyte)_byteText.Value);
                }
                catch { }
            };

            _window.Add(_byteText);

            var wordLabel = new Label(53, 38, 0, 1, "W");
            _window.Add(wordLabel);

            _wordText = new NumericTextBox(55, 38, 10);
            _wordText.Minimum = short.MinValue;
            _wordText.Maximum = short.MaxValue;
            _wordText.Changed += () =>
            {
                if (_editor.Buffer == null)
                    return;

                try
                {
                    var byteOffset = _editor.SelectedOffset / 2;
                    _editor.Buffer.WriteShort(byteOffset, (short)_wordText.Value);
                }
                catch { }
            };

            _window.Add(_wordText);

            var dwordLabel = new Label(66, 38, 0, 1, "D");
            _window.Add(dwordLabel);

            _dwordText = new NumericTextBox(68, 38, 10);
            _dwordText.Minimum = int.MinValue;
            _dwordText.Maximum = int.MaxValue;
            _dwordText.Changed += () =>
            {
                if (_editor.Buffer == null)
                    return;

                try
                {
                    var byteOffset = _editor.SelectedOffset / 2;
                    _editor.Buffer.WriteInt(byteOffset, _dwordText.Value);
                }
                catch { }
            };

            _window.Add(_dwordText);
            #endregion
        }
	public static void init()
	{
		instance = new DebugView ();
	}
Esempio n. 46
0
 protected override void Initialize()
 {
     base.Initialize();
     _camera = new Camera2D(GraphicsDevice);
     _camera.MaximumZoom = 1f;
     _camera.MinimumZoom = .5f;//.3f?
     _camera.Zoom = .8f;
     _debugView = new DebugView(_world, game,_ratio);
     IsMouseVisible = true;
     negativeForce = false;
     Pause = false;
     GameOver = false;
     #region Obsolete
     //_listeners = new Listeners();
     //_listeners.SetupCameraKeys(_camera);
     //_listeners.SetPlayerKeys()
     #endregion
 }
Esempio n. 47
0
        public Cpu(DebugView view)
            : base(view)
        {
            #region Widget Creation
            _window = new Window(10, 10, 110, 41, "CPU");
            View.Desktop.Add(_window);

            _disassembly = new Disassembly(1, 1, 79, 37);
            _disassembly.Clicked += (addr, button) =>
            {
                if (Target == null)
                    return;

                if (button == Mouse.Button.Left)
                    Target.AddBreakpoint(addr);
                else if (button == Mouse.Button.Right)
                    Target.RemoveBreakpoint(addr);
            };
            _window.Add(_disassembly);

            var y = 1;

            _registers = new Label[RegisterNames.Length];
            for (var i = 0; i < _registers.Length; i++, y++)
            {
                _registers[i] = new Label(82, y, 25, 1, "");
                _window.Add(_registers[i]);
            }

            y++;

            _flags = new Label[FlagNames.Length];
            for (var i = 0; i < _flags.Length; i++, y++)
            {
                _flags[i] = new Label(82, y, 25, 1, "");
                _window.Add(_flags[i]);
            }

            y++;
            _ivt = new Label(82, y++, 25, 1, "");
            _window.Add(_ivt);

            _error = new Label(82, ++y, 25, 4, "");
            _window.Add(_error);

            _skipInterrupt = new Checkbox(82, 29, 25, "Skip Interrupts");
            _skipInterrupt.Changed += () =>
            {
                if (Target != null)
                    Target.SkipInterrupts = _skipInterrupt.Checked;
            };
            _window.Add(_skipInterrupt);

            _step = new Button(82, 31, 25, "Step");
            _step.Clicked += () =>
            {
                if (Target == null || !Target.Paused)
                    return;

                Target.Step = true;
                _autoMove = true;
            };
            _window.Add(_step);

            _pause = new Button(82, 34, 25, "Pause");
            _pause.Clicked += () =>
            {
                if (Target == null)
                    return;

                if (!Target.Paused)
                    _autoMove = true;

                Target.Paused = !Target.Paused;
                Target.Step = true;
            };
            _window.Add(_pause);

            var gotoInput = new TextBox(82, 37, 17);
            _window.Add(gotoInput);

            var gotoButton = new Button(100, 37, 7, "Goto");
            gotoButton.Clicked += () =>
            {
                if (Target == null || gotoInput.Value.Length == 0)
                    return;

                try
                {
                    _gotoError = null;
                    var expr = WatchExpression.Compile(gotoInput.Value);
                    Goto(expr(Target));
                }
                catch (Exception e)
                {
                    _gotoError = string.Format("Goto: {0}", e.Message);
                }
            };
            _window.Add(gotoButton);
            #endregion
        }
Esempio n. 48
0
 /// <summary>
 /// Initializes the system
 /// </summary>
 public override void Initialize()
 {
     View = new DebugView(world, _Camera);
     Console.Start();
 }
 //UI interface
 private void UI_SetDebugView(DebugView debugView)
 {
     m_DebugView = debugView;
 }
Esempio n. 50
0
        public RenderSystem()
        {
            _debugView = new DebugView();

            _font = ResourceManager.getResource<Font>("gooddog_font");

            _actionLabel = new Text("", _font, 14);
            _actionLabel.Color = Color.White;

            _buildBridgeShape = new RectangleShape(new Vector2f(0.2f, 0f));
            _buildBridgeShape.FillColor = new Color(255, 255, 0, 128);
            _buildBridgeShape.Origin = new Vector2f(0.1f, 0f);

            _hpBarBackgrounds = new RectangleShape[MAX_HP_BARS];
            _hpBarForegrounds = new RectangleShape[MAX_HP_BARS];

            for (int i = 0; i < MAX_HP_BARS; i++)
            {
                RectangleShape background = new RectangleShape();
                RectangleShape foreground = new RectangleShape();

                background.Size = new Vector2f(HP_BAR_WIDTH + 2f, HP_BAR_HEIGHT + 2f);
                background.Origin = background.Size * 0.5f;
                background.FillColor = Color.Black;

                foreground.Size = new Vector2f(HP_BAR_WIDTH, HP_BAR_HEIGHT);
                foreground.Origin = foreground.Size * 0.5f;
                foreground.FillColor = Color.Green;

                _hpBarBackgrounds[i] = background;
                _hpBarForegrounds[i] = foreground;
            }

            _reticleShape = new RectangleShape();
            _reticleShape.Texture = ResourceManager.getResource<Texture>("reticle");
            _reticleShape.Size = new Vector2f(_reticleShape.Texture.Size.X, _reticleShape.Texture.Size.Y) / 35f;
            _reticleShape.Origin = _reticleShape.Size * 0.5f;

            _activeRopeKnotShapes = new List<int>();
            _ropeKnotTexture = ResourceManager.getResource<Texture>("rope_particle");
            _ropeKnotShapes = new RectangleShape[MAX_ROPE_KNOTS];
            for (int i = 0; i < MAX_ROPE_KNOTS; i++)
            {
                _ropeKnotShapes[i] = new RectangleShape();
                _ropeKnotShapes[i].Texture = _ropeKnotTexture;
                _ropeKnotShapes[i].Size = new Vector2f(0.25f, 0.3f);
                _ropeKnotShapes[i].Origin = _ropeKnotShapes[i].Size * 0.5f;
            }

            _activeBridgeSegmentShapes = new List<int>();
            _bridgeSegmentTexture = ResourceManager.getResource<Texture>("bridge_normal_0");
            _bridgeSegmentShapes = new RectangleShape[MAX_BRIDGE_SEGMENTS];
            for (int i = 0; i < MAX_BRIDGE_SEGMENTS; i++)
            {
                _bridgeSegmentShapes[i] = new RectangleShape();
                _bridgeSegmentShapes[i].Texture = _bridgeSegmentTexture;
                _bridgeSegmentShapes[i].Size = new Vector2f(2f, 0.5f);
                _bridgeSegmentShapes[i].Origin = _bridgeSegmentShapes[i].Size * 0.5f;
            }

            // Initialize animation textures
            initializeAnimations();

            // Initialize backgrounds
            initializeBackgrounds();
        }
 public void OnComputeComplete()
 {
     if (m_BuildTimeUIText != null) {
         m_BuildTimeUIText.text = m_System.m_ctx.getAccumulatedTime(Recast.rcTimerLabel.RC_TIMER_TOTAL) + " ms";
     }
     RecomputePath();
     //Force refresh debug renderer by invalidating watch
     m_CurrentDebugView = DebugView.None;
 }
Esempio n. 52
0
 protected override void Initialize()
 {
     base.Initialize();
     _camera = new Camera2D(GraphicsDevice);
     _camera.MaximumZoom = 1f;
     _camera.MinimumZoom = .5f;//.3f?
     _camera.Zoom = .8f;
     _debugView = new DebugView(_world, game,_ratio);
     IsMouseVisible = true;
     negativeForce = false;
     Pause = false;
     GameOver = false;
     CalledMother = false;
 }