CursorSoftware.h 934 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. * CCursorHandler.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. class CursorSoftware : public ICursor
  18. {
  19. std::shared_ptr<IImage> cursorImage;
  20. SDL_Texture * cursorTexture;
  21. SDL_Surface * cursorSurface;
  22. Point pos;
  23. Point pivot;
  24. bool needUpdate;
  25. bool visible;
  26. void createTexture(const Point & dimensions);
  27. void updateTexture();
  28. public:
  29. CursorSoftware();
  30. ~CursorSoftware();
  31. void setImage(std::shared_ptr<IImage> image, const Point & pivotOffset) override;
  32. void setCursorPosition( const Point & newPos ) override;
  33. void render() override;
  34. void setVisible( bool on) override;
  35. };