scripted_input is active is a script is loaded, not based on the button mapping

This commit is contained in:
danzel 2017-08-13 10:19:26 +12:00
parent a47dacfdd0
commit c96d031b90
5 changed files with 6 additions and 13 deletions

View File

@ -77,6 +77,10 @@ void ScriptRunner::LoadScript(std::string script_name) {
fclose(file);
}
bool ScriptRunner::HasScript() const {
return script.size() > 0;
}
void ScriptRunner::NotifyFrameFinished() {
frame_number++;

View File

@ -31,6 +31,7 @@ class ScriptRunner final {
public:
void SetButtons(std::shared_ptr<ScriptedButtons> buttons);
void LoadScript(std::string script_name);
bool HasScript() const;
void NotifyFrameFinished();
private:

View File

@ -63,16 +63,11 @@ std::unique_ptr<Input::ButtonDevice> ScriptedButtons::Create(const Common::Param
int index = IndexOfButton(button_str);
if (index >= 0) {
scripted_button_list.get()->buttons[index] = button.get();
is_in_use = true;
}
return std::move(button);
}
bool ScriptedButtons::IsInUse() {
return is_in_use;
}
void ScriptedButtons::SetActiveButtons(const std::vector<int>& buttons_active) {
for (int i = 0; i < button_count; i++) {

View File

@ -26,15 +26,9 @@ public:
*/
std::unique_ptr<Input::ButtonDevice> Create(const Common::ParamPackage& params) override;
/**
* True if any button is being controlled
*/
bool IsInUse();
void SetActiveButtons(const std::vector<int>& buttons_active);
private:
std::shared_ptr<ScriptedButtonList> scripted_button_list;
bool is_in_use {false};
};
} // namespace InputCommon

View File

@ -31,8 +31,7 @@ void Shutdown() {
}
bool IsInUse() {
//TODO return script_runner.HasScript();
return scripted_buttons.get()->IsInUse();
return script_runner.HasScript();
}
void NotifyFrameFinished() {