Пример #1
0
void Clickable::tick() {
    if (screen.isTouching(
        _pos.x,
        _pos.y,
        _pos.x+_size.w,
        _pos.y+_size.h
    )) {
        _touching++;
        if (_touching == 1) {
            pipe->push(drawControlForwarder, this);
        }
    } else if (_touching > 0) {
        _touching = 0;
        if (_onClick != nullptr) {
            pipe->push(_onClick, _onClickContext);
        }
        pipe->push(drawControlForwarder, this);
    }
}