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

Legacy GM GUI width is going crazy (?)

MIchael PS

Member
Hello,

Another small problem here,

I have set a view in the room 300 x 300 and its viewport 1200 x 1200.
Then inside player's Draw GUI, I said:

Code:
draw_set_halign(fa_center);

draw_sprite_ext(spr_bullet_sign,0,view_wport[0]-200,100,6,6,0,image_blend,1);
draw_sprite_ext(spr_hp_sign,0,200,100,6,6,0,image_blend,1);

draw_set_halign(fa_left);
But the sprite (both centered) aren't drawn symmetrical.

upload_2018-6-11_12-38-30.png

Why is that happening? Am I doing something wrong? (I mean: of course I'm doing something wrong, so what is it?)

Thank you a lot!
 
draw_set_halign() affects draw_text_ functions.

Your Gui layer will be the same dimension as your viewport in the first room of your game unless you resize the gui.
 

MIchael PS

Member
draw_set_halign() affects draw_text_ functions.

Your Gui layer will be the same dimension as your viewport in the first room of your game unless you resize the gui.
Well... I actually use text as you can see from the pic. but I took it off for the example code I uploaded. I should have taken off that function too.
But, either way that doesn't change the fact that the sprites are drawn incorrectly...
Right?

(Thanks for answering BTW)
 
If you are not resizing the GUI Layer in any way, then it should have the dimensions of 1200x1200.

You can check it by using show_debug_message() and printing out the values for display_get_gui_width() and display_get_gui_height() just to be sure.

Your code is drawing your gui bullets at x position -> view_wport[0]-200, and based on your screen shot its appearing where I would expect.

However, your hp sprites are drawing at x = 200, so I would expect them to appear further to the left within the black bar on your screen shot. So this is a bit odd, there is something else going on that I can't tell from the info above.

Do your gui sprites have their x and y offsets centered?

Have you resized the gui layer? Are all your rooms the same size and view_ports set to the same size as well?
 
Top