This commit is contained in:
Tanasart 2024-09-13 14:43:09 +07:00
parent e0c50eb23a
commit 34e70c96a0
11 changed files with 47 additions and 39 deletions

View file

@ -120,10 +120,10 @@ event_inherited();
draw_set_text(font, align, fa_center, clickable? COLORS._main_text : COLORS._main_text_sub);
if(align == fa_center) {
var _xc = _spr? hght + (_dw - hght) / 2 : _dw / 2;
draw_text_cut(_xc, _ly + hght / 2, txt, _dw);
draw_text_add(_xc, _ly + hght / 2, txt);
} else if(align == fa_left)
draw_text_cut(text_pad + _spr * hght, _ly + hght / 2, txt, _dw);
draw_text_add(text_pad + _spr * hght, _ly + hght / 2, txt);
} else if(sprite_exists(txt)) {
draw_sprite_ext(txt, i, _dw / 2, _ly + hght / 2);
@ -159,4 +159,6 @@ event_inherited();
return _h;
});
sc_content.scroll_resize = false;
#endregion

View file

@ -231,4 +231,6 @@ event_inherited();
return _h;
});
sc_content.scroll_resize = false;
#endregion

View file

@ -47,11 +47,8 @@
directory_verify(DIRECTORY);
APP_LOCATION = program_directory;
if(OS == os_macosx)
APP_LOCATION = string_replace(APP_LOCATION, "/Contents/MacOS/", "/Contents/Resources/");
if(string_pos("GameMakerStudio2/Cache/runtimes", APP_LOCATION))
APP_LOCATION = working_directory;
if(OS == os_macosx) APP_LOCATION = string_replace(APP_LOCATION, "/Contents/MacOS/", "/Contents/Resources/");
if(RUN_IDE) APP_LOCATION = "D:/Project/MakhamDev/LTS-PixelComposer/PixelComposer/datafiles/";
print($"===================== WORKING DIRECTORIES =====================\n\t{working_directory}\n\t{DIRECTORY}");
directory_verify($"{DIRECTORY}log");

View file

