WindowSettingsDemo.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. // Copyright (c) 2008-2023 the Urho3D project
  2. // License: MIT
  3. #pragma once
  4. #include "Sample.h"
  5. namespace Urho3D
  6. {
  7. class Window;
  8. class DropDownList;
  9. class CheckBox;
  10. }
  11. /// Demo application for dynamic window settings change.
  12. class WindowSettingsDemo : public Sample
  13. {
  14. URHO3D_OBJECT(WindowSettingsDemo, Sample);
  15. public:
  16. /// Construct.
  17. explicit WindowSettingsDemo(Context* context);
  18. /// Setup after engine initialization and before running the main loop.
  19. void Start() override;
  20. protected:
  21. /// Return XML patch instructions for screen joystick layout for a specific sample app, if any.
  22. String GetScreenJoystickPatchString() const override { return
  23. "<patch>"
  24. " <add sel=\"/element/element[./attribute[@name='Name' and @value='Hat0']]\">"
  25. " <attribute name=\"Is Visible\" value=\"false\" />"
  26. " </add>"
  27. "</patch>";
  28. }
  29. private:
  30. /// Construct the scene content.
  31. void CreateScene();
  32. /// Create window with settings.
  33. void InitSettings();
  34. /// Synchronize settings with current state of the engine.
  35. void SynchronizeSettings();
  36. /// The Window.
  37. Window* window_{};
  38. /// The UI's root UIElement.
  39. UIElement* uiRoot_{};
  40. /// Monitor control.
  41. DropDownList* monitorControl_{};
  42. /// Resolution control.
  43. DropDownList* resolutionControl_{};
  44. /// Fullscreen control.
  45. CheckBox* fullscreenControl_{};
  46. /// Borderless flag control.
  47. CheckBox* borderlessControl_{};
  48. /// Resizable flag control.
  49. CheckBox* resizableControl_{};
  50. /// V-sync flag control.
  51. CheckBox* vsyncControl_{};
  52. /// MSAA control.
  53. DropDownList* multiSampleControl_{};
  54. };