CursorSoftware.h 929 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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 IImage;
  12. struct SDL_Surface;
  13. struct SDL_Texture;
  14. struct SDL_Cursor;
  15. #include "../../lib/Point.h"
  16. #include "../render/ICursor.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 update() override;
  35. void setVisible( bool on) override;
  36. };