Exemple #1
0
 public TextureDesc(Microsoft.Xna.Framework.Graphics.RenderTarget2D texture)
 {
     SharedHandle = (uint)texture.GetSharedHandle().ToInt64();
     Width        = (uint)texture.Width;
     Height       = (uint)texture.Height;
     Format       = 0;
     Usage        = 1;
     Description  = new byte[256];
 }
Exemple #2
0
        protected virtual void InitializeEntity(bool addToManagers)
        {
            LoadStaticContent(ContentManagerName);
            RenderTargetInstance = new Microsoft.Xna.Framework.Graphics.RenderTarget2D(FlatRedBall.FlatRedBallServices.GraphicsDevice, FlatRedBall.Camera.Main.DestinationRectangle.Width, FlatRedBall.Camera.Main.DestinationRectangle.Height);

            PostInitialize();
            if (addToManagers)
            {
                AddToManagers(null);
            }
        }
Exemple #3
0
        public override Texture CreateTexture(string textureId, int width, int height)
        {
            var bmp = new Microsoft.Xna.Framework.Graphics.RenderTarget2D(game.GraphicsDevice,
                                                                          width,
                                                                          height,
                                                                          false,
                                                                          Microsoft.Xna.Framework.Graphics.SurfaceFormat.Color,
                                                                          Microsoft.Xna.Framework.Graphics.DepthFormat.None,
                                                                          1,
                                                                          Microsoft.Xna.Framework.Graphics.RenderTargetUsage.PreserveContents);

            return(new MONOTexture(textureId, bmp));
        }
Exemple #4
0
        public override void SetTarget(Texture tex)
        {
            var tx = tex.GetTexture();

            Microsoft.Xna.Framework.Graphics.RenderTarget2D currentView = tx as Microsoft.Xna.Framework.Graphics.RenderTarget2D;
            batch = game.SpriteBatch;
            batch.End();
            game.GraphicsDevice.SetRenderTarget(currentView);
            batch.Begin(Microsoft.Xna.Framework.Graphics.SpriteSortMode.Deferred,
                        Microsoft.Xna.Framework.Graphics.BlendState.AlphaBlend,
                        Microsoft.Xna.Framework.Graphics.SamplerState.PointClamp,
                        Microsoft.Xna.Framework.Graphics.DepthStencilState.None,
                        Microsoft.Xna.Framework.Graphics.RasterizerState.CullCounterClockwise);
        }
 public TextureObject CreateTextureObjectFromTarget(string name, Microsoft.Xna.Framework.Graphics.RenderTarget2D target)
 {
     if (!_systemReady)
     {
         throw new EngineException("System not ready for creation", true);
     }
     if (!_textures.ContainsKey(name))
     {
         TextureObject newTexture = new TextureObject(name, target, true);
         _textures[name] = newTexture;
         return(newTexture);
     }
     else
     {
         return(_textures[name]);
     }
 }
Exemple #6
0
 protected override void InitGraphics()
 {
     Logger.Info("Gfx", $"Init Graphics {viewWidth} x {viewHeight} scale = {viewScale}");
     view?.Dispose();
     view = new Microsoft.Xna.Framework.Graphics.RenderTarget2D(game.GraphicsDevice, viewWidth, viewHeight, false, Microsoft.Xna.Framework.Graphics.SurfaceFormat.Color, Microsoft.Xna.Framework.Graphics.DepthFormat.None, 1, Microsoft.Xna.Framework.Graphics.RenderTargetUsage.PreserveContents);
 }