#include "IButtonScript.h" #include "system/InputSystem.h" #include #include using namespace crepe; using namespace std; void IButtonScript::init() { this->subscribe([this](const ButtonExitEvent & e) { return this->on_button_exit(e); }); this->subscribe([this](const ButtonEnterEvent & e) { return this->on_button_enter(e); }); } bool IButtonScript::on_button_exit(const ButtonExitEvent & e) { RefVector sprites = this->get_components(); for (Sprite & sprite : sprites) { sprite.data.color = Color {255, 255, 255, 255}; } return false; } bool IButtonScript::on_button_enter(const ButtonEnterEvent & e) { RefVector sprites = this->get_components(); for (Sprite & sprite : sprites) { sprite.data.color = Color {200, 200, 200, 255}; } return false; }