Pixel-Composer/scripts/dialog_management/dialog_management.gml

26 lines
686 B
Plaintext
Raw Normal View History

2022-11-01 03:06:03 +01:00
function dialogCall(_dia, _x = noone, _y = noone, param = {}) {
if(_x == noone) _x = WIN_SW / 2;
if(_y == noone) _y = WIN_SH / 2;
2022-01-13 05:24:03 +01:00
var dia = instance_exists(_dia)? instance_find(_dia, 0) : instance_create_depth(_x, _y, 0, _dia);
dia.x = _x;
dia.y = _y;
2023-01-25 06:49:00 +01:00
dia.xstart = _x;
dia.ystart = _y;
dia.resetPosition();
2022-01-13 05:24:03 +01:00
2022-09-21 06:09:40 +02:00
var args = variable_struct_get_names(param);
for( var i = 0; i < array_length(args); i++ ) {
variable_instance_set(dia, args[i], variable_struct_get(param, args[i]));
}
2023-01-25 06:49:00 +01:00
setFocus(dia.id, "Dialog");
2022-12-10 05:06:01 +01:00
return dia;
}
function menuCall(_x = mouse_mx, _y = mouse_my, menu = []) {
var dia = dialogCall(o_dialog_menubox, _x, _y);
dia.setMenu(menu);
2022-01-13 05:24:03 +01:00
return dia;
}