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

Text Scaling

Discussion in 'Programming' started by Schwiftywaffles, Dec 1, 2019.

  1. Schwiftywaffles

    Schwiftywaffles Member

    Joined:
    Nov 30, 2019
    Posts:
    2
    I'm making a text based choose your own adventure game. I have it so that when F1 is hit my game goes fullscreen, which scales my text and makes it blurry. This is the code for my text boxes and my fullscreen.

    TEXTBOX

    draw event
    Code:
    //draw textbox
    
    draw_rectangle(x-2, y-2, x+boxwidth+2, y+boxheight+2, false);
    draw_sprite (sprite_storytextbox, 0, x,y);
    
    //draw text
    draw_set_font(font_text)
    
    draw_text_ext(x,y, text, stringHeight, boxwidth - (2*xBuffer));
    
    create event
    Code:
    text = "Where you type in what the textbox says "
    
    xBuffer = 10;
    yBuffer = 10;
    
    boxwidth = sprite_get_width (sprite_storytextbox)
    
    stringHeight = string_height(text);
    
    boxheight = sprite_get_height(sprite_storytextbox)
    FULLSCREEN
    key press f1 event

    window_set_fullscreen(!window_get_fullscreen());

    I've tried multiple things and I just can't figure out how to scale it correctly.
     
  2. shortbread

    shortbread Member

    Joined:
    Nov 28, 2019
    Posts:
    6
    Unfortunately all text in GameMaker is bitmap based (as opposed to the vector rendering you would see in most other applications), as such its essentially just a set of sprites.

    To get around this issue you have a couple of options:
    1. Create a couple versions of your font at different sizes, then use the closest one to the size you want. You can additionally try scaling a large font down but the quality of the output can degrade.
    2. Use a custom vector font solution (I remember seeing a couple of implementations online at one point, but can't find them at the moment).
     
    Ido-f likes this.
  3. Rob

    Rob Member

    Joined:
    Jul 12, 2016
    Posts:
    716
    You can always draw the text in the draw_gui layer too
     

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