summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2017-07-22 16:14:14 +0200
committerAndreas Baumann <mail@andreasbaumann.cc>2017-07-22 16:14:14 +0200
commit752ff17265f23d4fa9084368d2a90f66521a98e2 (patch)
tree2acad7fc117add49064f261cfbadcd341c7406b6 /src/gui
parent95292027625e905080f37f585402f49ec49bc97f (diff)
downloadabaos-752ff17265f23d4fa9084368d2a90f66521a98e2.tar.gz
abaos-752ff17265f23d4fa9084368d2a90f66521a98e2.tar.bz2
separated video driver in a virtual video driver and a specific
VGA video driver
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/desktop.c19
-rw-r--r--src/gui/graphics_context.h4
-rw-r--r--src/gui/text_widget.c3
-rw-r--r--src/gui/widget.c2
-rw-r--r--src/gui/window.c8
5 files changed, 21 insertions, 15 deletions
diff --git a/src/gui/desktop.c b/src/gui/desktop.c
index 33afed6..d560e8a 100644
--- a/src/gui/desktop.c
+++ b/src/gui/desktop.c
@@ -41,22 +41,27 @@ void desktop_draw( void *obj, graphics_context_t *context )
return;
}
- vga_clear_screen( context, desktop->base.base.background_color );
+ ((video_vtable_t *)(context->base.vtable))->clear_screen( context,
+ desktop->base.base.background_color );
composite_widget_draw( obj, context );
for( int i = 0; i < 4; i++ ) {
if( desktop->mouse_x > i ) {
- vga_set_pixel( context, desktop->mouse_x - i, desktop->mouse_y, VIDEO_RGB_COLOR_WHITE );
+ ((video_vtable_t *)(context->base.vtable))->set_pixel( context,
+ desktop->mouse_x - i, desktop->mouse_y, VIDEO_RGB_COLOR_WHITE );
}
- if( desktop->mouse_x < context->mode->base.x - i ) {
- vga_set_pixel( context, desktop->mouse_x + i, desktop->mouse_y, VIDEO_RGB_COLOR_WHITE );
+ if( desktop->mouse_x < context->mode->x - i ) {
+ ((video_vtable_t *)(context->base.vtable))->set_pixel( context,
+ desktop->mouse_x + i, desktop->mouse_y, VIDEO_RGB_COLOR_WHITE );
}
if( desktop->mouse_y > i ) {
- vga_set_pixel( context, desktop->mouse_x, desktop->mouse_y - i, VIDEO_RGB_COLOR_WHITE );
+ ((video_vtable_t *)(context->base.vtable))->set_pixel( context,
+ desktop->mouse_x, desktop->mouse_y - i, VIDEO_RGB_COLOR_WHITE );
}
- if( desktop->mouse_y < context->mode->base.y - i ) {
- vga_set_pixel( context, desktop->mouse_x, desktop->mouse_y + i, VIDEO_RGB_COLOR_WHITE );
+ if( desktop->mouse_y < context->mode->y - i ) {
+ ((video_vtable_t *)(context->base.vtable))->set_pixel( context,
+ desktop->mouse_x, desktop->mouse_y + i, VIDEO_RGB_COLOR_WHITE );
}
}
diff --git a/src/gui/graphics_context.h b/src/gui/graphics_context.h
index ba08273..65792d0 100644
--- a/src/gui/graphics_context.h
+++ b/src/gui/graphics_context.h
@@ -1,8 +1,8 @@
#ifndef GRAPHICS_CONTEXT_H
#define GRAPHICS_CONTEXT_H
-#include "vga.h"
+#include "video.h"
-typedef vga_t graphics_context_t;
+typedef video_t graphics_context_t;
#endif //GRAPHICS_CONTEXT_H
diff --git a/src/gui/text_widget.c b/src/gui/text_widget.c
index 3aa09cc..d9c96e0 100644
--- a/src/gui/text_widget.c
+++ b/src/gui/text_widget.c
@@ -45,7 +45,8 @@ void text_widget_draw( void *obj, graphics_context_t *context )
((widget_t *)widget)->vtable->model_to_screen( widget, &x, &y );
for( const char *p = widget->s; *p != '\0'; p++ ) {
- vga_draw_char( context, *p, x + w, y + h,
+ ((video_vtable_t *)(context->base.vtable))->draw_char(
+ context, *p, x + w, y + h,
((widget_t *)widget)->background_color,
VIDEO_RGB_COLOR_WHITE );
w += 9;
diff --git a/src/gui/widget.c b/src/gui/widget.c
index 70e0dbc..cac4dfb 100644
--- a/src/gui/widget.c
+++ b/src/gui/widget.c
@@ -37,7 +37,7 @@ void widget_draw( void *obj, graphics_context_t *context )
widget->vtable->model_to_screen( widget, &x, &y );
- vga_draw_rectangle( context, x, y, widget->w, widget->h,
+ ((video_vtable_t *)(context->base.vtable))->draw_rectangle( context, x, y, widget->w, widget->h,
widget->background_color );
}
diff --git a/src/gui/window.c b/src/gui/window.c
index 1cb1fb1..132dd89 100644
--- a/src/gui/window.c
+++ b/src/gui/window.c
@@ -39,14 +39,14 @@ void window_draw( void *obj, graphics_context_t *context )
if( ((widget_t *)widget)->x < 0 ) {
((widget_t *)widget)->x = 0;
}
- if( ((widget_t *)widget)->x > context->mode->base.x - ((widget_t *)widget)->w ) {
- ((widget_t *)widget)->x = context->mode->base.x - ((widget_t *)widget)->w;
+ if( ((widget_t *)widget)->x > context->mode->x - ((widget_t *)widget)->w ) {
+ ((widget_t *)widget)->x = context->mode->x - ((widget_t *)widget)->w;
}
if( ((widget_t *)widget)->y < 0 ) {
((widget_t *)widget)->y = 0;
}
- if( ((widget_t *)widget)->y > context->mode->base.y - ((widget_t *)widget)->h ) {
- ((widget_t *)widget)->y = context->mode->base.y - ((widget_t *)widget)->h;
+ if( ((widget_t *)widget)->y > context->mode->y - ((widget_t *)widget)->h ) {
+ ((widget_t *)widget)->y = context->mode->y - ((widget_t *)widget)->h;
}
composite_widget_draw( obj, context );