GM:S 1.4 GUI width is going crazy (?)

Discussion in 'Programming' started by MIchael PS, Jun 11, 2018.

Tags:
  1. MIchael PS

    MIchael PS Member

    Joined:
    Aug 12, 2017
    Posts:
    95
    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!
     
  2. IndianaBones

    IndianaBones Member

    Joined:
    Jul 5, 2016
    Posts:
    2,203
    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 likes this.
  3. MIchael PS

    MIchael PS Member

    Joined:
    Aug 12, 2017
    Posts:
    95
    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)
     
  4. IndianaBones

    IndianaBones Member

    Joined:
    Jul 5, 2016
    Posts:
    2,203
    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?
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice