Content of the material
Setting window resolution and position whether it’s in-game or in desktop requires you to first get the user’s current screen resolution.
Detecting screen resolution
Users have two relevant resolutions to consider:
"Screen resolution", which is the operating system’s default desktop resolution, and "game resolution" which is the resolution in which they play their game and can be different from the desktop setting.
Desktop resolution can be detected by using overwolf.utils.getMonitorsList().
Game resolution can be detected by using overwolf.games.getRunningGameInfo(). In addition, it returns also the monitorHandle, which can be used to get the monitor the game runs in.
The GameInfo object sent by the getRunningGameInfo() function has, in addition to the expected
height fields, two more properties called
logicalHeight. These fields return the game’s reported logical pixel dimensions. If your screen is scaled by a DPI factor, you should work with logical sizes, as the regular sizes will wound up being scaled in proportion, while the logical is not DPI aware.
Detecting resolution changes
In order to detect whether a user has changed their resolution:
In-game resolution change – Register to the overwolf.games.onGameInfoUpdated() event to get updated in-game resolution.
Desktop /out-of-game resolution change – There’s no way to detect a change in desktop resolution, you’ll have to check each time your app launches by using getMonitorsList().
Custom resize in Windows
When the upper-right section of the window looks like , your window is now in "resize mode," meaning you can use the mouse cursor to make the window any size you want. To do so, move the cursor to any edge or corner of the window until a double-headed arrow appears. When this arrow appears, click-and-drag to make the window larger or smaller. If this double-headed arrow does not appear, the window cannot be resized.
The animation below shows a double-headed arrow on the bottom, left, and corner of a window and how it resizes a window. To make the window horizontally bigger, move the cursor to the left or right edge of the window until it changes to the double-headed arrow. To make the window vertically bigger, do the same thing at the top or bottom of the window. To resize horizontally and vertically at the same time, use one of the corners of the window.
Post navigationPrevious Previous post: Vivaldi got bookmark icons and multiple instance support
Next Next post: How to move a window using keyboard only in Windows 10 and other versions
How to resize a window using Windows menus
A window can be resized using a series of keyboard shortcuts. Below are the steps for resizing a window only using the keyboard.
- Press Alt+Spacebar to open the window’s menu.
- If the window is maximized, arrow down to Restore and press Enter.
- Press Alt+Spacebar again to open the window menu, arrow down to Size, and press Enter.
- Press the up or down arrow key if you want to resize the window vertically or the left or right arrow key if you want to resize horizontally.
- Once an arrow key is pressed, you can press the same or opposite arrow key to continue resizing the window.