SceneAndUILoad.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. // Copyright (c) 2008-2023 the Urho3D project
  2. // License: MIT
  3. #pragma once
  4. #include "Sample.h"
  5. namespace Urho3D
  6. {
  7. class Drawable;
  8. class Node;
  9. class Scene;
  10. }
  11. /// Scene & UI load example.
  12. /// This sample demonstrates:
  13. /// - Loading a scene from a file and showing it
  14. /// - Loading a UI layout from a file and showing it
  15. /// - Subscribing to the UI layout's events
  16. class SceneAndUILoad : public Sample
  17. {
  18. URHO3D_OBJECT(SceneAndUILoad, Sample);
  19. public:
  20. /// Construct.
  21. explicit SceneAndUILoad(Context* context);
  22. /// Setup after engine initialization and before running the main loop.
  23. void Start() override;
  24. private:
  25. /// Construct the scene content.
  26. void CreateScene();
  27. /// Construct user interface elements.
  28. void CreateUI();
  29. /// Set up a viewport for displaying the scene.
  30. void SetupViewport();
  31. /// Subscribe to application-wide logic update event.
  32. void SubscribeToEvents();
  33. /// Reads input and moves the camera.
  34. void MoveCamera(float timeStep);
  35. /// Handle the logic update event.
  36. void HandleUpdate(StringHash eventType, VariantMap& eventData);
  37. /// Handle toggle button 1 being pressed.
  38. void ToggleLight1(StringHash eventType, VariantMap& eventData);
  39. /// Handle toggle button 2 being pressed.
  40. void ToggleLight2(StringHash eventType, VariantMap& eventData);
  41. };