TextureBuilder WithSize( int width, int height )
TextureBuilder WithSize( Vector2 size )

book_4_sparkGenerated
code_blocksInput

Description

The WithSize method of the TextureBuilder class allows you to specify the dimensions of a texture by setting its width and height. This method is part of a fluent interface, enabling you to chain multiple configuration methods together to build a texture with specific properties.

Usage

To use the WithSize method, first create an instance of TextureBuilder. Then, call WithSize with the desired width and height as integer parameters. This method returns the TextureBuilder instance, allowing for further configuration or finalization of the texture creation process.

Example

// Example of using the WithSize method
TextureBuilder builder = new TextureBuilder();
builder.WithSize(1024, 768);

// Continue configuring the texture
builder.WithFormat(ImageFormat.RGBA8)
       .WithStaticUsage();

// Create the texture
Texture texture = builder.Create("MyTexture", false, data, data.Length);