Exemple #1
0
 void DrawWindowDebugPoints()
 {
     MDraw.Begin();
     MDraw.DrawPoint(Vector2.Zero, Color.White);                                                   // World Origin
     MDraw.DrawPointGlobal(Screen.Center, Color.White);                                            // Screen Center
     MDraw.DrawBoxGlobal(Screen.Center, Screen.Center - new Vector2(0.5f), new Color(50, 50, 50)); // Screen extents
     MDraw.End();
 }
Exemple #2
0
        void DrawFPS()
        {
            double calcDeltaTime = Time.ExactTimeOfDraw - lastTimeOfDraw;

            MDraw.SpriteBatch.Begin();
            MDraw.SpriteBatch.DrawString(MDraw.DefaultFont, $"FPS: {1f / calcDeltaTime:f2}", new Vector2(Screen.Width - 80, 10),
                                         new Color(1, 1, 1, 0.4f), 0f, Vector2.Zero, 0.5f, SpriteEffects.None, 0);
            MDraw.End();
        }
Exemple #3
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            MDraw.LoadContent();

            quickTest.LoadContent();

            var grass    = Content.Load <Texture2D>("Images/Tiles/grass");
            var dirt     = Content.Load <Texture2D>("Images/Tiles/dirt");
            var deepDirt = Content.Load <Texture2D>("Images/Tiles/deep_dirt");
            var temple   = Content.Load <Texture2D>("Images/Tiles/temple");
            var player   = Content.Load <Texture2D>("Images/Tiles/player");


            /*
             * new DebugTestPhysics(CurrentScene);
             * //*/


            //*

            //new TestActor(CurrentScene, new Vector2(0, 0), temple);

            //new TestSolid(CurrentScene, grass, new Vector2(2, 0), new Vector2(1, 1));

            //new TestSolidDrift(CurrentScene, grass, new Vector2(5, 0), new Vector2(2, 2));

            for (int x = -9; x <= 9; x++)
            {
                new TestSolidStatic(CurrentScene, deepDirt, new Vector2(x, 5), new Vector2(1, 1));
            }

            new TestSolidStatic(CurrentScene, deepDirt, new Vector2(6, 3), new Vector2(1, 1));
            new TestSolidStatic(CurrentScene, deepDirt, new Vector2(6, 2), new Vector2(1, 1));
            new TestSolidStatic(CurrentScene, deepDirt, new Vector2(6, 1), new Vector2(1, 1));

            //new TestSolid(CurrentScene, grass, new Vector2(1, 2), new Vector2(1, 1));
            //new TestSolid(CurrentScene, grass, new Vector2(2, 1), new Vector2(1, 1));
            //new TestSolid(CurrentScene, grass, new Vector2(2, 0), new Vector2(1, 1));
            //new TestSolid(CurrentScene, grass, new Vector2(4, 2), new Vector2(1, 1));
            //new TestSolid(CurrentScene, grass, new Vector2(4, 1), new Vector2(1, 1));
            //new TestSolid(CurrentScene, grass, new Vector2(4, 0), new Vector2(1, 1));

            for (int x = 0; x < 3; x++)
            {
                for (int y = 0; y < 3; y++)
                {
                    //new TestSolid(CurrentScene, grass, new Vector2(-5 + x, 0 + y), new Vector2(1, 1));
                }
            }

            //*/

            CurrentScene.Init();
            Time.Init();
        }
        private void DrawSweeps(Vector2 p1, Vector2 p2, Vector2 extents, Color lineColor, Color endColor)
        {
            var cur = extents.Clone();

            MDraw.DrawLine(p1 + cur, p2 + cur, lineColor);
            cur.X *= -1;
            MDraw.DrawLine(p1 + cur, p2 + cur, lineColor);
            cur.Y *= -1;
            MDraw.DrawLine(p1 + cur, p2 + cur, lineColor);
            cur.X *= -1;
            MDraw.DrawLine(p1 + cur, p2 + cur, lineColor);

            MDraw.DrawBox(p2, extents, endColor);
        }
Exemple #5
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            lastWindowDimensions = GetDimensions(Window.ClientBounds);
            Viewport             = GraphicsDevice.Viewport;

            Screen.Update();
            MDraw.Initialize();
            InputManager.Init();
            GuiManager.Init();

            CurrentScene = new Scene("MainScene");

            Components.Add(new PanelRebindKeyboard(this));
            Components.Add(new PanelRebindGamepad(this, PlayerIndex.One));
            Components.Add(new PanelRebindGamepad(this, PlayerIndex.Two));
            Components.Add(new PanelRebindInputSources(this));

            quickTest = new QuickTest();
            quickTest.Init();

            base.Initialize();
        }
 public override void Draw()
 {
     MDraw.Draw(Texture, DrawDepth, Entity.Position + LocalPosition, Entity.Rotation, TextureOrigin, Entity.Scale);
 }