3
\$\begingroup\$

All the rooms in my game have the size of 1280x720, so normally my game runs like this:

enter image description here

When I try to enable fullscreen, none of the game's buttons respond to clicks, but the keyboard still works. So in the initial menu I clicked on the button to go to the settings room (image 1) and nothing happened, but when I typed "c" on my keyboard went to the settings room:

enter image description here

enter image description here

OBS - There is a distortion, but not the view in that image (I had to convert image 3 to jpg, because in png it was over 2MB in size).

I've thought about switching to 1920x1080 and hiding the title bar, but I'd really like to do things the "right way".


EDIT 1 - Another way to enable full screen. (It also does not work)

create event:

window_set_fullscreen(true);

EDIT 2 - By doing a few tests I noticed that when it is in full screen, the clicks behave as if it had a ghost room at the top left of the screen. Like this:

enter image description here

That is, I click the right side of the word music (in blue) and the language changes.

OBS - The buttons in my game are mostly sprites that I mapped and added a global left pressed event.

\$\endgroup\$
15
  • \$\begingroup\$ Not familiar with GameMaker, but is there a chance that you check for clicks based on pixels? Like if click happened between 100 and 200 pixels, music is clicked. If you did that, fullscreen just changes the position of all elements, and for a variety of reasons, its the wrong way of doing things. \$\endgroup\$ Dec 11, 2018 at 10:04
  • \$\begingroup\$ @TomTsagk Correct, I use this artifice so I do not have to create numerous objects to represent the buttons. \$\endgroup\$ Dec 11, 2018 at 21:46
  • \$\begingroup\$ Could you elaborate? Why would you need to create multiple objects? Can't you just check the button's dynamic position instead of static pixels? \$\endgroup\$ Dec 11, 2018 at 23:23
  • \$\begingroup\$ To create a button in GameMaker I see two possibilities: 1 - create an object for each button and add an event for each one. 2 - simply through a single object draw sprites and program clickable locations. I can put a part of the code in the question to explain it better. \$\endgroup\$ Dec 11, 2018 at 23:33
  • 1
    \$\begingroup\$ @TomTsagk The main controls for game maker objects are done via events which are preset conditions checked each frame which you can then either add code to be executed or a series of drag and drop functions. One of these events is “check clicked” or something to that effect. Not sure what “global” refers to but I’ve never gotten that event to work very consistently... ever, and I’ve been using the software for over 7 years. \$\endgroup\$
    – user64742
    Dec 22, 2018 at 6:47

2 Answers 2

0
\$\begingroup\$

You are using the global left press event, which as far as I know does not work in the manner you desire (screen resizing). Use the non-global version.

If that fails then implement your own click detection code and also contact the creators of Game Maker (shoot them an email) because that should be working and did work with rescaling as of version 8.1 which is only 7 years old. There’s no reason for the event functionality to have changed. That’s bedrock level stuff. Change that on purpose and thousands of games will be reporting bugs so I’d certainly expect the non global to work in your case.

\$\endgroup\$
3
  • \$\begingroup\$ Thanks for the answer. I intend to launch the game on Steam before doing anything you suggested. By my calculations on Wednesday having already released the game, I inform you if your answer has solved my problem and milestone as correct. \$\endgroup\$ Dec 22, 2018 at 21:22
  • \$\begingroup\$ You are aware it should take under five minutes to test the fix, right? \$\endgroup\$
    – user64742
    Dec 23, 2018 at 1:00
  • \$\begingroup\$ I'm aware, I've already backed up and I just do not start testing now because I'm trying to convert the game to launch also on Android. \$\endgroup\$ Dec 23, 2018 at 18:15
0
\$\begingroup\$

The way to detect mouse click was as follows (Global Left Pressed):

if(point_in_rectangle(window_mouse_get_x(),window_mouse_get_y(),1250,690,1280,720)){
    game_end();
}

That way it just happened to have a "ghost room" (as I said in the question).

Just change the click logic to the following (Global Left Pressed):

if(mouse_x>=1250 && mouse_x<=1280 && mouse_y>=690 && mouse_y<=720){
    game_end();
}

The problem was exactly how to get the values ​​of X and Y. Because if you use the function point_in_rectangle and use mouse_x/mouse_y instead of window_mouse_get_x/window_mouse_get_y, it works as expected.

Se below (Global Left Pressed):

if(point_in_rectangle(mouse_x,mouse_y,1250,690,1280,720)){
    game_end();
}
\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .