Pixel-Composer/scripts/gamemakerPathBox/gamemakerPathBox.gml

50 lines
1.7 KiB
Text
Raw Normal View History

function gamemakerPathBox(project) : widget() constructor {
self.project = project;
static trigger = function() { }
static drawParam = function(params) {
setParam(params);
return draw(params.x, params.y, params.w, params.h, params.data, params.m);
}
2024-12-11 03:07:22 +01:00
static draw = function(_x, _y, _w, _h, _gmPath, _m) {
x = _x;
y = _y;
w = _w;
h = _h;
if(project.bind_gamemaker == noone) {
2024-12-16 12:03:02 +01:00
if(buttonInstant(THEME.button_def, _x, _y, _w, _h, _m, hover, active) == 2) {
var path = get_open_filename("GameMaker project|*.yyp", ""); key_release();
if(path == "") return noone;
project.attributes.bind_gamemaker_path = path;
project.bind_gamemaker = Binder_Gamemaker(project.attributes.bind_gamemaker_path);
}
draw_sprite_uniform(s_gamemaker, 0, _x + ui(16), _y + _h / 2, 1, COLORS._main_icon, 1);
draw_set_text(f_p2, fa_center, fa_center, COLORS._main_text);
draw_text_add(_x + _w / 2, _y + _h / 2, "Link .yyp");
} else {
var _gm = project.bind_gamemaker;
draw_sprite_stretched(THEME.textbox, 3, _x, _y, _w, _h);
2024-12-16 12:03:02 +01:00
if(buttonInstant(THEME.button_def, _x, _y, ui(32), _h, _m, hover, active, "Refresh project", THEME.refresh_20, 0, COLORS._main_icon) == 2)
_gm.refreshResources();
2024-12-15 12:19:48 +01:00
draw_set_text(f_p2, fa_center, fa_center, COLORS._main_text);
draw_text_add(_x + _w / 2, _y + _h / 2, _gm.projectName);
2024-12-16 12:03:02 +01:00
if(buttonInstant(THEME.button_def, _x + _w - ui(32), _y, ui(32), _h, _m, hover, active, "Disconnect", THEME.cross_12, 0, [ COLORS._main_icon, COLORS._main_value_negative ]) == 2) {
project.attributes.bind_gamemaker_path = "";
project.bind_gamemaker = noone;
}
}
return h;
}
}