MAGE  v0.171.0
Matthias Advanced Game Engine
mage::rendering::SpriteBatch Class Reference

#include <sprite_batch.hpp>

Classes

class  Impl
 

Public Member Functions

 SpriteBatch (ID3D11Device &device, ID3D11DeviceContext &device_context)
 
 SpriteBatch (const SpriteBatch &sprite_batch)=delete
 
 SpriteBatch (SpriteBatch &&sprite_batch) noexcept
 
 ~SpriteBatch ()
 
SpriteBatchoperator= (const SpriteBatch &sprite_batch)=delete
 
SpriteBatchoperator= (SpriteBatch &&sprite_batch) noexcept
 
void Begin (SpriteSortMode sort_mode=SpriteSortMode::Deferred)
 
void XM_CALLCONV Draw (ID3D11ShaderResourceView *texture, FXMVECTOR color, SpriteEffect effects, const SpriteTransform2D &transform, const RECT *source=nullptr)
 
void End ()
 

Private Attributes

UniquePtr< Implm_impl
 

Detailed Description

A class of sprite batches.

Constructor & Destructor Documentation

◆ SpriteBatch() [1/3]

mage::rendering::SpriteBatch::SpriteBatch ( ID3D11Device &  device,
ID3D11DeviceContext &  device_context 
)

Constructs a sprite batch.

Parameters
[in,out]deviceA reference to the device.
[in,out]device_contextA reference to the device context.

◆ SpriteBatch() [2/3]

mage::rendering::SpriteBatch::SpriteBatch ( const SpriteBatch sprite_batch)
delete

Constructs a sprite batch from the given sprite batch.

Parameters
[in]sprite_batchA reference to the sprite batch to copy.

◆ SpriteBatch() [3/3]

mage::rendering::SpriteBatch::SpriteBatch ( SpriteBatch &&  sprite_batch)
defaultnoexcept

Constructs a sprite batch by moving the given sprite batch.

Parameters
[in]sprite_batchA reference to the sprite batch to move.

◆ ~SpriteBatch()

mage::rendering::SpriteBatch::~SpriteBatch ( )
default

Destructs this sprite batch.

Member Function Documentation

◆ Begin()

void mage::rendering::SpriteBatch::Begin ( SpriteSortMode  sort_mode = SpriteSortMode::Deferred)

Begins the processing of a batch of sprites.

Precondition
This sprite batch is not inside a begin/end pair.
Parameters
[in]sort_modeA reference to the sprite sorting mode for the whole batch of sprites.

◆ Draw()

void XM_CALLCONV mage::rendering::SpriteBatch::Draw ( ID3D11ShaderResourceView *  texture,
FXMVECTOR  color,
SpriteEffect  effects,
const SpriteTransform2D transform,
const RECT *  source = nullptr 
)

Draws a sprite.

Precondition
This sprite batch is inside a begin/end pair.
Parameters
[in]textureA pointer to the shader resource view of the texture to draw.
[in]colorThe (linear) RGBA color.
[in]effectsThe sprite effects to apply.
[in]transformA reference to the sprite transform.
[in]sourceA pointer the rectangular subregion of the texture.

◆ End()

void mage::rendering::SpriteBatch::End ( )

Ends the processing of a batch of sprites.

Precondition
This sprite batch is inside a begin/end pair.

◆ operator=() [1/2]

SpriteBatch& mage::rendering::SpriteBatch::operator= ( const SpriteBatch sprite_batch)
delete

Copies the given sprite batch to this sprite batch.

Parameters
[in]sprite_batchA reference to the sprite batch to copy.
Returns
A reference to the copy of the given sprite batch (i.e. this sprite batch).

◆ operator=() [2/2]

SpriteBatch & mage::rendering::SpriteBatch::operator= ( SpriteBatch &&  sprite_batch)
defaultnoexcept

Moves the given sprite batch to this sprite batch.

Parameters
[in]sprite_batchA reference to the sprite batch to move.
Returns
A reference to the moved sprite batch (i.e. this sprite batch).

Member Data Documentation

◆ m_impl

UniquePtr< Impl > mage::rendering::SpriteBatch::m_impl
private

A pointer to the implementation of this sprite batch.