mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-12 06:21:50 +00:00
add scrollbar (WIP)
This commit is contained in:
parent
ed3865964b
commit
dbd27d4423
1 changed files with 13 additions and 0 deletions
|
|
@ -95,6 +95,19 @@ void Container::draw(const DrawContext* pctx, Assets* assets) {
|
||||||
if (node->isVisible())
|
if (node->isVisible())
|
||||||
node->draw(pctx, assets);
|
node->draw(pctx, assets);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int diff = (actualLength-size.y);
|
||||||
|
if (scrollable && diff > 0) {
|
||||||
|
int w = 10;
|
||||||
|
int h = glm::max(size.y / actualLength * size.y, w / 2.0f);
|
||||||
|
batch->untexture();
|
||||||
|
batch->setColor(glm::vec4(1, 1, 1, 0.5f));
|
||||||
|
batch->rect(
|
||||||
|
pos.x + size.x - w,
|
||||||
|
pos.y - scroll / static_cast<float>(diff) * (size.y - h),
|
||||||
|
w, h
|
||||||
|
);
|
||||||
|
}
|
||||||
batch->flush();
|
batch->flush();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue