mirror of
https://github.com/GreenComfyTea/MHR-Overlay.git
synced 2026-01-24 04:18:11 -08:00
Make keyboard.update() event-based
This commit is contained in:
@@ -543,7 +543,6 @@ end
|
|||||||
|
|
||||||
re.on_frame(function()
|
re.on_frame(function()
|
||||||
time.update_timers();
|
time.update_timers();
|
||||||
keyboard.update();
|
|
||||||
|
|
||||||
if d2d == nil or not config.current_config.global_settings.renderer.use_d2d_if_available then
|
if d2d == nil or not config.current_config.global_settings.renderer.use_d2d_if_available then
|
||||||
draw_loop();
|
draw_loop();
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ local large_monster;
|
|||||||
local damage_meter_UI;
|
local damage_meter_UI;
|
||||||
local time;
|
local time;
|
||||||
local error_handler;
|
local error_handler;
|
||||||
|
local quest_status;
|
||||||
|
|
||||||
local sdk = sdk;
|
local sdk = sdk;
|
||||||
local tostring = tostring;
|
local tostring = tostring;
|
||||||
@@ -49,6 +50,7 @@ local hard_keyboard_field_type_def = hard_keyboard_field:get_type();
|
|||||||
local get_down_method = hard_keyboard_field_type_def:get_method("getDown");
|
local get_down_method = hard_keyboard_field_type_def:get_method("getDown");
|
||||||
local get_trigger_method = hard_keyboard_field_type_def:get_method("getTrg");
|
local get_trigger_method = hard_keyboard_field_type_def:get_method("getTrg");
|
||||||
local get_release_method = hard_keyboard_field_type_def:get_method("getRelease");
|
local get_release_method = hard_keyboard_field_type_def:get_method("getRelease");
|
||||||
|
local update_method = hard_keyboard_field_type_def:get_method("update");
|
||||||
|
|
||||||
this.hotkey_modifiers_down = {
|
this.hotkey_modifiers_down = {
|
||||||
ctrl = false,
|
ctrl = false,
|
||||||
@@ -334,13 +336,7 @@ this.keys = {
|
|||||||
--[254] = "Clear"
|
--[254] = "Clear"
|
||||||
};
|
};
|
||||||
|
|
||||||
function this.update()
|
function this.update(hard_keyboard)
|
||||||
if singletons.game_keyboard == nil then
|
|
||||||
error_handler.report("keyboard.update", "Failed to access Data: game_keyboard");
|
|
||||||
return;
|
|
||||||
end
|
|
||||||
|
|
||||||
local hard_keyboard = hard_keyboard_field:get_data(singletons.game_keyboard);
|
|
||||||
if hard_keyboard == nil then
|
if hard_keyboard == nil then
|
||||||
error_handler.report("keyboard.update", "Failed to access Data: hard_keyboard");
|
error_handler.report("keyboard.update", "Failed to access Data: hard_keyboard");
|
||||||
return;
|
return;
|
||||||
@@ -717,9 +713,19 @@ function this.init_dependencies()
|
|||||||
damage_meter_UI = require("MHR_Overlay.UI.Modules.damage_meter_UI");
|
damage_meter_UI = require("MHR_Overlay.UI.Modules.damage_meter_UI");
|
||||||
time = require("MHR_Overlay.Game_Handler.time");
|
time = require("MHR_Overlay.Game_Handler.time");
|
||||||
error_handler = require("MHR_Overlay.Misc.error_handler");
|
error_handler = require("MHR_Overlay.Misc.error_handler");
|
||||||
|
quest_status = require("MHR_Overlay.Game_Handler.quest_status");
|
||||||
end
|
end
|
||||||
|
|
||||||
function this.init_module()
|
function this.init_module()
|
||||||
|
sdk.hook(update_method, function(args)
|
||||||
|
|
||||||
|
local hard_keyboard = sdk.to_managed_object(args[2]);
|
||||||
|
|
||||||
|
this.update(hard_keyboard);
|
||||||
|
|
||||||
|
end, function(retval)
|
||||||
|
return retval;
|
||||||
|
end);
|
||||||
end
|
end
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
Reference in New Issue
Block a user