Legacy GM Fitting the SAME sprite to multiple resolutions.

C

Cole

Guest


The problem is with the draw GUI. Hello! I've never posted here before because I don't want to waste anybody's time with petty questions, so for my first game (as seen above) I tried to solve all issues I had by learning through other sources. However, this one I cannot figure out for the life of me... That box you see is the "text box", and it's important to me that I use that text box instead of drawing a one-shade rectangle for a text box. The first picture depicts how I want it to look (roughly), while the second picture depicts what happens when the game switches to "fullscreen". I plan on allowing the players to switch resolutions, so I want a GUI that works on all resolutions. In resolution change, however, I keep the aspect ration so that never gets distorted. Is there a way to keep the exact sprite I have there in the same screen position within changing resolutions? Thank you for any and all help!
 

kamiyasi

Member
Draw your text box and text that appears in it to a surface, then use draw_surface_stretched using the width and height of the resolution the game is currently set to.
 

Jaqueta

Member
You can use draw_set_gui_size and set the size to your view port or something like that.
Setting to -1 will make them the same size as the application_surface (Default Value)
 
C

Cole

Guest

I figured it out. Thank you guys for the help! Ultimately I drew the sprite to stretch and simply drew text over it, and set boundaries by getting the window with and height.
 
J

jackhigh24

Guest
careful there, someone venting there opinion on social websites like facebook twitter and news papers is classed as a news outlet, someone putting the same in a game will get sued big time.
 
C

Cole

Guest
careful there, someone venting there opinion on social websites like facebook twitter and news papers is classed as a news outlet, someone putting the same in a game will get sued big time.
I'm paraphrasing a meme, which was to test the dialogue box. My game has nothing to do with what you read and it will be deleted from the final version of the game. I doubt I would get sued over a meme in my own words, but thanks for the heads up anyhow.
 
J

jackhigh24

Guest
ye just making sure you don't fall in to the same situation i did when i did something similar, some things are very touchy and no matter how small you are they spot it instantly, only took 16 hours from when i published something to have them threaten legal action if not removed immediately then within hours of that a good telling off from apple and google too, suspended my accounts until they rang me up with warnings i take they didn't want to put in writing.
 

kupo15

Member
I figured it out. Thank you guys for the help! Ultimately I drew the sprite to stretch and simply drew text over it, and set boundaries by getting the window with and height.
Completely unnecessary. It seems like something is wrong with your gui_application_surface size.

If you are using the GUI event then you need to use window_gui_set_size(w,h) to match the size of your window width/height...NOT your actual application surface resolution. So you may have your game set to 720p fullscreen which stretches the graphics to 1080 with a 1080 window size. The GUI should still be set to 1080 settings and not 720. So simply put

window_set_gui_size(window_width(),window_height()) after you set your resolution
 
Last edited:
C

Cole

Guest
Completely unnecessary. It seems like something is wrong with your gui_application_surface size.

If you are using the GUI event then you need to use window_gui_set_size(w,h) to match the size of your window width/height...NOT your actual application surface resolution. So you may have your game set to 720p fullscreen which stretches the graphics to 1080 with a 1080 window size. The GUI should still be set to 1080 settings and not 720. So simply put

window_set_gui_size(window_width(),window_height()) after you set your resolution
Would that help with the other problem I am getting?


The text box is remaining fine during any resolution switch I throw at the game. However, the text is remaining the *same* size, and I would rather the text maintain the same look it had before. Thanks!
 

kupo15

Member
yes it will as long as you are drawing it on the GUI event. Anything that gets drawn to that event maintains its look (size, placement etc...not resolution of course) when you resize the gui layer like I described. And remember when you use the GUI event you don't need any relative view coordinates. Whatever your native resolution is you are dealing with that size and just need to assign the coor from 0,0 to res_w,res_h
 
C

Cole

Guest
yes it will as long as you are drawing it on the GUI event. Anything that gets drawn to that event maintains its look (size, placement etc...) when you resize the gui layer like I described. And remember when you use the GUI event you don't need any relative view coordinates. Whatever your native resolution is you are dealing with that size and just need to assign the coor from 0,0 to res_w,res_h
I would attach more pictures, but they look exactly the same.
display_set_gui_size(width, height); Is what I put in, and it did help maintain a better draw event for the sprite. However, the text is keeping it's original font as far as I can tell. Basically, it is the same length in pixels no matter my window size. Again, thank you so much for the help!
 

kupo15

Member
right display...oops
So its still not quite what you need yet or it is? It won't change the actual font you use but resize it so it will look different because you are resizing it of course.
 
C

Cole

Guest
right display...oops
So its still not quite what you need yet or it is? It won't change the actual font you use but resize it so it will look different because you are resizing it of course.
Unfortunately, no. Your advise on setting the gui was great for drawing the sprite. However, you're correct in that the text remains the same font. However, this means that in a resolution switch it is drawing at the same size it was at 720p in 1080p. Which is not what I want, because it means that there's really small font in a large text box as seen above when the game is in 1080p. Do you know of a way to keep the font the same size relative to the game instead of relative to it's native size? Thank you so much!
 

kupo15

Member
I may have made a mistake. Try not changing your gui size at all but still set it to your native resolution
 
Top