draw_text_ext_transformed

Draws a string with custom spacing and scaling.

Syntax:

GML Code Example

draw_text_ext_transformed(x, y, string, sep, w, xscale, yscale, angle);


Argument Description
x The x coordinate of the drawn string.
y The y coordinate of the drawn string.
string The string to draw.
sep The distance in pixels between lines of text.
w The maximum width in pixels of the string before a line break.
xscale The horizontal scale.
yscale The vertical scale.
angle The angle of the text.


Returns: N/A


Description

This function is a combination of the base draw_text function with the draw_text_ext and draw_text_transformed functions, permitting you to scale and rotate text while maintaining a specific line spacing and maximum width per line. Note that the "width" argument is based on a scale of 1, so if the scale is different, this value should be changed proportionally. For example, if the base width for a line break is 300 and you set the scale to 2, then the text will appear wrong, over-running the given width. Instead you should have set the width to 150 to compensate the scaling.


Example:

GML Code Example

draw_set_halign(fa_center);
 draw_set_valign(fa_middle);
 image_angle += 1;
 draw_text_ext_transformed(room_width / 2, room_height / 2, keyboard_string, 10, 300, 2, 2, image_angle);
 

The above code will draw the given text in the middle of the room, with a maximum string length of 300 pixels, a spacing between each line of 10 pixels, spinning round and scaled to twice its original size.





No Examples Submitted

Does this page need better examples? Be the first to Submit

These are page edits suggested by the community. Cast your vote to help improve the manual.

Suggested by /u/PixelatedPope on April 18, 2017

It is recommended you do NOT use this function or any function related to drawing text scaled. It is very likely to introduce distortion into your text that you wouldn't expect (even when scaling to whole numbers).

Instead, use this script:

///draw_text_trasnformed_d3d(x,y,string,xscale,yscale,angle)

var _x=argument[0];
var _y=argument[1];
var _str=argument[2];
var _xscale=argument[3];
var _yscale=argument[4];
var _angle=argument[5];

d3d_transform_set_scaling(_xscale,_yscale,1);
d3d_transform_add_rotation_z(_angle);
d3d_transform_add_translation(_x,_y,0);
draw_text(0,0,_str);
d3d_transform_set_identity();

No Questions Have Been Ask

Do you have a question about this page? Ask it Here