Rose
|
Store the current render target replacing it with a new render target. More...
#include <GraphicsModel.h>
Public Member Functions | |
RenderTargetGuard ()=delete | |
Deleted default constructor. | |
RenderTargetGuard (const RenderTargetGuard &)=delete | |
Deleted copy constructor. | |
~RenderTargetGuard () noexcept(false) | |
Set the old render target back on the renderer when destroyed. | |
operator bool () const noexcept | |
Test the status of the RenderTargetGuard. More... | |
RenderTargetGuard (Context &context, Texture &texture) | |
Constructor. More... | |
int | setRenderTarget (Texture &texture) |
Set a new render target without pushing it on the stack. More... | |
Protected Attributes | |
Context & | mContext |
The Context being guarded. | |
bool | popped {false} |
True if the target guard has already been popped off the stack. | |
SDL_Texture * | mLastTexture {nullptr} |
Save the current render target here. | |
int | status {0} |
The return status from the last SDL API call. | |
Store the current render target replacing it with a new render target.
When the object is destroyed (by going out of scope) the old render target is restored.
Constructor.
renderer | The renderer which render target will be managed. |
texture | The texture which will become the new render target. |
|
inlineexplicitnoexcept |
Test the status of the RenderTargetGuard.
The status is good (true is returned) if the status value returned from the last operation on the Context object returned 0.
int rose::gm::RenderTargetGuard::setRenderTarget | ( | Texture & | texture | ) |
Set a new render target without pushing it on the stack.
This may be used when a number of render target changes are needed in a context block. A RenderTargetGuard is created, calls to setRenderTarget are used to manipulate the render target. When the RenderTargetGuard goes out of scope the original render target is restored.
texture |