#pragma once #include #include #include namespace NXKit { struct UIGamepadKey; enum class UIPressType; enum class UIGamepadInputType; class UIApplication { public: static std::shared_ptr shared; UIApplication(); std::shared_ptr delegate; std::weak_ptr keyWindow; void handleEventsIfNeeded(); void handleSDLQuit(); bool isQuitRequested() const { return quitRequested; } void sendEvent(const std::shared_ptr& event) const; // TODO: Need to remove // static GPU_Target* currentRenderer; private: static void onWillEnterForeground(); static void onDidEnterForeground(); static void onWillEnterBackground(); static void onDidEnterBackground(); void handleSDLEvent(SDL_Event e); static UIGamepadKey mapControllerButtonEventToUIGamepadKey(SDL_ControllerButtonEvent event); static std::optional mapControllerAxisEventToUIGamepadKey(SDL_ControllerAxisEvent event); static UIPressType mapGamepadInputToUIPressType(UIGamepadInputType key); bool quitRequested = false; }; }