@overwolf/ow-electron-packages-types 1.1.2-beta.3 → 1.1.2-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/types.d.ts +51 -0
package/package.json
CHANGED
package/types.d.ts
CHANGED
|
@@ -5642,6 +5642,57 @@ interface IOverwolfOverlayApi extends EventEmitter {
|
|
|
5642
5642
|
*/
|
|
5643
5643
|
isHighElevationHelperInstalled?(): Promise<boolean>;
|
|
5644
5644
|
|
|
5645
|
+
/**
|
|
5646
|
+
* Captures the current game frame and saves it to disk.
|
|
5647
|
+
*
|
|
5648
|
+
* Only one screenshot can be in progress at a time. Calling this method
|
|
5649
|
+
* while a previous capture is still pending will reject immediately —
|
|
5650
|
+
* wait for the returned promise to settle before issuing the next call.
|
|
5651
|
+
*
|
|
5652
|
+
* The file extension in `filePath` is normalized automatically: if it does
|
|
5653
|
+
* not already end with `.jpg` or `.bmp` (matching `format`), the correct
|
|
5654
|
+
* extension is appended.
|
|
5655
|
+
*
|
|
5656
|
+
* Internally all backends (D3D9, D3D11, D3D12, Vulkan) capture as BMP
|
|
5657
|
+
* first and transcode to JPEG on demand, ensuring correct colors across
|
|
5658
|
+
* all graphics APIs and formats.
|
|
5659
|
+
*
|
|
5660
|
+
* @param filePath - Absolute path (UTF-8) where the image will be saved.
|
|
5661
|
+
* @param format - Output image format: `'jpg'` or `'bmp'`. Defaults to `'bmp'`.
|
|
5662
|
+
* @returns A promise that resolves with `void` when the file is written.
|
|
5663
|
+
*
|
|
5664
|
+
* @throws `'no active game'` — the overlay is not currently injected into
|
|
5665
|
+
* any game. Wait for the `game-injected` event before calling.
|
|
5666
|
+
* @throws `'screenshot already in progress'` — a previous capture has not
|
|
5667
|
+
* yet completed. Await the previous promise before calling again.
|
|
5668
|
+
* @throws `'no active graphics device'` — the game has no active GPU
|
|
5669
|
+
* device at this moment (e.g. the game window is minimized or in a
|
|
5670
|
+
* device-lost state). Try again once the game is in the foreground.
|
|
5671
|
+
* @throws `'capture failed: <backend>'` — the GPU-side readback failed
|
|
5672
|
+
* (e.g. staging texture creation, memory map, or WIC encode error).
|
|
5673
|
+
*
|
|
5674
|
+
* @example
|
|
5675
|
+
* ```ts
|
|
5676
|
+
* overlay.on('game-injected', () => {
|
|
5677
|
+
* overlay.hotkeys.register(
|
|
5678
|
+
* { name: 'screenshot', keyCode: 'F9', passthrough: false },
|
|
5679
|
+
* async (hotkey, state) => {
|
|
5680
|
+
* if (state !== 'pressed') return;
|
|
5681
|
+
* const ts = new Date().toISOString().replace(/[:.]/g, '-').slice(0, 19);
|
|
5682
|
+
* const filePath = path.join(app.getPath('pictures'), `screenshot_${ts}`);
|
|
5683
|
+
* try {
|
|
5684
|
+
* await overlay.takeScreenshot(filePath, 'jpg');
|
|
5685
|
+
* // file written to filePath + '.jpg'
|
|
5686
|
+
* } catch (err) {
|
|
5687
|
+
* console.error('Screenshot failed:', err.message);
|
|
5688
|
+
* }
|
|
5689
|
+
* }
|
|
5690
|
+
* );
|
|
5691
|
+
* });
|
|
5692
|
+
* ```
|
|
5693
|
+
*/
|
|
5694
|
+
takeScreenshot(filePath: string, format?: 'jpg' | 'bmp'): Promise<void>;
|
|
5695
|
+
|
|
5645
5696
|
/**
|
|
5646
5697
|
* Fires when an internal error occurs within the overlay system.
|
|
5647
5698
|
*/
|