Description
Sales:15
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.
Video:
- 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
draw_self();
// Run
scr_TextFitBox(Text_To_Draw,Text_Auto_Wrap,Text_Max_Scale,Text_halign,Text_valign,Text_Font,Text_Color,Text_allow_different_xyscale,Text_pixel_font);
More info
End User Licence Agreement (EULA).
Age Rating: 4+
Version
GMS1 - Version 1.0.0. Published March 4, 2016
Package contents
Loading, please wait
What is the issue?
Loading, please wait