This commit is contained in:
Alessandro Mauri 2022-12-01 00:08:25 +01:00
parent 8f46b88f1d
commit 94db9c18d5
No known key found for this signature in database
GPG key ID: 2B7BF9531FF03BE8
3 changed files with 133 additions and 0 deletions

21
ugui.c
View file

@ -215,3 +215,24 @@ int ug_end(ug_ctx_t *ctx)
ctx->input_text[0] = '\0';
return 0;
}
/*=============================================================================*
* UI ELEMENTS *
*=============================================================================*/
#undef TEST_CTX
#define TEST_CTX(ctx) { \
if (!ctx) { \
warn("__FUNCTION__:" "trying to use a null context"); \
return 0; \
} \
}
// Slider element, a rectangle with some text and another rectangle inside
// When used with a mouse the slider moves to the clicked area and stat gets
// updated, in that case a non-zero value gets returned
int ug_slider(ug_ctx_t *ctx, float *stat, float min, float max)
{
TEST_CTX(ctx);
ug_draw_rect(ctx)
}