Пример #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Gorgon2D"/> class.
        /// </summary>
        /// <param name="target">The primary render target to use.</param>
        /// <param name="vertexCacheSize">The number of vertices that can be placed in vertex cache.</param>
        /// <param name="autoCreatedTarget">TRUE if Gorgon created the target, FALSE if the user created the target.</param>
        internal Gorgon2D(GorgonRenderTargetView target, int vertexCacheSize, bool autoCreatedTarget)
        {
            _systemCreatedTarget = autoCreatedTarget;

            _cache = new Gorgon2DVertexCache(this, vertexCacheSize.Max(1024));

            IsBlendingEnabled  = true;
            IsAlphaTestEnabled = true;

            TrackedObjects = new GorgonDisposableObjectCollection();
            Graphics       = target.Resource.Graphics;
            DefaultTarget  = target;

            _logoSprite = new GorgonSprite(this, "Gorgon2D.LogoSprite")
            {
                Anchor        = new Vector2(Graphics.Textures.GorgonLogo.Settings.Size),
                Texture       = Graphics.Textures.GorgonLogo,
                TextureRegion = new RectangleF(Vector2.Zero, new Vector2(1)),
                Color         = Color.White,
                Size          = Graphics.Textures.GorgonLogo.Settings.Size
            };
            DefaultCamera = new Gorgon2DOrthoCamera(this,
                                                    "Gorgon.Camera.Default",
                                                    new RectangleF(0, 0, _defaultTarget.Width, _defaultTarget.Height),
                                                    0,
                                                    1.0f)
            {
                AutoUpdate = true
            };

            Renderables = new GorgonRenderables(this, _cache);
            Drawing     = new GorgonDrawing(this);

            // Perform further initialization.
            Initialize();
        }
Пример #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GorgonRenderables"/> class.
 /// </summary>
 /// <param name="gorgon2D">The gorgon 2D interface that owns this object.</param>
 /// <param name="cache">The vertex cache used by the renderer.</param>
 internal GorgonRenderables(Gorgon2D gorgon2D, Gorgon2DVertexCache cache)
 {
     _gorgon2D = gorgon2D;
     _cache    = cache;
 }