Handle to an owned renderer.
More...
|
void | Destroy () |
| Destroy the rendering context for a window and free all associated textures.
|
|
RendererShared | share () |
| Move this renderer into a RendererShared.
|
|
constexpr | ResourceUnique (std::nullptr_t=nullptr) |
| Default constructor.
|
|
constexpr | ResourceUnique (base::value_type value, DELETER deleter={}) |
| Constructs from raw type.
|
|
constexpr | ResourceUnique (ResourceUnique &&other) |
| Move constructor.
|
|
| ResourceUnique (const ResourceUnique &other)=delete |
|
constexpr | ResourceUnique (std::nullptr_t=nullptr) |
| Default constructor.
|
|
constexpr | ResourceUnique (base::value_type value, DefaultDeleter< RendererRef > deleter={}) |
| Constructs from raw type.
|
|
constexpr | ResourceUnique (ResourceUnique &&other) |
| Move constructor.
|
|
| ResourceUnique (const ResourceUnique &other)=delete |
|
| ~ResourceUnique () |
| Destructor.
|
|
constexpr ResourceUnique & | operator= (ResourceUnique other) |
| Assignment operator.
|
|
void | reset () |
| Resets the value, destroying the resource if not nullptr.
|
|
RESOURCE | release () |
| Returns reference and reset this.
|
|
constexpr | operator bool () const |
| Check if not null.
|
|
constexpr bool | operator== (const ResourcePtrBase &other) const |
| Comparison.
|
|
constexpr bool | operator== (std::nullptr_t) const |
| Comparison.
|
|
constexpr bool | operator== (std::nullopt_t) const |
| Comparison.
|
|
constexpr reference | operator* () const |
| Gets reference.
|
|
constexpr const reference * | operator-> () const |
| Gets addressable reference.
|
|
constexpr reference * | operator-> () |
| Gets addressable reference.
|
|
reference | get () const |
| Get reference.
|
|
|
using | deleter = DELETER |
| The deleter type.
|
|
using | reference = RESOURCE |
| The reference resource type.
|
|
using | value_type = typename reference::value_type |
| The raw resource type.
|
|
constexpr | ResourceOwnerBase (base::value_type value={}, DELETER deleter={}) |
| Constructs from raw type.
|
|
void | free () |
| Frees resource.
|
|
constexpr | ResourcePtrBase (value_type value={}) |
| Constructs from raw type.
|
|
reference & | get () |
| Get reference.
|
|
◆ Create() [1/2]
◆ Create() [2/2]
If you want a specific renderer, you can specify its name here. A list of available renderers can be obtained by calling GetRenderDriver() multiple times, with indices from 0 to GetNumRenderDrivers()-1. If you don't need a specific renderer, specify nullptr and SDL will attempt to choose the best option for you, based on what is available on the user's system.
If name
is a comma-separated list, SDL will try each name, in the order listed, until one succeeds or all of them fail.
By default the rendering size matches the window size in pixels, but you can call RendererRef.SetLogicalPresentation() to change the content size and scaling options.
- Parameters
-
window | the window where rendering is displayed. |
name | the name of the rendering driver to initialize, or nullptr to let SDL choose one. |
- Returns
- a valid rendering context on success.
- Exceptions
-
- Thread safety:
- This function should only be called on the main thread.
- Since
- This function is available since SDL 3.2.0.
- See also
- Renderer.CreateWithProperties
-
Renderer.CreateSoftware
-
Renderer.Destroy
-
GetNumRenderDrivers
-
GetRenderDriver
-
RendererRef.GetName
◆ CreateSoftware()
Two other API which can be used to create Renderer: Renderer.Create() and CreateWindowAndRenderer(). These can also create a software renderer, but they are intended to be used with an WindowRef as the final destination and not an SurfaceRef.
- Parameters
-
surface | the Surface structure representing the surface where rendering is done. |
- Returns
- a valid rendering context on success.
- Exceptions
-
- Thread safety:
- This function should only be called on the main thread.
- Since
- This function is available since SDL 3.2.0.
- See also
- Renderer.Destroy
◆ CreateWithProperties()
These are the supported properties:
prop::Renderer.CREATE_NAME_STRING
: the name of the rendering driver to use, if a specific one is desired
prop::Renderer.CREATE_WINDOW_POINTER
: the window where rendering is displayed, required if this isn't a software renderer using a surface
prop::Renderer.CREATE_SURFACE_POINTER
: the surface where rendering is displayed, if you want a software renderer without a window
prop::Renderer.CREATE_OUTPUT_COLORSPACE_NUMBER
: an Colorspace value describing the colorspace for output to the display, defaults to COLORSPACE_SRGB. The direct3d11, direct3d12, and metal renderers support COLORSPACE_SRGB_LINEAR, which is a linear color space and supports HDR output. If you select COLORSPACE_SRGB_LINEAR, drawing still uses the sRGB colorspace, but values can go beyond 1.0 and float (linear) format textures can be used for HDR content.
prop::Renderer.CREATE_PRESENT_VSYNC_NUMBER
: non-zero if you want present synchronized with the refresh rate. This property can take any value that is supported by RendererRef.SetVSync() for the renderer.
With the vulkan renderer:
prop::Renderer.CREATE_VULKAN_INSTANCE_POINTER
: the VkInstance to use with the renderer, optional.
prop::Renderer.CREATE_VULKAN_SURFACE_NUMBER
: the VkSurfaceKHR to use with the renderer, optional.
prop::Renderer.CREATE_VULKAN_PHYSICAL_DEVICE_POINTER
: the VkPhysicalDevice to use with the renderer, optional.
prop::Renderer.CREATE_VULKAN_DEVICE_POINTER
: the VkDevice to use with the renderer, optional.
prop::Renderer.CREATE_VULKAN_GRAPHICS_QUEUE_FAMILY_INDEX_NUMBER
: the queue family index used for rendering.
prop::Renderer.CREATE_VULKAN_PRESENT_QUEUE_FAMILY_INDEX_NUMBER
: the queue family index used for presentation.
- Parameters
-
props | the properties to use. |
- Returns
- a valid rendering context on success.
- Exceptions
-
- Thread safety:
- This function should only be called on the main thread.
- Since
- This function is available since SDL 3.2.0.
- See also
- Properties.Create
-
Renderer.Create
-
Renderer.CreateSoftware
-
Renderer.Destroy
-
RendererRef.GetName
◆ Destroy()
void SDL::Renderer::Destroy |
( |
| ) |
|
|
inline |
This should be called before destroying the associated window.
- Thread safety:
- This function should only be called on the main thread.
- Since
- This function is available since SDL 3.2.0.
- See also
- Renderer.Create
The documentation for this struct was generated from the following file: