1. Hello Guest! It's with a heavy heart that we must announce the removal of the Legacy GMC Archive. If you wish to save anything from it, now's the time! Please see this topic for more information.
    Dismiss Notice

Draw and DrawGUI exact same scaling

Discussion in 'Programming' started by streng, Dec 3, 2019.

  1. streng

    streng Member

    Joined:
    Jun 10, 2019
    Posts:
    19
    Hi, is it possible to achieve exactly same scaling on Draw and Draw GUI events?
    Native resolution (first room resolution) is 1024x768

    My code:

    Create:
    Code:
    surface_resize(application_surface, 512, 384)
    display_set_gui_size(1024, 768)
    Draw:
    Code:
    draw_set_valign(fa_center);
    draw_set_halign(fa_middle);
    draw_text(512,384,"Standard Draw");
    Draw GUI:
    Code:
    draw_set_valign(fa_center);
    draw_set_halign(fa_middle);
    draw_text(512,400,"Draw GUI")

    And result is in attached screenshot with name GUI_Not_Scaled.png

    This is the best result as far as i can achieve, but unfortunately, the GUI is still in the native resolution, if I tried to play with resolution of GUI layer, then everything is misplaced and with wrong scaling.

    So my original question. Can I achieve exactly same scaling on draw and DrawGUI events if i change resolution of application surface?

    Thanks for your answers
     

    Attached Files:

  2. IndianaBones

    IndianaBones Member

    Joined:
    Jul 5, 2016
    Posts:
    2,316
  3. Nocturne

    Nocturne Friendly Tyrant Forum Staff Admin

    Joined:
    Apr 13, 2016
    Posts:
    7,045
    That image looks pretty much correct, tbh... You're scaling the app surface but your're not changing the view ports or window size, so the app surface is simply being drawn at the window resolution. All this will do is make the game get drawn at a lower res over a larger area. You need to also set the view port to be the same size as the app surface or the room to be the same size as the app surface if you're not using views. If you set the room to be the same size, then you will need to resize the window on game start so it's larger and everything is stretched to fit.
     

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