@ -152,9 +152,10 @@ function draw_text_bbox_cut(bbox, text, scale = 1) {
draw_text_cut(bbox.xc, bbox.yc, text, bbox.w, ss * scale);
}
function draw_text_cut(x, y, str, w, scale = 1) {
function draw_text_cut(x, y, str, w, scale = 1, _add = false) {
INLINE
BLEND_ALPHA_MULP;
if(_add) { BLEND_ADD }
else { BLEND_ALPHA_MULP }
draw_text_transformed(round(x), round(y), string_cut(str, w,, scale), scale, scale, 0);
BLEND_NORMAL;
}

View file

@ -20,7 +20,7 @@
#endregion
#region ======================================================================= MAIN =======================================================================
globalvar OS, DEBUG, THEME, COLOR_KEYS;
globalvar OS, DEBUG, THEME, COLOR_KEYS, RUN_IDE;
globalvar CMD, CMDIN;
globalvar FPS_REAL;
@ -30,6 +30,7 @@
CMD = [];
CMDIN = [];
FPS_REAL = 0;
RUN_IDE = GM_build_type == "run";
DEBUG = false;
THEME = new Theme();

View file

@ -117,6 +117,7 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
];
export_template = new Inspector_Custom_Renderer(function(_x, _y, _w, _m, _hover, _focus) {
var _tx = _x + ui(10);
var _ty = _y;
var _tw = _w - ui(8);
@ -147,7 +148,7 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
case "n" : draw_set_color(COLORS.widget_text_dec_n); break;
case "f" : draw_set_color(COLORS.widget_text_dec_f); break;
case "i" : draw_set_color(COLORS.widget_text_dec_i); break;
case "ext" : draw_set_color(COLORS._main_text_sub); break;
case "ext" : draw_set_color(COLORS._main_text_sub); break;
}
_txt = _txt[1];
@ -172,8 +173,9 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
}
draw_set_alpha(1);
var hh = _th + ui(116);
var hh = _th + ui(16 + 20 * array_length(template_guide));
var _cy = _y + _th + ui(8);
for( var i = 0, n = array_length(template_guide); i < n; i++ ) {
var _yy = _cy + ui(20) * i;

View file

@ -56,9 +56,11 @@ function Node_Image_gif(_x, _y, _group = noone) : Node(_x, _y, _group) construct
newOutput(0, nodeValue_Output("Surface out", self, VALUE_TYPE.surface, noone));
newOutput(1, nodeValue_Output("Path", self, VALUE_TYPE.path, ""))
.setVisible(true, true);
detail = new Inspector_Label("Gif file");
input_display_list = [
["Image", false], 0,
["Image", false], 0, detail,
["Output", false], 2,
["Animation", false], 1, 3, 4, 7,
["Custom Frame Order", false, 5], 6,
@ -77,7 +79,7 @@ function Node_Image_gif(_x, _y, _group = noone) : Node(_x, _y, _group) construct
array_push(attributeEditors, [ "File Watcher", function() { return attributes.file_checker; },
new checkBox(function() { attributes.file_checker = !attributes.file_checker; }) ]);
on_drop_file = function(path) { #region
on_drop_file = function(path) {
inputs[0].setValue(path);
if(updatePaths(path)) {
@ -86,16 +88,16 @@ function Node_Image_gif(_x, _y, _group = noone) : Node(_x, _y, _group) construct
}
return false;
} #endregion
}
insp1UpdateTooltip = __txt("Refresh");
insp1UpdateIcon = [ THEME.refresh_icon, 1, COLORS._main_value_positive ];
static onInspector1Update = function() { #region
static onInspector1Update = function() {
updatePaths(path_get(getInputData(0)));
} #endregion
}
function updatePaths(path = path_current) { #region
function updatePaths(path = path_current) {
if(path == -1) return false;
var ext = string_lower(filename_ext(path));
@ -120,9 +122,9 @@ function Node_Image_gif(_x, _y, _group = noone) : Node(_x, _y, _group) construct
edit_time = max(edit_time, file_get_modify_s(path_current));
return true;
} #endregion
}
static step = function() { #region
static step = function() {
var _arr = getInputData(2);
var _lop = getInputData(3);
var _cus = getInputData(5);
@ -136,6 +138,7 @@ function Node_Image_gif(_x, _y, _group = noone) : Node(_x, _y, _group) construct
surfaces = [];
spr = spr_builder._spr;
//print($"{spr}: {sprite_get_width(spr)}, {sprite_get_height(spr)}");
detail.text = $"{filename_name(path_current)}\n{sprite_get_number(spr)} frames";
triggerRender();
loading = 0;
@ -153,9 +156,9 @@ function Node_Image_gif(_x, _y, _group = noone) : Node(_x, _y, _group) construct
}
}
} #endregion
}
static update = function(frame = CURRENT_FRAME) { #region
static update = function(frame = CURRENT_FRAME) {
var path = path_get(getInputData(0));
if(path_current != path) updatePaths(path);
@ -222,15 +225,15 @@ function Node_Image_gif(_x, _y, _group = noone) : Node(_x, _y, _group) construct
surface_set_shader(_outsurf);
if(_drw) draw_sprite(spr, _frm, 0, 0);
surface_reset_shader();
} #endregion
}
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
if(loading) draw_sprite_ui(THEME.loading, 0, xx + w * _s / 2, yy + h * _s / 2, _s, _s, current_time / 2, COLORS._main_icon, 1);
} #endregion
}
static onDestroy = function() { #region
static onDestroy = function() {
if(sprite_exists(spr)) sprite_flush(spr);
} #endregion
}
static dropPath = function(path) {
if(is_array(path)) path = array_safe_get(path, 0);

View file

@ -631,7 +631,7 @@ function Panel_Inspector() : PanelContent() constructor {
var lby = yy + ui(12);
draw_set_alpha(0.5);
draw_set_text(f_p1, fa_center, fa_center, COLORS._main_text_sub);
draw_text_add(xc, lby, edt);
draw_text(xc, lby, edt);
var lbw = string_width(edt) / 2;
draw_set_color(COLORS._main_text_sub);
@ -658,7 +658,7 @@ function Panel_Inspector() : PanelContent() constructor {
}
draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text);
draw_text_alpha(ui(8), yy + hg / 2, edt[0]);
draw_text(ui(8), yy + hg / 2, edt[0]);
var _param = new widgetParam(wx0, yy, ww, hg, val, {}, _m, x + contentPane.x, y + contentPane.y);
_param.s = hg;
@ -1015,7 +1015,7 @@ function Panel_Inspector() : PanelContent() constructor {
contentPane = new scrollPane(content_w, content_h, function(_y, _m) {
var con_w = contentPane.surface_w - ui(4);
draw_clear_alpha(COLORS.panel_bg_clear, 0);
draw_clear_alpha(COLORS.panel_bg_clear_inner, 1);
if(point_in_rectangle(_m[0], _m[1], 0, 0, con_w, content_h) && mouse_press(mb_left, pFOCUS))
prop_selecting = noone;

View file

@ -667,10 +667,8 @@ function Panel_Menu() : PanelContent() constructor {
if(PROJECT.safeMode) txt += $"[{__txt("SAFE MODE")}] ";
if(PROJECT.readonly) txt += $"[{__txt("READ ONLY")}] ";
txt += PROJECT.path == ""? __txt("Untitled") : filename_name(PROJECT.path);
txt += PROJECT.path == ""? __txt("Untitled.pxc") : filename_name(PROJECT.path);
if(PROJECT.modified) txt += "*";
txt += " - Pixel Composer";
if(DEMO) txt += " DEMO";
var tx0, tx1, tcx;
var ty0, ty1;
@ -705,6 +703,7 @@ function Panel_Menu() : PanelContent() constructor {
if(hori) {
tbx0 = tcx - tw / 2;
tby0 = ty1 / 2 - ui(14);
} else {
tbx0 = tx0;
tby0 = ty0;
@ -732,10 +731,10 @@ function Panel_Menu() : PanelContent() constructor {
}
if(hori) {
draw_set_text(f_p0b, fa_center, fa_center, COLORS._main_text_sub);
draw_set_text(f_p0b, fa_center, fa_center, COLORS._main_text);
draw_text_int(tcx, (ty0 + ty1) / 2, tc);
} else {
draw_set_text(f_p0b, fa_left, fa_center, COLORS._main_text_sub);
draw_set_text(f_p0b, fa_left, fa_center, COLORS._main_text);
draw_text_int(tx0 + ui(8), tby0 + th / 2, tc);
}

View file

@ -156,7 +156,7 @@
#region //////////////////////////////////////////////////////////////////////// PATHS /////////////////////////////////////////////////////////////////////////
PREFERENCES.temp_path = "%DIR%/temp/";
PREFERENCES.ImageMagick_path = "%APP%/imagemagick/";
PREFERENCES.ImageMagick_path = "%APP%/ImageMagick/";
PREFERENCES.webp_path = "%APP%/webp/";
PREFERENCES.gifski_path = "%APP%/gifski/";
PREFERENCES.ffmpeg_path = "%APP%/ffmpeg/";

View file

@ -17,6 +17,7 @@ function scrollPane(_w, _h, ondraw) : widget() constructor {
is_scroll = true;
always_scroll = true;
show_scroll = true;
scroll_resize = true;
scroll_step = 64;
scroll_lock = false;
@ -36,7 +37,7 @@ function scrollPane(_w, _h, ondraw) : widget() constructor {
static resize = function(_w, _h) {
w = _w;
h = _h;
surface_w = _w - ui(12);
surface_w = _w - ui(12) * (is_scroll || scroll_resize);
surface_h = _h;
}
@ -106,7 +107,7 @@ function scrollPane(_w, _h, ondraw) : widget() constructor {
scroll_y_to += pen_scroll_py;
}
if(show_scroll && (abs(content_h) > 0 || always_scroll)) {
if(show_scroll && (abs(content_h) > 0 || (always_scroll && scroll_resize))) {
var _p = PEN_USE && (is_scrolling || point_in_rectangle(x + mx, y + my, x + w - scroll_w - 2, y, x + w, y + surface_h));
scroll_w = lerp_float(scroll_w, _p? 12 : scroll_s, 5);