R
RobotoSkunk
Guest
Hi, how can I make a text adapt its X and Y scale within a limited space? Because I tried to do it and I just can not. What should I do?
Code:
draw_self();
draw_set_halign(fa_center);
draw_set_font(fnt_pixelman);
xt = x+lengthdir_x(15*image_xscale, image_angle+90);
yt = y+lengthdir_y(15*image_yscale, image_angle+90);
if(string_width(tt) > 100){
width -= 0.05;
}
switch(type){
case 0:
draw_text_transformed(xt, yt, string_hash_to_newline(text[1]), image_xscale*width, image_yscale*width, image_angle);
break;
case 1:
draw_text_transformed(xt, yt, string_hash_to_newline(text[2]), image_xscale*width, image_yscale*width, image_angle);
break;
case 2:
draw_text_transformed(xt, yt, string_hash_to_newline(text[3]), image_xscale*width, image_yscale*width, image_angle);
break;
case 3:
draw_text_transformed(xt, yt, string_hash_to_newline(text[8]), image_xscale*width, image_yscale*width, image_angle);
break;
}
draw_set_halign(-1);
draw_set_font(-1);