Example #1
0
	public Sprite2D( Sprite2DBatch batch, Sprite2DMaterial material = null, int zIndex = 0 )
	{
		this.batch = batch ;
		this.material = material ?? Sprite2DMaterial.DefaultMaterial ;
		this.zIndex = zIndex ;
		vertexID = -1 ;
		indexID = -1 ;
		UpdateSortKey( false ) ;
		batch.AddSprite( this ) ;

		Center = new Vector2( 0.5f ) ;
		UVSize = new Vector2( 1.0f ) ;
		Color = new Rgba( 255, 255, 255, 255 ) ;
			
		updateFlag = false;
	}
Example #2
0
        public void InitSpriteBatch( int maxSpriteCount , GraphicsContext graphics )
        {
            batch = new Sprite2DBatch( graphics, maxSpriteCount ) ;
            material = new Sprite2DMaterial( new Texture2D( "/Application/res/data/2Dtex/unifiedTexture.png", true ) ) ;
            material.Texture.SetFilter( TextureFilterMode.Linear, TextureFilterMode.Linear,
                                        TextureFilterMode.Nearest ) ;

            sprites = new Sprite2D[ maxSpriteCount ] ;
            spriteCount = 0 ;
        }