コード例 #1
0
ファイル: GameMain.cs プロジェクト: raphaelmun/MonoXen
        protected override void LoadContent()
        {
            _textures    = new Texture2DCache(typeof(Textures));
            _spriteBatch = new SpriteBatch(Globals.GraphicsDevice);

            for (int i = 0; i < 3; i++)
            {
                for (int j = 0; j < 3; j++)
                {
                    var sprite = StaticSprite.Acquire(_textures[(int)Textures.ColoredRect]);
                    sprite.LayerDepth             = 1;
                    sprite.RenderingExtent.Anchor = new Vector2(100 + i * 250, 100 + j * 250);
                    _sprites.Add(sprite);
                }
            }

            _viewportCenter            = StaticSprite.Acquire(_textures[(int)Textures.Marker_Red], new Vector2(4, 4));
            _viewportCenter.LayerDepth = 0;
            _sprites.Add(_viewportCenter);

            ScreenUtility.InitGraphicsMode(800, 480, false);

            _viewport.ResetWithScreenSize(800, 480);

            _contentLoaded = true;
        }
コード例 #2
0
        protected override void LoadContent()
        {
            _spriteBatch = new SpriteBatch(Globals.GraphicsDevice);

            ScreenUtility.InitGraphicsMode(800, 480, false);

            var vertices = new List <Vector2>();

            vertices.Add(new Vector2(100, 100));
            vertices.Add(new Vector2(200, 100));
            vertices.Add(new Vector2(150, 150));

            _polygons[0] = new PolygonExtent();
            _polygons[0].Reset(vertices);
            _polygons[0].ReAnchor(_polygons[0].Center);

            vertices.Clear();
            vertices.Add(new Vector2(300, 300));
            vertices.Add(new Vector2(400, 300));
            vertices.Add(new Vector2(400, 400));
            vertices.Add(new Vector2(300, 400));

            _polygons[1] = new PolygonExtent();
            _polygons[1].Reset(vertices);
            _polygons[1].ReAnchor(_polygons[1].Center);

            vertices.Clear();
            vertices.Add(new Vector2(300, 300));
            vertices.Add(new Vector2(400, 300));
            vertices.Add(new Vector2(420, 400));
            vertices.Add(new Vector2(350, 450));
            vertices.Add(new Vector2(280, 400));

            _polygons[2] = new PolygonExtent();
            _polygons[2].Reset(vertices);
            _polygons[2].ReAnchor(_polygons[2].Center);

            vertices.Clear();
            Vector2 offset = new Vector2(300, 100);

            vertices.Add(offset + new Vector2(0, 0));
            vertices.Add(offset + new Vector2(50, 0));
            vertices.Add(offset + new Vector2(50, -50));
            vertices.Add(offset + new Vector2(100, -50));
            vertices.Add(offset + new Vector2(100, 0));
            vertices.Add(offset + new Vector2(150, 0));
            vertices.Add(offset + new Vector2(150, 50));
            vertices.Add(offset + new Vector2(100, 50));
            vertices.Add(offset + new Vector2(100, 100));
            vertices.Add(offset + new Vector2(50, 100));
            vertices.Add(offset + new Vector2(50, 50));
            vertices.Add(offset + new Vector2(0, 50));

            _polygons[3] = new PolygonExtent();
            _polygons[3].Reset(vertices);
            _polygons[3].ReAnchor(_polygons[3].Center);

            _contentLoaded = true;
        }
コード例 #3
0
ファイル: GameMain.cs プロジェクト: raphaelmun/MonoXen
        protected override void LoadContent()
        {
            _spriteBatch = new SpriteBatch(Globals.GraphicsDevice);

            ScreenUtility.InitGraphicsMode(800, 480, false);

            _circles[0] = new CircularExtent();
            _circles[0].Reset(new Vector2(100, 100), 50);
            _circles[0].ReAnchor(_circles[0].Center);

            _circles[1] = new CircularExtent();
            _circles[1].Reset(new Vector2(300, 300), 50);
            _circles[1].ReAnchor(_circles[1].Center);

            _circles[2] = new CircularExtent();
            _circles[2].Reset(new Vector2(400, 350), 100);
            _circles[2].ReAnchor(_circles[2].Center);

            _circles[3] = new CircularExtent();
            _circles[3].Reset(new Vector2(300, 100), 75);
            _circles[3].ReAnchor(_circles[3].Center);

            _contentLoaded = true;
        }
コード例 #4
0
        protected override void LoadContent()
        {
            _spriteBatch = new SpriteBatch(Globals.GraphicsDevice);

            ScreenUtility.InitGraphicsMode(800, 480, false);

            var circle = new CircularExtent();

            circle.Reset(new Vector2(100, 100), 50);
            circle.ReAnchor(circle.Center);
            _extents[0] = circle;

            circle = new CircularExtent();
            circle.Reset(new Vector2(300, 300), 75);
            circle.ReAnchor(circle.Center);
            _extents[1] = circle;

            var vertices = new List <Vector2>();

            vertices.Add(new Vector2(300, 300));
            vertices.Add(new Vector2(400, 300));
            vertices.Add(new Vector2(420, 400));
            vertices.Add(new Vector2(350, 450));
            vertices.Add(new Vector2(280, 400));

            var poly = new PolygonExtent();

            poly.Reset(vertices);
            poly.ReAnchor(poly.Center);
            _extents[2] = poly;

            vertices.Clear();
            Vector2 offset = new Vector2(300, 100);

            vertices.Add(offset + new Vector2(0, 0));
            vertices.Add(offset + new Vector2(50, 0));
            vertices.Add(offset + new Vector2(50, -50));
            vertices.Add(offset + new Vector2(100, -50));
            vertices.Add(offset + new Vector2(100, 0));
            vertices.Add(offset + new Vector2(150, 0));
            vertices.Add(offset + new Vector2(150, 50));
            vertices.Add(offset + new Vector2(100, 50));
            vertices.Add(offset + new Vector2(100, 100));
            vertices.Add(offset + new Vector2(50, 100));
            vertices.Add(offset + new Vector2(50, 50));
            vertices.Add(offset + new Vector2(0, 50));

            poly = new PolygonExtent();
            poly.Reset(vertices);
            poly.ReAnchor(poly.Center);
            _extents[3] = poly;

            var composite = new CompositeExtent();

            var child1 = new CircularExtent();

            child1.Reset(new Vector2(50, 50), 50);
            child1.ReAnchor(circle.Center);

            vertices = new List <Vector2>();

            vertices.Add(new Vector2(100, 100));
            vertices.Add(new Vector2(200, 100));
            vertices.Add(new Vector2(200, 200));
            vertices.Add(new Vector2(100, 200));

            var child2 = new PolygonExtent();

            child2.Reset(vertices);
            child2.ReAnchor(poly.Center);

            composite.Add(child1);
            composite.Add(child2);

            _extents[4]    = composite;
            _contentLoaded = true;
        }