Ejemplo n.º 1
0
        public DrawableObject()
            : base()
        {
            _color         = Color.White;
            _spriteEffects = SpriteEffects.None;
            _spriteOptions = SpriteOptions.Default;
            _visible       = true;
            _opacity       = 1.0f;

            LoadedScene.OrderDrawable(this);
        }
Ejemplo n.º 2
0
 public bool Equals(SpriteOptions b)
 {
     if (b == null)
     {
         return(false);
     }
     return(
         this.SpriteSortMode == b.SpriteSortMode &&
         this.BlendState == b.BlendState &&
         this.SamplerState == b.SamplerState &&
         this.DepthStencilState == b.DepthStencilState &&
         this.RasterizerState == b.RasterizerState &&
         this.Effect == b.Effect &&
         this.TransformMatrix == b.TransformMatrix &&
         this.DrawOrder == b.DrawOrder &&
         this.DrawingSpace == b.DrawingSpace);
 }
Ejemplo n.º 3
0
        private void SpriteBatchBegin(SpriteBatch spriteBatch, SpriteOptions options)
        {
            Matrix camMat = ActiveCamera.Matrix;

            if (options.DrawingSpace == DrawingSpace.Screen)
            {
                camMat = Matrix.Identity;
            }

            spriteBatch.Begin(
                options.SpriteSortMode,
                options.BlendState,
                options.SamplerState,
                options.DepthStencilState,
                options.RasterizerState,
                options.Effect,
                camMat * options.TransformMatrix);
        }
Ejemplo n.º 4
0
        public MGTK()
            : base()
        {
            _instance             = this;
            _graphics             = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            _debugDrawEnabled = true;

            _defaultSpriteOptions = new SpriteOptions(
                SpriteSortMode.Deferred,
                BlendState.NonPremultiplied,
                SamplerState.PointClamp,
                DepthStencilState.None,
                RasterizerState.CullCounterClockwise,
                null, DrawingSpace.World, Matrix.Identity);


            _graphics.PreferredBackBufferWidth  = 1280;
            _graphics.PreferredBackBufferHeight = 720;
            _prevBackBufferWidth  = _graphics.PreferredBackBufferWidth;
            _prevBackBufferHeight = _graphics.PreferredBackBufferHeight;
            _projection           = Matrix.CreateOrthographicOffCenter(0f, _graphics.PreferredBackBufferWidth, _graphics.PreferredBackBufferHeight, 0f, 0f, 1f);

            _clearColor = Color.Black;

            DisplayMode display = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode;

            Window.Title             = "MonoGameToolkit";
            Window.AllowUserResizing = false;
            Window.AllowAltF4        = true;

            Window.ClientSizeChanged += OnWindowResized;

            IsMouseVisible = true;
            ShowFps        = true;

            _graphics.SynchronizeWithVerticalRetrace = false;
            IsFixedTimeStep = false;

            OnBackBufferSizeChanged += UpdateRenderTarget;
        }