コード例 #1
0
ファイル: sprite.c プロジェクト: Super-Man/seal2d
void sprite_touch(struct sprite* self, struct touch_event* touch_event) {
    struct array* children = self->children;
    for (int i = 0 ;i < array_size(children); ++i) {
        struct sprite* child = (struct sprite*)array_at(children, i);
        if (child) { // NULL indicates that the child has been removed
            // recursively visit the children.
            sprite_touch(child, touch_event);
        }
    }
    
    if(touch_event->swallowd) {
        return;
    }
    
    if (sprite_contains(self, touch_event->x, touch_event->y)) {
        if (self->swallow) {
            touch_event->swallowd = true;
        }
        
        //TODO: this call is ugly, refactor someday.
        lua_handler_exe_func(GAME->lua_handler, GAME->lstate, self, NULL);
    }
}
コード例 #2
0
ファイル: seal.c プロジェクト: gfphoenix/seal2d
void seal_touch_event(struct touch_event* touch_event) {
    
    sprite_touch(GAME->root, touch_event);
}