Game Maker Games, Articles, Tutorials & More

Game Maker Network


Howdy, Guest! Please sign in or register an account.

Print

draw_text_outlined

By Daniel · December 24, 2008

A very customizable function for drawing text with an outline

// draw_text_outlined(x,y,outline,text)

var _x, _y, outline, precision, text, dir_inc, dir, dist_inc, dist;

_x = argument0;
_y = argument1;
outline = argument2;
text = argument3;

// Settings
dprecision = 8; // Directional precision - the number of directions in which the outline is drawn
lprecision = 2; // Longitudinal precision - the number of times the text is drawn in each direction; set at (outline_size/font_thickness) for optimal performance and results

dir_inc = 360 / dprecision;
dist_inc = outline / lprecision;

draw_set_color(c_black);
for (dir = 0; dir < 360; dir += dir_inc)
  for (dist = dist_inc; dist <= outline; dist += dist_inc)
    draw_text(_x+lengthdir_x(dist,dir),_y+lengthdir_y(dist,dir),text);

draw_set_color(c_white);
draw_text(_x,_y,text);

Categories: 2D graphics

Comments

There are no comments to display.

Post a Comment

You must be signed in to post comments.

Advertisement