Pixel-Composer/scripts/draw_surface_functions/draw_surface_functions.gml

21 lines
601 B
Text
Raw Normal View History

2022-12-16 09:18:09 +01:00
function draw_surface_align(surface, _x, _y, _s, _halign = fa_left, _valign = fa_top) {
2023-06-13 14:42:06 +02:00
if(!is_surface(surface)) return;
2023-09-08 21:37:36 +02:00
var w = surface_get_width_safe(surface) * _s;
var h = surface_get_height_safe(surface) * _s;
2022-12-16 09:18:09 +01:00
var _sx = _x, _sy = _y;
switch(_halign) {
case fa_left: _sx = _x; break;
case fa_center: _sx = _x - w / 2; break;
case fa_right: _sx = _x - w; break;
}
switch(_valign) {
case fa_top: _sy = _y; break;
case fa_center: _sy = _y - h / 2; break;
case fa_bottom: _sy = _y - h; break;
}
2023-09-09 13:52:16 +02:00
draw_surface_ext_safe(surface, _sx, _sy, _s, _s, 0, c_white, 1);
2022-12-16 09:18:09 +01:00
}