// Copyright (c) 2008-2023 the Urho3D project // License: MIT #pragma once #include "Sample.h" namespace Urho3D { class Node; class Scene; } /// Urho2D and Physics2D sample. /// This sample demonstrates: /// - Creating both static and moving 2D physics objects to a scene /// - Displaying physics debug geometry class Urho2DPhysics : public Sample { URHO3D_OBJECT(Urho2DPhysics, Sample); public: /// Construct. explicit Urho2DPhysics(Context* context); /// Setup after engine initialization and before running the main loop. void Start() override; protected: /// Return XML patch instructions for screen joystick layout for a specific sample app, if any. String GetScreenJoystickPatchString() const override { return "" " " " Zoom In" " " " " " " " " " " " " " " " Zoom Out" " " " " " " " " " " " " ""; } private: /// Construct the scene content. void CreateScene(); /// Construct an instruction text to the UI. void CreateInstructions(); /// Set up a viewport for displaying the scene. void SetupViewport(); /// Read input and moves the camera. void MoveCamera(float timeStep); /// Subscribe to application-wide logic update events. void SubscribeToEvents(); /// Handle the logic update event. void HandleUpdate(StringHash eventType, VariantMap& eventData); };