From e77368940afaa2bbc7bd883ef6cd25a5565a1bbd Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Sun, 25 Jun 2017 07:48:48 +0200 Subject: fixed calculation of coordinates in text widget --- src/gui/text_widget.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/gui') diff --git a/src/gui/text_widget.c b/src/gui/text_widget.c index 6071fd1..64bf161 100644 --- a/src/gui/text_widget.c +++ b/src/gui/text_widget.c @@ -40,16 +40,18 @@ void text_widget_draw( void *obj, graphics_context_t *context ) int x = 0; int y = 0; + int w = 0; + int h = 0; widget->base.vtable->model_to_screen( widget, &x, &y ); for( const char *p = widget->s; *p != '\0'; p++ ) { - vga_draw_char( context, *p, x, y, widget->base.background_color, + vga_draw_char( context, *p, x + w, y + h, widget->base.background_color, VGA_COLOR_WHITE ); - x += 9; - if( x >= widget->base.w - 9 ) { - y += 16; - x = 0; + w += 9; + if( w >= widget->base.w - 9 ) { + h += 16; + w = 0; } } -- cgit v1.2.3-54-g00ecf