示例#1
0
        protected override void LoadContent()
        {
            _textures = new Texture2DCache(typeof(Textures));

            _spriteBatch = new SpriteBatch(Globals.GraphicsDevice);

            _markerAnchor_Blue            = StaticSprite.Acquire(_textures[(int)Textures.Marker_Blue], new Vector2(4, 4));
            _markerAnchor_Blue.LayerDepth = 0;
            _renderParamsTemplate.GetTexture_MarkCenter = new Getter <ISprite>(() => { return(_markerAnchor_Blue); });

            _markerTopLeft_Red            = StaticSprite.Acquire(_textures[(int)Textures.Marker_Red], new Vector2(4, 4));
            _markerTopLeft_Red.LayerDepth = 0;
            _renderParamsTemplate.GetTexture_MarkOrigin = new Getter <ISprite>(() => { return(_markerTopLeft_Red); });

            _markerCompositeAnchor_Green                 = StaticSprite.Acquire(_textures[(int)Textures.Marker_Green], new Vector2(4, 4));
            _markerCompositeAnchor_Green.LayerDepth      = 0;
            _renderParamsTemplate.GetTexture_MarkTopLeft = new Getter <ISprite>(() => { return(_markerCompositeAnchor_Green); });

            List <Vector2> vertices = new List <Vector2>();

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

            _polygon = new PolygonExtent();
            _polygon.Reset(vertices);
            _polygon.ReAnchor(_polygon.ActualCenter);

            _contentLoaded = true;
        }
示例#2
0
        protected override void LoadContent()
        {
            _textures = new Texture2DCache(typeof(Textures));

            _spriteBatch = new SpriteBatch(Globals.GraphicsDevice);
            _fonts       = new SpriteFontCache(typeof(Fonts));

            _markerIntersect_Blue            = StaticSprite.Acquire(_textures[(int)Textures.Marker_Blue], new Vector2(4, 4));
            _markerIntersect_Blue.LayerDepth = 0;

            _markerPoint_Red                        = StaticSprite.Acquire(_textures[(int)Textures.Marker_Red], new Vector2(4, 4));
            _markerPoint_Red.LayerDepth             = 0;
            _markerPoint_Red.RenderingExtent.Anchor = new Vector2(_xValue, _yValue);

            var vertices = new List <Vector2>();

            vertices.Add(new Vector2(22, 122));
            vertices.Add(new Vector2(66, 23));
            vertices.Add(new Vector2(150, 5));
            vertices.Add(new Vector2(293, 78));
            vertices.Add(new Vector2(256, 194));
            vertices.Add(new Vector2(230, 86));
            vertices.Add(new Vector2(202, 175));
            vertices.Add(new Vector2(113, 157));
            vertices.Add(new Vector2(168, 69));
            vertices.Add(new Vector2(165, 148));
            vertices.Add(new Vector2(203, 60));
            vertices.Add(new Vector2(105, 50));
            vertices.Add(new Vector2(77, 140));
            vertices.Add(new Vector2(40, 147));

            _insidePolygon = XenString.Acquire();
            _insidePolygon.Reset(_fonts[(int)Fonts.Arial], "Inside!");

            _polygonExtent = new PolygonExtent();
            _polygonExtent.Reset(vertices);
        }