• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Windows Non-Zooming HUD / Objects

Dan1

Member
Hey everyone!

So I'm getting used to the camera system in GMS2 and I have a question.
At the moment I have a system in which you can scroll across the room and zoom in and out:


My question is:
- How do I create a HUD and separate objects (for menu buttons etc) that exist within the same room on the edge of the screen, that do not scale or zoom with the rest of the room?

Thanks :)
 
Draw them using the Draw GUI event so you don't have to adjust the size or position when you zoom in/out, and when writing the code to check if you are clicking them just make sure you use the GUI coordinates. You can use the point_in_* functions to check if your mouse is in the area where the buttons are drawn.
 

Dan1

Member
Draw them using the Draw GUI event so you don't have to adjust the size or position when you zoom in/out, and when writing the code to check if you are clicking them just make sure you use the GUI coordinates. You can use the point_in_* functions to check if your mouse is in the area where the buttons are drawn.
Okay, I think I see what you're getting at there, but what expressions would I use in the arguments for point_in_...? I can't just use "x-10" for example, how would I point to GUI coordinates?
And also, would this mean that I'd have to use the global mouse event to register the menu clicks?
Thanks for your help! :)
 
L

lord_berto

Guest
Okay, I think I see what you're getting at there, but what expressions would I use in the arguments for point_in_...? I can't just use "x-10" for example, how would I point to GUI coordinates?
And also, would this mean that I'd have to use the global mouse event to register the menu clicks?
Thanks for your help! :)
the gui by default will be the resolution of your game/room. so if your game is 640x480 it will be that size. resizing to bigger resolutions like 2x of ur game will allow for more HD text while maintaining your games pixel style.
you can resize the gui layer to be the size of your monitor too.
if you need to resize, goto the create event of the hud object and specify the size of your gui. using display_set_gui_size(width, height);

and then after that, anytime you refer to the x y position in a draw gui event, it becomes relavent to the size of your gui.

If you draw text at guiWidth/2 it'll draw it in the center.
 

Dan1

Member
If you draw text at guiWidth/2 it'll draw it in the center.
Thanks, I see what you mean with the GUI for the drawing, but then what variables would I call to detect mouse movement and pressing within an object that I've drawn within the GUI?
 
Top