SampleSelector.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. //
  2. // Copyright (c) 2008-2016 the Urho3D project.
  3. // Copyright (c) 2014-2016, THUNDERBEAST GAMES LLC All rights reserved
  4. //
  5. // Permission is hereby granted, free of charge, to any person obtaining a copy
  6. // of this software and associated documentation files (the "Software"), to deal
  7. // in the Software without restriction, including without limitation the rights
  8. // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  9. // copies of the Software, and to permit persons to whom the Software is
  10. // furnished to do so, subject to the following conditions:
  11. //
  12. // The above copyright notice and this permission notice shall be included in
  13. // all copies or substantial portions of the Software.
  14. //
  15. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20. // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  21. // THE SOFTWARE.
  22. //
  23. #pragma once
  24. #include <Atomic/Core/Object.h>
  25. using namespace Atomic;
  26. class Sample;
  27. /// Sample class, as framework for all samples.
  28. /// - Initialization of the Urho3D engine (in Application class)
  29. /// - Modify engine parameters for windowed mode and to show the class name as title
  30. /// - Create Urho3D logo at screen
  31. /// - Set custom window title and icon
  32. /// - Create Console and Debug HUD, and use F1 and F2 key to toggle them
  33. /// - Toggle rendering options from the keys 1-8
  34. /// - Take screenshot with key 9
  35. /// - Handle Esc key down to hide Console or exit application
  36. /// - Init touch input on mobile platform using screen joysticks (patched for each individual sample)
  37. class SampleSelector : public Object
  38. {
  39. // Enable type information.
  40. ATOMIC_OBJECT(SampleSelector, Object)
  41. public:
  42. /// Construct.
  43. SampleSelector(Context* context);
  44. protected:
  45. private:
  46. /// Handle key down event to process key controls common to all samples.
  47. void HandleKeyDown(StringHash eventType, VariantMap& eventData);
  48. void HandleWidgetEvent(StringHash eventType, VariantMap& eventData);
  49. SharedPtr<Sample> currentSample_;
  50. /// the Renderer subsystem frame the selector was created on
  51. unsigned constructionFrame_;
  52. };