From e030694c6c8e3986b999470cd4d1f1fc35efcd93 Mon Sep 17 00:00:00 2001 From: Dan Fabulich Date: Thu, 8 Jun 2023 16:59:13 -0700 Subject: [PATCH 1/2] Add a button to test the overlay --- README.md | 6 ++++++ test/electron/index.html | 1 + test/electron/renderer.js | 6 +++++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 10cfade..81d2aa1 100644 --- a/README.md +++ b/README.md @@ -77,3 +77,9 @@ Make sure you have the latest [node.js](https://nodejs.org/en/), [Rust](https:// 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](./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. diff --git a/test/electron/index.html b/test/electron/index.html index f187a43..56c81a2 100644 --- a/test/electron/index.html +++ b/test/electron/index.html @@ -11,6 +11,7 @@

Your steam name:

+ diff --git a/test/electron/renderer.js b/test/electron/renderer.js index 69c4c8e..f1ef7b2 100644 --- a/test/electron/renderer.js +++ b/test/electron/renderer.js @@ -3,4 +3,8 @@ const steamworks = require('steamworks.js'); const client = steamworks.init(480); const playerName = client.localplayer.getName() -document.getElementById('name').innerText = playerName \ No newline at end of file +document.getElementById('name').innerText = playerName + +document.getElementById('activateOverlay').addEventListener('click', function() { + client.overlay.activateToWebPage('https://www.example.com/') +}) From 72874156aff6962f0b604398fb104a6f302eb823 Mon Sep 17 00:00:00 2001 From: Dan Fabulich Date: Thu, 22 Jun 2023 10:41:36 -0700 Subject: [PATCH 2/2] include headless overlay example --- test/overlay.js | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 test/overlay.js diff --git a/test/overlay.js b/test/overlay.js new file mode 100644 index 0000000..7b30e50 --- /dev/null +++ b/test/overlay.js @@ -0,0 +1,10 @@ +const { init } = require('../index.js') + +const client = init(480) + +/* +This node script is "headless." It has no graphical context into which Steam can inject an overlay. + +Therefore, when you run this script while the Steam app is running, Steam will foreground the Steam app, and display example.com in the Steam app's window. +*/ +client.overlay.activateToWebPage('https://www.example.com/'); \ No newline at end of file