CCursorHandler.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #pragma once
  2. struct SDL_Thread;
  3. class CDefHandler;
  4. struct SDL_Surface;
  5. /*
  6. * CCursorhandler.h, part of VCMI engine
  7. *
  8. * Authors: listed in file AUTHORS in main folder
  9. *
  10. * License: GNU General Public License v2.0 or later
  11. * Full text of license available in license.txt file, in main folder
  12. *
  13. */
  14. namespace ECursor
  15. {
  16. enum ECursorTypes { ADVENTURE, COMBAT, DEFAULT, SPELLBOOK };
  17. enum EBattleCursors { COMBAT_BLOCKED, COMBAT_MOVE, COMBAT_FLY, COMBAT_SHOOT,
  18. COMBAT_HERO, COMBAT_QUERY, COMBAT_POINTER,
  19. //various attack frames
  20. COMBAT_SHOOT_PENALTY = 15, COMBAT_SHOOT_CATAPULT, COMBAT_HEAL,
  21. COMBAT_SACRIFICE, COMBAT_TELEPORT};
  22. }
  23. /// handles mouse cursor
  24. class CCursorHandler
  25. {
  26. public:
  27. int mode, number;
  28. SDL_Surface * help;
  29. SDL_Surface * dndImage;
  30. bool Show;
  31. std::vector<CDefHandler*> cursors;
  32. int xpos, ypos; //position of cursor
  33. void initCursor(); //inits cursorHandler - run only once, it's not memleak-proof (rev 1333)
  34. void cursorMove(const int & x, const int & y); //change cursor's positions to (x, y)
  35. void changeGraphic(const int & type, const int & no); //changes cursor graphic for type type (0 - adventure, 1 - combat, 2 - default, 3 - spellbook) and frame no (not used for type 3)
  36. void dragAndDropCursor (SDL_Surface* image); // Replace cursor with a custom image.
  37. void draw1();
  38. void draw(SDL_Surface *to);
  39. void shiftPos( int &x, int &y );
  40. void draw2();
  41. void hide() { Show=0; };
  42. void show() { Show=1; };
  43. void centerCursor();
  44. ~CCursorHandler();
  45. };