CursorSoftware.h 970 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * CursorSoftware.h, part of VCMI engine
  3. *
  4. * Authors: listed in file AUTHORS in main folder
  5. *
  6. * License: GNU General Public License v2.0 or later
  7. * Full text of license available in license.txt file, in main folder
  8. *
  9. */
  10. #pragma once
  11. class CAnimation;
  12. class IImage;
  13. struct SDL_Surface;
  14. struct SDL_Texture;
  15. struct SDL_Cursor;
  16. #include "../../lib/Point.h"
  17. #include "../render/ICursor.h"
  18. class CursorSoftware : public ICursor
  19. {
  20. std::shared_ptr<IImage> cursorImage;
  21. SDL_Texture * cursorTexture;
  22. SDL_Surface * cursorSurface;
  23. Point pos;
  24. Point pivot;
  25. bool needUpdate;
  26. bool visible;
  27. void createTexture(const Point & dimensions);
  28. void updateTexture();
  29. public:
  30. CursorSoftware();
  31. ~CursorSoftware();
  32. void setImage(std::shared_ptr<IImage> image, const Point & pivotOffset) override;
  33. void setCursorPosition( const Point & newPos ) override;
  34. void render() override;
  35. void setVisible( bool on) override;
  36. const Point & getCursorPosition() override;
  37. };