Pixel-Composer/objects/o_main/Step_1.gml

169 lines
4 KiB
Text
Raw Normal View History

2022-01-13 05:24:03 +01:00
/// @description init
#region window
//if(keyboard_check_pressed(vk_f12)) DEBUG = !DEBUG;
if(_cursor != CURSOR) {
window_set_cursor(CURSOR);
_cursor = CURSOR;
}
CURSOR = cr_default;
2023-03-11 06:40:34 +01:00
if(!gameframe_is_minimized() && (win_wp != WIN_W || win_hp != WIN_H) && (WIN_W > 1 && WIN_H > 1)) {
if(!win_resize) CURRENT_PANEL = panelSerialize();
2022-11-01 03:06:03 +01:00
display_refresh();
2023-03-11 06:40:34 +01:00
win_resize = true;
} else
win_resize = false;
2022-01-13 05:24:03 +01:00
#endregion
#region focus
HOVER = noone;
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-02-28 09:43:01 +01:00
with(_p_dialog) checkFocus();
with(_p_dialog) checkDepth();
2022-01-13 05:24:03 +01:00
2023-02-28 09:43:01 +01:00
with(_p_dialog) doDrag();
with(_p_dialog) doResize();
with(_p_dialog) checkMouse();
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;
if(PREF_MAP[? "auto_save_time"] > 0 && AUTO_SAVE_TIMER > PREF_MAP[? "auto_save_time"]) {
AUTO_SAVE_TIMER = 0;
2023-03-08 12:14:01 +01:00
var loc = DIRECTORY + "Autosave/";
2023-02-15 10:43:24 +01:00
if(!directory_exists(loc))
directory_create(loc);
var fname = string_replace(filename_name(CURRENT_PATH), filename_ext(CURRENT_PATH), "") +
"_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) +
string_lead_zero(current_second, 2) + ".pxc";
2023-02-19 13:49:20 +01:00
try
SAVE_AT(loc + fname, "Autosaved ");
catch(e)
print(exception_print(e));
2023-02-15 10:43:24 +01:00
}
#endregion
2022-01-13 05:24:03 +01:00
#region nodes
2022-12-16 09:18:09 +01:00
var _k = ds_map_find_first(NODE_MAP);
var _a = ds_map_size(NODE_MAP);
repeat(_a) {
NODE_MAP[? _k].stepBegin();
_k = ds_map_find_next(NODE_MAP, _k);
2022-01-13 05:24:03 +01:00
}
2023-03-12 02:28:21 +01:00
if(ANIMATOR.is_playing || ANIMATOR.rendering) {
if(ANIMATOR.frame_progress)
2023-03-19 09:17:39 +01:00
Render(true);
2023-03-12 02:28:21 +01:00
ANIMATOR.frame_progress = false;
} else {
if(UPDATE & RENDER_TYPE.full) {
Render();
} else if(UPDATE & RENDER_TYPE.partial)
Render(true);
}
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) {
DOUBLE_CLICK = true;
dc_check = 0;
2022-12-12 09:08:03 +01:00
} else
dc_check = PREF_MAP[? "double_click_delay"];
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
#region step
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
#region dialog
2023-01-25 06:49:00 +01:00
if(mouse_release(mb_any))
2022-11-18 03:20:31 +01:00
DIALOG_CLICK = true;
2022-12-22 03:09:55 +01:00
#endregion
#region modifiers
2023-02-14 02:51:14 +01:00
if(CTRL == KEYBOARD_STATUS.up)
CTRL = KEYBOARD_STATUS.idle;
if(SHIFT == KEYBOARD_STATUS.up)
SHIFT = KEYBOARD_STATUS.idle;
if(ALT == KEYBOARD_STATUS.up)
ALT = KEYBOARD_STATUS.idle;
if(CTRL == KEYBOARD_STATUS.pressing && !keyboard_check(vk_control))
CTRL = KEYBOARD_STATUS.up;
if(SHIFT == KEYBOARD_STATUS.pressing && !keyboard_check(vk_shift))
SHIFT = KEYBOARD_STATUS.up;
if(ALT == KEYBOARD_STATUS.pressing && !keyboard_check(vk_alt))
ALT = KEYBOARD_STATUS.up;
2022-12-22 03:09:55 +01:00
if(CTRL == KEYBOARD_STATUS.down)
CTRL = KEYBOARD_STATUS.pressing;
2023-02-14 02:51:14 +01:00
2022-12-22 03:09:55 +01:00
if(SHIFT == KEYBOARD_STATUS.down)
2023-02-14 02:51:14 +01:00
SHIFT = KEYBOARD_STATUS.pressing;
2022-12-22 03:09:55 +01:00
if(ALT == KEYBOARD_STATUS.down)
2023-02-14 02:51:14 +01:00
ALT = KEYBOARD_STATUS.pressing;
2022-12-22 03:09:55 +01:00
if(keyboard_check_pressed(vk_control))
2023-02-14 02:51:14 +01:00
CTRL = KEYBOARD_STATUS.down;
2022-12-22 03:09:55 +01:00
if(keyboard_check_pressed(vk_shift))
SHIFT = KEYBOARD_STATUS.down;
if(keyboard_check_pressed(vk_alt))
2023-02-14 02:51:14 +01:00
ALT = KEYBOARD_STATUS.down;
2022-12-22 03:09:55 +01:00
if(keyboard_check_released(vk_control))
2023-02-14 02:51:14 +01:00
CTRL = KEYBOARD_STATUS.up;
2022-12-22 03:09:55 +01:00
if(keyboard_check_released(vk_shift))
SHIFT = KEYBOARD_STATUS.up;
if(keyboard_check_released(vk_alt))
2023-02-14 02:51:14 +01:00
ALT = KEYBOARD_STATUS.up;
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-03-07 14:29:47 +01:00
#endregion