How to Maximize the GUI in GameMaker: Studio - dummies

How to Maximize the GUI in GameMaker: Studio

By Michael Rohde

An important thing to note when configuring your game in GameMaker: Studio for a fixed aspect ratio (or if you’re positioning the application layer manually) is that the graphical user interface (GUI) layer is normally letterboxed along with the application surface.

This makes things very easy to position, as the top-left corner of the GUI layer is the (0,0) position of the application surface and the width and height are scaled by default to fit the application surface, too.

However, this may not be what you want. Fortunately, GameMaker enables you to set the GUI layer to cover the whole window or display, regardless of where the application surface is being drawn, permitting you to override the letterbox effect and draw over the whole area.

Basically, the GUI layer is dealt with apart from the general Draw Events and has its own resolution and positioning, based on the relative position (0,0) of the application surface.

If you choose not to resize the GUI layer, it will be 1:1 with the application surface, but in many games you may want to resize this to better fit heads-up display (HUD) elements, such as virtual keys, ammo count, health status, and so on.

Here’s how to maximize the GUI layer and set it to 1.5 times the size of the View. This procedure uses “The_Application_Surface_Scaling” tutorial. Because of this, you do need to backtrack and remove all the Events from the control Object except for the Keyboard Event as described in the following procedure:

  1. With obj_Control open from the previous sections, right-click each Event one at a time and choose Delete Event.

    Only the Press <Space> Event and Create Event should appear in the Events section.

  2. Click to select the Create Event.

    The Create Event Actions appear in the Actions section.

  3. Double-click the Execute Code Action.

    The code window appears.

  4. Update the code to only show the following:


    This code tells GameMaker to start drawing the GUI layer from the (0,0) position of the display (or game window) rather than the position at which it draws the application surface.

  5. Click the green check mark to save and close the code window.

Now you need to update the Global Game Settings:

  1. From the main menu, choose Resources→Change Global Game Settings.

    The Global Game Settings appear.

  2. Click the Windows tab.

  3. From the left side of the window, click the Graphics tab.

  4. In the Options section, select the Start in Fullscreen Mode check box.

  5. Make sure that Allow the Player to Resize the Game Window is selected.

  6. In the Scaling section, make sure Keep Aspect Ratio is selected.

  7. Directly below the Scaling section, make sure Allow Switching to Fullscreen is selected.

  8. Click OK to save and close the Global Game Settings.

Go ahead and run the game now. The game should start in full-screen mode. To exit full-screen mode, press Alt+Enter. If you resize the window, the game should maintain its aspect ratio. You may also notice that the letterbox effect is back.