Jump to content


Photo

Draw Text Shadowed


  • Please log in to reply
No replies to this topic

#1 Rixeno

Rixeno

    The One 'n' Only

  • New Member
  • 513 posts

Posted 31 May 2008 - 12:03 PM

Draw Text Shadowed - Rixeno

What it does:

It does what it's supposed to do, it draws a text with a shadow. With this script you can also call the light source's direction and length to create some-what "dynamic" shadows for a text.

Draw_text_shadow()
/* draw_text_shadow(x,y,string,text_color,shadow_color,shadow_alph
a,shadow_direction,shadow_length)
** Argument(s):
**  argument0   =   x position
**  argument1   =   y position
**  argument2   =   string
**  argument3   =   color of the text
**  argument4   =   color of the shadow
**  argument5   =   alpha of the shadow
**  argument6   =   direction of the cast
**  argument7   =   length of the cast
** Returns: Nothing
*/
var old_color,old_alpha;
old_color=draw_get_color();
old_alpha=draw_get_alpha();
draw_set_color(argument4);
draw_set_alpha(argument5);
draw_text(argument0+lengthdir_x(argument7,argument6),argument1+lengthdir_y(argument7,argument6),argument2);
draw_set_color(argument3);
draw_set_alpha(old_alpha);
draw_text(argument0,argument1,argument2);
draw_set_color(old_color);

Draw_text_shadow_ext()
/* draw_text_shadow_ext(x,y,string,text_color,text_angle,xscale,yscale
,shadow_color,shadow_alpha,shadow_direction,shadow_
length)
** Argument(s):
**  argument0   =   x position
**  argument1   =   y position
**  argument2   =   string
**  argument3   =   color of the text
**  argument4   =   text angle
**  argument5   =   x scale
**  argument6   =   y scale
**  argument7   =   color of the shadow
**  argument8   =   alpha of the shadow
**  argument9   =   direction of the cast
**  argument10  =   length of the cast
** Returns: Nothing
*/
var old_color,old_alpha;
old_color=draw_get_color();
old_alpha=draw_get_alpha();
draw_set_color(argument7);
draw_set_alpha(argument8);
draw_text_transformed(argument0+lengthdir_x(argument10,argument9),argument1+lengthdir_y(argument10,argument9),argument2,argument5,argument6,argument4);
draw_set_color(argument3);
draw_set_alpha(old_alpha);
draw_text_transformed(argument0,argument1,argument2,argument5,argume
nt6,argument4);
draw_set_color(old_color);

It's as simple as that. Credit isn't required, but appreciated. I hope you enjoy it B)
  • 0
Do you need an example? You can PM me a request and I'll try my best.
Creations:
- Extra String Functions - Sprite Chroma Key - String at Position - Word Censor - Draw_Line_Width (Unreg GM6-) - Shadowed Text - Draw N-Gon - PIXEL PERFECT COLLISION ENGINE-