feat: working implementation of multiple widgets on macos

This commit is contained in:
Nick Fisher
2024-09-30 13:45:57 +08:00
parent 22020d8607
commit fbd54a2a09
21 changed files with 382 additions and 183 deletions

View File

@@ -70,7 +70,6 @@ namespace thermion
bool render(
uint64_t frameTimeInNanos,
View* view,
SwapChain* swapChain,
void *pixelBuffer,
void (*callback)(void *buf, size_t size, void *data),
@@ -92,6 +91,22 @@ namespace thermion
Renderer *getRenderer();
std::vector<View*> _renderable;
void setRenderable(View* view, bool renderable) {
auto it = std::find(_renderable.begin(), _renderable.end(), view);
if(renderable) {
if(it == _renderable.end()) {
_renderable.push_back(view);
}
} else {
if(it != _renderable.end()) {
_renderable.erase(it);
}
}
}
void setBackgroundColor(const float r, const float g, const float b, const float a);
void setBackgroundImage(const char *resourcePath, bool fillHeight, uint32_t width, uint32_t height);
void clearBackgroundImage();