Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

A steamworks implementation for nw.js/electron games

License

NotificationsYou must be signed in to change notification settings

ceifa/steamworks.js

Repository files navigation

Build StatusnpmLicense: MITChat

Steamworks.js

A modern implementation of the Steamworks SDK for HTML/JS and NodeJS based applications.

Why

I usedgreenworks for a long time and it's great, but I gave up for the following reasons.

  • It's not being maintained anymore.
  • It's not up to date.
  • It's not context-aware.
  • You have to build the binaries by yourself.
  • Don't have typescript definitions.
  • The API it's not trustful.
  • The API implement callbacks instead of return flags or promises.
  • I hate C++.

API

conststeamworks=require('steamworks.js')// You can pass an appId, or don't pass anything and use a steam_appid.txt fileconstclient=steamworks.init(480)// Print Steam usernameconsole.log(client.localplayer.getName())// Tries to activate an achievementif(client.achievement.activate('ACHIEVEMENT')){// ...}

You can refer to thedeclarations file to check the API support and get more detailed documentation of each function.

Installation

To use steamworks.js you don't have to build anything, just install it from npm:

$: npm i steamworks.js

Electron

Steamworks.js is a native module and cannot be used by default in the renderer process. To enable the usage of native modules on the renderer process, the following configurations should be made onmain.js:

constmainWindow=newBrowserWindow({// ...webPreferences:{// ...contextIsolation:false,nodeIntegration:true}})

To make the steam overlay working, call theelectronEnableSteamOverlay on the end of yourmain.js file:

require('steamworks.js').electronEnableSteamOverlay()

For the production build, copy the relevant distro files fromsdk/redistributable_bin/{YOUR_DISTRO} into the root of your build. If you are using electron-forge, look for#75.

How to build

Youonly need to build if you are going to change something on steamworks.js code, if you are looking to just consume the library or use it in your game, refer to theinstallation section.

Make sure you have the latestnode.js,Rust andClang. We also needSteam installed and running.

Install dependencies withnpm install and then runnpm run build:debug to build the library.

There is no way to build for all targets easily. The good news is that you don't need to. You can develop and test on your current target, and open a PR. When the code is merged to main, a github action will build for all targets and publish a new version.

Testing Electron

Go to thetest/electron directory. There, you can runnpm install and thennpm start to run the Electron app.

Click "activate overlay" to test the overlay.

About

A steamworks implementation for nw.js/electron games

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Languages


[8]ページ先頭

©2009-2025 Movatter.jp