Asset - Extension Draw_Set *free*

ZeDuval

Member
"One Function to set them all, One Function to define them,
One Function to manage them all and in the draw_event bind them"


Draw_Set()
is a combination of the functions draw_set_color(), draw_set_font(), draw_set_alpha(), draw_set_halign() and draw_set_valign() with builtin color-conversion, without restrictions regarding the order or number of arguments.



There are two new functions.
1.) draw_set() is used to SET the values of above mentioned functions, including an extended input for color values. It replaces the single-use-functions and allows for shorter and cleaner code.
2.) cc(), short for ConvertColor, is used to RETURN a color value, for further usage, e.g. image_blend = cc("#FF0000").

Use draw_set() to set the values for color, font, alpha, halign and valign, all at once or one at a time, without restrictions regarding the order or number of arguments.

Multi-argument example:
Code:
draw_set('fn_arial', 0.7, $673AB7, ha.l, va.m);
Sets font to fn_arial, alpha to 0.7, color to purple, halign to left and valign to middle. Use the order of arguments you prefer.

Single-argument example:
Code:
draw_set(0.5);
Sets alpha to 50%. The function knows what to do based on the input.



Use cc() to convert and return colors provided as RGB, HEX or CONSTANT. Example of usage:
Code:
color = cc(255,0,0) or color =  cc("255,0,0") or color =  cc($FF0000) or color = cc("FF0000") or color = cc(red)
You can download it here:

https://marketplace.yoyogames.com/assets/4087/draw_set

In despite of the screenshot, the usage of the predefined c_color constants is NOT supported, use the new color constants instead. e.g. red instead of c_red. Also, fonts must be provided as a string value to the function.
*Tested for following export modules: Windows, HTML5. Does NOT work with the YYG-Compiler right now!
 
Top