GalaxyEggbertApp

Urho3D Application subclass — engine lifecycle entry point.

Overview

GalaxyEggbertApp is the top-level application class. It subclasses Urho3D::Application and is registered as the application entry point via URHO3D_DEFINE_APPLICATION_MAIN(GalaxyEggbertApp) in Program.cpp.

Sources: src/GalaxyEggbert/GalaxyEggbertApp.hpp and .cpp

Class Declaration

class GalaxyEggbertApp : public Urho3D::Application {
    URHO3D_OBJECT(GalaxyEggbertApp, Urho3D::Application);
public:
    explicit GalaxyEggbertApp(Urho3D::Context* context);
    void Setup() override;
    void Start()  override;
    void Stop()   override;
    void GameUpdate(float dt);
    void HandleUpdate(Urho3D::StringHash, Urho3D::VariantMap&);
private:
    std::unique_ptr<GalaxyEggbertGame> game_;
};

Methods

Setup()

Called by Urho3D before engine initialization. Sets engine parameters:

Start()

Called after engine initialization. Creates GalaxyEggbertGame and subscribes to the E_UPDATE event.

HandleUpdate(eventType, eventData)

Event handler for E_UPDATE. Extracts the timestep from eventData[P_TIMESTEP] and calls GameUpdate(dt).

GameUpdate(float dt)

Delegates to game_->Update(dt) if the game object exists.

Stop()

Called on shutdown. Resets game_ (triggers GalaxyEggbertGame::Stop() and save-write).

Ownership

Owns game_ as a std::unique_ptr<GalaxyEggbertGame>. The game is created in Start() and destroyed in Stop().