|
@@ -46,11 +46,10 @@ extern dwin_font_t dwin_font;
|
46
|
46
|
void lcd_moveto_xy(const lcd_uint_t x, const lcd_uint_t y) { cursor.x = x; cursor.y = y; }
|
47
|
47
|
|
48
|
48
|
void lcd_moveto(const lcd_uint_t col, const lcd_uint_t row) {
|
49
|
|
- cursor.x = col * dwin_font.width;
|
50
|
|
- cursor.y = (row * (dwin_font.height + EXTRA_ROW_HEIGHT)) + (EXTRA_ROW_HEIGHT / 2);
|
|
49
|
+ lcd_moveto_xy(col * dwin_font.width, row * (dwin_font.height + EXTRA_ROW_HEIGHT) + EXTRA_ROW_HEIGHT / 2);
|
51
|
50
|
}
|
52
|
51
|
|
53
|
|
-inline void lcd_advance_cursor() { cursor.x += dwin_font.width; }
|
|
52
|
+inline void lcd_advance_cursor(const uint8_t len=1) { cursor.x += len * dwin_font.width; }
|
54
|
53
|
|
55
|
54
|
void lcd_put_int(const int i) {
|
56
|
55
|
// TODO: Draw an int at the cursor position, advance the cursor
|
|
@@ -58,19 +57,18 @@ void lcd_put_int(const int i) {
|
58
|
57
|
|
59
|
58
|
int lcd_put_dwin_string() {
|
60
|
59
|
DWIN_Draw_String(dwin_font.solid, dwin_font.index, dwin_font.fg, dwin_font.bg, cursor.x, cursor.y, (char*)dwin_string.string());
|
61
|
|
- cursor.x += dwin_string.length() * dwin_font.width;
|
|
60
|
+ lcd_advance_cursor(dwin_string.length());
|
62
|
61
|
return dwin_string.length();
|
63
|
62
|
}
|
64
|
63
|
|
65
|
64
|
// return < 0 on error
|
66
|
65
|
// return the advanced cols
|
67
|
66
|
int lcd_put_wchar_max(wchar_t c, pixel_len_t max_length) {
|
68
|
|
- dwin_string.set();
|
69
|
|
- dwin_string.add(c);
|
|
67
|
+ dwin_string.set(c);
|
70
|
68
|
dwin_string.truncate(max_length);
|
71
|
69
|
// Draw the char(s) at the cursor and advance the cursor
|
72
|
70
|
DWIN_Draw_String(dwin_font.solid, dwin_font.index, dwin_font.fg, dwin_font.bg, cursor.x, cursor.y, (char*)dwin_string.string());
|
73
|
|
- cursor.x += dwin_string.length() * dwin_font.width;
|
|
71
|
+ lcd_advance_cursor(dwin_string.length());
|
74
|
72
|
return dwin_string.length();
|
75
|
73
|
}
|
76
|
74
|
|
|
@@ -95,7 +93,7 @@ static int lcd_put_u8str_max_cb(const char * utf8_str, uint8_t (*cb_read_byte)(u
|
95
|
93
|
dwin_string.add(ch);
|
96
|
94
|
}
|
97
|
95
|
DWIN_Draw_String(dwin_font.solid, dwin_font.index, dwin_font.fg, dwin_font.bg, cursor.x, cursor.y, (char*)dwin_string.string());
|
98
|
|
- cursor.x += dwin_string.length() * dwin_font.width;
|
|
96
|
+ lcd_advance_cursor(dwin_string.length());
|
99
|
97
|
return dwin_string.length();
|
100
|
98
|
}
|
101
|
99
|
|
|
@@ -112,7 +110,7 @@ lcd_uint_t lcd_put_u8str_ind_P(PGM_P const pstr, const int8_t ind, PGM_P const i
|
112
|
110
|
dwin_string.add((uint8_t*)pstr, ind, (uint8_t*)inStr);
|
113
|
111
|
dwin_string.truncate(maxlen);
|
114
|
112
|
DWIN_Draw_String(dwin_font.solid, dwin_font.index, dwin_font.fg, dwin_font.bg, cursor.x, cursor.y, (char*)dwin_string.string());
|
115
|
|
- cursor.x += dwin_string.length() * dwin_font.width;
|
|
113
|
+ lcd_advance_cursor(dwin_string.length());
|
116
|
114
|
return dwin_string.length();
|
117
|
115
|
}
|
118
|
116
|
|