Pixel-Composer/scripts/draw_surface_functions/draw_surface_functions.gml
2023-06-13 14:42:06 +02:00

21 lines
586 B
Plaintext

function draw_surface_align(surface, _x, _y, _s, _halign = fa_left, _valign = fa_top) {
if(!is_surface(surface)) return;
var w = surface_get_width(surface) * _s;
var h = surface_get_height(surface) * _s;
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;
}
draw_surface_ext(surface, _sx, _sy, _s, _s, 0, c_white, 1);
}