Example #1
0
        /// <summary>Initializes a new gui painter</summary>
        /// <param name="contentManager">Content manager containing the resources for the GUI. The instance takes ownership of the content manager and will dispose it.</param>
        /// <param name="skinStream">Stream from which the skin description will be read</param>
        public MultiGuiGraphics(ContentManager contentManager, Stream skinStream)
        {
            IGraphicsDeviceService graphicsDeviceService = (IGraphicsDeviceService)contentManager.ServiceProvider.GetService(typeof(IGraphicsDeviceService));

            this.spriteBatch = new SpriteBatch(graphicsDeviceService.GraphicsDevice);
            this.contentManager = contentManager;
            this.openingLocator = new OpeningLocator();
            this.stringBuilder = new StringBuilder(64);
            this.scissorManager = new ScissorKeeper(this);
            this.rasterizerState = new RasterizerState()
            {
                ScissorTestEnable = true
            };
            this.fonts = new Dictionary<string, SpriteFont>();
            this.bitmaps = new Dictionary<string, Texture2D>();
            this.frames = new Dictionary<string, Frame>();

            loadSkin(skinStream);
        }
        /// <summary>Initializes a new gui painter</summary>
        /// <param name="contentManager">
        ///     Content manager containing the resources for the GUI. The instance takes
        ///     ownership of the content manager and will dispose it.
        /// </param>
        /// <param name="skinStream">
        ///     Stream from which the skin description will be read
        /// </param>
        public FlatGuiGraphics(ContentManager contentManager, Stream skinStream)
        {
            var graphicsDeviceService =
                (IGraphicsDeviceService)contentManager.ServiceProvider.GetService(
                    typeof(IGraphicsDeviceService)
                    );

            _spriteBatch     = new SpriteBatch(graphicsDeviceService.GraphicsDevice);
            _contentManager  = contentManager;
            _openingLocator  = new OpeningLocator();
            _stringBuilder   = new StringBuilder(64);
            _scissorManager  = new ScissorKeeper(this);
            _rasterizerState = new RasterizerState
            {
                ScissorTestEnable = true
            };
            _fonts   = new Dictionary <string, SpriteFont>();
            _bitmaps = new Dictionary <string, Texture2D>();
            _frames  = new Dictionary <string, Frame>();

            LoadSkin(skinStream);
        }