draw_text_transformed_colour

Draws a string with scaling and colour.

Syntax:

draw_text_transformed_colour(x, y, string, xscale, yscale, angle, c1, c2, c3, c4, alpha);


Argument Description
x The x coordinate of the drawn string.
y The y coordinate of the drawn string.
string The string to draw.
xscale The horizontal scale.
yscale The vertical scale.
angle The angle of the text.
c1 The colour for the top left of the drawn text.
c2 The colour for the top right of the drawn text.
c3 The colour for the bottom right of the drawn text.
c4 The colour for the bottom left of the drawn text.
alpha The alpha for the text.


Returns: N/A


Description

This function is a combination of the base draw_text function with the draw_text_transformed and draw_text_colour functions, permitting you to scale and rotate text as well as colour it with a gradient fill and change its alpha value, ignoring the base alpha and colour settings for drawing.

NOTE: Gradient blending is not available for the HTML5 target unless WebGL is enabled, although you can still set the blending colours and it will blend the font with the first given colour. However all blending in this way creates a duplicate font which is then stored in the cache and used when required, which is far from optimal and if you use multiple colour changes it will slow down your games performance. You can set the font cache size to try and limit this should it be necessary using the function font_set_cache_size.


Example:

draw_set_halign(fa_center);
draw_set_valign(fa_middle);
image_angle += 1;
draw_text_transformed_colour(room_width / 2, room_height / 2, keyboard_string, 2, 2, image_angle, c_red, c_red, c_yellow, c_yellow, 0.5);

The above code will draw the given text in the middle of the room, spinning round and scaled to twice its original size, with a colour gradient going from yellow to red as well as an alpha of 0.5.


Back: Drawing Text
Next: draw_text_ext_transformed_colour
© Copyright YoYo Games Ltd. 2018 All Rights Reserved