IScreenHandler.h 1.9 KB

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