Skip to content

Instantly share code, notes, and snippets.

@tinkerer-red
Created May 24, 2024 01:56
Show Gist options
  • Save tinkerer-red/2f60ce3bbde788574401437819887737 to your computer and use it in GitHub Desktop.
Save tinkerer-red/2f60ce3bbde788574401437819887737 to your computer and use it in GitHub Desktop.
draw_hq_text
function draw_hq_text_ext_transformed(_x,_y,_str,_sep,_width,_xscale,_yscale,_angle) {
//this function will automatically adjust the x, y, width, scakes and sep based on what the gui was scaled to before hand
//this is a drawing function for breaking out of the rescaling the gui layer to the highest possible quality before returning
static _is_browser = (os_browser != browser_not_a_browser);
var _w, _h;
//get the gui measurements
if (_is_browser){
_w = browser_width;
_h = browser_height;
}
else{
_w = window_get_width();
_h = window_get_height();
}
//cache our current width/height
var _pre_w = display_get_gui_width();
var _pre_h = display_get_gui_height();
display_set_gui_size(_w, _h);
var _x_mutator = _w/_pre_w;
var _y_mutator = _h/_pre_h;
draw_hq_text_ext_transformed(
_x*_x_mutator,
_y*_y_mutator,
_str,
(_sep == -1) ? _sep : _sep*_y_mutator,
_width*_x_mutator,
_xscale*_x_mutator,
_yscale*_y_mutator,
_angle
)
display_set_gui_size(_pre_w, _pre_h);
}
function draw_hq_text_ext(_x,_y,_str,_sep,_width) {
//this function will automatically adjust the x, y, width, scakes and sep based on what the gui was scaled to before hand
//this is a drawing function for breaking out of the rescaling the gui layer to the highest possible quality before returning
static _is_browser = (os_browser != browser_not_a_browser);
var _w, _h;
//get the gui measurements
if (_is_browser){
_w = browser_width;
_h = browser_height;
}
else{
_w = window_get_width();
_h = window_get_height();
}
//cache our current width/height
var _pre_w = display_get_gui_width();
var _pre_h = display_get_gui_height();
display_set_gui_size(_w, _h);
var _x_mutator = _w/_pre_w;
var _y_mutator = _h/_pre_h;
draw_text_ext_transformed(
_x*_x_mutator,
_y*_y_mutator,
_str,
(_sep == -1) ? _sep : _sep*_y_mutator,
_width*_x_mutator,
_x_mutator,
_y_mutator,
0
)
display_set_gui_size(_pre_w, _pre_h);
}
function draw_hq_text(_x,_y,_str) {
//this function will automatically adjust the x, y, width, scakes and sep based on what the gui was scaled to before hand
//this is a drawing function for breaking out of the rescaling the gui layer to the highest possible quality before returning
static _is_browser = (os_browser != browser_not_a_browser);
var _w, _h;
//get the gui measurements
if (_is_browser){
_w = browser_width;
_h = browser_height;
}
else{
_w = window_get_width();
_h = window_get_height();
}
//cache our current width/height
var _pre_w = display_get_gui_width();
var _pre_h = display_get_gui_height();
display_set_gui_size(_w, _h);
var _x_mutator = _w/_pre_w;
var _y_mutator = _h/_pre_h;
draw_text_transformed(
_x*_x_mutator,
_y*_y_mutator,
_str,
_x_mutator,
_y_mutator,
0
)
display_set_gui_size(_pre_w, _pre_h);
}
function draw_hq_text_transformed(_x,_y,_str,_x_scale,_y_scale,_angle) {
//this function will automatically adjust the x, y, width, scakes and sep based on what the gui was scaled to before hand
//this is a drawing function for breaking out of the rescaling the gui layer to the highest possible quality before returning
static _is_browser = (os_browser != browser_not_a_browser);
var _w, _h;
//get the gui measurements
if (_is_browser){
_w = browser_width;
_h = browser_height;
}
else{
_w = window_get_width();
_h = window_get_height();
}
//cache our current width/height
var _pre_w = display_get_gui_width();
var _pre_h = display_get_gui_height();
display_set_gui_size(_w, _h);
var _x_mutator = _w/_pre_w;
var _y_mutator = _h/_pre_h;
draw_text_transformed(
_x*_x_mutator,
_y*_y_mutator,
_str,
_x_scale*_x_mutator,
_y_scale*_y_mutator,
_angle
)
display_set_gui_size(_pre_w, _pre_h);
}
function draw_hq_text_outline(_x,_y,_str,_text_color,_text_alpha,_outline_color,_outline_alpha,_xscale,_yscale,_angle) {
//this function will automatically adjust the x, y, width, scakes and sep based on what the gui was scaled to before hand
//this is a drawing function for breaking out of the rescaling the gui layer to the highest possible quality before returning
static _is_browser = (os_browser != browser_not_a_browser);
var _w, _h;
//get the gui measurements
if (_is_browser){
_w = browser_width;
_h = browser_height;
}
else{
_w = window_get_width();
_h = window_get_height();
}
//cache our current width/height
var _pre_w = display_get_gui_width();
var _pre_h = display_get_gui_height();
display_set_gui_size(_w, _h);
var _x_mutator = _w/_pre_w;
var _y_mutator = _h/_pre_h;
// Create the outline
draw_text_transformed_color((_x + 1)*_x_mutator, _y, _str,_xscale*_x_mutator,_yscale*_y_mutator,_angle,_outline_color,_outline_color,_outline_color,_outline_color,_outline_alpha); // Direction: 0
draw_text_transformed_color((_x + 1)*_x_mutator, (_y - 1)*_y_mutator, _str,_xscale*_x_mutator,_yscale*_y_mutator,_angle,_outline_color,_outline_color,_outline_color,_outline_color,_outline_alpha); // Direction: 45
draw_text_transformed_color(_x, (_y - 1)*_y_mutator, _str,_xscale*_x_mutator,_yscale*_y_mutator,_angle,_outline_color,_outline_color,_outline_color,_outline_color,_outline_alpha); // Direction: 90
draw_text_transformed_color((_x - 1)*_x_mutator, (_y - 1)*_y_mutator, _str,_xscale*_x_mutator,_yscale*_y_mutator,_angle,_outline_color,_outline_color,_outline_color,_outline_color,_outline_alpha); // Direction: 135
draw_text_transformed_color((_x - 1)*_x_mutator, _y, _str,_xscale*_x_mutator,_yscale*_y_mutator,_angle,_outline_color,_outline_color,_outline_color,_outline_color,_outline_alpha); // Direction: 180
draw_text_transformed_color((_x - 1)*_x_mutator, (_y + 1)*_y_mutator, _str,_xscale*_x_mutator,_yscale*_y_mutator,_angle,_outline_color,_outline_color,_outline_color,_outline_color,_outline_alpha); // Direction: 225
draw_text_transformed_color(_x, (_y + 1)*_y_mutator, _str,_xscale*_x_mutator,_yscale*_y_mutator,_angle,_outline_color,_outline_color,_outline_color,_outline_color,_outline_alpha); // Direction: 270
draw_text_transformed_color((_x + 1)*_x_mutator, (_y + 1)*_y_mutator, _str,_xscale*_x_mutator,_yscale*_y_mutator,_angle,_outline_color,_outline_color,_outline_color,_outline_color,_outline_alpha); // Direction: 315
// Now create the base text
draw_text_transformed_color(_x*_x_mutator, _y*_y_mutator, _str,_xscale*_x_mutator,_yscale*_y_mutator,_angle,_text_color,_text_color,_text_color,_text_color,_text_alpha);
display_set_gui_size(_pre_w, _pre_h);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment