51 m_native_cursor(NULL),
52 m_renderbackend(renderbackend),
61 m_native_image_cursor_enabled(false) {
69 if (!SDL_ShowCursor(1)) {
88 if (!SDL_ShowCursor(1)) {
92 else if (SDL_ShowCursor(0)) {
110 if (!SDL_ShowCursor(1)) {
114 else if (SDL_ShowCursor(0)) {
245 return SDL_SYSTEM_CURSOR_ARROW;
247 return SDL_SYSTEM_CURSOR_IBEAM;
249 return SDL_SYSTEM_CURSOR_WAIT;
251 return SDL_SYSTEM_CURSOR_CROSSHAIR;
253 return SDL_SYSTEM_CURSOR_WAITARROW;
255 return SDL_SYSTEM_CURSOR_SIZENWSE;
257 return SDL_SYSTEM_CURSOR_SIZENESW;
259 return SDL_SYSTEM_CURSOR_SIZEWE;
261 return SDL_SYSTEM_CURSOR_SIZENS;
263 return SDL_SYSTEM_CURSOR_SIZEALL;
265 return SDL_SYSTEM_CURSOR_NO;
267 return SDL_SYSTEM_CURSOR_HAND;
274 SDL_Cursor* cursor = SDL_CreateSystemCursor(static_cast<SDL_SystemCursor>(cursor_id));
276 FL_WARN(
_log,
"No cursor matching cursor_id was found.");
279 SDL_SetCursor(cursor);
303 SDL_Cursor* cursor = SDL_CreateColorCursor(
307 if (cursor == NULL) {
309 "\". Falling back to software cursor.");
316 SDL_SetCursor(cursor);
virtual ImagePtr create(IResourceLoader *loader=0)
Creates a blank Image but does not load it immediately.
#define FL_WARN(logger, msg)
Abstract interface for all the renderbackends.
MouseCursorType m_cursor_type
virtual ResourceState getState()
uint32_t getTime() const
Get the time.
MouseCursorType m_drag_type
TimeManager * m_timemanager
Helper class to create log strings out from separate parts Usage: LMsg("some text") << variable << "...
void reset(T *ptr=0)
reset this pointer to a null shared pointer this can be used to lower the reference count of the shar...
virtual void remove(ImagePtr &resource)
Removes an Image from the manager.
static Logger _log(LM_AUDIO)
bool m_native_image_cursor_enabled
int32_t getYShift() const
static RenderBackend * instance()
ImagePtr m_cursor_drag_image
void setDrag(ImagePtr image, int32_t drag_offset_x=0, int32_t drag_offset_y=0)
Sets the current drag image cursor.
AnimationPtr m_cursor_animation
void setNativeCursor(uint32_t cursor_id)
Sets the cursor to a native type.
ImagePtr getFrameByTimestamp(uint32_t timestamp)
Gets the frame image that matches the given timestamp.
SDL_Surface * getSurface()
virtual void copySubimage(uint32_t xoffset, uint32_t yoffset, const ImagePtr &img)
Copies given image into this one with respect to given offsets.
uint32_t getHeight() const
void setNativeImageCursorEnabled(bool native_image_cursor_enabled)
Enables or disables the native image cursor feature.
virtual void draw()
draws cursor on screen
void pushClipArea(const Rect &cliparea, bool clear=true)
Pushes clip area to clip stack Clip areas define which area is drawn on screen.
int32_t getXShift() const
void popClipArea()
Pops clip area from clip stack.
void set(uint32_t cursor_id=0)
Sets the current mouse cursor.
void resetDrag()
Resets the cursor drag type to CURSOR_NONE.
uint32_t getNativeId(uint32_t cursor_id)
To get some consistancy between platforms, this function checks if cursor_id matches any of the value...
bool isSharedImage() const
Returns true if this image shares data with another one.
ImagePtr m_native_cursor_image
AnimationPtr m_cursor_drag_animation
virtual void render(const Rect &rect, uint8_t alpha=255, uint8_t const *rgb=0)=0
Renders itself to the current render target (main screen or attached destination image) at the rectan...
Cursor(RenderBackend *renderbackend)
Constructor.
bool setNativeImageCursor(ImagePtr image)
Sets the SDL cursor to the specified image.
void getPosition(int32_t *x, int32_t *y)
Get the current mouse position.
virtual void renderVertexArrays()=0
Render the Vertex Arrays, only for primitives (points, lines,...)
RenderBackend * m_renderbackend
SDL_Cursor * m_native_cursor
uint32_t getDuration() const
Gets the total duration for the whole animation.
bool isNativeImageCursorEnabled() const
Returns whether cursors set to an image or an animation are drawn natively.
void setPosition(uint32_t x, uint32_t y)
Set the mouse position.
uint32_t getWidth() const