AeThex-Engine-Core/engine/modules/aethex_launcher/aethex_launcher.h
mrpiglr 190b6b2eab
Some checks are pending
Build AeThex Engine / build-windows (push) Waiting to run
Build AeThex Engine / build-linux (push) Waiting to run
Build AeThex Engine / build-macos (push) Waiting to run
Build AeThex Engine / create-release (push) Blocked by required conditions
Deploy Docsify Documentation / build (push) Waiting to run
Deploy Docsify Documentation / deploy (push) Blocked by required conditions
chore: sync local changes to Forgejo
2026-03-13 00:37:06 -07:00

117 lines
3.7 KiB
C++

/**************************************************************************/
/* 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<GameLibrary> game_library;
Ref<DownloadManager> download_manager;
Ref<LauncherStore> store;
Ref<FriendSystem> friend_system;
Ref<LauncherProfile> current_profile;
// Auth state
bool authenticated = false;
String user_id;
String username;
String email;
String avatar_url;
// Config
Ref<ConfigFile> 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<GameLibrary> get_game_library() const;
Ref<DownloadManager> get_download_manager() const;
Ref<LauncherStore> get_store() const;
Ref<FriendSystem> get_friend_system() const;
Ref<LauncherProfile> 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