static oswald_ui *ui_g;
-void hal_lcd_set_pixel(gint x, gint y, gboolean state)
+void hal_lcd_set_pixel(gint x, gint y, uint8_t state)
{
gint ix, iy;
ix = x*2;
iy = y*2;
+ // we double all pixel to get a bigger picture
gdk_draw_point(GDK_DRAWABLE(ui_g->pixmap), state ? ui_g->darea->style->black_gc : ui_g->darea->style->white_gc, ix, iy);
gdk_draw_point(GDK_DRAWABLE(ui_g->pixmap), state ? ui_g->darea->style->black_gc : ui_g->darea->style->white_gc, ix+1, iy);
gdk_draw_point(GDK_DRAWABLE(ui_g->pixmap), state ? ui_g->darea->style->black_gc : ui_g->darea->style->white_gc, ix, iy+1);
void oswald_draw_line_ww(const uint8_t xstart, const uint8_t ystart, const uint8_t xend, const uint8_t yend, const uint8_t thickness)
{
- int i, x, y, t, dx, dy, incx, incy, pdx, pdy, ddx, ddy, es, el, err;
+ int16_t i, x, y, t, dx, dy, incx, incy, pdx, pdy, ddx, ddy, es, el, err;
dx = xend - xstart;
dy = yend - ystart;
if (dx>dy) {
pdx = incx;
pdy = 0;
- ddx=incx;
- ddy=incy;
- es =dy;
- el =dx;
+ ddx = incx;
+ ddy = incy;
+ es = dy;
+ el = dx;
} else {
- pdx=0;
- pdy=incy;
- ddx=incx;
- ddy=incy;
- es =dx;
- el =dy;
+ pdx = 0;
+ pdy = incy;
+ ddx = incx;
+ ddy = incy;
+ es = dx;
+ el = dy;
}
x = xstart;
#define COLOR_WHITE 0
-//#define COLOR_BLACK 1
+#define COLOR_BLACK 1
#define COLOR_XOR 2
#define COLOR_INV 3
// GRID_Y is +1 since there is one empty row for title icon
#define MAIN_MENU_GRID_Y 3
#define MAIN_MENU_GRID_SPACING 0
-#define MAIN_MENU_OFFSET_X 3
-#define MAIN_MENU_OFFSET_Y 10
+#define MAIN_MENU_OFFSET_X 6
+#define MAIN_MENU_OFFSET_Y 8
void draw_main_menu_screen(main_menu_data_t *sdata)
{
hal_lcd_set_pixel(MAIN_MENU_OFFSET_X+23+((pf%MAIN_MENU_GRID_X) * (MAIN_MENU_GRID_PIXEL / MAIN_MENU_GRID_X)) % (MAIN_MENU_GRID_X*(MAIN_MENU_GRID_PIXEL / MAIN_MENU_GRID_X)),
MAIN_MENU_OFFSET_Y+23+((pf/MAIN_MENU_GRID_X) * (MAIN_MENU_GRID_PIXEL / MAIN_MENU_GRID_Y)) % (MAIN_MENU_GRID_Y*(MAIN_MENU_GRID_PIXEL / MAIN_MENU_GRID_Y)), FALSE);
+
+ // finally a nice border
+ oswald_draw_line(3, 0, 95, 0);
+ oswald_draw_line(2, 1, 95, 1);
+ oswald_draw_line(1, 2, 95, 2);
+
+ oswald_draw_line(0, 3, 0, 92);
+ oswald_draw_line(1, 3, 1, 93);
+ oswald_draw_line(2, 3, 2, 94);
+
+ oswald_draw_line(1, 93, 95, 93);
+ oswald_draw_line(2, 94, 95, 94);
+ oswald_draw_line(3, 95, 95, 95);
+
hal_lcd_update_display();
}
gRow = 0;
gColumn = 45;
for (i=0; i<strlen(MainMessage); i++) {
+ // do not draw a whitespace as first character of a row
if (gRow == 0 && MainMessage[i] == ' ')
continue;
+ // interpret new line
+ if (MainMessage[i] == '\n') {
+ gRow = 0;
+ gColumn += 9;
+ continue;
+ }
gRow += oswald_write_character(gRow, gColumn, FONT_DROID8x12, FALSE, MainMessage[i]);
+ // wrap to new line if line is full
if (gRow > 90) {
gRow = 0;
gColumn += 9;
}
+ // OK, screen ends, leave the loop, no matter what
if (gColumn > 86)
i = 255;
}