Pixel-Composer/scripts/globals/globals.gml

222 lines
5.2 KiB
Plaintext
Raw Normal View History

2022-01-13 05:24:03 +01:00
#region save
2023-07-06 19:49:16 +02:00
globalvar LOADING, APPENDING, CLONING, SAFE_MODE;
globalvar CONNECTION_CONFLICT, ALWAYS_FULL;
LOADING = false;
CLONING = false;
APPENDING = false;
SAFE_MODE = false;
2022-01-13 05:24:03 +01:00
CONNECTION_CONFLICT = ds_queue_create();
randomize();
2022-12-13 09:20:36 +01:00
ALWAYS_FULL = false;
2022-01-13 05:24:03 +01:00
#endregion
2023-07-06 19:49:16 +02:00
#region project
function Project() constructor {
path = "";
2023-07-08 20:29:23 +02:00
version = 0;
2023-07-06 19:49:16 +02:00
seed = irandom_range(100000, 999999);
modified = false;
readonly = false;
nodes = ds_list_create();
nodeMap = ds_map_create();
nodeNameMap = ds_map_create();
animator = new AnimationManager();
globalNode = new Node_Global();
addons = {};
2023-07-08 20:29:23 +02:00
onion_skin = {
enabled: false,
range: [ -1, 1 ],
step: 1,
color: [ c_red, c_blue ],
alpha: 0.5,
on_top: true,
};
2023-07-10 20:14:10 +02:00
static cleanup = function() {
ds_list_destroy(nodes);
ds_map_destroy(nodeMap);
ds_map_destroy(nodeNameMap);
}
2023-07-06 19:49:16 +02:00
}
globalvar PROJECTS, PROJECT;
gml_pragma("global", "__init()");
function __init() {
PROJECTS = [];
PROJECT = new Project();
}
2023-07-12 16:28:32 +02:00
globalvar PROJECT_VARIABLES;
PROJECT_VARIABLES = ds_map_create();
PROJECT_VARIABLES[? "frame"] = [ function() { return PROJECT.animator.current_frame; }];
2023-07-14 20:34:35 +02:00
PROJECT_VARIABLES[? "progress"] = [ function() { return PROJECT.animator.current_frame / PROJECT.animator.frames_total; }];
2023-07-12 16:28:32 +02:00
PROJECT_VARIABLES[? "frameTotal"] = [ function() { return PROJECT.animator.frames_total; }];
PROJECT_VARIABLES[? "fps"] = [ function() { return PROJECT.animator.framerate; }];
2023-07-14 20:34:35 +02:00
PROJECT_VARIABLES[? "time"] = [ function() { return PROJECT.animator.current_frame / PROJECT.animator.framerate; }];
PROJECT_VARIABLES[? "name"] = [ function() { return filename_name_only(PROJECT.path); }];
2023-07-06 19:49:16 +02:00
#endregion
2022-01-13 05:24:03 +01:00
#region main
2023-04-08 20:06:27 +02:00
globalvar OS, DEBUG, THEME, COLOR_KEYS;
2023-03-07 14:29:47 +01:00
OS = os_type;
//OS = os_macosx;
2022-01-13 05:24:03 +01:00
DEBUG = false;
2023-07-05 15:09:52 +02:00
THEME = new Theme();
2022-11-18 03:20:31 +01:00
COLOR_KEYS = [];
2022-01-13 05:24:03 +01:00
2023-07-06 19:49:16 +02:00
globalvar VERSION, SAVE_VERSION, VERSION_STRING, BUILD_NUMBER;
2022-01-13 05:24:03 +01:00
2023-07-08 20:29:23 +02:00
VERSION = 1147;
2023-07-14 20:34:35 +02:00
SAVE_VERSION = 1448;
VERSION_STRING = "1.14.6n7";
2023-07-06 19:49:16 +02:00
BUILD_NUMBER = 114600;
2022-01-13 05:24:03 +01:00
2023-07-06 19:49:16 +02:00
globalvar APPEND_MAP;
2023-03-28 06:58:28 +02:00
APPEND_MAP = ds_map_create();
2022-01-13 05:24:03 +01:00
2023-07-06 19:49:16 +02:00
globalvar HOTKEYS, HOTKEY_CONTEXT;
2022-01-13 05:24:03 +01:00
HOTKEYS = ds_map_create();
HOTKEY_CONTEXT = ds_list_create();
HOTKEY_CONTEXT[| 0] = "";
2023-03-25 12:27:04 +01:00
globalvar CURSOR, TOOLTIP, DRAGGING, DIALOG_DEPTH_HOVER;
2023-01-25 06:49:00 +01:00
globalvar UPDATE, RENDER_QUEUE;
2022-01-13 05:24:03 +01:00
#endregion
2022-01-19 04:16:28 +01:00
#region inputs
2023-05-03 21:42:17 +02:00
globalvar FOCUS, FOCUS_STR, HOVER, HOVERING_ELEMENT, _HOVERING_ELEMENT;
globalvar DOUBLE_CLICK;
2023-07-06 19:49:16 +02:00
globalvar DIALOG_CLICK;
2022-01-13 05:24:03 +01:00
2022-01-19 04:16:28 +01:00
DOUBLE_CLICK = false;
FOCUS = noone;
FOCUS_STR = "";
HOVER = noone;
2023-05-03 21:42:17 +02:00
HOVERING_ELEMENT = noone;
_HOVERING_ELEMENT = noone;
2022-11-18 03:20:31 +01:00
DIALOG_CLICK = true;
2022-01-13 05:24:03 +01:00
2023-02-23 07:02:19 +01:00
globalvar ADD_NODE_PAGE;
2022-12-16 09:18:09 +01:00
ADD_NODE_PAGE = 0;
2022-01-13 05:24:03 +01:00
#endregion
#region macro
2022-11-01 03:06:03 +01:00
#macro WIN_W window_get_width()
#macro WIN_H window_get_height()
#macro WIN_SW window_get_width()
#macro WIN_SH window_get_height()
2022-11-03 11:44:49 +01:00
#macro UI_SCALE PREF_MAP[? "display_scaling"]
2022-01-13 05:24:03 +01:00
#macro mouse_mx device_mouse_x_to_gui(0)
#macro mouse_my device_mouse_y_to_gui(0)
2023-03-08 12:14:01 +01:00
#macro mouse_raw_x (device_mouse_raw_x(0) + window_get_x())
#macro mouse_raw_y (device_mouse_raw_y(0) + window_get_y())
2022-11-03 11:44:49 +01:00
#macro mouse_ui [device_mouse_x_to_gui(0), device_mouse_y_to_gui(0)]
2023-01-25 06:49:00 +01:00
#macro sFOCUS FOCUS == self.id
#macro sHOVER HOVER == self.id
2022-01-13 05:24:03 +01:00
2023-01-01 02:06:02 +01:00
#macro DELTA_TIME delta_time / 1_000_000
2023-02-14 02:51:14 +01:00
#macro CONF_TESTING false
2023-06-17 18:59:20 +02:00
globalvar TESTING, TEST_ERROR;
2023-02-14 02:51:14 +01:00
TESTING = CONF_TESTING;
2023-06-17 18:59:20 +02:00
TEST_ERROR = false;
2023-02-14 02:51:14 +01:00
2023-04-03 13:55:12 +02:00
#macro DEMO false
#macro ItchDemo:DEMO true
#macro SteamDemo:DEMO true
#macro MacAlpha:DEMO true
2023-03-21 13:16:57 +01:00
#macro ALPHA false
2023-04-03 13:55:12 +02:00
#macro MacAlpha:ALPHA true
2022-12-12 09:08:03 +01:00
2022-01-13 05:24:03 +01:00
#region color
#macro c_ui_blue_dkblack $251919
#macro c_ui_blue_mdblack $2c1e1e
#macro c_ui_blue_black $362727
#macro c_ui_blue_dkgrey $4e3b3b
#macro c_ui_blue_grey $816d6d
#macro c_ui_blue_ltgrey $8f7e7e
#macro c_ui_blue_white $e8d6d6
#macro c_ui_cyan $e9ff88
2022-11-01 03:06:03 +01:00
2022-01-13 05:24:03 +01:00
#macro c_ui_yellow $78e4ff
#macro c_ui_orange $6691ff
#macro c_ui_orange_light $92c2ff
#macro c_ui_red $4b00eb
#macro c_ui_pink $b700eb
#macro c_ui_purple $d40092
#macro c_ui_lime_dark $38995e
#macro c_ui_lime $5dde8f
#macro c_ui_lime_light $b2ffd0
2022-11-18 03:20:31 +01:00
#macro c_ui_white $ffffff
2022-01-13 05:24:03 +01:00
#endregion
2022-12-12 09:08:03 +01:00
#macro printlog if(log) show_debug_message
2022-12-13 09:20:36 +01:00
2023-07-06 19:49:16 +02:00
#macro RETURN_ON_REST if(!PROJECT.animator.is_playing || !PROJECT.animator.frame_progress) return;
2023-02-14 02:51:14 +01:00
2023-06-10 13:59:45 +02:00
#macro PANEL_PAD THEME_VALUE.panel_padding
2023-02-14 02:51:14 +01:00
function print(str) {
2023-03-23 13:38:50 +01:00
//show_debug_message(string(str));
2023-02-28 09:43:01 +01:00
noti_status(string(str));
2023-02-14 02:51:14 +01:00
}
2022-12-13 09:20:36 +01:00
function printIf(cond, log) {
if(!cond) return;
show_debug_message(log);
}
2022-01-13 05:24:03 +01:00
#endregion
#region presets
function INIT_FOLDERS() {
if(!directory_exists(DIRECTORY + "Palettes"))
directory_create(DIRECTORY + "Palettes");
if(!directory_exists(DIRECTORY + "Gradients"))
directory_create(DIRECTORY + "Gradients");
}
#endregion
#region default
2023-03-28 06:58:28 +02:00
globalvar DEF_SURFACE, USE_DEF;
DEF_SURFACE = noone;
USE_DEF = -10;
2022-01-13 05:24:03 +01:00
function DEF_SURFACE_RESET() {
2023-03-28 06:58:28 +02:00
if(is_surface(DEF_SURFACE)) return;
DEF_SURFACE = surface_create_valid(32, 32);
2022-01-13 05:24:03 +01:00
surface_set_target(DEF_SURFACE);
2023-03-28 06:58:28 +02:00
draw_clear(c_white);
2022-01-13 05:24:03 +01:00
surface_reset_target();
}
DEF_SURFACE_RESET();
2023-03-08 14:59:54 +01:00
#endregion
#region PATCH
#macro PATCH_STATIC static _doUpdate = function() { doUpdate() };
2023-05-08 19:14:30 +02:00
#endregion
#region debug
2023-05-22 20:31:55 +02:00
global.FLAG = {};
2023-07-12 21:00:05 +02:00
global.FLAG.expression_debug = false;
2022-01-13 05:24:03 +01:00
#endregion