static bool buttonLogic(unsigned int id, bool over) { bool res = false; // process down if (!anyActive()) { if (over) setHot(id); if (isHot(id) && g_state.leftPressed) setActive(id); } // if button is active, then react on left up if (isActive(id)) { g_state.isActive = true; if (over) setHot(id); if (g_state.leftReleased) { if (isHot(id)) res = true; clearActive(); } } if (isHot(id)) g_state.isHot = true; return res; }
static bool buttonLogic(UIPanel::State & state, uint32_t id, bool over) { bool result = false; // process down if (!anyActive(state)) { if (over) setHot(state, id); if (isHot(state, id) && state.mousePressed) setActive(state, id); } // if button is active, then react on left up if (isActive(state, id)) { state.isActive = true; if (over) setHot(state, id); if (state.mouseReleased) { if (isHot(state, id)) result = true; clearActive(state); } } if (isHot(state, id)) state.isHot = true; return result; }
static bool textInputLogic(unsigned int id, bool over){ //same as button logic without the react on left up bool res = false; // process down if (!anyActive()) { if (over) setHot(id); if (isHot(id) && g_state.leftPressed) setInputable(id); } if (isHot(id)) g_state.isHot = true; return res; }