GameMaker (2.3)
Icon

Monitor Utils

CraterHater

You must be logged in to obtain assets

Description

Monitor Utils

This extension adds a number of functions you can use to add multi monitor support to your game (in combination with existing GML functions).

Unfortunately, it only works on Windows for now. I only tested on the latest version of Gamemaker.

mu_get_monitor_count() Gets the number of monitors attached to the device. Example; if you have two extra monitors attached to a laptop this function will return 3. Without any external monitors it will return 1.

mu_get_monitor(window_handle) Returns the monitorID for the monitor the game is currently on. Use window_handle() to get the argument required for this function.

Make sure you check how many monitors there are before getting any data using the functions below. There is no check to see if you are going out of bounds. If you try getting the monitor frequency of monitor number 2 while there is only one monitor the game will just crash!

mu_get_monitor_position_x(monitorID) Makes it much easier to get the x coordinate of a monitor. This resembles the left x coordinate of the monitor.

mu_get_monitor_position_y(monitorID) Makes it much easier to get the y coordinate of a monitor. This resembles the top y coordinate of the monitor.

mu_get_monitor_width(monitorID) Returns the width of the monitor.

mu_get_monitor_height(monitorID) Returns the height of the monitor.

mu_get_monitor_frequency(monitorID) Returns the refresh rate in hertz of the monitor. This replaces the existing display_get_frequency as that function is broken.

Example Use In order to move the game to another monitor. This only works with borderless fullscreen or windowed mode. Get the window out of exclusive fullscreen mode before moving: window_set_position(mu_get_monitor_position_x(target_monitor), mu_get_monitor_position_y(target_monitor));

I hope this is helpful.

End User Licence Agreement (EULA).

Age Rating: 4+

Version

GMS2.3 - Version 1.0.2. Published February 20, 2023

Loading, please wait

Package contents

Loading, please wait

What is the issue?

Loading, please wait