2009-04-15 17:03:31 +03:00
|
|
|
/*
|
2023-02-01 16:42:03 +02:00
|
|
|
* CursorSoftware.h, part of VCMI engine
|
2009-04-15 17:03:31 +03:00
|
|
|
*
|
|
|
|
* Authors: listed in file AUTHORS in main folder
|
|
|
|
*
|
|
|
|
* License: GNU General Public License v2.0 or later
|
|
|
|
* Full text of license available in license.txt file, in main folder
|
|
|
|
*
|
2009-04-16 14:14:13 +03:00
|
|
|
*/
|
2017-07-13 10:26:03 +02:00
|
|
|
#pragma once
|
2023-01-05 19:03:27 +02:00
|
|
|
|
2023-01-05 21:30:54 +02:00
|
|
|
class CAnimation;
|
|
|
|
class IImage;
|
2017-07-13 10:26:03 +02:00
|
|
|
struct SDL_Surface;
|
2018-07-25 00:36:48 +02:00
|
|
|
struct SDL_Texture;
|
2023-01-05 22:13:24 +02:00
|
|
|
struct SDL_Cursor;
|
2023-01-05 19:03:27 +02:00
|
|
|
|
2023-01-18 15:50:52 +02:00
|
|
|
#include "../../lib/Point.h"
|
2023-02-01 20:42:06 +02:00
|
|
|
#include "../render/ICursor.h"
|
2009-04-16 14:14:13 +03:00
|
|
|
|
2023-01-05 22:38:52 +02:00
|
|
|
class CursorSoftware : public ICursor
|
2009-04-16 14:14:13 +03:00
|
|
|
{
|
2023-01-05 21:30:54 +02:00
|
|
|
std::shared_ptr<IImage> cursorImage;
|
|
|
|
|
|
|
|
SDL_Texture * cursorTexture;
|
|
|
|
SDL_Surface * cursorSurface;
|
|
|
|
|
|
|
|
Point pos;
|
|
|
|
Point pivot;
|
2018-07-25 00:36:48 +02:00
|
|
|
bool needUpdate;
|
2023-01-19 18:16:11 +02:00
|
|
|
bool visible;
|
2018-07-25 00:36:48 +02:00
|
|
|
|
2023-01-05 21:30:54 +02:00
|
|
|
void createTexture(const Point & dimensions);
|
|
|
|
void updateTexture();
|
|
|
|
public:
|
|
|
|
CursorSoftware();
|
|
|
|
~CursorSoftware();
|
2016-10-28 12:39:16 +02:00
|
|
|
|
2023-01-05 22:38:52 +02:00
|
|
|
void setImage(std::shared_ptr<IImage> image, const Point & pivotOffset) override;
|
|
|
|
void setCursorPosition( const Point & newPos ) override;
|
|
|
|
void render() override;
|
2023-01-19 18:16:11 +02:00
|
|
|
void setVisible( bool on) override;
|
2023-01-05 21:30:54 +02:00
|
|
|
};
|
2016-10-28 13:03:26 +02:00
|
|
|
|