/**************************************************************************/ /* aethex_launcher.h */ /**************************************************************************/ /* AeThex Engine */ /* https://aethex.dev */ /**************************************************************************/ #ifndef AETHEX_LAUNCHER_H #define AETHEX_LAUNCHER_H #include "core/object/object.h" #include "core/object/ref_counted.h" #include "core/io/config_file.h" #include "data/game_library.h" #include "data/download_manager.h" #include "data/launcher_store.h" #include "data/friend_system.h" #include "data/launcher_profile.h" class AethexLauncher : public Object { GDCLASS(AethexLauncher, Object); private: static AethexLauncher *singleton; // API Configuration String api_base_url = "https://api.aethex.dev"; String supabase_url = ""; String supabase_anon_key = ""; String auth_token = ""; // Sub-systems Ref game_library; Ref download_manager; Ref store; Ref friend_system; Ref current_profile; // Auth state bool authenticated = false; String user_id; String username; String email; String avatar_url; // Config Ref config; String config_path; // Internal methods void _load_config(); void _save_config(); void _load_cached_auth(); Dictionary _make_api_request(const String &p_endpoint, int p_method, const Dictionary &p_data = Dictionary()); protected: static void _bind_methods(); public: static AethexLauncher *get_singleton(); // Initialization void initialize(); void shutdown(); // API Configuration void set_api_base_url(const String &p_url); String get_api_base_url() const; void set_supabase_config(const String &p_url, const String &p_anon_key); // Authentication Error sign_in_with_email(const String &p_email, const String &p_password); Error sign_up_with_email(const String &p_email, const String &p_password, const String &p_username); Error sign_in_with_oauth(const String &p_provider); // google, discord, github void sign_out(); bool is_authenticated() const; void refresh_auth_token(); // OAuth callback handling void handle_oauth_callback(const String &p_code, const String &p_provider); String get_oauth_url(const String &p_provider) const; // User info String get_user_id() const; String get_username() const; String get_email() const; String get_avatar_url() const; String get_auth_token() const; // Sub-systems access Ref get_game_library() const; Ref get_download_manager() const; Ref get_store() const; Ref get_friend_system() const; Ref get_current_profile() const; // Launcher Profile Error fetch_launcher_profile(); Error update_launcher_profile(const Dictionary &p_data); Error create_launcher_profile(const String &p_gamertag); // Quick actions Error launch_game(const String &p_game_id); Error install_game(const String &p_game_id); Error uninstall_game(const String &p_game_id); // Paths String get_games_directory() const; String get_downloads_directory() const; String get_cache_directory() const; void set_games_directory(const String &p_path); AethexLauncher(); ~AethexLauncher(); }; #endif // AETHEX_LAUNCHER_H