• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

GameMaker [SOLVED] Change Monitor

Metrollos

Member
While working on multiple screens, I noticed, that I can not find any effective way to change the monitor, where the game will be shown in fullscreen mode.

The only way I figured out was:
  1. change the game to windowed mode
  2. drag the window to the other monitor / use window_set_position() to move the window to the other monitor (does not work in fullscreen)
  3. change the game back to fullscreen mode
The problems are:
  1. Nobody wants to drag the game around in windowed mode every time the game starts.*
  2. Using window_set_position() can not be used effectively, because there is no way to predict the monitor set-up of the user.
My question:
Is there a way to change the used monitor, either through a function of the engine, that I just overlooked, or through some dll?


*
Because the game always starts on the monitor that windows gives the left upper corner the coordinates (0/0)**. In my case, the game always starts on monitor 2, the left upper corner of monitor 1 has the coordinates (-1920/0)**.

**
I got the coordinates through window_get_x() and window_get_y().
 
T

ThePropagation

Guest
Look in the yoyo library, you can probably do it with an extension, I haven't seen one though
 

YellowAfterlife

ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ
Forum Staff
Moderator
If this is strictly for Windows, you can do a big hack that is making your game press Win+Right three times (snap to right side of current screen > snap to left side of next screen > unsnap to center of next screen)
Code:
for (var i = 0; i < 3; i++) {
    keyboard_key_press(0x5B);
    keyboard_key_press(vk_right);
    var m = current_time + 10; while (current_time < m) {}
    keyboard_key_release(0x5B);
    keyboard_key_release(vk_right);
    var m = current_time + 10; while (current_time < m) {}
}
I have functions for measuring screen dimensions in one of my extensions, but not currently for measuring dimensions of secondary screens (you either get dimensions of primary screen or dimensions of all screens combined). I could add something for that if you'd like a less hacky way
 
I

immortalx

Guest
Wait, are you talking about running a compiled game or a game run through the IDE? Because I have no problem running a compiled game to the currently primary display, which all applications do. Through the IDE though, no matter on which monitor the main GMS2 window is located, the game will always run on the primary monitor.
If it is the second case, and you want to have GMS2 on one window and the game running on other, the only current way to do that (except the workaround by YelloAfterlife) is to move the GMS2 window to a secondary monitor. It will stay there and the game will run on the primary.
 

Metrollos

Member
Ok, my question could not be answered, but this is ok. The game will always be started on the main monitor (like the most games). The problem of one of my testers was easily fixed over the windows settings, by setting his main monitor (for some reason, noone was marked as such). Thank you to everyone here, who tried to help me. Have a nice day!
 
Last edited:
Top