fix F16-F24 keys offsetting keycodes, add key name to canvas key callback args

This commit is contained in:
Kae 2024-07-31 08:40:56 +10:00
parent 420f1d9731
commit 42acfb3f2d
3 changed files with 13 additions and 13 deletions

View File

@ -119,15 +119,6 @@ enum class Key : uint16_t {
F13,
F14,
F15,
F16,
F17,
F18,
F19,
F20,
F21,
F22,
F23,
F24,
NumLock,
CapsLock,
ScrollLock,
@ -146,7 +137,18 @@ enum class Key : uint16_t {
SysReq,
Pause,
Menu,
Power
Power,
// can't have this where I want because canvases
// pass keycodes to Lua as a numeric code >:[
F16,
F17,
F18,
F19,
F20,
F21,
F22,
F23,
F24
};
extern EnumMap<Key> const KeyNames;

View File

@ -81,7 +81,7 @@ void BaseScriptPane::tick(float dt) {
}
for (auto p : m_canvasKeyCallbacks) {
for (auto const& keyEvent : p.first->pullKeyEvents())
m_script.invoke(p.second, (int)keyEvent.key, keyEvent.keyDown);
m_script.invoke(p.second, (int)keyEvent.key, keyEvent.keyDown, KeyNames.getRight(keyEvent.key));
}
m_script.update(m_script.updateDt(dt));

View File

@ -28,8 +28,6 @@ StatusController::StatusController(Json const& config) : m_statCollection(config
m_primaryScript.setScripts(jsonToStringList(config.get("primaryScriptSources", JsonArray())));
m_primaryScript.setUpdateDelta(config.getUInt("primaryScriptDelta", 1));
m_primaryScript.setUpdateDelta(config.getUInt("primaryScriptDelta", 1));
uint64_t keepDamageSteps = config.getUInt("keepDamageNotificationSteps", 120);
m_recentHitsGiven.setHistoryLimit(keepDamageSteps);
m_recentDamageGiven.setHistoryLimit(keepDamageSteps);