Nez.Graphics.createSingleColorTexture C# (CSharp) Method

createSingleColorTexture() public static method

helper method that generates a single color texture of the given dimensions
public static createSingleColorTexture ( int width, int height, Color color ) : Microsoft.Xna.Framework.Graphics.Texture2D
width int Width.
height int Height.
color Color Color.
return Microsoft.Xna.Framework.Graphics.Texture2D
		public static Texture2D createSingleColorTexture( int width, int height, Color color )
		{
			var texture = new Texture2D( Core.graphicsDevice, width, height );
			var data = new Color[width * height];
			for( var i = 0; i < data.Length; i++ )
				data[i] = color;
			
			texture.SetData<Color>( data );
			return texture;
		}

Usage Example

Ejemplo n.º 1
0
        public override IEnumerator onBeginTransition()
        {
            // create a single pixel transparent texture so we can do our squares out to the next scene
            _overlayTexture = Graphics.createSingleColorTexture(1, 1, Color.Transparent);

            // populate squares
            yield return(Core.startCoroutine(tickEffectProgressProperty(_squaresEffect, squaresInDuration, easeType)));

            // load up the new Scene
            yield return(Core.startCoroutine(loadNextScene()));

            // dispose of our previousSceneRender. We dont need it anymore.
            previousSceneRender.Dispose();
            previousSceneRender = null;

            // delay
            yield return(delayBeforeSquaresInDuration);

            // unpopulate squares
            yield return(Core.startCoroutine(tickEffectProgressProperty(_squaresEffect, squaresInDuration, EaseHelper.oppositeEaseType(easeType), true)));

            transitionComplete();

            // cleanup
            _overlayTexture.Dispose();
            Core.contentManager.unloadEffect(_squaresEffect.Name);
        }
All Usage Examples Of Nez.Graphics::createSingleColorTexture