1
Fork 0
mirror of https://github.com/redstrate/Astra.git synced 2025-04-22 04:37:46 +00:00
astra/launcher/src/steamapi.cpp
Joshua Goins 16420b7421 Complete rewrite to Kirigami
Giant commit overhauling the interface to use KDE's Kirigami framework,
which is based on Qt Quick. The logic is all but rewritten, allowing
accounts to be separate from profiles.
2023-07-30 08:49:34 -04:00

44 lines
814 B
C++

#include "steamapi.h"
#ifdef ENABLE_STEAM
#include <steam/steam_api.h>
#endif
#include "launchercore.h"
SteamAPI::SteamAPI(LauncherCore &core, QObject *parent)
: QObject(parent)
, core(core)
{
#ifdef ENABLE_STEAM
if (core.isSteam()) {
qputenv("SteamAppId", "39210");
qputenv("SteamGameId", "39210");
if (!SteamAPI_Init())
qDebug() << "Failed to initialize steam api!";
}
#endif
}
void SteamAPI::setLauncherMode(bool isLauncher)
{
#ifdef ENABLE_STEAM
if (core.isSteam()) {
SteamUtils()->SetGameLauncherMode(isLauncher);
}
#endif
}
bool SteamAPI::isDeck() const
{
#ifdef ENABLE_STEAM
if (core.isSteam()) {
return SteamUtils()->IsSteamRunningOnSteamDeck();
} else {
return false;
}
#else
return false;
#endif
}