|
SDL3pp
A slim C++ wrapper for SDL3
|
A structure representing rendering state. More...
Public Member Functions | |
| constexpr | Renderer (RendererRaw resource) noexcept |
| Constructs from raw Renderer. | |
| constexpr | Renderer (const Renderer &other)=delete |
| Copy constructor. | |
| constexpr | Renderer (Renderer &&other) noexcept |
| Move constructor. | |
| constexpr | Renderer (const RendererRef &other)=delete |
| constexpr | Renderer (RendererRef &&other)=delete |
| Renderer (WindowRef window, StringParam name=nullptr) | |
| Create a 2D rendering context for a window. | |
| Renderer (PropertiesRef props) | |
| Create a 2D rendering context for a window, with the specified properties. | |
| Renderer (SurfaceRef surface) | |
| Create a 2D software rendering context for a surface. | |
| ~Renderer () | |
| Destructor. | |
| constexpr Renderer & | operator= (Renderer &&other) noexcept |
| Assignment operator. | |
| Renderer & | operator= (const Renderer &other)=delete |
| Assignment operator. | |
| void | Destroy () |
| Destroy the rendering context for a window and free all associated textures. | |
| GPUDeviceRef | GetGPUDevice () |
| Return the GPU device used by a renderer. | |
| WindowRef | GetWindow () |
| Get the window associated with a renderer. | |
| const char * | GetName () const |
| Get the name of a renderer. | |
| PropertiesRef | GetProperties () const |
| Get the properties associated with a renderer. | |
| void | GetOutputSize (int *w, int *h) const |
| Get the output size in pixels of a rendering context. | |
| Point | GetOutputSize () const |
| Get the output size in pixels of a rendering context. | |
| void | GetCurrentOutputSize (int *w, int *h) const |
| Get the current output size in pixels of a rendering context. | |
| Point | GetCurrentOutputSize () const |
| Get the current output size in pixels of a rendering context. | |
| Texture | CreateTexture (PixelFormat format, TextureAccess access, const PointRaw &size) |
| Create a texture for a rendering context. | |
| Texture | CreateTextureFromSurface (SurfaceRef surface) |
| Create a texture from an existing surface. | |
| Texture | CreateTextureWithProperties (PropertiesRef props) |
| Create a texture for a rendering context with the specified properties. | |
| void | SetTarget (TextureRef texture) |
| Set a texture as the current rendering target. | |
| void | ResetTarget () |
| Set target texture back to window. | |
| Texture | GetTarget () const |
| Get the current render target. | |
| void | SetLogicalPresentation (const PointRaw &size, RendererLogicalPresentation mode) |
| Set a device-independent resolution and presentation mode for rendering. | |
| void | GetLogicalPresentation (int *w, int *h, RendererLogicalPresentation *mode) const |
| Get device independent resolution and presentation mode for rendering. | |
| void | GetLogicalPresentation (PointRaw *size, RendererLogicalPresentation *mode) |
| Get device independent resolution and presentation mode for rendering. | |
| FRect | GetLogicalPresentationRect () const |
| Get the final presentation rectangle for rendering. | |
| FPoint | RenderCoordinatesFromWindow (const FPointRaw &window_coord) const |
| Get a point in render coordinates when given a point in window coordinates. | |
| FPoint | RenderCoordinatesToWindow (const FPointRaw &coord) const |
| Get a point in window coordinates when given a point in render coordinates. | |
| void | ConvertEventToRenderCoordinates (Event *event) const |
| Convert the coordinates in an event to render coordinates. | |
| void | SetViewport (OptionalRef< const RectRaw > rect) |
| Set the drawing area for rendering on the current target. | |
| void | ResetViewport () |
| Reset the drawing area for rendering to the entire target. | |
| Rect | GetViewport () const |
| Get the drawing area for the current target. | |
| bool | ViewportSet () const |
| Return whether an explicit rectangle was set as the viewport. | |
| Rect | GetSafeArea () const |
| Get the safe area for rendering within the current viewport. | |
| void | SetClipRect (OptionalRef< const RectRaw > rect) |
| Set the clip rectangle for rendering on the specified target. | |
| void | ResetClipRect () |
| Reset the clip rectangle for rendering to the entire render target. | |
| Rect | GetClipRect () const |
| Get the clip rectangle for the current target. | |
| bool | IsClipEnabled () const |
| Get whether clipping is enabled on the given render target. | |
| void | SetScale (const FPointRaw &scale) |
| Set the drawing scale for rendering on the current target. | |
| void | GetScale (float *scaleX, float *scaleY) const |
| Get the drawing scale for the current target. | |
| FPoint | GetScale () const |
| Get the drawing scale for the current target. | |
| void | SetDrawColor (ColorRaw c) |
| Set the color used for drawing operations. | |
| void | SetDrawColorFloat (const FColorRaw &c) |
| Set the color used for drawing operations (Rect, Line and Clear). | |
| void | GetDrawColor (Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a) const |
| Get the color used for drawing operations (Rect, Line and Clear). | |
| Color | GetDrawColor () const |
| Get the color used for drawing operations (Rect, Line and Clear). | |
| void | GetDrawColorFloat (float *r, float *g, float *b, float *a) const |
| Get the color used for drawing operations (Rect, Line and Clear). | |
| FColor | GetDrawColorFloat () const |
| Get the color used for drawing operations (Rect, Line and Clear). | |
| void | SetColorScale (float scale) |
| Set the color scale used for render operations. | |
| float | GetColorScale () const |
| Get the color scale used for render operations. | |
| void | SetDrawBlendMode (BlendMode blendMode) |
| Set the blend mode used for drawing operations (Fill and Line). | |
| BlendMode | GetDrawBlendMode () const |
| Get the blend mode used for drawing operations. | |
| void | RenderClear () |
| Clear the current rendering target with the drawing color. | |
| void | RenderPoint (const FPointRaw &p) |
| Draw a point on the current rendering target at subpixel precision. | |
| void | RenderPoints (SpanRef< const FPointRaw > points) |
| Draw multiple points on the current rendering target at subpixel precision. | |
| void | RenderLine (const FPointRaw &p1, const FPointRaw &p2) |
| Draw a line on the current rendering target at subpixel precision. | |
| void | RenderLines (SpanRef< const FPointRaw > points) |
| Draw a series of connected lines on the current rendering target at subpixel precision. | |
| void | RenderRect (OptionalRef< const FRectRaw > rect) |
| Draw a rectangle on the current rendering target at subpixel precision. | |
| void | RenderRects (SpanRef< const FRectRaw > rects) |
| Draw some number of rectangles on the current rendering target at subpixel precision. | |
| void | RenderFillRect (OptionalRef< const FRectRaw > rect) |
| Fill a rectangle on the current rendering target with the drawing color at subpixel precision. | |
| void | RenderFillRects (SpanRef< const FRectRaw > rects) |
| Fill some number of rectangles on the current rendering target with the drawing color at subpixel precision. | |
| void | RenderTexture (TextureRef texture, OptionalRef< const FRectRaw > srcrect, OptionalRef< const FRectRaw > dstrect) |
| Copy a portion of the texture to the current rendering target at subpixel precision. | |
| void | RenderTextureRotated (TextureRef texture, OptionalRef< const FRectRaw > srcrect, OptionalRef< const FRectRaw > dstrect, double angle, OptionalRef< const FPointRaw > center, FlipMode flip=FlipMode::SDL_FLIP_NONE) |
| Copy a portion of the source texture to the current rendering target, with rotation and flipping, at subpixel precision. | |
| void | RenderTextureAffine (TextureRef texture, OptionalRef< const FRectRaw > srcrect, OptionalRef< const FPointRaw > origin, OptionalRef< const FPointRaw > right, OptionalRef< const FPointRaw > down) |
| Copy a portion of the source texture to the current rendering target, with affine transform, at subpixel precision. | |
| void | RenderTextureTiled (TextureRef texture, OptionalRef< const FRectRaw > srcrect, float scale, OptionalRef< const FRectRaw > dstrect) |
| Tile a portion of the texture to the current rendering target at subpixel precision. | |
| void | RenderTexture9Grid (TextureRef texture, OptionalRef< const FRectRaw > srcrect, float left_width, float right_width, float top_height, float bottom_height, float scale, OptionalRef< const FRectRaw > dstrect) |
| Perform a scaled copy using the 9-grid algorithm to the current rendering target at subpixel precision. | |
| void | RenderTexture9GridTiled (TextureRef texture, const FRectRaw &srcrect, float left_width, float right_width, float top_height, float bottom_height, float scale, const FRectRaw &dstrect, float tileScale) |
| Perform a scaled copy using the 9-grid algorithm to the current rendering target at subpixel precision. | |
| void | RenderGeometry (TextureRef texture, std::span< const Vertex > vertices, std::span< const int > indices={}) |
| Render a list of triangles, optionally using a texture and indices into the vertex array Color and alpha modulation is done per vertex (Texture.SetColorMod and Texture.SetAlphaMod are ignored). | |
| void | RenderGeometryRaw (TextureRef texture, const float *xy, int xy_stride, const FColor *color, int color_stride, const float *uv, int uv_stride, int num_vertices, const void *indices, int num_indices, int size_indices) |
| Render a list of triangles, optionally using a texture and indices into the vertex arrays Color and alpha modulation is done per vertex (Texture.SetColorMod and Texture.SetAlphaMod are ignored). | |
| void | SetRenderTextureAddressMode (TextureAddressMode u_mode, TextureAddressMode v_mode) |
| Set the texture addressing mode used in Renderer.RenderGeometry(). | |
| void | GetRenderTextureAddressMode (TextureAddressMode *u_mode, TextureAddressMode *v_mode) |
| Get the texture addressing mode used in Renderer.RenderGeometry(). | |
| Surface | ReadPixels (OptionalRef< const RectRaw > rect={}) const |
| Read pixels from the current rendering target. | |
| void | Present () |
| Update the screen with any rendering performed since the previous call. | |
| void | Flush () |
| Force the rendering context to flush any pending commands and state. | |
| void * | GetRenderMetalLayer () |
| Get the CAMetalLayer associated with the given Metal renderer. | |
| void * | GetRenderMetalCommandEncoder () |
| Get the Metal command encoder for the current frame. | |
| void | AddVulkanRenderSemaphores (Uint32 wait_stage_mask, Sint64 wait_semaphore, Sint64 signal_semaphore) |
| Add a set of synchronization semaphores for the current frame. | |
| void | SetVSync (int vsync) |
| Toggle VSync of the given renderer. | |
| int | GetVSync () const |
| Get VSync of the given renderer. | |
| void | RenderDebugText (const FPointRaw &p, StringParam str) |
| Draw debug text to an Renderer. | |
| template<class... ARGS> | |
| void | RenderDebugTextFormat (const FPointRaw &p, std::string_view fmt, ARGS... args) |
| Draw debug text to an Renderer. | |
| void | SetDefaultTextureScaleMode (ScaleMode scale_mode) |
| Set default scale mode for new textures for given renderer. | |
| void | GetDefaultTextureScaleMode (ScaleMode *scale_mode) |
| Get default texture scale mode of the given renderer. | |
| GPURenderState | CreateGPURenderState (const GPURenderStateCreateInfo &createinfo) |
| Create custom GPU render state. | |
| void | SetGPURenderState (GPURenderStateRef state) |
| Set custom GPU render state. | |
| constexpr | ResourceBase (RawPointer resource) |
| Constructs from resource pointer. | |
| constexpr | ResourceBase (std::nullptr_t=nullptr) |
| Constructs null/invalid. | |
| Public Member Functions inherited from SDL::ResourceBase< RendererRaw > | |
| constexpr | ResourceBase (RawPointer resource) |
| Constructs from resource pointer. | |
| constexpr | operator bool () const |
| Converts to bool. | |
| constexpr auto | operator<=> (const ResourceBase &other) const=default |
| Comparison. | |
| constexpr RawConstPointer | operator-> () const noexcept |
| member access to underlying resource pointer. | |
| constexpr RawPointer | get () const noexcept |
| Retrieves underlying resource pointer. | |
| constexpr RawPointer | release () noexcept |
| Retrieves underlying resource pointer and clear this. | |
Additional Inherited Members | |
| Public Types inherited from SDL::ResourceBase< RendererRaw > | |
| using | RawPointer |
| The underlying raw pointer type. | |
| using | RawConstPointer |
| The underlying const raw pointer type. | |
A structure representing rendering state.
|
inlineexplicitconstexprnoexcept |
Constructs from raw Renderer.
| resource | a RendererRaw to be wrapped. |
This assumes the ownership, call release() if you need to take back.