mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-12-24 14:06:23 +01:00
WinMan
This commit is contained in:
parent
ac0be33bee
commit
68cc32252c
30 changed files with 450 additions and 1561 deletions
|
@ -291,6 +291,7 @@
|
|||
{"name":"s_node_frame","order":1,"path":"sprites/s_node_frame/s_node_frame.yy",},
|
||||
{"name":"node_active_canvas","order":22,"path":"scripts/node_active_canvas/node_active_canvas.yy",},
|
||||
{"name":"s_node_fluidSim_turbulence","order":10,"path":"sprites/s_node_fluidSim_turbulence/s_node_fluidSim_turbulence.yy",},
|
||||
{"name":"windowManager","order":1,"path":"scripts/windowManager/windowManager.yy",},
|
||||
{"name":"node_pb_fx_hash","order":7,"path":"scripts/node_pb_fx_hash/node_pb_fx_hash.yy",},
|
||||
{"name":"sh_pb_draw_mask","order":8,"path":"shaders/sh_pb_draw_mask/sh_pb_draw_mask.yy",},
|
||||
{"name":"node_blur_radial","order":7,"path":"scripts/node_blur_radial/node_blur_radial.yy",},
|
||||
|
@ -1032,6 +1033,7 @@
|
|||
{"name":"node_3d_uv_remap","order":5,"path":"scripts/node_3d_uv_remap/node_3d_uv_remap.yy",},
|
||||
{"name":"fd_rectangle_get_initial_value_pressure","order":7,"path":"scripts/fd_rectangle_get_initial_value_pressure/fd_rectangle_get_initial_value_pressure.yy",},
|
||||
{"name":"node_timeline_preview","order":2,"path":"scripts/node_timeline_preview/node_timeline_preview.yy",},
|
||||
{"name":"display_measure","order":2,"path":"extensions/display_measure/display_measure.yy",},
|
||||
{"name":"__polygon","order":2,"path":"scripts/__polygon/__polygon.yy",},
|
||||
{"name":"o_dialog_fontscrollbox","order":5,"path":"objects/o_dialog_fontscrollbox/o_dialog_fontscrollbox.yy",},
|
||||
{"name":"sh_d3d_normal_blur","order":25,"path":"shaders/sh_d3d_normal_blur/sh_d3d_normal_blur.yy",},
|
||||
|
@ -1040,7 +1042,6 @@
|
|||
{"name":"node_fluid_render_output","order":11,"path":"scripts/node_fluid_render_output/node_fluid_render_output.yy",},
|
||||
{"name":"s_node_vfx_output","order":11,"path":"sprites/s_node_vfx_output/s_node_vfx_output.yy",},
|
||||
{"name":"sh_greyscale","order":13,"path":"shaders/sh_greyscale/sh_greyscale.yy",},
|
||||
{"name":"gameframe_native","order":2,"path":"extensions/gameframe_native/gameframe_native.yy",},
|
||||
{"name":"s_node_pb_box_mirror","order":21,"path":"sprites/s_node_pb_box_mirror/s_node_pb_box_mirror.yy",},
|
||||
{"name":"__node_shader_generator","order":22,"path":"scripts/__node_shader_generator/__node_shader_generator.yy",},
|
||||
{"name":"node_global","order":3,"path":"scripts/node_global/node_global.yy",},
|
||||
|
@ -1452,7 +1453,6 @@
|
|||
{"name":"draw_set_blend_mode","order":1,"path":"scripts/draw_set_blend_mode/draw_set_blend_mode.yy",},
|
||||
{"name":"d3d_gizmo_line_dashed","order":3,"path":"scripts/d3d_gizmo_line_dashed/d3d_gizmo_line_dashed.yy",},
|
||||
{"name":"s_node_3d_camera_set","order":24,"path":"sprites/s_node_3d_camera_set/s_node_3d_camera_set.yy",},
|
||||
{"name":"gameframe_macros","order":1,"path":"scripts/gameframe_macros/gameframe_macros.yy",},
|
||||
{"name":"s_node_trigger_bool","order":4,"path":"sprites/s_node_trigger_bool/s_node_trigger_bool.yy",},
|
||||
{"name":"panel_color","order":1,"path":"scripts/panel_color/panel_color.yy",},
|
||||
{"name":"s_copy","order":3,"path":"sprites/s_copy/s_copy.yy",},
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"CRUD","folderPath":"folders/_extensions/FireBase/Firebase Firestore/Testing/CRUD.yy",},
|
||||
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"Query","folderPath":"folders/_extensions/FireBase/Firebase Firestore/Testing/Query.yy",},
|
||||
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"Firebase Utils","folderPath":"folders/_extensions/FireBase/Firebase Utils.yy",},
|
||||
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"Gameframe","folderPath":"folders/_extensions/Gameframe.yy",},
|
||||
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"WinMan","folderPath":"folders/_extensions/WinMan.yy",},
|
||||
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"GMD3D11","folderPath":"folders/_extensions/GMD3D11.yy",},
|
||||
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"MAC","folderPath":"folders/_extensions/MAC.yy",},
|
||||
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"patreon","folderPath":"folders/_extensions/patreon.yy",},
|
||||
|
@ -862,6 +862,7 @@
|
|||
{"id":{"name":"s_node_frame","path":"sprites/s_node_frame/s_node_frame.yy",},},
|
||||
{"id":{"name":"node_active_canvas","path":"scripts/node_active_canvas/node_active_canvas.yy",},},
|
||||
{"id":{"name":"s_node_fluidSim_turbulence","path":"sprites/s_node_fluidSim_turbulence/s_node_fluidSim_turbulence.yy",},},
|
||||
{"id":{"name":"windowManager","path":"scripts/windowManager/windowManager.yy",},},
|
||||
{"id":{"name":"node_pb_fx_hash","path":"scripts/node_pb_fx_hash/node_pb_fx_hash.yy",},},
|
||||
{"id":{"name":"sh_pb_draw_mask","path":"shaders/sh_pb_draw_mask/sh_pb_draw_mask.yy",},},
|
||||
{"id":{"name":"node_blur_radial","path":"scripts/node_blur_radial/node_blur_radial.yy",},},
|
||||
|
@ -1707,6 +1708,7 @@
|
|||
{"id":{"name":"node_3d_uv_remap","path":"scripts/node_3d_uv_remap/node_3d_uv_remap.yy",},},
|
||||
{"id":{"name":"fd_rectangle_get_initial_value_pressure","path":"scripts/fd_rectangle_get_initial_value_pressure/fd_rectangle_get_initial_value_pressure.yy",},},
|
||||
{"id":{"name":"node_timeline_preview","path":"scripts/node_timeline_preview/node_timeline_preview.yy",},},
|
||||
{"id":{"name":"display_measure","path":"extensions/display_measure/display_measure.yy",},},
|
||||
{"id":{"name":"__polygon","path":"scripts/__polygon/__polygon.yy",},},
|
||||
{"id":{"name":"sh_morph_surface","path":"shaders/sh_morph_surface/sh_morph_surface.yy",},},
|
||||
{"id":{"name":"o_dialog_fontscrollbox","path":"objects/o_dialog_fontscrollbox/o_dialog_fontscrollbox.yy",},},
|
||||
|
@ -2188,7 +2190,6 @@
|
|||
{"id":{"name":"draw_set_blend_mode","path":"scripts/draw_set_blend_mode/draw_set_blend_mode.yy",},},
|
||||
{"id":{"name":"d3d_gizmo_line_dashed","path":"scripts/d3d_gizmo_line_dashed/d3d_gizmo_line_dashed.yy",},},
|
||||
{"id":{"name":"s_node_3d_camera_set","path":"sprites/s_node_3d_camera_set/s_node_3d_camera_set.yy",},},
|
||||
{"id":{"name":"gameframe_macros","path":"scripts/gameframe_macros/gameframe_macros.yy",},},
|
||||
{"id":{"name":"s_node_trigger_bool","path":"sprites/s_node_trigger_bool/s_node_trigger_bool.yy",},},
|
||||
{"id":{"name":"panel_color","path":"scripts/panel_color/panel_color.yy",},},
|
||||
{"id":{"name":"s_copy","path":"sprites/s_copy/s_copy.yy",},},
|
||||
|
@ -2539,7 +2540,6 @@
|
|||
{"id":{"name":"node_shadow_cast","path":"scripts/node_shadow_cast/node_shadow_cast.yy",},},
|
||||
{"id":{"name":"node_strand_render","path":"scripts/node_strand_render/node_strand_render.yy",},},
|
||||
{"id":{"name":"s_node_3d_obj_combine","path":"sprites/s_node_3d_obj_combine/s_node_3d_obj_combine.yy",},},
|
||||
{"id":{"name":"gameframe","path":"scripts/gameframe/gameframe.yy",},},
|
||||
{"id":{"name":"s_node_wav_file_read","path":"sprites/s_node_wav_file_read/s_node_wav_file_read.yy",},},
|
||||
{"id":{"name":"o_dialog_assetbox","path":"objects/o_dialog_assetbox/o_dialog_assetbox.yy",},},
|
||||
{"id":{"name":"node_lerp","path":"scripts/node_lerp/node_lerp.yy",},},
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
/// @description
|
||||
gameframe_init();
|
||||
gameframe_button_array = [];
|
||||
|
||||
#region setup
|
||||
window_set_size(640, 480);
|
||||
display_set_gui_size(640, 480);
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
/// @description
|
||||
gameframe_update();
|
||||
|
||||
draw_clear(#1c1c23);
|
||||
var w = 640;
|
||||
var h = 480;
|
||||
|
|
|
@ -14,17 +14,7 @@
|
|||
window_set_min_width(960);
|
||||
window_set_min_height(600);
|
||||
|
||||
if(OS == os_windows) {
|
||||
gameframe_init();
|
||||
gameframe_set_cursor = false;
|
||||
gameframe_caption_height_normal = ui(40);
|
||||
gameframe_caption_height_maximized = ui(40);
|
||||
|
||||
gameframe_button_array = [
|
||||
game_frame_button_create("", s_kenney, 0, function() {}),
|
||||
game_frame_button_create("", s_kenney, 0, function() {}),
|
||||
];
|
||||
} else if(OS == os_macosx)
|
||||
if(OS == os_macosx)
|
||||
mac_window_init();
|
||||
|
||||
depth = 0;
|
||||
|
@ -57,9 +47,6 @@
|
|||
|
||||
panelInit();
|
||||
|
||||
//show_debug_overlay(true);
|
||||
//display_set_timing_method(tm_sleep);
|
||||
|
||||
addHotkey("", "New file", "N", MOD_KEY.ctrl, NEW);
|
||||
if(!DEMO) {
|
||||
addHotkey("", "Save", "S", MOD_KEY.ctrl, SAVE );
|
||||
|
@ -76,12 +63,7 @@
|
|||
|
||||
addHotkey("", "Open notification", vk_f12, MOD_KEY.none, function() { dialogPanelCall(new Panel_Notification()); });
|
||||
|
||||
addHotkey("", "Fullscreen", vk_f11, MOD_KEY.none, function() {
|
||||
if(gameframe_is_fullscreen_window())
|
||||
gameframe_set_fullscreen(0);
|
||||
else
|
||||
gameframe_set_fullscreen(2);
|
||||
});
|
||||
addHotkey("", "Fullscreen", vk_f11, MOD_KEY.none, function() { winMan_setFullscreen(!window_is_fullscreen); });
|
||||
|
||||
addHotkey("", "Render all", vk_f5, MOD_KEY.none, function() { RENDER_ALL_REORDER });
|
||||
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
/// @description init
|
||||
draw_clear(COLORS.bg);
|
||||
|
||||
#region gameframe
|
||||
if(OS == os_windows && gameframe_is_minimized()) {
|
||||
//gameframe_update();
|
||||
#region windows init
|
||||
if(OS == os_windows && winMan_isMinimized())
|
||||
exit;
|
||||
} else if(OS == os_macosx) {
|
||||
else if(OS == os_macosx)
|
||||
mac_window_step();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region widget scroll
|
||||
|
@ -45,8 +43,6 @@ draw_clear(COLORS.bg);
|
|||
}
|
||||
|
||||
panelDraw();
|
||||
|
||||
gameframe_update();
|
||||
#endregion
|
||||
|
||||
#region notes
|
||||
|
@ -55,25 +51,5 @@ draw_clear(COLORS.bg);
|
|||
#endregion
|
||||
|
||||
#region window
|
||||
var pd = gameframe_resize_padding;
|
||||
|
||||
if(mouse_mx > 0 && mouse_mx < pd && mouse_my > 0 && mouse_my < WIN_H)
|
||||
CURSOR = cr_size_we;
|
||||
if(mouse_mx > WIN_W - pd && mouse_mx < WIN_W && mouse_my > 0 && mouse_my < WIN_H)
|
||||
CURSOR = cr_size_we;
|
||||
|
||||
if(mouse_mx > 0 && mouse_mx < WIN_W && mouse_my > 0 && mouse_my < pd)
|
||||
CURSOR = cr_size_ns;
|
||||
if(mouse_mx > 0 && mouse_mx < WIN_W && mouse_my > WIN_H - pd && mouse_my < WIN_H)
|
||||
CURSOR = cr_size_ns;
|
||||
|
||||
if(mouse_mx > 0 && mouse_mx < pd && mouse_my > 0 && mouse_my < pd)
|
||||
CURSOR = cr_size_nwse;
|
||||
if(mouse_mx > WIN_W - pd && mouse_mx < WIN_W && mouse_my > WIN_H - pd && mouse_my < WIN_H)
|
||||
CURSOR = cr_size_nwse;
|
||||
|
||||
if(mouse_mx > 0 && mouse_mx < pd && mouse_my > WIN_H - pd && mouse_my < WIN_H)
|
||||
CURSOR = cr_size_nesw;
|
||||
if(mouse_mx > WIN_W - pd && mouse_mx < WIN_W && mouse_my > 0 && mouse_my < pd)
|
||||
CURSOR = cr_size_nesw;
|
||||
winManDraw();
|
||||
#endregion
|
|
@ -1,5 +1,5 @@
|
|||
/// @description tooltip filedrop
|
||||
if(OS == os_windows && gameframe_is_minimized()) exit;
|
||||
if(OS == os_windows && winMan_isMinimized()) exit;
|
||||
|
||||
#region tooltip
|
||||
if(is_struct(TOOLTIP)) {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/// @description init
|
||||
if(OS == os_windows && gameframe_is_minimized()) exit;
|
||||
if(OS == os_windows && winMan_isMinimized()) exit;
|
||||
winManStep()
|
||||
|
||||
//print("===== Step start =====");
|
||||
if(PROJECT.active && !PROJECT.safeMode) { #region
|
||||
|
|
|
@ -6,7 +6,7 @@ HOVERING_ELEMENT = _HOVERING_ELEMENT;
|
|||
_HOVERING_ELEMENT = noone;
|
||||
|
||||
#region minimize
|
||||
if(OS == os_windows && gameframe_is_minimized()) {
|
||||
if(OS == os_windows && winMan_isMinimized()) {
|
||||
if(!minimized)
|
||||
game_set_speed(1, gamespeed_fps);
|
||||
minimized = true;
|
||||
|
@ -28,13 +28,6 @@ _HOVERING_ELEMENT = noone;
|
|||
}
|
||||
|
||||
CURSOR = cr_default;
|
||||
|
||||
if(!gameframe_is_minimized() && (win_wp != WIN_W || win_hp != WIN_H) && (WIN_W > 1 && WIN_H > 1)) {
|
||||
if(!win_resize) CURRENT_PANEL = panelSerialize();
|
||||
display_refresh();
|
||||
win_resize = true;
|
||||
} else
|
||||
win_resize = false;
|
||||
#endregion
|
||||
|
||||
#region focus
|
||||
|
|
|
@ -15,6 +15,24 @@ function SurfaceAtlas(surface, _x = 0, _y = 0, rot = 0, sx = 1, sy = 1, blend =
|
|||
oriSurf_w = w;
|
||||
oriSurf_h = h;
|
||||
|
||||
static set = function(surface, _x = 0, _y = 0, rot = 0, sx = 1, sy = 1, blend = c_white, alpha = 1) {
|
||||
INLINE
|
||||
|
||||
self.surface = new Surface(surface);
|
||||
self.x = _x;
|
||||
self.y = _y;
|
||||
self.rotation = rot;
|
||||
self.sx = sx;
|
||||
self.sy = sy;
|
||||
self.blend = blend;
|
||||
self.alpha = alpha;
|
||||
|
||||
w = surface_get_width_safe(surface);
|
||||
h = surface_get_height_safe(surface);
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
static setOrginalSurface = function(surf) {
|
||||
INLINE
|
||||
|
||||
|
|
|
@ -358,10 +358,9 @@
|
|||
[ "window_mouse_set", window_mouse_set ],
|
||||
[ "window_set_caption", window_set_caption ],
|
||||
[ "window_set_colour", window_set_colour ],
|
||||
[ "window_set_fullscreen", window_set_fullscreen ],
|
||||
[ "winMan_setFullscreen", winMan_setFullscreen ],
|
||||
[ "window_set_position", window_set_position ],
|
||||
[ "window_set_size", window_set_size ],
|
||||
[ "gameframe_drag_set_rect", gameframe_drag_set_rect ],
|
||||
[ "window_set_cursor", window_set_cursor ],
|
||||
[ "window_set_min_width", window_set_min_width ],
|
||||
[ "window_set_max_width", window_set_max_width ],
|
||||
|
|
|
@ -78,6 +78,8 @@ function __APPEND_MAP(_map, context = PANEL_GRAPH.getCurrentContext()) { #region
|
|||
appended_list[| i].preConnect();
|
||||
for(var i = 0; i < ds_list_size(appended_list); i++)
|
||||
appended_list[| i].connect();
|
||||
for(var i = 0; i < ds_list_size(appended_list); i++)
|
||||
appended_list[| i].postConnect();
|
||||
} catch(e) {
|
||||
log_warning("APPEND, connect", exception_print(e));
|
||||
}
|
||||
|
|
|
@ -1,10 +1,14 @@
|
|||
function display_refresh() {
|
||||
function window_refresh() {
|
||||
o_main.win_wp = WIN_W;
|
||||
o_main.win_hp = WIN_H;
|
||||
room_width = WIN_W;
|
||||
room_height = WIN_H;
|
||||
|
||||
display_set_gui_size(WIN_SW, WIN_SH);
|
||||
}
|
||||
|
||||
function display_refresh() {
|
||||
window_refresh();
|
||||
|
||||
clearPanel();
|
||||
resetPanel();
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,36 +0,0 @@
|
|||
global.__display_gui_args = [0, 0, 0, 0, 0];
|
||||
|
||||
#macro __display_set_gui_size_base display_set_gui_size
|
||||
#macro display_set_gui_size __display_set_gui_size_hook
|
||||
function __display_set_gui_size_hook(_width, _height) {
|
||||
__display_set_gui_size_base(_width, _height);
|
||||
global.__display_gui_args[@0] = -1;
|
||||
global.__display_gui_args[@1] = _width;
|
||||
global.__display_gui_args[@2] = _height;
|
||||
global.__display_gui_args[@3] = 0;
|
||||
global.__display_gui_args[@4] = 0;
|
||||
}
|
||||
|
||||
#macro __display_set_gui_maximize_base display_set_gui_maximize
|
||||
#macro __display_set_gui_maximise_base display_set_gui_maximise
|
||||
#macro display_set_gui_maximize __display_set_gui_maximize_hook
|
||||
#macro display_set_gui_maximise __display_set_gui_maximize_hook
|
||||
function __display_set_gui_maximize_hook() {
|
||||
global.__display_gui_args[@0] = argument_count;
|
||||
var i = 0;
|
||||
for (; i < argument_count; i++) global.__display_gui_args[@i + 1] = argument[i];
|
||||
for (; i < 4; i++) global.__display_gui_args[@i + 1] = 0;
|
||||
}
|
||||
|
||||
function __display_gui_restore() {
|
||||
var _args = global.__display_gui_args;
|
||||
switch (_args[0]) {
|
||||
case -1: __display_set_gui_size_base(_args[1], _args[2]); break;
|
||||
case 0: __display_set_gui_maximise_base(); break;
|
||||
case 1: __display_set_gui_maximise_base(_args[1]); break;
|
||||
case 2: __display_set_gui_maximise_base(_args[1], _args[2]); break;
|
||||
case 3: __display_set_gui_maximise_base(_args[1], _args[2], _args[3]); break;
|
||||
case 4: __display_set_gui_maximise_base(_args[1], _args[2], _args[3], _args[4]); break;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
{
|
||||
"resourceType": "GMScript",
|
||||
"resourceVersion": "1.0",
|
||||
"name": "gameframe_macros",
|
||||
"isCompatibility": false,
|
||||
"isDnD": false,
|
||||
"parent": {
|
||||
"name": "Gameframe",
|
||||
"path": "folders/_extensions/Gameframe.yy",
|
||||
},
|
||||
}
|
|
@ -25,10 +25,10 @@
|
|||
globalvar VERSION, SAVE_VERSION, VERSION_STRING, BUILD_NUMBER, LATEST_VERSION;
|
||||
|
||||
LATEST_VERSION = 11500;
|
||||
VERSION = 11585;
|
||||
VERSION = 11586;
|
||||
SAVE_VERSION = 11600;
|
||||
VERSION_STRING = "1.16rc5";
|
||||
BUILD_NUMBER = 11585;
|
||||
VERSION_STRING = "1.16rc6";
|
||||
BUILD_NUMBER = 11586;
|
||||
|
||||
globalvar APPEND_MAP;
|
||||
APPEND_MAP = ds_map_create();
|
||||
|
|
|
@ -41,7 +41,7 @@ function mac_window_maximize() {
|
|||
room_height = _h;
|
||||
|
||||
display_set_gui_size(_w, _h);
|
||||
gameframe_drag_set_rect(0, 0, _w, _h);
|
||||
winMan_setRect(0, 0, _w, _h);
|
||||
|
||||
display_refresh();
|
||||
}
|
||||
|
@ -51,6 +51,6 @@ function mac_window_minimize() {
|
|||
|
||||
__win_is_maximized = false;
|
||||
|
||||
gameframe_drag_set_rect(__win_min_x, __win_min_y, __win_min_w, __win_min_h);
|
||||
winMan_setRect(__win_min_x, __win_min_y, __win_min_w, __win_min_h);
|
||||
display_refresh();
|
||||
}
|
|
@ -9,7 +9,7 @@ function mac_window_step() {
|
|||
window_set_position(__win_drag_sx + (_mx - __win_drag_mx), __win_drag_sy + (_my - __win_drag_my));
|
||||
else {
|
||||
if((__win_is_dragging & WINDOW_DRAG_MODE.resize_n) != 0) {
|
||||
gameframe_drag_set_rect(
|
||||
winMan_setRect(
|
||||
__win_drag_sx,
|
||||
__win_drag_sy + (_my - __win_drag_my),
|
||||
__win_drag_sw,
|
||||
|
@ -22,7 +22,7 @@ function mac_window_step() {
|
|||
);
|
||||
|
||||
if((__win_is_dragging & WINDOW_DRAG_MODE.resize_w) != 0) {
|
||||
gameframe_drag_set_rect(
|
||||
winMan_setRect(
|
||||
__win_drag_sx + (_mx - __win_drag_mx),
|
||||
__win_drag_sy,
|
||||
__win_drag_sw - (_mx - __win_drag_mx),
|
||||
|
|
|
@ -41,6 +41,7 @@ function Node_Path(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
|||
outputs[| 1] = nodeValue("Path data", self, JUNCTION_CONNECT.output, VALUE_TYPE.pathnode, self);
|
||||
|
||||
outputs[| 2] = nodeValue("Anchors", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, [])
|
||||
.setVisible(false)
|
||||
.setArrayDepth(1);
|
||||
|
||||
tool_pathDrawer = new NodeTool( "Draw path", THEME.path_tools_draw )
|
||||
|
|
|
@ -90,24 +90,24 @@ function Node_Path_Array(_x, _y, _group = noone) : Node(_x, _y, _group) construc
|
|||
return 0;
|
||||
} #endregion
|
||||
|
||||
static get__vec2Ratio = function(_rat, ind = 0) { #region
|
||||
static getPointRatio = function(_rat, ind = 0) { #region
|
||||
for( var i = input_fix_len; i < ds_list_size(inputs) - 1; i += data_length ) {
|
||||
var _path = getInputData(i);
|
||||
var lc = struct_has(_path, "getLineCount")? _path.getLineCount() : 1;
|
||||
|
||||
if(ind < lc) return _path.get__vec2Ratio(_rat, ind).clone();
|
||||
if(ind < lc) return _path.getPointRatio(_rat, ind).clone();
|
||||
ind -= lc;
|
||||
}
|
||||
|
||||
return new __vec2();
|
||||
} #endregion
|
||||
|
||||
static get__vec2Distance = function(_dist, ind = 0) { #region
|
||||
static getPointDistance = function(_dist, ind = 0) { #region
|
||||
for( var i = input_fix_len; i < ds_list_size(inputs) - 1; i += data_length ) {
|
||||
var _path = getInputData(i);
|
||||
var lc = struct_has(_path, "getLineCount")? _path.getLineCount() : 1;
|
||||
|
||||
if(ind < lc) return _path.get__vec2Distance(_dist, ind).clone();
|
||||
if(ind < lc) return _path.getPointDistance(_dist, ind).clone();
|
||||
ind -= lc;
|
||||
}
|
||||
|
||||
|
@ -126,6 +126,15 @@ function Node_Path_Array(_x, _y, _group = noone) : Node(_x, _y, _group) construc
|
|||
return 0;
|
||||
} #endregion
|
||||
|
||||
static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { #region
|
||||
for( var i = input_fix_len; i < ds_list_size(inputs) - 1; i += data_length ) {
|
||||
var _path = getInputData(i);
|
||||
if(!struct_has(_path, "drawOverlay")) continue;
|
||||
|
||||
_path.drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny);
|
||||
}
|
||||
} #endregion
|
||||
|
||||
static update = function(frame = CURRENT_FRAME) { #region
|
||||
outputs[| 0].setValue(self);
|
||||
} #endregion
|
||||
|
|
|
@ -26,6 +26,9 @@ function Node_Path_Builder(_x, _y, _group = noone) : Node(_x, _y, _group) constr
|
|||
|
||||
draw_line(_x + p0[0] * _s, _y + p0[1] * _s,
|
||||
_x + p1[0] * _s, _y + p1[1] * _s);
|
||||
|
||||
if(j == 1) draw_circle(_x + p0[0] * _s, _y + p0[1] * _s, 4, false);
|
||||
draw_circle(_x + p1[0] * _s, _y + p1[1] * _s, 4, false);
|
||||
}
|
||||
}
|
||||
} #endregion
|
||||
|
|
|
@ -199,7 +199,7 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group)
|
|||
var _h = surface_get_height_safe(inpt[i]);
|
||||
|
||||
surface_set_target(oo);
|
||||
BLEND_OVERRIDE;
|
||||
BLEND_OVERRIDE
|
||||
|
||||
switch(pack) {
|
||||
case SPRITE_STACK.horizontal :
|
||||
|
|
|
@ -1,3 +1,12 @@
|
|||
enum NODE_SCATTER_DIST {
|
||||
area,
|
||||
border,
|
||||
map,
|
||||
data,
|
||||
path,
|
||||
tile
|
||||
}
|
||||
|
||||
function Node_Scatter(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
|
||||
name = "Scatter";
|
||||
dimension_index = 1;
|
||||
|
@ -115,7 +124,6 @@ function Node_Scatter(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
|
|||
|
||||
static processData = function(_outSurf, _data, _output_index, _array_index) { #region
|
||||
if(_output_index == 1) return scatter_data;
|
||||
if(_output_index == 0 && _array_index == 0) scatter_data = [];
|
||||
|
||||
var _inSurf = _data[0];
|
||||
if(_inSurf == 0)
|
||||
|
@ -159,6 +167,23 @@ function Node_Scatter(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
|
|||
if(_dist == 2 && is_surface(_distMap))
|
||||
_posDist = get_points_from_dist(_distMap, _amount, seed);
|
||||
|
||||
if(_dist == 4) {
|
||||
var path_valid = path != noone && struct_has(path, "getPointRatio");
|
||||
|
||||
if(!path_valid) return _outSurf;
|
||||
|
||||
var _pathProgress = 0;
|
||||
var path_amount = struct_has(path, "getLineCount")? path.getLineCount() : 1;
|
||||
var _pre_amount = _amount;
|
||||
_amount *= path_amount;
|
||||
|
||||
var path_line_index = 0;
|
||||
}
|
||||
|
||||
var _sed = seed;
|
||||
var _sct = array_create(_amount);
|
||||
var _sct_len = 0;
|
||||
|
||||
surface_set_target(_outSurf);
|
||||
DRAW_CLEAR
|
||||
switch(blend) {
|
||||
|
@ -171,45 +196,37 @@ function Node_Scatter(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
|
|||
break;
|
||||
}
|
||||
|
||||
var _pathProgress = 0;
|
||||
var _sed = seed;
|
||||
var res_index = 0, bg = 0;
|
||||
|
||||
for(var i = 0; i < _amount; i++) {
|
||||
var sp = noone, _x = 0, _y = 0;
|
||||
var _v = noone;
|
||||
|
||||
if(_dist < 2) {
|
||||
if(_dist == NODE_SCATTER_DIST.area || _dist == NODE_SCATTER_DIST.border) {
|
||||
sp = area_get_random_point(_area, _dist, _scat, i, _amount, _sed); _sed += 20;
|
||||
_x = sp[0];
|
||||
_y = sp[1];
|
||||
} else if(_dist == 2) {
|
||||
} else if(_dist == NODE_SCATTER_DIST.data) {
|
||||
sp = array_safe_get(_posDist, i);
|
||||
if(!is_array(sp)) continue;
|
||||
|
||||
_x = _area[0] + _area[2] * (sp[0] * 2 - 1.);
|
||||
_y = _area[1] + _area[3] * (sp[1] * 2 - 1.);
|
||||
} else if(_dist == 3) {
|
||||
} else if(_dist == NODE_SCATTER_DIST.map) {
|
||||
sp = array_safe_get(_distData, i);
|
||||
if(!is_array(sp)) continue;
|
||||
|
||||
_x = array_safe_get(sp, 0);
|
||||
_y = array_safe_get(sp, 1);
|
||||
_v = array_safe_get(sp, 2, noone);
|
||||
} else if(_dist == 4) {
|
||||
if(path != noone && struct_has(path, "getPointRatio")) {
|
||||
_pathProgress = _scat? random_seed(1, _sed) : i / max(1, _amount); _sed++;
|
||||
} else if(_dist == NODE_SCATTER_DIST.path) {
|
||||
_pathProgress = _scat? random_seed(1, _sed) : i / max(1, _pre_amount); _sed++;
|
||||
_pathProgress = frac((_pathProgress + pathShf) * 0.9999);
|
||||
|
||||
var pp = path.getPointRatio(_pathProgress);
|
||||
var pp = path.getPointRatio(_pathProgress, path_line_index);
|
||||
_x = pp.x + random_range_seed(-pathDis, pathDis, _sed); _sed++;
|
||||
_y = pp.y + random_range_seed(-pathDis, pathDis, _sed); _sed++;
|
||||
}
|
||||
} else if(_dist == 5) {
|
||||
} else if(_dist == NODE_SCATTER_DIST.tile) {
|
||||
_x = random_range_seed(0, _dim[0], _sed); _sed++;
|
||||
_y = random_range_seed(0, _dim[1], _sed); _sed++;
|
||||
|
||||
//print(string(_x) + ", " + string(_y));
|
||||
}
|
||||
|
||||
var posS = _dist < 4? seed + _y * _dim[0] + _x : seed + i * 100;
|
||||
|
@ -227,9 +244,9 @@ function Node_Scatter(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
|
|||
if(vRot && _v != noone)
|
||||
_r *= _v;
|
||||
|
||||
if(_dist == 4 && path != noone && pathRot) {
|
||||
var p0 = path.getPointRatio(clamp(_pathProgress - 0.001, 0, 0.9999));
|
||||
var p1 = path.getPointRatio(clamp(_pathProgress + 0.001, 0, 0.9999));
|
||||
if(_dist == NODE_SCATTER_DIST.path && pathRot) {
|
||||
var p0 = path.getPointRatio(clamp(_pathProgress - 0.001, 0, 0.9999), path_line_index);
|
||||
var p1 = path.getPointRatio(clamp(_pathProgress + 0.001, 0, 0.9999), path_line_index);
|
||||
|
||||
var dirr = point_direction(p0.x, p0.y, p1.x, p1.y);
|
||||
_r += dirr;
|
||||
|
@ -248,7 +265,7 @@ function Node_Scatter(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
|
|||
var sw = surface_get_width_safe(surf);
|
||||
var sh = surface_get_height_safe(surf);
|
||||
|
||||
if(_dist != AREA_DISTRIBUTION.area || _scat != AREA_SCATTER.uniform) {
|
||||
if(_dist != NODE_SCATTER_DIST.area || _scat != AREA_SCATTER.uniform) {
|
||||
var p = point_rotate(-sw / 2 * _scx, -sh * _scy / 2, 0, 0, _r);
|
||||
_x += p[0];
|
||||
_y += p[1];
|
||||
|
@ -261,31 +278,37 @@ function Node_Scatter(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
|
|||
var clr = color.eval(grSamp);
|
||||
var alp = random_range_seed(alpha[0], alpha[1], posS); posS++;
|
||||
|
||||
array_push(scatter_data, new SurfaceAtlas(surf, _x, _y, _r, _scx, _scy, clr, alp));
|
||||
var _atl = array_safe_get(scatter_data, _sct_len);
|
||||
if(!is_instanceof(_atl, SurfaceAtlas))
|
||||
_atl = new SurfaceAtlas(surf, _x, _y, _r, _scx, _scy, clr, alp);
|
||||
else
|
||||
_atl.set(surf, _x, _y, _r, _scx, _scy, clr, alp);
|
||||
_sct[_sct_len] = _atl;
|
||||
_sct_len++;
|
||||
|
||||
draw_surface_ext_safe(surf, _x, _y, _scx, _scy, _r, clr, alp);
|
||||
|
||||
if(_dist == 5) {
|
||||
if(_dist == NODE_SCATTER_DIST.path) {
|
||||
path_line_index = floor(i / _pre_amount);
|
||||
} else if(_dist == NODE_SCATTER_DIST.tile) {
|
||||
var _sw = surface_get_width_safe(surf) * _scx;
|
||||
var _sh = surface_get_height_safe(surf) * _scy;
|
||||
|
||||
if(_x < _sw)
|
||||
draw_surface_ext_safe(surf, _dim[0] + _x, _y, _scx, _scy, _r, clr, alp);
|
||||
if(_y < _sh)
|
||||
draw_surface_ext_safe(surf, _x, _dim[1] + _y, _scx, _scy, _r, clr, alp);
|
||||
if(_x < _sw && _y < _sh)
|
||||
draw_surface_ext_safe(surf, _dim[0] + _x, _dim[1] + _y, _scx, _scy, _r, clr, alp);
|
||||
if(_x < _sw) draw_surface_ext_safe(surf, _dim[0] + _x, _y, _scx, _scy, _r, clr, alp);
|
||||
if(_y < _sh) draw_surface_ext_safe(surf, _x, _dim[1] + _y, _scx, _scy, _r, clr, alp);
|
||||
if(_x < _sw && _y < _sh) draw_surface_ext_safe(surf, _dim[0] + _x, _dim[1] + _y, _scx, _scy, _r, clr, alp);
|
||||
|
||||
if(_x > _dim[0] - _sw)
|
||||
draw_surface_ext_safe(surf, _x - _dim[0], _y, _scx, _scy, _r, clr, alp);
|
||||
if(_y > _dim[1] - _sh)
|
||||
draw_surface_ext_safe(surf, _x, _y - _dim[1], _scx, _scy, _r, clr, alp);
|
||||
if(_x > _dim[0] - _sw || _y > _dim[1] - _sh)
|
||||
draw_surface_ext_safe(surf, _x - _dim[0], _y - _dim[1], _scx, _scy, _r, clr, alp);
|
||||
if(_x > _dim[0] - _sw) draw_surface_ext_safe(surf, _x - _dim[0], _y, _scx, _scy, _r, clr, alp);
|
||||
if(_y > _dim[1] - _sh) draw_surface_ext_safe(surf, _x, _y - _dim[1], _scx, _scy, _r, clr, alp);
|
||||
if(_x > _dim[0] - _sw || _y > _dim[1] - _sh) draw_surface_ext_safe(surf, _x - _dim[0], _y - _dim[1], _scx, _scy, _r, clr, alp);
|
||||
}
|
||||
}
|
||||
BLEND_NORMAL;
|
||||
surface_reset_target();
|
||||
|
||||
array_resize(_sct, _sct_len);
|
||||
scatter_data = _sct;
|
||||
|
||||
return _outSurf;
|
||||
} #endregion
|
||||
|
||||
|
|
|
@ -1778,24 +1778,33 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
|
||||
var cx = nodes_selecting[0].x;
|
||||
var cy = 0;
|
||||
var pr = ds_priority_create();
|
||||
var amo = array_length(nodes_selecting);
|
||||
var len = 0;
|
||||
|
||||
for(var i = 0; i < array_length(nodes_selecting); i++) {
|
||||
for(var i = 0; i < amo; i++) {
|
||||
var _node = nodes_selecting[i];
|
||||
if(ds_list_size(_node.outputs) == 0) continue;
|
||||
|
||||
cx = max(cx, _node.x);
|
||||
cy += _node.y;
|
||||
|
||||
ds_priority_add(pr, _node, _node.y);
|
||||
len++;
|
||||
}
|
||||
|
||||
cx = cx + 160;
|
||||
cy = round(cy / array_length(nodes_selecting) / 32) * 32;
|
||||
cy = round(cy / len / 32) * 32;
|
||||
|
||||
var _array = nodeBuild("Node_Array", cx, cy);
|
||||
|
||||
for( var i = 0; i < array_length(nodes_selecting); i++ ) {
|
||||
var _node = nodes_selecting[i];
|
||||
if(ds_list_size(_node.outputs) == 0) continue;
|
||||
repeat(len) {
|
||||
var _node = ds_priority_delete_min(pr);
|
||||
_array.addInput(_node.outputs[| 0]);
|
||||
}
|
||||
|
||||
nodes_selecting = [];
|
||||
ds_priority_destroy(pr);
|
||||
} #endregion
|
||||
|
||||
function doGroup() { #region
|
||||
|
|
|
@ -76,12 +76,7 @@ function Panel_Menu() : PanelContent() constructor {
|
|||
return submenuCall(_dat, arr);
|
||||
}, THEME.addon_icon ).setIsShelf(),
|
||||
-1,
|
||||
menuItem(__txt("Fullscreen"), function() {
|
||||
if(gameframe_is_fullscreen_window())
|
||||
gameframe_set_fullscreen(0);
|
||||
else
|
||||
gameframe_set_fullscreen(2);
|
||||
},, ["", "Fullscreen"]),
|
||||
menuItem(__txt("Fullscreen"), function() { winMan_setFullscreen(!window_is_fullscreen); },, ["", "Fullscreen"]),
|
||||
menuItem(__txt("Close current project"), function() { PANEL_GRAPH.close(); },, [ "", "Close file" ]),
|
||||
menuItem(__txt("Close all projects"), function() { for( var i = array_length(PROJECTS) - 1; i >= 0; i-- ) closeProject(PROJECTS[i]); },, [ "", "Close all" ]),
|
||||
menuItem(__txt("Close program"), function() { window_close(); },, [ "", "Close program" ]),
|
||||
|
@ -322,6 +317,7 @@ function Panel_Menu() : PanelContent() constructor {
|
|||
|
||||
function drawContent(panel) { #region
|
||||
var _right = PREFERENCES.panel_menu_right_control;
|
||||
var _draggable = pFOCUS;
|
||||
|
||||
draw_clear_alpha(COLORS.panel_bg_clear, 1);
|
||||
menus[6][1] = STEAM_ENABLED? menu_help_steam : menu_help;
|
||||
|
@ -346,6 +342,7 @@ function Panel_Menu() : PanelContent() constructor {
|
|||
|
||||
draw_sprite_ui_uniform(THEME.icon_24, 0, bx, h / 2, 1, c_white);
|
||||
if(pHOVER && point_in_rectangle(mx, my, bx - ui(16), 0, bx + ui(16), ui(32))) {
|
||||
_draggable = false;
|
||||
if(mouse_press(mb_left, pFOCUS))
|
||||
dialogCall(o_dialog_about);
|
||||
}
|
||||
|
@ -355,6 +352,7 @@ function Panel_Menu() : PanelContent() constructor {
|
|||
|
||||
draw_sprite_ui_uniform(THEME.icon_24, 0, bx, by, 1, c_white);
|
||||
if(pHOVER && point_in_rectangle(mx, my, bx - ui(16), by - ui(16), bx + ui(16), by + ui(16))) {
|
||||
_draggable = false;
|
||||
if(mouse_press(mb_left, pFOCUS))
|
||||
dialogCall(o_dialog_about);
|
||||
}
|
||||
|
@ -419,6 +417,7 @@ function Panel_Menu() : PanelContent() constructor {
|
|||
}
|
||||
|
||||
if(pHOVER && point_in_rectangle(mx, my, x0, y0, x1, y1)) {
|
||||
_draggable = false;
|
||||
draw_sprite_stretched(THEME.menu_button, 0, x0, y0, x1 - x0, y1 - y0);
|
||||
|
||||
if((mouse_press(mb_left, pFOCUS)) || instance_exists(o_dialog_menubox)) {
|
||||
|
@ -479,6 +478,7 @@ function Panel_Menu() : PanelContent() constructor {
|
|||
var cc = merge_color(c_white, noti_flash_color, ev);
|
||||
|
||||
if(pHOVER && point_in_rectangle(mx, my, nx0, ny0 - nh / 2, nx0 + nw, ny0 + nh / 2)) {
|
||||
_draggable = false;
|
||||
draw_sprite_stretched_ext(THEME.menu_button, 0, nx0, ny0 - nh / 2, nw, nh, cc, 1);
|
||||
if(mouse_press(mb_left, pFOCUS)) {
|
||||
var dia = dialogPanelCall(new Panel_Notification(), nx0, ny0 + nh / 2 + ui(4));
|
||||
|
@ -520,6 +520,7 @@ function Panel_Menu() : PanelContent() constructor {
|
|||
var ww = hori? string_width(name) + ui(40) : w - ui(16);
|
||||
|
||||
if(pHOVER && point_in_rectangle(mx, my, nx0, ny0 - wh / 2, nx0 + ww, ny0 + wh / 2)) {
|
||||
_draggable = false;
|
||||
TOOLTIP = __txt("Addons");
|
||||
draw_sprite_stretched(THEME.menu_button, 1, nx0, ny0 - wh / 2, ww, wh);
|
||||
if(mouse_press(mb_left, pFOCUS))
|
||||
|
@ -544,23 +545,29 @@ function Panel_Menu() : PanelContent() constructor {
|
|||
|
||||
switch(action) {
|
||||
case "exit":
|
||||
if(buttonInstant(THEME.button_hide_fill, x1 - bs, ui(6), bs, bs, [mx, my], pFOCUS, pHOVER,, THEME.window_exit, 0, COLORS._main_accent) == 2)
|
||||
window_close();
|
||||
var b = buttonInstant(THEME.button_hide_fill, x1 - bs, ui(6), bs, bs, [mx, my], pFOCUS, pHOVER,, THEME.window_exit, 0, COLORS._main_accent);
|
||||
if(b) _draggable = false;
|
||||
if(b == 2) window_close();
|
||||
break;
|
||||
case "maximize":
|
||||
var win_max = gameframe_is_maximized() || gameframe_is_fullscreen_window();
|
||||
var win_max = window_is_maximized || window_is_fullscreen;
|
||||
if(OS == os_macosx)
|
||||
win_max = __win_is_maximized;
|
||||
|
||||
if(buttonInstant(THEME.button_hide_fill, x1 - bs, ui(6), bs, bs, [mx, my], pFOCUS, pHOVER,, THEME.window_maximize, win_max, [ COLORS._main_icon, CDEF.lime ]) == 2) {
|
||||
var b = buttonInstant(THEME.button_hide_fill, x1 - bs, ui(6), bs, bs, [mx, my], pFOCUS, pHOVER,, THEME.window_maximize, win_max, [ COLORS._main_icon, CDEF.lime ]);
|
||||
if(b) _draggable = false;
|
||||
if(b == 2) {
|
||||
if(OS == os_windows) {
|
||||
if(gameframe_is_fullscreen_window()) {
|
||||
gameframe_set_fullscreen(0);
|
||||
gameframe_restore();
|
||||
} else if(gameframe_is_maximized())
|
||||
gameframe_restore();
|
||||
else
|
||||
gameframe_maximize();
|
||||
if(window_is_fullscreen) {
|
||||
winMan_setFullscreen(false);
|
||||
winMan_Unmaximize();
|
||||
} else if(window_is_maximized) {
|
||||
winMan_Unmaximize();
|
||||
DISPLAY_REFRESH
|
||||
} else {
|
||||
winMan_Maximize();
|
||||
DISPLAY_REFRESH
|
||||
}
|
||||
} else if(OS == os_macosx) {
|
||||
if(__win_is_maximized) mac_window_minimize();
|
||||
else mac_window_maximize();
|
||||
|
@ -568,30 +575,35 @@ function Panel_Menu() : PanelContent() constructor {
|
|||
}
|
||||
break;
|
||||
case "minimize":
|
||||
if(OS == os_windows) {
|
||||
var b = buttonInstant(THEME.button_hide_fill, x1 - bs, ui(6), bs, bs, [mx, my], pFOCUS, pHOVER,, THEME.window_minimize, 0, [ COLORS._main_icon, CDEF.yellow ]);
|
||||
if(b) _draggable = false;
|
||||
if(b == -2) {
|
||||
if(OS == os_windows)
|
||||
if(buttonInstant(THEME.button_hide_fill, x1 - bs, ui(6), bs, bs, [mx, my], pFOCUS, pHOVER,, THEME.window_minimize, 0, [ COLORS._main_icon, CDEF.yellow ]) == -2) {
|
||||
if(OS == os_windows)
|
||||
gameframe_minimize();
|
||||
winMan_Minimize();
|
||||
else if(OS == os_macosx) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if(OS == os_macosx) {
|
||||
buttonInstant(THEME.button_hide, x1 - bs, ui(6), bs, bs, [mx, my], pFOCUS, pHOVER,, THEME.window_minimize, 0, [ COLORS._main_icon, COLORS._main_icon ]);
|
||||
}
|
||||
|
||||
//if(OS == os_macosx) {
|
||||
// buttonInstant(THEME.button_hide, x1 - bs, ui(6), bs, bs, [mx, my], pFOCUS, pHOVER,, THEME.window_minimize, 0, [ COLORS._main_icon, COLORS._main_icon ]);
|
||||
//}
|
||||
break;
|
||||
case "fullscreen":
|
||||
var win_full = OS == os_windows? gameframe_is_fullscreen_window() : window_get_fullscreen();
|
||||
if(buttonInstant(THEME.button_hide_fill, x1 - bs, ui(6), bs, bs, [mx, my], pFOCUS, pHOVER,, THEME.window_fullscreen, win_full, [ COLORS._main_icon, CDEF.cyan ]) == 2) {
|
||||
var win_full = window_is_fullscreen;
|
||||
var b = buttonInstant(THEME.button_hide_fill, x1 - bs, ui(6), bs, bs, [mx, my], pFOCUS, pHOVER,, THEME.window_fullscreen, win_full, [ COLORS._main_icon, CDEF.cyan ]);
|
||||
if(b) _draggable = false;
|
||||
if(b == 2) {
|
||||
if(OS == os_windows)
|
||||
gameframe_set_fullscreen(gameframe_is_fullscreen_window()? 0 : 2);
|
||||
winMan_setFullscreen(!win_full);
|
||||
else if(OS == os_macosx) {
|
||||
if(window_get_fullscreen()) {
|
||||
window_set_fullscreen(false);
|
||||
if(win_full) {
|
||||
winMan_setFullscreen(false);
|
||||
mac_window_minimize();
|
||||
} else
|
||||
window_set_fullscreen(true);
|
||||
winMan_setFullscreen(true);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -621,6 +633,7 @@ function Panel_Menu() : PanelContent() constructor {
|
|||
var _y1 = h - ui(6);
|
||||
|
||||
if(pHOVER && point_in_rectangle(mx, my, _x0, _y0, _x1, _y1)) {
|
||||
_draggable = false;
|
||||
draw_sprite_stretched_ext(THEME.button_hide_fill, 1, _x0, _y0, _x1 - _x0, _y1 - _y0, sc, 1);
|
||||
|
||||
if(mouse_press(mb_left, pFOCUS))
|
||||
|
@ -639,6 +652,7 @@ function Panel_Menu() : PanelContent() constructor {
|
|||
draw_set_text(f_p0, fa_left, fa_center, tc);
|
||||
var ww = string_width(txt) + ui(12);
|
||||
if(pHOVER && point_in_rectangle(mx, my, _xx1, y1 - ui(16), _xx1 + ww, y1 + ui(16))) {
|
||||
_draggable = false;
|
||||
draw_sprite_stretched_ext(THEME.button_hide_fill, 1, _xx1, y1 - ui(16), ww, ui(32), sc, 1);
|
||||
|
||||
if(mouse_press(mb_left, pFOCUS))
|
||||
|
@ -705,6 +719,7 @@ function Panel_Menu() : PanelContent() constructor {
|
|||
var _b = buttonInstant(THEME.button_hide_fill, tbx0, tby0, tw, th, [mx, my], pFOCUS, pHOVER);
|
||||
var _hov = _b > 0;
|
||||
|
||||
if(_b) _draggable = false;
|
||||
if(_b == 2) {
|
||||
_hov = true;
|
||||
var arr = [];
|
||||
|
@ -755,5 +770,10 @@ function Panel_Menu() : PanelContent() constructor {
|
|||
draw_sprite_ext(s_patreon_supporter, 1, _cx, _cy, 1, 1, 0, _ib, 1);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region drag
|
||||
if(mouse_press(mb_left, _draggable))
|
||||
winMan_initDrag(0b10000);
|
||||
#endregion
|
||||
} #endregion
|
||||
}
|
|
@ -164,9 +164,9 @@
|
|||
|
||||
map.key = save_l;
|
||||
|
||||
PREFERENCES.window_maximize = gameframe_is_maximized();
|
||||
PREFERENCES.window_width = max(960, WIN_W);
|
||||
PREFERENCES.window_height = max(600, WIN_H);
|
||||
PREFERENCES.window_maximize = window_is_maximized;
|
||||
PREFERENCES.window_width = max(960, window_minimize_size[0]);
|
||||
PREFERENCES.window_height = max(600, window_minimize_size[1]);
|
||||
|
||||
map.preferences = PREFERENCES;
|
||||
|
||||
|
@ -215,15 +215,18 @@
|
|||
|
||||
if(OS != os_macosx && !LOADING) {
|
||||
if(PREFERENCES.window_maximize) {
|
||||
gameframe_maximize();
|
||||
winMan_Maximize();
|
||||
} else {
|
||||
var ww = PREFERENCES.window_width;
|
||||
var hh = PREFERENCES.window_height;
|
||||
window_minimize_size = [ ww, hh ];
|
||||
|
||||
window_set_position(display_get_width() / 2 - ww / 2, display_get_height() / 2 - hh / 2);
|
||||
window_set_size(ww, hh);
|
||||
}
|
||||
}
|
||||
|
||||
window_refresh();
|
||||
game_set_speed(PREFERENCES.ui_framerate, gamespeed_fps);
|
||||
|
||||
var grav = struct_try_get(PREFERENCES, "physics_gravity", [ 0, 10 ]);
|
||||
|
|
233
scripts/windowManager/windowManager.gml
Normal file
233
scripts/windowManager/windowManager.gml
Normal file
|
@ -0,0 +1,233 @@
|
|||
#region defines
|
||||
globalvar window_resize_padding; window_resize_padding = 6;
|
||||
globalvar window_minimize_size; window_minimize_size = [ 1920, 1080 ];
|
||||
globalvar window_is_maximized; window_is_maximized = false;
|
||||
globalvar window_is_fullscreen; window_is_fullscreen = false;
|
||||
globalvar window_drag_status; window_drag_status = 0;
|
||||
globalvar window_drag_hold; window_drag_hold = 0;
|
||||
globalvar window_drag_mx; window_drag_mx = 0;
|
||||
globalvar window_drag_my; window_drag_my = 0;
|
||||
globalvar window_drag_sx; window_drag_sx = 0;
|
||||
globalvar window_drag_sy; window_drag_sy = 0;
|
||||
globalvar window_drag_sw; window_drag_sw = 0;
|
||||
globalvar window_drag_sh; window_drag_sh = 0;
|
||||
|
||||
globalvar window_min_w; window_min_w = 960;
|
||||
globalvar window_min_h; window_min_h = 600;
|
||||
|
||||
#macro DISPLAY_REFRESH CURRENT_PANEL = panelSerialize(); display_refresh();
|
||||
#endregion
|
||||
|
||||
function winMan_getData(curr = true) { #region
|
||||
INLINE
|
||||
var _monitors = display_measure_all();
|
||||
var _x = window_get_x();
|
||||
var _y = window_get_y();
|
||||
|
||||
for( var i = 0, n = array_length(_monitors); i < n; i++ ) {
|
||||
var _monitor = _monitors[i];
|
||||
if(!is_array(_monitor) || array_length(_monitor) < 8) continue;
|
||||
|
||||
if(point_in_rectangle(
|
||||
_x + WIN_W / 2,
|
||||
_y + WIN_H / 2,
|
||||
_monitor[0],
|
||||
_monitor[1],
|
||||
_monitor[0] + _monitor[2],
|
||||
_monitor[1] + _monitor[3]
|
||||
)) return _monitor;
|
||||
}
|
||||
|
||||
if(!is_array(_monitor) || array_length(_monitor) < 8)
|
||||
return [ 0, 0, display_get_width(), display_get_height(),
|
||||
0, 0, display_get_width(), display_get_height(), ];
|
||||
return _monitors[0];
|
||||
} #endregion
|
||||
|
||||
function winMan_setRect(_x, _y, _w, _h) { #region
|
||||
INLINE
|
||||
_w = max(window_min_w, _w);
|
||||
_h = max(window_min_h, _h);
|
||||
|
||||
window_set_rectangle(_x, _y, _w, _h);
|
||||
} #endregion
|
||||
|
||||
function winMan_isMinimized() { #region
|
||||
INLINE
|
||||
return gameframe_is_natively_minimized();
|
||||
} #endregion
|
||||
|
||||
function winMan_Maximize() { #region
|
||||
INLINE
|
||||
if(gameframe_is_natively_minimized()) return;
|
||||
window_is_maximized = true;
|
||||
|
||||
var _mon = winMan_getData();
|
||||
winMan_setRect(_mon[4], _mon[5], _mon[6], _mon[7]);
|
||||
gameframe_set_shadow(false);
|
||||
} #endregion
|
||||
|
||||
function winMan_Unmaximize() { #region
|
||||
INLINE
|
||||
if(gameframe_is_natively_minimized()) return;
|
||||
window_is_maximized = false;
|
||||
|
||||
var _mon = winMan_getData();
|
||||
|
||||
winMan_setRect(
|
||||
_mon[4] + _mon[6] / 2 - window_minimize_size[0] / 2,
|
||||
_mon[5] + _mon[7] / 2 - window_minimize_size[1] / 2,
|
||||
window_minimize_size[0],
|
||||
window_minimize_size[1]
|
||||
);
|
||||
gameframe_set_shadow(true);
|
||||
} #endregion
|
||||
|
||||
function winMan_Minimize() { #region
|
||||
INLINE
|
||||
if(gameframe_is_natively_minimized()) return;
|
||||
gameframe_syscommand(61472);
|
||||
} #endregion
|
||||
|
||||
function winMan_initDrag(_index) { #region
|
||||
window_drag_status = _index;
|
||||
window_drag_hold = 0;
|
||||
window_drag_mx = mouse_raw_x;
|
||||
window_drag_my = mouse_raw_y;
|
||||
window_drag_sx = window_get_x();
|
||||
window_drag_sy = window_get_y();
|
||||
window_drag_sw = window_get_width();
|
||||
window_drag_sh = window_get_height();
|
||||
} #endregion
|
||||
|
||||
function winMan_setFullscreen(full) { #region
|
||||
if(full == window_is_fullscreen) return;
|
||||
window_is_fullscreen = full;
|
||||
|
||||
var _mon = winMan_getData();
|
||||
if(full) {
|
||||
winMan_setRect(_mon[0], _mon[1], _mon[2], _mon[3]);
|
||||
gameframe_set_shadow(false);
|
||||
} else {
|
||||
if(window_is_maximized) winMan_Maximize();
|
||||
else winMan_Unmaximize();
|
||||
}
|
||||
|
||||
run_in(5, function() { DISPLAY_REFRESH });
|
||||
} #endregion
|
||||
|
||||
function winManStep() { #region
|
||||
if(window_drag_status == 0) return;
|
||||
var _mx = window_drag_mx;
|
||||
var _my = window_drag_my;
|
||||
var _sx = window_drag_sx;
|
||||
var _sy = window_drag_sy;
|
||||
var _sw = window_drag_sw;
|
||||
var _sh = window_drag_sh;
|
||||
|
||||
var mx = mouse_raw_x;
|
||||
var my = mouse_raw_y;
|
||||
var sx = _sx;
|
||||
var sy = _sy;
|
||||
var sw = _sw;
|
||||
var sh = _sh;
|
||||
|
||||
if(window_drag_status & 0b10000) {
|
||||
if(window_drag_hold == 0 && window_is_maximized) {
|
||||
if(point_distance(mx, my, _mx, _my) > 8)
|
||||
window_drag_hold = 1;
|
||||
} else if(window_drag_hold == 1) {
|
||||
if(window_is_maximized) {
|
||||
winMan_Unmaximize();
|
||||
window_drag_sw = window_minimize_size[0];
|
||||
window_drag_sh = window_minimize_size[1];
|
||||
} else {
|
||||
sx = _sx + (mx - _mx);
|
||||
sy = _sy + (my - _my);
|
||||
|
||||
winMan_setRect(sx, sy, sw, sh);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if(window_drag_status & 0b0001) {
|
||||
sw = _sw + (mx - _mx);
|
||||
}
|
||||
|
||||
if(window_drag_status & 0b0010) {
|
||||
sh = max(window_min_h, _sh - (my - _my));
|
||||
sy = _sy + (_sh - sh);
|
||||
}
|
||||
|
||||
if(window_drag_status & 0b0100) {
|
||||
sw = max(window_min_w, _sw - (mx - _mx));
|
||||
sx = _sx + (_sw - sw);
|
||||
}
|
||||
|
||||
if(window_drag_status & 0b1000) {
|
||||
sh = _sh + (my - _my);
|
||||
}
|
||||
|
||||
winMan_setRect(sx, sy, sw, sh);
|
||||
}
|
||||
|
||||
if(mouse_release(mb_left)) {
|
||||
window_minimize_size = [ sw, sh ];
|
||||
window_drag_status = 0;
|
||||
DISPLAY_REFRESH
|
||||
}
|
||||
} #endregion
|
||||
|
||||
function winManDraw() { #region
|
||||
if(window_is_maximized || window_is_fullscreen) return;
|
||||
|
||||
var pd = window_resize_padding;
|
||||
var hv = -1;
|
||||
|
||||
var l = mouse_mx > 0 && mouse_mx < pd && mouse_my > 0 && mouse_my < WIN_H;
|
||||
var r = mouse_mx > WIN_W - pd && mouse_mx < WIN_W && mouse_my > 0 && mouse_my < WIN_H;
|
||||
var u = mouse_mx > 0 && mouse_mx < WIN_W && mouse_my > 0 && mouse_my < pd;
|
||||
var d = mouse_mx > 0 && mouse_mx < WIN_W && mouse_my > WIN_H - pd && mouse_my < WIN_H;
|
||||
|
||||
if(r) {
|
||||
CURSOR = cr_size_we;
|
||||
hv = 0b0001;
|
||||
}
|
||||
|
||||
if(u) {
|
||||
CURSOR = cr_size_ns;
|
||||
hv = 0b0010;
|
||||
}
|
||||
|
||||
if(l) {
|
||||
CURSOR = cr_size_we;
|
||||
hv = 0b0100;
|
||||
}
|
||||
|
||||
if(d) {
|
||||
CURSOR = cr_size_ns;
|
||||
hv = 0b1000;
|
||||
}
|
||||
|
||||
if(l && u) {
|
||||
CURSOR = cr_size_nwse;
|
||||
hv = 0b0110;
|
||||
}
|
||||
|
||||
if(r && d) {
|
||||
CURSOR = cr_size_nwse;
|
||||
hv = 0b1001;
|
||||
}
|
||||
|
||||
if(l && d) {
|
||||
CURSOR = cr_size_nesw;
|
||||
hv = 0b1100;
|
||||
}
|
||||
|
||||
if(r && u) {
|
||||
CURSOR = cr_size_nesw;
|
||||
hv = 0b0011;
|
||||
}
|
||||
|
||||
if(hv > -1 && mouse_press(mb_left))
|
||||
winMan_initDrag(hv);
|
||||
} #endregion
|
|
@ -1,11 +1,11 @@
|
|||
{
|
||||
"resourceType": "GMScript",
|
||||
"resourceVersion": "1.0",
|
||||
"name": "gameframe",
|
||||
"name": "windowManager",
|
||||
"isCompatibility": false,
|
||||
"isDnD": false,
|
||||
"parent": {
|
||||
"name": "Gameframe",
|
||||
"path": "folders/_extensions/Gameframe.yy",
|
||||
"name": "WinMan",
|
||||
"path": "folders/_extensions/WinMan.yy",
|
||||
},
|
||||
}
|
Loading…
Reference in a new issue