2026-02-02 12:24:50 -08:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "ui/auth_screen.hpp"
|
|
|
|
|
#include "ui/realm_screen.hpp"
|
2026-02-05 14:13:48 -08:00
|
|
|
#include "ui/character_create_screen.hpp"
|
2026-02-02 12:24:50 -08:00
|
|
|
#include "ui/character_screen.hpp"
|
|
|
|
|
#include "ui/game_screen.hpp"
|
`chore(application): extract appearance controller and unify UI flow`
- Refactor UI application architecture: extracted appearance controller into ui_services.hpp + implementation updates
- Update UI components and managers to use new service layer:
- `action_bar_panel`, `auth_screen`, `character_screen`, `chat_panel`, `combat_ui`, `dialog_manager`, `game_screen`, `settings_panel`, `social_panel`, `toast_manager`, `ui_manager`, `window_manager`
- Adjust core application entrypoints:
- application.cpp
- Update component implementations for new controller flow:
- action_bar_panel.cpp, `chat_panel.cpp`, `combat_ui.cpp`, `dialog_manager.cpp`, `game_screen.cpp`, `settings_panel.cpp`, `social_panel.cpp`, `toast_manager.cpp`, `window_manager.cpp`
These staged changes implement a major architectural refactor for UI/appearance controller separation
2026-04-01 20:59:17 +03:00
|
|
|
#include "ui/ui_services.hpp"
|
2026-02-02 12:24:50 -08:00
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
|
|
// Forward declare SDL_Event
|
|
|
|
|
union SDL_Event;
|
|
|
|
|
|
|
|
|
|
namespace wowee {
|
|
|
|
|
|
|
|
|
|
// Forward declarations
|
2026-04-01 20:38:37 +03:00
|
|
|
namespace core { class Window; class AppearanceComposer; enum class AppState; }
|
2026-02-02 12:24:50 -08:00
|
|
|
namespace auth { class AuthHandler; }
|
|
|
|
|
namespace game { class GameHandler; }
|
|
|
|
|
|
|
|
|
|
namespace ui {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* UIManager - Manages all UI screens and ImGui rendering
|
|
|
|
|
*
|
|
|
|
|
* Coordinates screen transitions and rendering based on application state
|
|
|
|
|
*/
|
|
|
|
|
class UIManager {
|
|
|
|
|
public:
|
|
|
|
|
UIManager();
|
|
|
|
|
~UIManager();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Initialize ImGui and UI screens
|
|
|
|
|
* @param window Window instance for ImGui initialization
|
|
|
|
|
*/
|
|
|
|
|
bool initialize(core::Window* window);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Shutdown ImGui and cleanup
|
|
|
|
|
*/
|
|
|
|
|
void shutdown();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Update UI state
|
|
|
|
|
* @param deltaTime Time since last frame in seconds
|
|
|
|
|
*/
|
|
|
|
|
void update(float deltaTime);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Render UI based on current application state
|
|
|
|
|
* @param appState Current application state
|
|
|
|
|
* @param authHandler Authentication handler reference
|
|
|
|
|
* @param gameHandler Game handler reference
|
|
|
|
|
*/
|
|
|
|
|
void render(core::AppState appState, auth::AuthHandler* authHandler, game::GameHandler* gameHandler);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Process SDL event for ImGui
|
|
|
|
|
* @param event SDL event to process
|
|
|
|
|
*/
|
|
|
|
|
void processEvent(const SDL_Event& event);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get screen instances for callback setup
|
|
|
|
|
*/
|
|
|
|
|
AuthScreen& getAuthScreen() { return *authScreen; }
|
|
|
|
|
RealmScreen& getRealmScreen() { return *realmScreen; }
|
2026-02-05 14:13:48 -08:00
|
|
|
CharacterCreateScreen& getCharacterCreateScreen() { return *characterCreateScreen; }
|
2026-02-02 12:24:50 -08:00
|
|
|
CharacterScreen& getCharacterScreen() { return *characterScreen; }
|
|
|
|
|
GameScreen& getGameScreen() { return *gameScreen; }
|
|
|
|
|
|
2026-04-01 20:38:37 +03:00
|
|
|
// Dependency injection forwarding (Phase A singleton breaking)
|
|
|
|
|
void setAppearanceComposer(core::AppearanceComposer* ac) {
|
|
|
|
|
if (gameScreen) gameScreen->setAppearanceComposer(ac);
|
|
|
|
|
}
|
|
|
|
|
|
`chore(application): extract appearance controller and unify UI flow`
- Refactor UI application architecture: extracted appearance controller into ui_services.hpp + implementation updates
- Update UI components and managers to use new service layer:
- `action_bar_panel`, `auth_screen`, `character_screen`, `chat_panel`, `combat_ui`, `dialog_manager`, `game_screen`, `settings_panel`, `social_panel`, `toast_manager`, `ui_manager`, `window_manager`
- Adjust core application entrypoints:
- application.cpp
- Update component implementations for new controller flow:
- action_bar_panel.cpp, `chat_panel.cpp`, `combat_ui.cpp`, `dialog_manager.cpp`, `game_screen.cpp`, `settings_panel.cpp`, `social_panel.cpp`, `toast_manager.cpp`, `window_manager.cpp`
These staged changes implement a major architectural refactor for UI/appearance controller separation
2026-04-01 20:59:17 +03:00
|
|
|
// Section 3.5: UIServices injection (Phase B singleton breaking)
|
|
|
|
|
void setServices(const UIServices& services) {
|
|
|
|
|
services_ = services;
|
|
|
|
|
if (gameScreen) gameScreen->setServices(services);
|
|
|
|
|
if (authScreen) authScreen->setServices(services);
|
|
|
|
|
if (characterScreen) characterScreen->setServices(services);
|
|
|
|
|
}
|
|
|
|
|
const UIServices& getServices() const { return services_; }
|
|
|
|
|
|
2026-02-02 12:24:50 -08:00
|
|
|
private:
|
|
|
|
|
core::Window* window = nullptr;
|
`chore(application): extract appearance controller and unify UI flow`
- Refactor UI application architecture: extracted appearance controller into ui_services.hpp + implementation updates
- Update UI components and managers to use new service layer:
- `action_bar_panel`, `auth_screen`, `character_screen`, `chat_panel`, `combat_ui`, `dialog_manager`, `game_screen`, `settings_panel`, `social_panel`, `toast_manager`, `ui_manager`, `window_manager`
- Adjust core application entrypoints:
- application.cpp
- Update component implementations for new controller flow:
- action_bar_panel.cpp, `chat_panel.cpp`, `combat_ui.cpp`, `dialog_manager.cpp`, `game_screen.cpp`, `settings_panel.cpp`, `social_panel.cpp`, `toast_manager.cpp`, `window_manager.cpp`
These staged changes implement a major architectural refactor for UI/appearance controller separation
2026-04-01 20:59:17 +03:00
|
|
|
UIServices services_; // Section 3.5: Injected services
|
2026-02-02 12:24:50 -08:00
|
|
|
|
|
|
|
|
// UI Screens
|
|
|
|
|
std::unique_ptr<AuthScreen> authScreen;
|
|
|
|
|
std::unique_ptr<RealmScreen> realmScreen;
|
2026-02-05 14:13:48 -08:00
|
|
|
std::unique_ptr<CharacterCreateScreen> characterCreateScreen;
|
2026-02-02 12:24:50 -08:00
|
|
|
std::unique_ptr<CharacterScreen> characterScreen;
|
|
|
|
|
std::unique_ptr<GameScreen> gameScreen;
|
|
|
|
|
|
|
|
|
|
// ImGui state
|
|
|
|
|
bool imguiInitialized = false;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace ui
|
|
|
|
|
} // namespace wowee
|