steamworks

package module
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 16, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

README

go-steamworks

A Steamworks SDK binding for Go

[!WARNING] 32bit OSes are not supported.

Steamworks SDK version

161

How to use

On Windows, copy one of these files on the working directory:

  • steam_api64.dll (For 64bit. Copy redistribution_bin\win64\steam_api64.dll in the SDK)
package steamapi

import (
	"fmt"
	"os"

	"github.com/happychui/go-steamworks"
	"golang.org/x/text/language"
)

const appID = 480 // Rewrite this

func init() {
	if steamworks.RestartAppIfNecessary(appID) {
		os.Exit(1)
	}
	if err := steamworks.Init(); err != nil {
		panic(fmt.Sprintf("steamworks.Init failed: %v", err))
	}
}

func SystemLang() language.Tag {
	switch steamworks.SteamApps().GetCurrentGameLanguage() {
	case "english":
		return language.English
	case "japanese":
		return language.Japanese
	}
	return language.Und
}

License

All the source code files are licensed under Apache License 2.0.

These binary files are copied from Steamworks SDK's redistribution_bin directory. You must follow Valve Corporation Steamworks SDK Access Agreement for these files:

  • libsteam_api.dylib (copied from redistribution_bin/osx/libsteam_api.dylib)
  • libsteam_api64.so (copied from redistribution_bin/linux64/libsteam_api.so)

Resources

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init() error

func RestartAppIfNecessary

func RestartAppIfNecessary(appID uint32) bool

func RunCallbacks

func RunCallbacks()

Types

type AppId_t

type AppId_t uint32

type CSteamID

type CSteamID uint64

type EFloatingGamepadTextInputMode

type EFloatingGamepadTextInputMode int32
const (
	EFloatingGamepadTextInputMode_ModeSingleLine    EFloatingGamepadTextInputMode = 0
	EFloatingGamepadTextInputMode_ModeMultipleLines EFloatingGamepadTextInputMode = 1
	EFloatingGamepadTextInputMode_ModeEmail         EFloatingGamepadTextInputMode = 2
	EFloatingGamepadTextInputMode_ModeNumeric       EFloatingGamepadTextInputMode = 3
)

type ESteamAPIInitResult

type ESteamAPIInitResult int32
const (
	ESteamAPIInitResult_OK              ESteamAPIInitResult = 0
	ESteamAPIInitResult_FailedGeneric   ESteamAPIInitResult = 1
	ESteamAPIInitResult_NoSteamClient   ESteamAPIInitResult = 2
	ESteamAPIInitResult_VersionMismatch ESteamAPIInitResult = 3
)

type ESteamInputType

type ESteamInputType int32
const (
	ESteamInputType_Unknown              ESteamInputType = 0
	ESteamInputType_SteamController      ESteamInputType = 1
	ESteamInputType_XBox360Controller    ESteamInputType = 2
	ESteamInputType_XBoxOneController    ESteamInputType = 3
	ESteamInputType_GenericXInput        ESteamInputType = 4
	ESteamInputType_PS4Controller        ESteamInputType = 5
	ESteamInputType_AppleMFiController   ESteamInputType = 6 // Unused
	ESteamInputType_AndroidController    ESteamInputType = 7 // Unused
	ESteamInputType_SwitchJoyConPair     ESteamInputType = 8 // Unused
	ESteamInputType_SwitchJoyConSingle   ESteamInputType = 9 // Unused
	ESteamInputType_SwitchProController  ESteamInputType = 10
	ESteamInputType_MobileTouch          ESteamInputType = 11
	ESteamInputType_PS3Controller        ESteamInputType = 12
	ESteamInputType_PS5Controller        ESteamInputType = 13
	ESteamInputType_SteamDeckController  ESteamInputType = 14
	ESteamInputType_Count                ESteamInputType = 15
	ESteamInputType_MaximumPossibleValue ESteamInputType = 255
)

type ISteamApps

type ISteamApps interface {
	BGetDLCDataByIndex(iDLC int) (appID AppId_t, available bool, pchName string, success bool)
	BIsDlcInstalled(appID AppId_t) bool
	GetAppInstallDir(appID AppId_t) string
	GetCurrentGameLanguage() string
	GetDLCCount() int32
}

func SteamApps

func SteamApps() ISteamApps

type ISteamFriends

type ISteamFriends interface {
	GetPersonaName() string
	SetRichPresence(string, string) bool
}

func SteamFriends

func SteamFriends() ISteamFriends

type ISteamInput

type ISteamInput interface {
	GetConnectedControllers() []InputHandle_t
	GetInputTypeForHandle(inputHandle InputHandle_t) ESteamInputType
	Init(bExplicitlyCallRunFrame bool) bool
	RunFrame()
}

func SteamInput

func SteamInput() ISteamInput

type ISteamRemoteStorage

type ISteamRemoteStorage interface {
	FileWrite(file string, data []byte) bool
	FileRead(file string, data []byte) int32
	FileDelete(file string) bool
	GetFileSize(file string) int32
}

func SteamRemoteStorage

func SteamRemoteStorage() ISteamRemoteStorage

type ISteamUser

type ISteamUser interface {
	GetSteamID() CSteamID
}

func SteamUser

func SteamUser() ISteamUser

type ISteamUserStats

type ISteamUserStats interface {
	GetAchievement(name string) (achieved, success bool)
	SetAchievement(name string) bool
	ClearAchievement(name string) bool
	StoreStats() bool
}

func SteamUserStats

func SteamUserStats() ISteamUserStats

type ISteamUtils

type ISteamUtils interface {
	IsOverlayEnabled() bool
	IsSteamRunningOnSteamDeck() bool
	ShowFloatingGamepadTextInput(keyboardMode EFloatingGamepadTextInputMode, textFieldXPosition, textFieldYPosition, textFieldWidth, textFieldHeight int32) bool
}

func SteamUtils

func SteamUtils() ISteamUtils

type InputHandle_t

type InputHandle_t uint64

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL