Handle to an owned cursor.
More...
|
void | Destroy () |
| Free a previously-created cursor.
|
|
CursorShared | share () |
| Move this cursor into a CursorShared.
|
|
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< CursorRef > 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.
|
|
- Category:
- Resource
- See also
- CursorRef
◆ Create()
static Cursor SDL::Cursor::Create |
( |
const Uint8 * |
data, |
|
|
const Uint8 * |
mask, |
|
|
const SDL_Point & |
size, |
|
|
const SDL_Point & |
hot |
|
) |
| |
|
inlinestatic |
mask
has to be in MSB (Most Significant Bit) format.
The cursor width (w
) must be a multiple of 8 bits.
The cursor is created in black and white according to the following:
- data=0, mask=1: white
- data=1, mask=1: black
- data=0, mask=0: transparent
- data=1, mask=0: inverted color if possible, black if not.
If you want to have a color cursor, or create your cursor from an SurfaceRef, you should use Cursor.CreateColor(). Alternately, you can hide the cursor and draw your own as part of your game's rendering, but it will be bound to the framerate.
Also, Cursor.CreateSystem() is available, which provides several readily-available system cursors to pick from.
- Parameters
-
data | the color value for each pixel of the cursor. |
mask | the mask value for each pixel of the cursor. |
size | the width and height of the cursor. |
hot | the x position of the cursor hot spot, from the top-left, in the range of 0 to size.x - 1 and 0 to size.y - 1. |
- Returns
- a new cursor with the specified parameters 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
- Cursor.CreateColor
-
Cursor.CreateSystem
-
Cursor.Destroy
-
SetCursor
◆ CreateColor()
static Cursor SDL::Cursor::CreateColor |
( |
SurfaceRef |
surface, |
|
|
const SDL_Point & |
hot |
|
) |
| |
|
inlinestatic |
If this function is passed a surface with alternate representations, the surface will be interpreted as the content to be used for 100% display scale, and the alternate representations will be used for high DPI situations. For example, if the original surface is 32x32, then on a 2x macOS display or 200% display scale on Windows, a 64x64 version of the image will be used, if available. If a matching version of the image isn't available, the closest larger size image will be downscaled to the appropriate size and be used instead, if available. Otherwise, the closest smaller image will be upscaled and be used instead.
- Parameters
-
surface | an SurfaceRef structure representing the cursor image. |
hot | the x position of the cursor hot spot. |
- Returns
- the new cursor 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
- Cursor.Create
-
Cursor.CreateSystem
-
Cursor.Destroy
-
SetCursor
◆ CreateSystem()
- Parameters
-
id | an SystemCursor enum value. |
- Returns
- a cursor 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
- Cursor.Destroy
◆ Destroy()
void SDL::Cursor::Destroy |
( |
| ) |
|
|
inline |
The documentation for this struct was generated from the following file: