Add Steam controller input manager and integrate with Steam API
This commit is contained in:
@@ -1,13 +1,34 @@
|
||||
class_name SteamIntegration
|
||||
extends Node
|
||||
|
||||
var app_id: String = "3575090"
|
||||
var app_id: String = "3575090"
|
||||
var is_on_steam_deck: bool = false
|
||||
var is_online: bool = false
|
||||
var has_bought_game: bool = false
|
||||
|
||||
|
||||
func _init() -> void:
|
||||
OS.set_environment("STEAM_APP_ID", app_id)
|
||||
OS.set_environment("STEAM_GAME_ID", app_id)
|
||||
OS.set_environment("SteamAppId", app_id)
|
||||
OS.set_environment("SteamGameId", app_id)
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
pass
|
||||
Steam.steamInit()
|
||||
Steam.enableDeviceCallbacks()
|
||||
SteamControllerInput.init()
|
||||
var is_running := Steam.isSteamRunning()
|
||||
|
||||
if !is_running:
|
||||
print("Steam is not running.")
|
||||
return
|
||||
|
||||
print("Steam is running.")
|
||||
|
||||
is_on_steam_deck = Steam.isSteamRunningOnSteamDeck()
|
||||
is_online = Steam.loggedOn()
|
||||
has_bought_game = Steam.isSubscribed()
|
||||
|
||||
if not has_bought_game:
|
||||
print("You have not bought the game.")
|
||||
get_tree().quit(69)
|
||||
|
Reference in New Issue
Block a user