mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-12-24 14:06:23 +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_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;
|
||||
|
|
|
@ -72,14 +72,16 @@
|
|||
dKey = _key;
|
||||
dModi = _mod;
|
||||
|
||||
static serialize = function() {
|
||||
return { context, name, key, modi };
|
||||
}
|
||||
static serialize = function() { return { context, name, key, modi }; }
|
||||
|
||||
static deserialize = function(ll) {
|
||||
key = is_struct(ll)? ll.key : ll[2];
|
||||
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) {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#region preference
|
||||
globalvar PREFERENCES, PREFERENCES_DEF;
|
||||
globalvar PREFERENCES, PREFERENCES_DEF, HOTKEYS_DATA;
|
||||
PREFERENCES = {};
|
||||
HOTKEYS_DATA = {};
|
||||
|
||||
PREFERENCES.ui_framerate = 60;
|
||||
PREFERENCES.path_resolution = 32;
|
||||
|
@ -179,15 +180,14 @@
|
|||
if(!file_exists(path)) return;
|
||||
|
||||
var map = json_load_struct(path);
|
||||
HOTKEYS_DATA = {};
|
||||
|
||||
var key = map.key;
|
||||
for(var i = 0; i < array_length(key); i++) {
|
||||
var key_list = key[i];
|
||||
for(var i = 0; i < array_length(map.key); i++) {
|
||||
var key_list = map.key[i];
|
||||
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 _key = find_hotkey(_context, name);
|
||||
if(_key) _key.deserialize(key_list);
|
||||
HOTKEYS_DATA[$ $"{_context}_{name}"] = key_list;
|
||||
}
|
||||
|
||||
struct_override(PREFERENCES, map.preferences);
|
||||
|
|
|
@ -9,8 +9,6 @@ function __initTheme() { #region
|
|||
|
||||
loadGraphic(PREFERENCES.theme);
|
||||
loadColor(PREFERENCES.theme);
|
||||
|
||||
print($">>>>>>>>>>>>>>>>>>>>>>>>>>>>>> OBJECT CHECK: {THEME.ui_panel_bg} <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<");
|
||||
} #endregion
|
||||
|
||||
function _sprite_path(rel, theme) { #region
|
||||
|
|
Loading…
Reference in a new issue