diff --git a/objects/o_dialog_panel/Draw_75.gml b/objects/o_dialog_panel/Draw_75.gml new file mode 100644 index 000000000..2a099ce1b --- /dev/null +++ b/objects/o_dialog_panel/Draw_75.gml @@ -0,0 +1 @@ +/// @description diff --git a/scripts/node_string_regex_replace601/node_string_regex_replace601.gml b/scripts/node_string_regex_replace601/node_string_regex_replace601.gml new file mode 100644 index 000000000..5bc390814 --- /dev/null +++ b/scripts/node_string_regex_replace601/node_string_regex_replace601.gml @@ -0,0 +1,3 @@ +function node_string_regex_replace601(){ + +} \ No newline at end of file diff --git a/scripts/node_string_regex_search600/node_string_regex_search600.gml b/scripts/node_string_regex_search600/node_string_regex_search600.gml new file mode 100644 index 000000000..a53e34103 --- /dev/null +++ b/scripts/node_string_regex_search600/node_string_regex_search600.gml @@ -0,0 +1,3 @@ +function node_string_regex_search600(){ + +} \ No newline at end of file diff --git a/scripts/panel_color/panel_color.gml b/scripts/panel_color/panel_color.gml new file mode 100644 index 000000000..17baef708 --- /dev/null +++ b/scripts/panel_color/panel_color.gml @@ -0,0 +1,173 @@ +enum COLOR_SELECTOR_MODE { + hue, + value +} + +function Panel_Color() : PanelContent() constructor { + title = "Color"; + showHeader = false; + title_height = 64; + padding = 24; + + w = ui(320); + h = ui(320); + + mode = COLOR_SELECTOR_MODE.hue; + + hue = 1; + sat = 1; + val = 1; + color = c_black; + + drag_con = false; + drag_sel = false; + + colors = []; + + static setColor = function(color) { + self.color = color; + hue = color_get_hue(color) / 255; + sat = color_get_saturation(color) / 255; + val = color_get_value(color) / 255; + } + + static setHSV = function(h = hue, s = sat, v = val) { + hue = h; + sat = s; + val = v; + + color = make_color_hsv(h * 255, s * 255, v * 255); + } + setHSV(); + + function drawContent(panel) { + PANEL_PADDING + PANEL_TITLE + + var px = ui(padding); + var py = ui(title_height); + var pw = w - ui(padding + padding); + var ph = h - ui(title_height + padding); + + draw_sprite_stretched(THEME.ui_panel_bg, !in_dialog, px - ui(8), py - ui(8), pw + ui(16), ph + ui(16)); + + var cont_x = ui(padding); + var cont_y = ui(title_height); + var cont_w = w - ui(padding + padding + ui(16 + 8)); + var cont_h = h - ui(title_height + padding + ui(24 + 8)); + + shader_set(sh_color_select_content); + shader_set_i("mode", mode); + shader_set_f("hue", hue); + shader_set_f("val", val); + draw_sprite_stretched(s_fx_pixel, 0, cont_x, cont_y, cont_w, cont_h); + + var sel_x = cont_x + cont_w + ui(8); + var sel_y = ui(title_height); + var sel_w = ui(16); + var sel_h = cont_h; + + shader_set(sh_color_select_side); + shader_set_i("mode", mode); + shader_set_f("hue", hue); + draw_sprite_stretched(s_fx_pixel, 0, sel_x, sel_y, sel_w, sel_h); + shader_reset(); + + if(drag_con) { + if(mode == 0) { + sat = clamp((mx - cont_x) / cont_w, 0, 1); + val = 1 - clamp((my - cont_y) / cont_h, 0, 1); + } else if(mode == 1) { + hue = clamp((mx - cont_x) / cont_w, 0, 1); + sat = 1 - clamp((my - cont_y) / cont_h, 0, 1); + } + + setHSV(); + + if(mouse_release(mb_left)) + drag_con = false; + } + + if(drag_sel) { + if(mode == 0) + hue = clamp((my - sel_y) / sel_h, 0, 1); + else if(mode == 1) + val = 1 - clamp((my - sel_y) / sel_h, 0, 1); + + setHSV(); + + if(mouse_release(mb_left)) + drag_sel = false; + } + + if(mouse_press(mb_left, pFOCUS)) { + if(point_in_rectangle(mx, my, cont_x, cont_y, cont_x + cont_w, cont_y + cont_h)) + drag_con = true; + + if(point_in_rectangle(mx, my, sel_x, sel_y, sel_x + sel_w, sel_y + sel_h)) + drag_sel = true; + } + + if(mode == 0) { + var hy = sel_y + hue * sel_h; + var cx = cont_x + sat * cont_w - ui(6); + var cy = cont_y + (1 - val) * cont_h - ui(6); + draw_sprite_stretched_ext(s_ui_base_white, 0, sel_x - ui(3), hy - ui(6), ui(16 + 6), ui(10), make_color_hsv(hue * 255, 255, 255), 1); + draw_sprite_stretched_ext(s_ui_base_white, 0, cx, cy, ui(12), ui(12), color, 1); + } else if(mode == 1) { + var vy = sel_y + (1 - val) * sel_h; + var cx = cont_x + hue * cont_w - ui(6); + var cy = cont_y + (1 - sat) * cont_h - ui(6); + draw_sprite_stretched_ext(s_ui_base_white, 0, sel_x - ui(3), vy - ui(6), ui(16 + 6), ui(10), make_color_hsv(hue * 255, 255, val * 255), 1); + draw_sprite_stretched_ext(s_ui_base_white, 0, cx, cy, ui(12), ui(12), color, 1); + } + + var amo = min(array_length(colors) + 1, floor((w - ui(padding * 2)) / ui(24 + 4))); + + for( var i = 0; i < amo; i++ ) { + var cx = ui(padding) + ui(24 + 4) * i; + var cy = cont_y + cont_h + ui(8); + + if(i == 0) { + draw_sprite_stretched_ext(s_ui_base_white, 0, cx + ui(4), cy + ui(4), ui(16), ui(16), color, 1); + draw_sprite_stretched_ext(THEME.ui_panel_active, 0, cx, cy, ui(24), ui(24), c_white, 0.5); + + if(pHOVER && point_in_rectangle(mx, my, cx, cy, cx + ui(24), cy + ui(24))) { + draw_sprite_stretched_ext(THEME.ui_panel_active, 0, cx, cy, ui(24), ui(24), c_white, 1); + if(mouse_press(mb_left, pFOCUS)) { + array_insert(colors, 0, color); + DRAGGING = { + type: "Color", + data: color + } + } + } + continue; + } + + var c = colors[i - 1]; + draw_sprite_stretched_ext(s_ui_base_white, 0, cx, cy, ui(24), ui(24), c, 1); + + if(mouse_press(mb_left, pFOCUS) && point_in_rectangle(mx, my, cx, cy, cx + ui(24), cy + ui(24))) { + DRAGGING = { + type: "Color", + data: c + } + } + } + + var bx = w - ui(32 + 16); + var by = title_height / 2 - ui(16 + !in_dialog * 2); + + if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(32), [mx, my], pFOCUS, pHOVER, "Mode", THEME.color_wheel,, c_white) == 2) + mode = !mode; + + bx -= ui(32); + + if(DRAGGING && DRAGGING.type == "Color" && pHOVER) { + draw_sprite_stretched_ext(THEME.ui_panel_active, 0, 2, 2, w - 4, h - 4, COLORS._main_value_positive, 1); + if(mouse_release(mb_left)) + setColor(DRAGGING.data); + } + } +} \ No newline at end of file diff --git a/scripts/panel_color/panel_color.yy b/scripts/panel_color/panel_color.yy new file mode 100644 index 000000000..3ca654922 --- /dev/null +++ b/scripts/panel_color/panel_color.yy @@ -0,0 +1,11 @@ +{ + "resourceType": "GMScript", + "resourceVersion": "1.0", + "name": "panel_color", + "isCompatibility": false, + "isDnD": false, + "parent": { + "name": "colors", + "path": "folders/panels/colors.yy", + }, +} \ No newline at end of file diff --git a/scripts/panel_palette/panel_palette.gml b/scripts/panel_palette/panel_palette.gml new file mode 100644 index 000000000..2f1711f60 --- /dev/null +++ b/scripts/panel_palette/panel_palette.gml @@ -0,0 +1,121 @@ +function Panel_Palette() : PanelContent() constructor { + title = "Palette"; + showHeader = false; + title_height = 64; + padding = 24; + + w = ui(320); + h = ui(480); + + presets = []; + view_mode = 0; + + color_dragging = noone; + + static presetCollect = function() { + presets = []; + + var path = DIRECTORY + "Palettes/" + var file = file_find_first(path + "*", 0); + while(file != "") { + array_push(presets, { + name: filename_name(file), + palette: loadPalette(path + file) + }); + + file = file_find_next(); + } + file_find_close(); + } + presetCollect() + + function onResize() { + PANEL_PADDING + + sp_palettes.resize(w - ui(padding + padding), h - ui(title_height + padding)); + } + + sp_palettes = new scrollPane(w - ui(padding + padding), h - ui(title_height + padding), function(_y, _m) { + draw_clear_alpha(COLORS.panel_bg_clear, 0); + var ww = sp_palettes.surface_w; + var hh = ui(28); + var _gs = ui(24); + switch(view_mode) { + case 0 : _gs = ui(24); break; + case 1 : _gs = ui(32); break; + case 2 : _gs = ui(16); break; + } + var yy = _y; + var _height; + + for(var i = 0; i < array_length(presets); i++) { + var preset = presets[i]; + var pre_amo = array_length(preset.palette); + var col = floor((ww - ui(20)) / _gs); + var row = ceil(pre_amo / col); + + _height = ui(34) + row * _gs; + + var isHover = pHOVER && point_in_rectangle(_m[0], _m[1], 0, max(0, yy), ww, min(sp_palettes.h, yy + _height)); + + draw_sprite_stretched(THEME.ui_panel_bg, in_dialog, 0, yy, ww, _height); + if(isHover) + draw_sprite_stretched_ext(THEME.node_active, 1, 0, yy, ww, _height, COLORS._main_accent, 1); + + draw_set_text(f_p2, fa_left, fa_top, COLORS._main_text_sub); + draw_text(ui(10), yy + ui(2), preset.name); + drawPaletteGrid(preset.palette, ui(10), yy + ui(24), ww - ui(20), _gs); + + if(isHover && mouse_press(mb_left, pFOCUS)) { + if(point_in_rectangle(_m[0], _m[1], ui(10), yy + ui(24), ww - ui(10), yy + ui(24) + _height)) { + var m_ax = _m[0] - ui(10); + var m_ay = _m[1] - (yy + ui(24)); + + var m_gx = floor(m_ax / _gs); + var m_gy = floor(m_ay / _gs); + + var _index = m_gy * col + m_gx; + if(_index < pre_amo && _index >= 0) + DRAGGING = { + type: "Color", + data: array_safe_get(preset.palette, _index) + } + } else if(point_in_rectangle(_m[0], _m[1], ui(10), yy, ww - ui(10), yy + ui(24))) + DRAGGING = { + type: "Palette", + data: preset.palette + } + } + + yy += _height + ui(8); + hh += _height + ui(8); + } + + return hh; + }); + + function drawContent(panel) { + PANEL_PADDING + PANEL_TITLE + + var px = ui(padding); + var py = ui(title_height); + var pw = w - ui(padding + padding); + var ph = h - ui(title_height + padding); + + draw_sprite_stretched(THEME.ui_panel_bg, !in_dialog, px - ui(8), py - ui(8), pw + ui(16), ph + ui(16)); + + sp_palettes.setActiveFocus(pFOCUS, pHOVER); + sp_palettes.draw(px, py, mx - px, my - py); + + var bx = w - ui(32 + 16); + var by = title_height / 2 - ui(16 + !in_dialog * 2); + + if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(32), [mx, my], pFOCUS, pHOVER, "Refresh", THEME.refresh, 1, COLORS._main_icon) == 2) + presetCollect(); + + bx -= ui(32) + if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(32), [mx, my], pFOCUS, pHOVER, "Change view", THEME.icon_visibility, 1, COLORS._main_icon) == 2) + view_mode = (view_mode + 1) % 3; + } +} \ No newline at end of file diff --git a/scripts/panel_palette/panel_palette.yy b/scripts/panel_palette/panel_palette.yy new file mode 100644 index 000000000..9427a4937 --- /dev/null +++ b/scripts/panel_palette/panel_palette.yy @@ -0,0 +1,11 @@ +{ + "resourceType": "GMScript", + "resourceVersion": "1.0", + "name": "panel_palette", + "isCompatibility": false, + "isDnD": false, + "parent": { + "name": "colors", + "path": "folders/panels/colors.yy", + }, +} \ No newline at end of file diff --git a/scripts/panel_palette603/panel_palette603.gml b/scripts/panel_palette603/panel_palette603.gml new file mode 100644 index 000000000..d64ba82ad --- /dev/null +++ b/scripts/panel_palette603/panel_palette603.gml @@ -0,0 +1,3 @@ +function panel_palette603(){ + +} \ No newline at end of file diff --git a/scripts/panel_preview_window602/panel_preview_window602.gml b/scripts/panel_preview_window602/panel_preview_window602.gml new file mode 100644 index 000000000..fb41157d3 --- /dev/null +++ b/scripts/panel_preview_window602/panel_preview_window602.gml @@ -0,0 +1,3 @@ +function panel_preview_window602(){ + +} \ No newline at end of file diff --git a/shaders/Shader178/Shader178.fsh b/shaders/Shader178/Shader178.fsh new file mode 100644 index 000000000..e28a17897 --- /dev/null +++ b/shaders/Shader178/Shader178.fsh @@ -0,0 +1,10 @@ +// +// Simple passthrough fragment shader +// +varying vec2 v_vTexcoord; +varying vec4 v_vColour; + +void main() +{ + gl_FragColor = v_vColour * texture2D( gm_BaseTexture, v_vTexcoord ); +} diff --git a/shaders/Shader178/Shader178.vsh b/shaders/Shader178/Shader178.vsh new file mode 100644 index 000000000..3900c20f4 --- /dev/null +++ b/shaders/Shader178/Shader178.vsh @@ -0,0 +1,19 @@ +// +// Simple passthrough vertex shader +// +attribute vec3 in_Position; // (x,y,z) +//attribute vec3 in_Normal; // (x,y,z) unused in this shader. +attribute vec4 in_Colour; // (r,g,b,a) +attribute vec2 in_TextureCoord; // (u,v) + +varying vec2 v_vTexcoord; +varying vec4 v_vColour; + +void main() +{ + vec4 object_space_pos = vec4( in_Position.x, in_Position.y, in_Position.z, 1.0); + gl_Position = gm_Matrices[MATRIX_WORLD_VIEW_PROJECTION] * object_space_pos; + + v_vColour = in_Colour; + v_vTexcoord = in_TextureCoord; +} diff --git a/shaders/sh_color_select_side179/sh_color_select_side179.fsh b/shaders/sh_color_select_side179/sh_color_select_side179.fsh new file mode 100644 index 000000000..e28a17897 --- /dev/null +++ b/shaders/sh_color_select_side179/sh_color_select_side179.fsh @@ -0,0 +1,10 @@ +// +// Simple passthrough fragment shader +// +varying vec2 v_vTexcoord; +varying vec4 v_vColour; + +void main() +{ + gl_FragColor = v_vColour * texture2D( gm_BaseTexture, v_vTexcoord ); +} diff --git a/shaders/sh_color_select_side179/sh_color_select_side179.vsh b/shaders/sh_color_select_side179/sh_color_select_side179.vsh new file mode 100644 index 000000000..3900c20f4 --- /dev/null +++ b/shaders/sh_color_select_side179/sh_color_select_side179.vsh @@ -0,0 +1,19 @@ +// +// Simple passthrough vertex shader +// +attribute vec3 in_Position; // (x,y,z) +//attribute vec3 in_Normal; // (x,y,z) unused in this shader. +attribute vec4 in_Colour; // (r,g,b,a) +attribute vec2 in_TextureCoord; // (u,v) + +varying vec2 v_vTexcoord; +varying vec4 v_vColour; + +void main() +{ + vec4 object_space_pos = vec4( in_Position.x, in_Position.y, in_Position.z, 1.0); + gl_Position = gm_Matrices[MATRIX_WORLD_VIEW_PROJECTION] * object_space_pos; + + v_vColour = in_Colour; + v_vTexcoord = in_TextureCoord; +}