MIT License

项目介绍

ceifa/steamworks.js 是一个托管在 GitHub 上的开源项目,主要使用 Rust 编写,采用 MIT License 许可证,目前获得 638 个 Star、120 次 Fork。

仓库全名
ceifa/steamworks.js
开源许可证
MIT License
Star 数
638
Fork 数
120
未关闭 Issue
52

README 摘要

Steamworks.js A modern implementation of the Steamworks SDK for HTML/JS and NodeJS based applications. Why I used greenworks 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…

完整内容见 GitHub 原始 README 或本页 。

常见问题

steamworks.js 用什么语言开发?

主要使用 Rust 编写,采用 MIT License 许可证,目前有 638 个 Star。

steamworks.js 可以免费商用吗?

仓库采用 MIT License 许可证,可免费使用与修改,商业使用请遵守许可证条款(例如保留版权声明与许可声明)。

如何获取 steamworks.js 的源码?

可以直接克隆仓库:git clone https://github.com/ceifa/steamworks.js.git,默认分支为 main;安装与运行步骤见仓库 README。

steamworks.js 最近还在维护吗?

仓库最近一次更新为 4月8日,当前有 52 个未关闭 Issue;Star 数为 638,可作为社区活跃度的参考。

关于

A steamworks implementation for nw.js/electron games

描述取自 GitHub 官方 API,中文内容由 GitRead 中文社区 编辑团队整理。

简要分析

热度分
888
价值分
417
活跃状态
活跃

语言占比

HTML
JavaScript
Rust
TypeScript

README

Build Status npm License: MIT Chat

Steamworks.js

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

Why

I used greenworks 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

const steamworks = require('steamworks.js')

// You can pass an appId, or don't pass anything and use a steam_appid.txt file
const client = steamworks.init(480)

// Print Steam username
console.log(client.localplayer.getName())

// Tries to activate an achievement
if (client.achievement.activate('ACHIEVEMENT')) {
    // ...
}

You can refer to the declarations 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 on main.js:

const mainWindow = new BrowserWindow({
    // ...
    webPreferences: {
        // ...
        contextIsolation: false,
        nodeIntegration: true
    }
})

To make the steam overlay working, call the electronEnableSteamOverlay on the end of your main.js file:

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

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

How to build

You only 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 the installation section.

Make sure you have the latest node.js, Rust and Clang. We also need Steam installed and running.

Install dependencies with npm install and then run npm 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 the test/electron directory. There, you can run npm install and then npm start to run the Electron app.

Click “activate overlay” to test the overlay.

评论

暂无评论