2023-05-28 20:00:51 +02:00
|
|
|
function line_get_height(font = noone, offset = 0) {
|
2024-03-31 11:10:14 +02:00
|
|
|
INLINE
|
2024-08-06 04:30:00 +02:00
|
|
|
var _f = draw_get_font();
|
|
|
|
|
|
|
|
if(font != noone) draw_set_font(font);
|
|
|
|
var _h = string_height("l") + offset * UI_SCALE;
|
|
|
|
draw_set_font(_f);
|
|
|
|
|
|
|
|
return _h;
|
2022-11-03 11:44:49 +01:00
|
|
|
}
|
|
|
|
|
2023-05-28 20:00:51 +02:00
|
|
|
function line_get_width(txt, font = noone, offset = 0) {
|
2023-03-26 07:13:36 +02:00
|
|
|
var ff = draw_get_font();
|
|
|
|
|
|
|
|
if(font != noone)
|
|
|
|
draw_set_font(font);
|
|
|
|
var ww = string_width(txt) + offset * UI_SCALE;
|
|
|
|
|
|
|
|
draw_set_font(ff);
|
|
|
|
return ww;
|
|
|
|
}
|
|
|
|
|
2023-04-08 20:06:27 +02:00
|
|
|
#region global
|
2024-09-11 11:56:41 +02:00
|
|
|
#macro TEXTBOX_HEIGHT line_get_height(f_p1, 6)
|
2024-09-10 11:48:51 +02:00
|
|
|
#macro BUTTON_HEIGHT line_get_height(f_p1, 12)
|
2024-09-11 09:54:40 +02:00
|
|
|
|
2023-04-16 16:24:17 +02:00
|
|
|
function ui(val) {
|
2023-11-08 08:38:04 +01:00
|
|
|
INLINE
|
2023-12-11 05:45:12 +01:00
|
|
|
return round(val * UI_SCALE);
|
|
|
|
}
|
|
|
|
|
2024-03-23 07:26:11 +01:00
|
|
|
function resetScale(scale, willResize = false) {
|
2024-04-08 07:13:46 +02:00
|
|
|
if(PREFERENCES.display_scaling == scale) return;
|
2023-10-04 11:28:13 +02:00
|
|
|
|
2023-12-11 05:45:12 +01:00
|
|
|
PREFERENCES.display_scaling = scale;
|
2024-04-22 14:13:03 +02:00
|
|
|
resetPanel(false);
|
2023-12-11 05:45:12 +01:00
|
|
|
loadFonts();
|
|
|
|
|
2024-03-23 07:26:11 +01:00
|
|
|
if(willResize) time_source_start(time_source_create(time_source_global, 1, time_source_units_frames, onResize));
|
2023-12-11 05:45:12 +01:00
|
|
|
PREF_SAVE();
|
2023-04-16 16:24:17 +02:00
|
|
|
}
|
2023-04-08 20:06:27 +02:00
|
|
|
#endregion
|