diff options
Diffstat (limited to 'src/mgui/label.c')
-rw-r--r-- | src/mgui/label.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/mgui/label.c b/src/mgui/label.c index 5ab1bc0..e67821d 100644 --- a/src/mgui/label.c +++ b/src/mgui/label.c @@ -57,8 +57,9 @@ void mgui_label_on_event(mgui_label *self, mgl_window *window, mgl_event *event) } mgl_vec2i mgui_label_draw(mgui_label *self, mgl_window *window) { - (void)window; const mgl_vec2f text_bounds = mgl_text_get_bounds(&self->text); - mgl_text_draw(mgl_get_context(), &self->text); - return (mgl_vec2i){ text_bounds.x, text_bounds.y }; + const mgl_vec2i text_bounds_int = (mgl_vec2i){ text_bounds.x, text_bounds.y }; + if(mgui_rectangle_intersects_with_scissor(self->position, text_bounds_int, window)) + mgl_text_draw(mgl_get_context(), &self->text); + return text_bounds_int; } |