chckIterPool* chckIterPoolNewFromCArray(const void *items, size_t memb, size_t growStep, size_t memberSize) { chckIterPool *pool; if (!(pool = chckIterPoolNew(growStep, 0, memberSize))) return NULL; if (!chckIterPoolSetCArray(pool, items, memb)) goto fail; return pool; fail: chckIterPoolFree(pool); return NULL; }
chckIterPool* queryMouseAreasContainingPoint(guihckContext* ctx, float x, float y) { chckIterPool* result = chckIterPoolNew(4, 4, sizeof(guihckMouseAreaId)); guihckMouseAreaId mouseAreaIter = 0; _guihckMouseArea* mouseArea = NULL; while((mouseArea = chckPoolIter(ctx->mouseAreas, &mouseAreaIter))) { /* Should be replaced by querying a quad tree*/ if(pointInRect(x, y, &mouseArea->rect)) { guihckMouseAreaId id = mouseAreaIter - 1; chckIterPoolAdd(result, &id, NULL); } } return sortMouseAreasByElementOrder(ctx, result); }