Legacy GM [SOLVED] user interface bugs when turning off full screen

jobjorgos

Member
Helloa

I designed a user interface for my game and it worked perfect when running in full screen mode, but now when I launch the game in switched screen, the interface is very strange like it is zoomed in.

The size of all rooms in the game are 1024x768.

i tested the game in both 1920x1080 as 1024x768 screen resolution on my laptop, and they had both the same result: everthing looks perfect in full screen, but in switched screen the user interface is too big and zoomed in.

Anything I could do?

I use draw GUE:
Code:
//player ->
draw_sprite_ext(spr_port1,0,21,25,image_xscale*2.0,image_yscale*2.0,image_angle,c_white,image_alpha);

draw_sprite_ext(spr_bar1,0,99,36,image_xscale*2.0,image_yscale*2.0,image_angle,c_white,image_alpha);
draw_text(166,34,global.name);

draw_sprite_ext(spr_bar2,0,99,64,image_xscale*2.0,image_yscale*2.0,image_angle,c_white,image_alpha);
draw_sprite_ext(spr_hp,0,101,67,global.hp/global.maxhp*2,image_yscale*2.0,image_angle,c_white,image_alpha);
draw_sprite_ext(spr_mini_hp,0,101,66,image_xscale*0.9,image_yscale*0.9,image_angle,c_white,image_alpha);

draw_sprite_ext(spr_bar3,0,79,89,image_xscale*2.0,image_yscale*2.0,image_angle,c_white,image_alpha);
draw_text_transformed(100, 90, global.level, 1.0, 1.0, image_angle);
// <-

//enemys ->
//Crixar level 9
if global.enemyframe==21{
    draw_sprite_ext(spr_port23,0,1561,25,image_xscale*2.0,image_yscale*2.0,image_angle,c_white,image_alpha);
   
    draw_sprite_ext(spr_bar1,0,1639,36,image_xscale*2.0,image_yscale*2.0,image_angle,c_white,image_alpha);
    draw_text(1728,34,global.enemyname21);
   
    draw_sprite_ext(spr_bar2,0,1639,64,image_xscale*2.0,image_yscale*2.0,image_angle,c_white,image_alpha);
    draw_sprite_ext(spr_hp,0,1641,67,global.enemyhp21/global.enemymaxhp21*2,image_yscale*2.0,image_angle,c_white,image_alpha);
    draw_sprite_ext(spr_mini_hp,0,1641,66,image_xscale*0.9,image_yscale*0.9,image_angle,c_white,image_alpha);
    draw_sprite_ext(spr_mini_boss,0,1593,23,image_xscale*1.0,image_yscale*1.0,image_angle,c_white,image_alpha);
   
    draw_sprite_ext(spr_bar3,0,1619,89,image_xscale*2.0,image_yscale*2.0,image_angle,c_white,image_alpha);
    draw_text_transformed(1640, 90, global.enemylevel21, 1.0, 1.0, image_angle);
   
    if global.showenemyhp21=true{
        if global.enemyhp21 <=0{
            draw_text(1736,66,'DEAD');
        }else{     
            draw_text(1692,66,"HP: "+string(global.enemyhp21)+"/"+string(global.enemymaxhp21));
        }
    }
}
//and the code continues here with like 1000 more rows
 
Last edited:

jobjorgos

Member
FULLSCREEN USER INTERFACE IN ANY SCREEN RESOLUTION OF MY LAPTOP:

SWITCHED SCREEN USER INTERFACE IN ANY SCREEN RESOLUTION OF MY LAPTOP:

as you can see switched screen cause to zoom in into the user interface which makes the half of it to disappear
 
Last edited:

CloseRange

Member
It's a fairly easy fix (but time consuming)
You need to make a scalier that all drawn things can use so it has the right scale.
I like to consider the 'formula' for a scalier to be: what you want / what it is
so in this case:
we want 1024 but it's scaled at 1920 so let's make a x scalier and a y scalier:
Code:
var sc_x = 1024 / 1920; // xscalier
var sc_y = 768 / 1080; // yscalier
however what we want might be differant depending on the person using it, so we'll replace what we want with window_get_width and height:
Code:
var sc_x = window_get_width() / 1920;

var sc_y = window_get_height() / 1080;
now you might want to know what to actually do with these scaliers. Just use them in your draw sprite's and draw_text's in the xscale and yscale:
Code:
draw_sprite_ext(spr_bar3, 0, image_xscale*2.0*x_sc, image_yscale*2.0*y_sc, image_angle, c_white, image_alpha);
draw_text_transformed(100, 90, global.level, 1.0*x_sc, 1.0*y_sc, image_angle);
NOTE: if you have sprites that arn't drawn with ext or a draw_text that isn't using transformed then you need to make it so they are and use these for the scale values.

Also this will cause the sprites to scale to the same ratio the window scales, but the ratio from 1920x1080 is a differant ratio than 1024x768 so the sprites would be scaled funny (like a circle would turn into an oval)
to get around this you can change both the scaliers to go based off the exact same value:
Code:
var sc_x = 1024 / 1920;
var sc_y = sc_x;
 

RangerX

Member
Are you drawing your HUD on the GUI layer?
If yes, that's why its happening. The GUI layer will stay the same size it was when the game was fullscreen unless your resize it to the window's size.
 

jobjorgos

Member
The GUI layer will stay the same size it was when the game was fullscreen unless your resize it to the window's size.
Oh thanks alot that was indeed the case and the solution!! Didnot except it would be that easy to fix, all I had to use was
Code:
display_set_gui_size(1920, 1080);
Thanks alot for the support

@CloseRange thanks for those usefull information too, it is very usefull
 
Top