Content


NTL
Core
CStoreBlock

CStoreBlock


This helper class provides shorter alternative for saving and restoring active block in renderer.

Instead of using code like below

Block *old_block_ptr{ renderer->ActiveBlock }, old_block;
if (old_block_ptr)
{
    old_block = *old_block_ptr;
    old_block_ptr = &old_block;
}
...
// Change active block in renderer 
...
renderer->ActivateBlock(old_block_ptr);

you may shorten it to the following one.

CStoreBlock store{ renderer };
...
// Change active block in renderer 
...
class CStoreBlock final
{
public:
    CStoreBlock(IRenderer *renderer);
    ~CStoreBlock();
};
Namespace: nitisa
Include: Nitisa/Render/StoreBlock.h