This helper class provides shorter alternative for saving and restoring active bitmask in renderer.
Instead of using code like below
Bitmask *old_bitmask_ptr{ renderer->ActiveBitmask }, old_bitmask;
if (old_bitmask_ptr)
{
old_bitmask = *old_bitmask_ptr;
old_bitmask_ptr = &old_bitmask;
}
...
// Change active bitmask in renderer
...
renderer->ActivateBitmask(old_bitmask_ptr);
you may shorten it to the following one.
CStoreBitmask store{ renderer };
...
// Change active bitmask in renderer
...
class CStoreBitmask final
{
public:
CStoreBitmask(IRenderer *renderer);
~CStoreBitmask();
};
Namespace: | nitisa |
Include: | Nitisa/Render/StoreBitmask.h |