Creating a Window

Since we’re built on electron, any window that doesn’t need to be rendered within a game is just an electron BrowserWindow, so you should refer to the Electron docs for creating out-of-game windows.

In-game Windows

To render a window in-game, you’ll need to do the following:

overlay.windows.createWindow(options);

This will return a RenderWindow, read more about them in-depth here.

If you want to render the same window in-game and out-of-game, you’ll need to create the window twice.

Active Game Info

The getActiveGameInfo method returns useful information like if the overlay is connected to the game, the game’s resolution, etc.

overlay.windows.getActiveGameInfo();

Global Window Events

The windows object emits the following **global **events:

Resolution

Listen to when the game changes resolution.

overlay.windows.on("resolution", (width: number, height: number) => {
	// ...
});

Key Down

overlay.windows.on("keyDown", (event: KeyboardKeyEvent) => {
	// ...
});

Key Up

overlay.windows.on("keyUp", (event: KeyboardKeyEvent) => {
	// ...
});

Keyboard Focus

overlay.windows.on("keyboardFocus", (focus: boolean) => {
	// ...
});

Mouse Down

overlay.windows.on("mouseDown", (event: MouseButtonEvent) => {
	// ...
});

Mouse Up

overlay.windows.on("mouseUp", (event: MouseButtonEvent) => {
	// ...
});