mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-12-25 06:26:42 +01:00
- Fix hotkey not saving.
This commit is contained in:
parent
2f8f36c4ae
commit
ed6785c22a
4 changed files with 12 additions and 15 deletions
|
@ -48,9 +48,6 @@ event_inherited();
|
||||||
|
|
||||||
draw_set_text(f_p0, fa_left, fa_center, COLORS._main_text);
|
draw_set_text(f_p0, fa_left, fa_center, COLORS._main_text);
|
||||||
draw_text(ui(8), _yy + hh / 2, preset.name);
|
draw_text(ui(8), _yy + hh / 2, preset.name);
|
||||||
|
|
||||||
//draw_set_color(COLORS._main_text_sub);
|
|
||||||
//draw_line(ui(8), _yy + hh, sc_presets.w - ui(16), _yy + hh);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return _h;
|
return _h;
|
||||||
|
|
|
@ -72,14 +72,16 @@
|
||||||
dKey = _key;
|
dKey = _key;
|
||||||
dModi = _mod;
|
dModi = _mod;
|
||||||
|
|
||||||
static serialize = function() {
|
static serialize = function() { return { context, name, key, modi }; }
|
||||||
return { context, name, key, modi };
|
|
||||||
}
|
|
||||||
|
|
||||||
static deserialize = function(ll) {
|
static deserialize = function(ll) {
|
||||||
key = is_struct(ll)? ll.key : ll[2];
|
key = is_struct(ll)? ll.key : ll[2];
|
||||||
modi = is_struct(ll)? ll.modi : ll[3];
|
modi = is_struct(ll)? ll.modi : ll[3];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var _loadKey = $"{context}_{name}";
|
||||||
|
if(struct_has(HOTKEYS_DATA, _loadKey))
|
||||||
|
deserialize(HOTKEYS_DATA[$ _loadKey]);
|
||||||
}
|
}
|
||||||
|
|
||||||
function addHotkey(_context, _name, _key, _mod, _action) {
|
function addHotkey(_context, _name, _key, _mod, _action) {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#region preference
|
#region preference
|
||||||
globalvar PREFERENCES, PREFERENCES_DEF;
|
globalvar PREFERENCES, PREFERENCES_DEF, HOTKEYS_DATA;
|
||||||
PREFERENCES = {};
|
PREFERENCES = {};
|
||||||
|
HOTKEYS_DATA = {};
|
||||||
|
|
||||||
PREFERENCES.ui_framerate = 60;
|
PREFERENCES.ui_framerate = 60;
|
||||||
PREFERENCES.path_resolution = 32;
|
PREFERENCES.path_resolution = 32;
|
||||||
|
@ -179,15 +180,14 @@
|
||||||
if(!file_exists(path)) return;
|
if(!file_exists(path)) return;
|
||||||
|
|
||||||
var map = json_load_struct(path);
|
var map = json_load_struct(path);
|
||||||
|
HOTKEYS_DATA = {};
|
||||||
|
|
||||||
var key = map.key;
|
for(var i = 0; i < array_length(map.key); i++) {
|
||||||
for(var i = 0; i < array_length(key); i++) {
|
var key_list = map.key[i];
|
||||||
var key_list = key[i];
|
|
||||||
var _context = is_struct(key_list)? key_list.context : key_list[0];
|
var _context = is_struct(key_list)? key_list.context : key_list[0];
|
||||||
var name = is_struct(key_list)? key_list.name : key_list[1];
|
var name = is_struct(key_list)? key_list.name : key_list[1];
|
||||||
|
|
||||||
var _key = find_hotkey(_context, name);
|
HOTKEYS_DATA[$ $"{_context}_{name}"] = key_list;
|
||||||
if(_key) _key.deserialize(key_list);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct_override(PREFERENCES, map.preferences);
|
struct_override(PREFERENCES, map.preferences);
|
||||||
|
|
|
@ -9,8 +9,6 @@ function __initTheme() { #region
|
||||||
|
|
||||||
loadGraphic(PREFERENCES.theme);
|
loadGraphic(PREFERENCES.theme);
|
||||||
loadColor(PREFERENCES.theme);
|
loadColor(PREFERENCES.theme);
|
||||||
|
|
||||||
print($">>>>>>>>>>>>>>>>>>>>>>>>>>>>>> OBJECT CHECK: {THEME.ui_panel_bg} <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<");
|
|
||||||
} #endregion
|
} #endregion
|
||||||
|
|
||||||
function _sprite_path(rel, theme) { #region
|
function _sprite_path(rel, theme) { #region
|
||||||
|
|
Loading…
Reference in a new issue