diff options
author | Andreas Baumann <mail@andreasbaumann.cc> | 2017-06-25 07:48:48 +0200 |
---|---|---|
committer | Andreas Baumann <mail@andreasbaumann.cc> | 2017-06-25 07:48:48 +0200 |
commit | e77368940afaa2bbc7bd883ef6cd25a5565a1bbd (patch) | |
tree | d05f5f399b57a249535f7d88a44abe8473db6797 /src/gui | |
parent | 32e2ee0e675265b46338722773606467add4623b (diff) | |
download | abaos-e77368940afaa2bbc7bd883ef6cd25a5565a1bbd.tar.gz abaos-e77368940afaa2bbc7bd883ef6cd25a5565a1bbd.tar.bz2 |
fixed calculation of coordinates in text widget
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/text_widget.c | 12 |
1 files changed, 7 insertions, 5 deletions
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; } } |