Pixel-Composer/objects/o_main/Step_0.gml

144 lines
3.3 KiB
Plaintext
Raw Normal View History

2022-01-13 05:24:03 +01:00
/// @description init
#region step
if(PANEL_MAIN != 0)
PANEL_MAIN.step();
for(var i = 0; i < ds_list_size(NODES); i++) {
NODES[| i].step();
}
#endregion
#region animation
if(ANIMATOR.is_playing) {
2022-12-12 09:08:03 +01:00
var fr = ANIMATOR.real_frame + ANIMATOR.framerate * (delta_time / 1000000);
if(fr <= ANIMATOR.real_frame + 1)
ANIMATOR.real_frame = fr;
2022-11-22 14:25:39 +01:00
if(round(ANIMATOR.real_frame) >= ANIMATOR.frames_total) {
2022-01-13 05:24:03 +01:00
switch(ANIMATOR.playback) {
case ANIMATOR_END.loop :
2022-12-10 05:06:01 +01:00
ANIMATOR.setFrame(0);
2022-01-13 05:24:03 +01:00
break;
case ANIMATOR_END.stop :
2022-12-10 05:06:01 +01:00
ANIMATOR.setFrame(ANIMATOR.frames_total - 1);
2022-01-13 05:24:03 +01:00
ANIMATOR.is_playing = false;
break;
}
}
} else {
2022-12-10 05:06:01 +01:00
ANIMATOR.setFrame(ANIMATOR.real_frame);
2022-01-13 05:24:03 +01:00
}
var _c = ANIMATOR.current_frame;
2022-11-21 06:38:44 +01:00
ANIMATOR.current_frame = round(ANIMATOR.real_frame);
2022-12-12 09:08:03 +01:00
ANIMATOR.frame_progress = _c != ANIMATOR.current_frame;
2022-01-13 05:24:03 +01:00
#endregion
#region hotkey
HOTKEY_MOD = 0;
if(keyboard_check_direct(vk_control)) HOTKEY_MOD |= MOD_KEY.ctrl;
if(keyboard_check_direct(vk_shift)) HOTKEY_MOD |= MOD_KEY.shift;
if(keyboard_check_direct(vk_alt)) HOTKEY_MOD |= MOD_KEY.alt;
if(ds_map_exists(HOTKEYS, "")) {
var l = HOTKEYS[? ""];
for(var i = 0; i < ds_list_size(l); i++) {
var hotkey = l[| i];
if(key_press(hotkey.key, hotkey.modi)) {
hotkey.action();
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];
if(hotkey.key != -1) {
if(key_press(hotkey.key, hotkey.modi)) {
hotkey.action();
break;
}
}
}
}
#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
file_dnd_set_files(file_dnd_pattern, file_dnd_allowfiles, file_dnd_allowdirs, file_dnd_allowmulti);
file_dnd_filelist = file_dnd_get_files();
file_dnd_set_enabled(true);
if(file_dnd_filelist != "" && file_dnd_filelist != 0) {
file_dropping = file_dnd_filelist;
if(string_pos("\n", file_dropping) == 1)
file_dropping = string_replace(file_dropping, "\n", "");
alarm[3] = 2;
file_dnd_set_enabled(false);
file_dnd_filelist = "";
}
2022-09-27 06:37:28 +02:00
#endregion
#region window
if (window_command_check(window_command_maximize)) {
window_command_run(window_command_maximize);
PREF_MAP[? "window_maximize"] = !PREF_MAP[? "window_maximize"];
}
if (window_command_check(window_command_close)) {
2022-11-01 03:06:03 +01:00
if(MODIFIED && !READONLY) {
2022-09-27 06:37:28 +02:00
dialogCall(o_dialog_exit);
} else {
PREF_SAVE();
game_end();
}
}
if(_modified != MODIFIED) {
_modified = MODIFIED;
window_set_caption(CURRENT_PATH + (MODIFIED? "*" : "") + " - Pixel Composer");
}
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);
}
2022-09-21 06:09:40 +02:00
#endregion