IScreenHandler.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. * IScreenHandler.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. VCMI_LIB_NAMESPACE_BEGIN
  12. class Point;
  13. class Rect;
  14. VCMI_LIB_NAMESPACE_END
  15. class Canvas;
  16. class IScreenHandler
  17. {
  18. public:
  19. virtual ~IScreenHandler() = default;
  20. /// Updates window state after fullscreen state has been changed in settings
  21. virtual void onScreenResize() = 0;
  22. /// De-initializes window state
  23. virtual void close() = 0;
  24. /// Fills screen with black color, erasing any existing content
  25. virtual void clearScreen() = 0;
  26. /// Returns canvas that can be used to display objects on screen
  27. virtual Canvas getScreenCanvas() const = 0;
  28. /// Synchronizes internal screen texture. Screen canvas may not be modified during this call
  29. virtual void updateScreenTexture() = 0;
  30. /// Presents screen texture on the screen
  31. virtual void presetScreenTexture() = 0;
  32. /// Returns list of resolutions supported by current screen
  33. virtual std::vector<Point> getSupportedResolutions() const = 0;
  34. /// Returns <min, max> range of possible values for screen scaling percentage
  35. virtual std::tuple<int, int> getSupportedScalingRange() const = 0;
  36. /// Converts provided rect from logical coordinates into coordinates within window, accounting for scaling and viewport
  37. virtual Rect convertLogicalPointsToWindow(const Rect & input) const = 0;
  38. /// Dimensions of render output
  39. virtual Point getRenderResolution() const = 0;
  40. /// Dimensions of logical output. Can be different if scaling is used
  41. virtual Point getLogicalResolution() const = 0;
  42. virtual int getInterfaceScalingPercentage() const = 0;
  43. virtual int getScalingFactor() const = 0;
  44. /// Window has focus
  45. virtual bool hasFocus() = 0;
  46. };