Pixel-Composer/objects/o_main/Step_0.gml

158 lines
3.6 KiB
Plaintext
Raw Normal View History

2022-01-13 05:24:03 +01:00
/// @description init
2023-03-28 06:58:28 +02:00
if(OS == os_windows && gameframe_is_minimized()) exit;
2023-03-07 14:29:47 +01:00
//print("===== Step start =====");
2022-01-13 05:24:03 +01:00
#region animation
2023-01-25 06:49:00 +01:00
if(ANIMATOR.is_playing && ANIMATOR.play_freeze == 0) {
2023-01-01 02:06:02 +01:00
ANIMATOR.time_since_last_frame += ANIMATOR.framerate * (delta_time / 1000000);
2023-02-14 02:51:14 +01:00
if(ANIMATOR.time_since_last_frame >= 1)
ANIMATOR.setFrame(ANIMATOR.real_frame + 1);
2022-01-13 05:24:03 +01:00
} else {
2023-03-02 07:59:14 +01:00
ANIMATOR.frame_progress = false;
2022-12-10 05:06:01 +01:00
ANIMATOR.setFrame(ANIMATOR.real_frame);
2023-01-01 02:06:02 +01:00
ANIMATOR.time_since_last_frame = 0;
2022-01-13 05:24:03 +01:00
}
2023-01-25 06:49:00 +01:00
ANIMATOR.play_freeze = max(0, ANIMATOR.play_freeze - 1);
2023-02-14 02:51:14 +01:00
#endregion
#region step
2023-03-07 14:29:47 +01:00
GLOBAL.step();
2023-01-25 06:49:00 +01:00
2023-02-14 02:51:14 +01:00
try {
if(PANEL_MAIN != 0)
PANEL_MAIN.step();
for(var i = 0; i < ds_list_size(NODES); i++) {
NODES[| i].step();
}
} catch(e)
noti_warning("Step error: " + exception_print(e));
2022-01-13 05:24:03 +01:00
#endregion
#region hotkey
HOTKEY_MOD = 0;
2022-12-22 03:09:55 +01:00
if(CTRL == KEYBOARD_STATUS.pressing) HOTKEY_MOD |= MOD_KEY.ctrl;
if(SHIFT == KEYBOARD_STATUS.pressing) HOTKEY_MOD |= MOD_KEY.shift;
if(ALT == KEYBOARD_STATUS.pressing) HOTKEY_MOD |= MOD_KEY.alt;
2022-01-13 05:24:03 +01:00
if(ds_map_exists(HOTKEYS, "")) {
var l = HOTKEYS[? ""];
for(var i = 0; i < ds_list_size(l); i++) {
2023-01-17 08:11:55 +01:00
var hotkey = l[| i];
var name = hotkey.name;
2022-01-13 05:24:03 +01:00
2023-03-07 14:29:47 +01:00
if(hotkey.key != -1 && key_press(hotkey.key, hotkey.modi)) {
2022-12-22 03:09:55 +01:00
hotkey.action();
2022-01-13 05:24:03 +01:00
break;
}
}
}
if(ds_map_exists(HOTKEYS, FOCUS_STR)) {
var list = HOTKEYS[? FOCUS_STR];
for(var i = 0; i < ds_list_size(list); i++) {
var hotkey = list[| i];
2023-02-28 09:43:01 +01:00
if(hotkey.key != -1 && key_press(hotkey.key, hotkey.modi)) {
hotkey.action();
break;
2022-01-13 05:24:03 +01:00
}
}
}
#endregion
#region coroutine
for( var i = 0; i < ds_list_size(GIF_READER); i++ ) {
var _reader = GIF_READER[| i];
var _reading = _reader[0].reading();
if(_reading) {
var ret = _reader[2];
ret(new __gif_sprite_builder(_reader[0]));
ds_stack_push(gif_complete_st, i);
}
}
while(!ds_stack_empty(gif_complete_st)) {
var i = ds_stack_pop(gif_complete_st);
buffer_delete(GIF_READER[| i][1]);
delete GIF_READER[| i][0];
ds_list_delete(GIF_READER, i);
}
#endregion
2022-09-21 06:09:40 +02:00
#region file drop
2023-03-08 12:14:01 +01:00
if(OS == os_windows) {
if(array_length(drop_path)) {
load_file_path(drop_path);
drop_path = [];
}
} else if(OS == os_macosx) {
file_dnd_set_files(file_dnd_pattern, file_dnd_allowfiles, file_dnd_allowdirs, file_dnd_allowmulti);
file_dnd_filelist = file_dnd_get_files();
if(file_dnd_filelist != "" && _file_dnd_filelist != file_dnd_filelist) {
var path = string_trim(file_dnd_filelist);
load_file_path(string_splice(path, "\n"));
}
_file_dnd_filelist = file_dnd_filelist;
2022-09-21 06:09:40 +02:00
}
2022-09-27 06:37:28 +02:00
#endregion
#region window
if(_modified != MODIFIED) {
_modified = MODIFIED;
2023-02-14 02:51:14 +01:00
var cap = "";
if(SAFE_MODE) cap += "[SAFE MODE] ";
if(READONLY) cap += "[READ ONLY] ";
cap += CURRENT_PATH + (MODIFIED? "*" : "") + " - Pixel Composer";
window_set_caption(cap);
2022-09-27 06:37:28 +02:00
}
2022-11-03 11:44:49 +01:00
#endregion
#region notification
if(!ds_list_empty(WARNING)) {
var rem = ds_stack_create();
for( var i = 0; i < ds_list_size(WARNING); i++ ) {
var w = WARNING[| i];
if(--w.life <= 0)
ds_stack_push(rem, w);
}
while(!ds_stack_empty(rem)) {
ds_list_delete(WARNING, ds_stack_pop(rem));
}
ds_stack_destroy(rem);
}
2023-02-14 02:51:14 +01:00
#endregion
#region steam
steam_update();
if(STEAM_ENABLED) {
if (steam_is_screenshot_requested()) {
var file = "PixelComposer_" + string(irandom_range(100_000, 999_999)) + ".png";
screen_save(file);
steam_send_screenshot(file, window_get_width(), window_get_height());
}
}
2023-03-07 14:29:47 +01:00
#endregion
2023-03-26 07:13:36 +02:00
#region tween
tweenStep();
#endregion
2023-03-11 01:40:17 +01:00
//print("===== Step end =====");
2023-03-13 10:45:56 +01:00
//if(keyboard_check_pressed(ord("Q"))) {
// if(key_mod_press(CTRL))
// print(panelSerializeArray());
// else
// print(panelSerialize());
//}