A downloadable asset pack

Buy Now$1.99 USD or more

Short desc:
Sometimes you want to fit a text in a menu box or area and don't care about the size of the text. You simply want it to fit in that area.

Check the video to get a step by step.

This extension:
This code module let you create a text area and show text in it. The text will always fit in the box.
You can setup:
Text_Auto_Wrap (Long text will auto wrap inside the text area)
Text_Max_Scale (Use a specific scale and the box will try use it, good in big text area with less text)
Text_halign (align text fa_left, fa_center, fa_right inside the box)
Text_valign (align fa_top, fa_middle, fa_bottom inside the box)
Text_Font (-1 to use a global for easy change or specify it)
Text_Color (-1 to use a global for easy change or specify it)
Text_allow_different_xyscale (Scale to fill box left to right, top to bottom)
Text_pixel_font (Will use texture_set_interpolation(false) when draw text)

Code example:
Duplicate the object TextFitBox_Template and change the draw event.

/// Draw text
var Text_To_Draw="My text";
var Text_Auto_Wrap=false; // Wrap text
var Text_Max_Scale=-1; // Will try to hold this scale on the text (-1 to fit in box)
var Text_halign=fa_center; // fa_left fa_center fa_right
var Text_valign=fa_middle; // fa_top fa_middle fa_bottom
var Text_Font=-1; // Set or -1 to get from scr_TextFitBox_DEFAULT_FONT()
var Text_Color=-1; // Set or -1 to get from scr_TextFitBox_DEFAULT_COLOR()
var Text_allow_different_xyscale=false; // fill whole area with text
var Text_pixel_font=false; // set true if you use a pixel font

// Show box

// Run

More information

Published 1 year ago
AuthorThe any Key
Tagsasset, GameMaker, gamemakerstudio


Buy Now$1.99 USD or more

In order to download this asset pack you must purchase it at or above the minimum price of $1.99 USD. You will get access to the following files:

TextFitBox.gmez 38 kB