2022-01-13 05:24:03 +01:00
|
|
|
/// @description init
|
2024-09-11 09:54:40 +02:00
|
|
|
if(PREFERENCES.multi_window) winwin_update();
|
|
|
|
|
2024-09-12 12:42:35 +02:00
|
|
|
// print($"{TOOLTIP_WINDOW}, {winwin_get_focus()}");
|
|
|
|
// print(keyboard_check(vk_space));
|
|
|
|
|
2023-11-30 08:55:33 +01:00
|
|
|
global.__debug_runner++;
|
2023-07-14 20:34:35 +02:00
|
|
|
global.cache_call = 0;
|
|
|
|
global.cache_hit = 0;
|
|
|
|
|
2023-11-08 13:05:24 +01:00
|
|
|
HOVERING_ELEMENT = _HOVERING_ELEMENT;
|
2023-05-03 21:42:17 +02:00
|
|
|
_HOVERING_ELEMENT = noone;
|
2024-07-22 10:21:57 +02:00
|
|
|
FILE_DROPPED = _FILE_DROPPED;
|
|
|
|
_FILE_DROPPED = false;
|
2023-05-03 21:42:17 +02:00
|
|
|
|
2023-03-28 06:58:28 +02:00
|
|
|
#region minimize
|
2023-12-18 04:40:21 +01:00
|
|
|
if(winMan_isMinimized()) {
|
|
|
|
if(!minimized) game_set_speed(1, gamespeed_fps);
|
|
|
|
minimized = true;
|
|
|
|
exit;
|
2024-05-07 10:54:34 +02:00
|
|
|
|
2023-12-18 04:40:21 +01:00
|
|
|
} else if(!minimized)
|
|
|
|
window_preminimize_rect = [ window_get_x(), window_get_y(), window_get_width(), window_get_height() ];
|
2023-03-28 06:58:28 +02:00
|
|
|
|
|
|
|
if(minimized) {
|
2023-12-18 04:40:21 +01:00
|
|
|
window_set_rectangle(window_preminimize_rect[0], window_preminimize_rect[1], window_preminimize_rect[2], window_preminimize_rect[3]);
|
2023-03-28 06:58:28 +02:00
|
|
|
minimized = false;
|
|
|
|
}
|
2024-09-02 11:53:15 +02:00
|
|
|
|
2024-09-11 09:54:40 +02:00
|
|
|
var foc = window_has_focus();
|
2024-09-12 05:27:42 +02:00
|
|
|
//if(HOVER && instance_exists(HOVER) && HOVER.window != noone)
|
2024-10-01 08:17:03 +02:00
|
|
|
if(PREFERENCES.multi_window)
|
2024-09-12 05:27:42 +02:00
|
|
|
foc = true;
|
2024-09-11 09:54:40 +02:00
|
|
|
|
|
|
|
game_set_speed(foc || IS_PLAYING? PREFERENCES.ui_framerate : PREFERENCES.ui_framerate_non_focus, gamespeed_fps);
|
|
|
|
WINDOW_ACTIVE = noone;
|
2023-03-28 06:58:28 +02:00
|
|
|
#endregion
|
|
|
|
|
2024-03-29 05:20:49 +01:00
|
|
|
#region fpss
|
|
|
|
if(fpsr++ % 5 == 0) {
|
|
|
|
var ff = 0;
|
|
|
|
for( var i = 1; i < 10; i++ ) {
|
|
|
|
fpss[i] = fpss[i - 1]
|
|
|
|
ff += fpss[i];
|
|
|
|
}
|
|
|
|
fpss[0] = fps_real;
|
|
|
|
ff += fps_real;
|
|
|
|
FPS_REAL = round(ff / 10);
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
|
2024-03-02 10:08:44 +01:00
|
|
|
#region window & mouse
|
2022-01-13 05:24:03 +01:00
|
|
|
//if(keyboard_check_pressed(vk_f12)) DEBUG = !DEBUG;
|
|
|
|
|
2024-09-12 05:08:48 +02:00
|
|
|
global_mouse_pool_init();
|
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
if(_cursor != CURSOR) {
|
|
|
|
window_set_cursor(CURSOR);
|
|
|
|
_cursor = CURSOR;
|
2024-03-24 04:58:08 +01:00
|
|
|
}
|
|
|
|
CURSOR = cr_default;
|
|
|
|
|
|
|
|
if(_cursor_lock != CURSOR_LOCK) {
|
|
|
|
window_mouse_set_locked(CURSOR_LOCK);
|
|
|
|
if(!CURSOR_LOCK) window_mouse_set(CURSOR_LOCK_X, CURSOR_LOCK_Y);
|
2022-01-13 05:24:03 +01:00
|
|
|
}
|
2023-11-05 04:19:19 +01:00
|
|
|
|
2024-03-26 04:03:45 +01:00
|
|
|
_cursor_lock = CURSOR_LOCK;
|
|
|
|
CURSOR_IS_LOCK = CURSOR_LOCK;
|
|
|
|
CURSOR_LOCK = false;
|
2024-02-25 11:02:10 +01:00
|
|
|
|
|
|
|
if(!is_surface(watcher_surface)) {
|
|
|
|
RENDER_ALL
|
|
|
|
watcher_surface = surface_create(1, 1);
|
|
|
|
}
|
2024-03-02 10:08:44 +01:00
|
|
|
|
2024-07-17 06:50:02 +02:00
|
|
|
if(PEN_POOL <= 0) PEN_USE = false;
|
|
|
|
else PEN_POOL--;
|
|
|
|
|
2024-03-02 10:08:44 +01:00
|
|
|
PEN_RELEASED = false;
|
|
|
|
PEN_RIGHT_PRESS = false;
|
|
|
|
PEN_RIGHT_RELEASE = false;
|
|
|
|
|
2024-04-18 08:01:23 +02:00
|
|
|
PEN_X_DELTA = 0;
|
|
|
|
PEN_Y_DELTA = 0;
|
|
|
|
|
2024-03-02 10:08:44 +01:00
|
|
|
if(!IS_CMD) tabletstuff_perform_event(id, ev_other, ev_user10);
|
|
|
|
|
|
|
|
//print($"{PEN_RIGHT_CLICK} | {PEN_RIGHT_PRESS}, {PEN_RIGHT_RELEASE}");
|
|
|
|
//print($"{mouse_x}, {mouse_y}");
|
2022-01-13 05:24:03 +01:00
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region focus
|
2023-08-12 09:41:13 +02:00
|
|
|
if(mouse_release(mb_any)) DIALOG_CLICK = true;
|
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
HOVER = noone;
|
2024-09-11 09:54:40 +02:00
|
|
|
with(_p_dialog) checkMouse(); WINDOW_ACTIVE = noone;
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2023-11-08 08:38:04 +01:00
|
|
|
if(PANEL_MAIN != 0) PANEL_MAIN.stepBegin();
|
2023-02-28 09:43:01 +01:00
|
|
|
|
2022-01-13 05:24:03 +01:00
|
|
|
DIALOG_DEPTH_HOVER = 0;
|
2023-08-12 09:41:13 +02:00
|
|
|
|
2024-09-11 09:54:40 +02:00
|
|
|
with(_p_dialog) checkFocus(); WINDOW_ACTIVE = noone;
|
|
|
|
with(_p_dialog) checkDepth(); WINDOW_ACTIVE = noone;
|
2022-01-13 05:24:03 +01:00
|
|
|
|
2024-09-11 09:54:40 +02:00
|
|
|
with(_p_dialog) doDrag(); WINDOW_ACTIVE = noone;
|
|
|
|
with(_p_dialog) doResize(); WINDOW_ACTIVE = noone;
|
2022-01-13 05:24:03 +01:00
|
|
|
#endregion
|
|
|
|
|
2023-02-15 10:43:24 +01:00
|
|
|
#region auto save
|
|
|
|
AUTO_SAVE_TIMER += delta_time / 1_000_000;
|
|
|
|
|
2023-10-31 05:30:42 +01:00
|
|
|
if(PROJECT.modified && PREFERENCES.auto_save_time > 0 && AUTO_SAVE_TIMER > PREFERENCES.auto_save_time) {
|
2023-02-15 10:43:24 +01:00
|
|
|
AUTO_SAVE_TIMER = 0;
|
2023-03-08 12:14:01 +01:00
|
|
|
var loc = DIRECTORY + "Autosave/";
|
2023-11-18 03:47:11 +01:00
|
|
|
directory_verify(loc);
|
2023-02-15 10:43:24 +01:00
|
|
|
|
2023-07-06 19:49:16 +02:00
|
|
|
var fname = string_replace(filename_name(PROJECT.path), filename_ext(PROJECT.path), "") +
|
2023-02-15 10:43:24 +01:00
|
|
|
"_autosave" + string(current_year) + "-" +
|
|
|
|
string_lead_zero(current_month, 2) + "-" +
|
|
|
|
string_lead_zero(current_day, 2) + "T" +
|
|
|
|
string_lead_zero(current_hour, 2) +
|
|
|
|
string_lead_zero(current_minute, 2) +
|
2024-04-01 13:32:13 +02:00
|
|
|
string_lead_zero(current_second, 2) + filename_ext(PROJECT.path);
|
2023-02-15 10:43:24 +01:00
|
|
|
|
2023-07-06 19:49:16 +02:00
|
|
|
try { SAVE_AT(PROJECT, loc + fname, "Autosaved "); }
|
2023-05-08 10:50:42 +02:00
|
|
|
catch(e) { print(exception_print(e)); }
|
2023-02-15 10:43:24 +01:00
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
|
2023-11-26 13:16:38 +01:00
|
|
|
#region animation & render
|
2023-03-28 06:58:28 +02:00
|
|
|
DEF_SURFACE_RESET();
|
|
|
|
|
2024-02-11 14:53:33 +01:00
|
|
|
if(!PROJECT.safeMode && UPDATE_RENDER_ORDER) {
|
2023-12-25 12:51:12 +01:00
|
|
|
ResetAllNodesRender();
|
|
|
|
NodeTopoSort();
|
|
|
|
}
|
|
|
|
|
2024-08-08 06:57:51 +02:00
|
|
|
if(!PROJECT.safeMode) array_foreach(PROJECT.allNodes, function(_node) /*=>*/ { if(!_node.active) return; _node.stepBegin(); });
|
|
|
|
|
2023-12-25 12:51:12 +01:00
|
|
|
if(LIVE_UPDATE)
|
2023-12-22 08:42:02 +01:00
|
|
|
Render();
|
|
|
|
else if(!PROJECT.safeMode) {
|
2023-11-01 08:10:25 +01:00
|
|
|
UPDATE_RENDER_ORDER = false;
|
2023-11-08 08:38:04 +01:00
|
|
|
|
2023-11-01 08:10:25 +01:00
|
|
|
if(PROJECT.active) {
|
2024-01-19 09:33:37 +01:00
|
|
|
PROJECT.animator.is_simulating = false;
|
2023-11-08 08:38:04 +01:00
|
|
|
|
2024-02-12 13:59:43 +01:00
|
|
|
if(PROGRAM_ARGUMENTS._run) {
|
|
|
|
if(PROJECT != noone && PROJECT.path != "") {
|
|
|
|
exportAll();
|
|
|
|
PROGRAM_ARGUMENTS._run = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
} else if(IS_PLAYING || IS_RENDERING) {
|
2023-11-01 08:10:25 +01:00
|
|
|
if(PROJECT.animator.frame_progress) {
|
|
|
|
__addon_preAnim();
|
2023-11-25 08:54:35 +01:00
|
|
|
|
2024-01-19 09:33:37 +01:00
|
|
|
if(IS_FIRST_FRAME)
|
2023-11-01 08:10:25 +01:00
|
|
|
ResetAllNodesRender();
|
2024-02-12 13:59:43 +01:00
|
|
|
|
|
|
|
if(IS_CMD) Render(false);
|
|
|
|
else Render(true);
|
2023-11-30 03:18:25 +01:00
|
|
|
|
2023-11-01 08:10:25 +01:00
|
|
|
__addon_postAnim();
|
|
|
|
}
|
|
|
|
PROJECT.animator.frame_progress = false;
|
2024-02-12 13:59:43 +01:00
|
|
|
|
2023-11-01 08:10:25 +01:00
|
|
|
} else {
|
2024-02-15 14:23:26 +01:00
|
|
|
if(UPDATE & RENDER_TYPE.full)
|
2024-02-12 13:59:43 +01:00
|
|
|
Render();
|
2024-02-11 14:53:33 +01:00
|
|
|
|
2024-02-15 14:23:26 +01:00
|
|
|
else if(UPDATE & RENDER_TYPE.partial)
|
2023-11-01 08:10:25 +01:00
|
|
|
Render(true);
|
2023-07-23 21:15:45 +02:00
|
|
|
}
|
2023-04-23 16:47:33 +02:00
|
|
|
}
|
2023-03-12 02:28:21 +01:00
|
|
|
}
|
2023-07-23 21:15:45 +02:00
|
|
|
|
2024-02-15 14:23:26 +01:00
|
|
|
if(PROGRAM_ARGUMENTS._rendering && PROGRAM_ARGUMENTS._run == false && array_empty(PROGRAM_ARGUMENTS._exporting)) {
|
|
|
|
log_console($"Export {CLI_EXPORT_AMOUNT} {CLI_EXPORT_AMOUNT > 1? "files" : "file"} completed");
|
|
|
|
|
|
|
|
if(PROGRAM_ARGUMENTS._persist) {
|
|
|
|
PROGRAM_ARGUMENTS._rendering = false;
|
|
|
|
cli_wait();
|
|
|
|
} else
|
|
|
|
game_end();
|
|
|
|
}
|
2024-02-12 13:59:43 +01:00
|
|
|
|
2022-12-10 05:06:01 +01:00
|
|
|
UPDATE = RENDER_TYPE.none;
|
2022-01-13 05:24:03 +01:00
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region clicks
|
|
|
|
DOUBLE_CLICK = false;
|
2022-12-10 05:06:01 +01:00
|
|
|
if(mouse_press(mb_left)) {
|
2022-01-13 05:24:03 +01:00
|
|
|
if(dc_check > 0) {
|
2023-07-17 19:58:33 +02:00
|
|
|
if(point_distance(mouse_mx, mouse_my, DOUBLE_CLICK_POS[0], DOUBLE_CLICK_POS[1]) < 8)
|
|
|
|
DOUBLE_CLICK = true;
|
2022-01-13 05:24:03 +01:00
|
|
|
dc_check = 0;
|
2023-07-17 19:58:33 +02:00
|
|
|
} else {
|
2023-10-31 05:30:42 +01:00
|
|
|
dc_check = PREFERENCES.double_click_delay;
|
2023-07-17 19:58:33 +02:00
|
|
|
DOUBLE_CLICK_POS = [ mouse_mx, mouse_my ];
|
|
|
|
}
|
2022-01-13 05:24:03 +01:00
|
|
|
}
|
|
|
|
|
2022-12-12 09:08:03 +01:00
|
|
|
dc_check -= DELTA_TIME;
|
2022-01-13 05:24:03 +01:00
|
|
|
#endregion
|
|
|
|
|
2024-08-02 14:30:35 +02:00
|
|
|
#region actions
|
2022-01-13 05:24:03 +01:00
|
|
|
if(array_length(action_last_frame) > 0) {
|
|
|
|
ds_stack_push(UNDO_STACK, action_last_frame);
|
|
|
|
ds_stack_clear(REDO_STACK);
|
|
|
|
}
|
|
|
|
action_last_frame = [];
|
2022-11-18 03:20:31 +01:00
|
|
|
#endregion
|
|
|
|
|
2022-12-22 03:09:55 +01:00
|
|
|
#region modifiers
|
2024-07-05 05:18:46 +02:00
|
|
|
var _d = PREFERENCES.double_click_delay;
|
|
|
|
|
|
|
|
kd_ctrl += DELTA_TIME;
|
|
|
|
if(CTRL == KEY_STAT.up) CTRL = KEY_STAT.idle;
|
|
|
|
if(CTRL == KEY_STAT.pressing && !keyboard_check(vk_control)) CTRL = KEY_STAT.up;
|
|
|
|
if(CTRL == KEY_STAT.down || CTRL == KEY_STAT.double) CTRL = KEY_STAT.pressing;
|
|
|
|
if(keyboard_check_pressed(vk_control)) { CTRL = kd_ctrl < _d? KEY_STAT.double : KEY_STAT.down; kd_ctrl = 0; }
|
|
|
|
if(keyboard_check_released(vk_control)) CTRL = KEY_STAT.up;
|
|
|
|
|
|
|
|
kd_shift += DELTA_TIME;
|
|
|
|
if(SHIFT == KEY_STAT.up) SHIFT = KEY_STAT.idle;
|
|
|
|
if(SHIFT == KEY_STAT.pressing && !keyboard_check(vk_shift)) SHIFT = KEY_STAT.up;
|
|
|
|
if(SHIFT == KEY_STAT.down || SHIFT == KEY_STAT.double) SHIFT = KEY_STAT.pressing;
|
|
|
|
if(keyboard_check_pressed(vk_shift)) { SHIFT = kd_shift < _d? KEY_STAT.double : KEY_STAT.down; kd_shift = 0; }
|
|
|
|
if(keyboard_check_released(vk_shift)) SHIFT = KEY_STAT.up;
|
|
|
|
|
|
|
|
kd_alt += DELTA_TIME;
|
|
|
|
if(ALT == KEY_STAT.up) ALT = KEY_STAT.idle;
|
|
|
|
if(ALT == KEY_STAT.pressing && !keyboard_check(vk_alt)) ALT = KEY_STAT.up;
|
|
|
|
if(ALT == KEY_STAT.down || ALT == KEY_STAT.double) ALT = KEY_STAT.pressing;
|
|
|
|
if(keyboard_check_pressed(vk_alt)) { ALT = kd_alt < _d? KEY_STAT.double : KEY_STAT.down; kd_alt = 0; }
|
|
|
|
if(keyboard_check_released(vk_alt)) ALT = KEY_STAT.up;
|
2022-12-22 03:09:55 +01:00
|
|
|
|
2024-04-21 11:52:16 +02:00
|
|
|
HOTKEY_MOD = 0;
|
2024-07-05 05:18:46 +02:00
|
|
|
if(CTRL == KEY_STAT.pressing) HOTKEY_MOD |= MOD_KEY.ctrl;
|
|
|
|
if(SHIFT == KEY_STAT.pressing) HOTKEY_MOD |= MOD_KEY.shift;
|
|
|
|
if(ALT == KEY_STAT.pressing) HOTKEY_MOD |= MOD_KEY.alt;
|
|
|
|
|
2022-12-23 04:45:52 +01:00
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region mouse wrap
|
|
|
|
MOUSE_WRAPPING = max(0, MOUSE_WRAPPING - 1);
|
|
|
|
|
|
|
|
if(MOUSE_WRAP) {
|
2022-12-27 04:00:50 +01:00
|
|
|
var _pad = 2;
|
|
|
|
|
2023-01-25 06:49:00 +01:00
|
|
|
if(mouse_mx < _pad) {
|
|
|
|
window_mouse_set(window_get_width() - _pad, mouse_my);
|
2022-12-23 04:45:52 +01:00
|
|
|
MOUSE_WRAPPING = 2;
|
2023-01-25 06:49:00 +01:00
|
|
|
} else if(mouse_mx > window_get_width() - _pad) {
|
|
|
|
window_mouse_set(_pad, mouse_my);
|
2022-12-23 04:45:52 +01:00
|
|
|
MOUSE_WRAPPING = 2;
|
|
|
|
}
|
|
|
|
|
2023-01-25 06:49:00 +01:00
|
|
|
if(mouse_my < _pad) {
|
|
|
|
window_mouse_set(mouse_mx, window_get_height() - _pad);
|
2022-12-23 04:45:52 +01:00
|
|
|
MOUSE_WRAPPING = 2;
|
2023-01-25 06:49:00 +01:00
|
|
|
} else if(mouse_my > window_get_height() - _pad) {
|
|
|
|
window_mouse_set(mouse_mx, _pad);
|
2022-12-23 04:45:52 +01:00
|
|
|
MOUSE_WRAPPING = 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
MOUSE_WRAP = false;
|
2023-07-14 20:34:35 +02:00
|
|
|
#endregion
|
|
|
|
|
2024-01-25 08:24:02 +01:00
|
|
|
#region depth
|
|
|
|
if(_use_depth != USE_DEPTH) {
|
|
|
|
_use_depth = USE_DEPTH;
|
|
|
|
surface_depth_disable(!USE_DEPTH);
|
|
|
|
}
|
|
|
|
|
|
|
|
USE_DEPTH = false;
|
|
|
|
#endregion
|
|
|
|
|
2024-02-15 14:23:26 +01:00
|
|
|
#region cmd
|
|
|
|
var _resPath = program_directory + "in";
|
|
|
|
|
|
|
|
if(file_exists(_resPath)) {
|
|
|
|
var cmd = file_read_all(_resPath);
|
|
|
|
cmd_submit(cmd);
|
|
|
|
file_delete(_resPath);
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
|
2024-04-08 07:13:46 +02:00
|
|
|
//if(global.cache_call) print($"CACHE called: {global.cache_call} | hit: {global.cache_hit} ({global.cache_hit / global.cache_call * 100}%)");
|
2024-09-18 03:05:47 +02:00
|
|
|
//print($"{is_struct(HOVER)? instanceof(HOVER) : HOVER}, {is_struct(FOCUS)? instanceof(FOCUS) : FOCUS}");
|
2024-09-17 05:09:06 +02:00
|
|
|
//print($"{mouse_mx}, {mouse_my}");
|