• 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!

String with a gamepad input image in it?

DrScoop

Member
Hi there, I noticed in a lot of games, including GameMaker ones, developers use an Image of things like Xbox Controller buttons or Thumbsticks interspersed with a printed string to communicate input instructions. How exactly are they accomplishing this? Are they using a draw_text function for this or something else?
Hope this isn't a repeat topic. Thanks.

(Side question: Does GameMaker have the ability to check whether a controller is an Xbox one vs. a DualShock one built in, or would I have to use something from Steam or something else to check this? Reason being I'd like to switch out Xbox button images for PlayStation buttons if detected.)
 

kburkhart84

Firehammer Games
Hi there, I noticed in a lot of games, including GameMaker ones, developers use an Image of things like Xbox Controller buttons or Thumbsticks interspersed with a printed string to communicate input instructions. How exactly are they accomplishing this? Are they using a draw_text function for this or something else?
Hope this isn't a repeat topic. Thanks.
The easiest way to do this is probably with Scribble. It has this functionality already included.

(Side question: Does GameMaker have the ability to check whether a controller is an Xbox one vs. a DualShock one built in, or would I have to use something from Steam or something else to check this? Reason being I'd like to switch out Xbox button images for PlayStation buttons if detected.)
You can use the get description functions, but I'm not certain how reliable they will be for this.
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
Hi there, I noticed in a lot of games, including GameMaker ones, developers use an Image of things like Xbox Controller buttons or Thumbsticks interspersed with a printed string to communicate input instructions. How exactly are they accomplishing this? Are they using a draw_text function for this or something else?
I feel that just offering you links to someone else's asset doesn't actually answer your question in any way at all... so let's resolve that and actually answer what you asked! Especially as scribble may be "too much" for what you want since it has a LOT if extra functionality which may or may not be required.

GameMaker does NOT have any functionality to embed images into strings. What you see other developers do is simply add spaces into their strings where they want the image to go, then in another line of code they draw the sprite in the position where those spaces are.

As for checking inputs for buttons, a "cheap" method that I use - on WINDOWS - is to simply check the gamepad slot ID. If it's in the slots 0 - 3 then it's an xbox controller, if it's 4 or greater then it's something else, so I use the PS4 icons. If you want a more refined method then you'd have to investigate the return values for gamepad_get_description()...
 
Top