-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtext.c
More file actions
28 lines (26 loc) · 765 Bytes
/
Copy pathtext.c
File metadata and controls
28 lines (26 loc) · 765 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include "text.h"
#include "font.h"
#include "graphics.h"
#include "myLib.h"
/**
* Draws a character at a given row and column
*/
void drawChar(int row, int col, char ch, unsigned short color, unsigned short background) {
for (int r = 0; r < 8; r++) {
for (int c = 0; c < 6; c++) {
if (fontdata_6x8[OFFSET(r, c, 6) + ch * 48]) {
setPixel(row + r, col + c, color);
} else {
setPixel(row + r, col + c, background);
}
}
}
}
/**
* Draws a string at a given row and column
*/
void drawString(int row, int col, char str[], unsigned short color, unsigned short background) {
for (int i = 0; str[i] != 0; i++) {
drawChar(row, col + i * 6, str[i], color, background);
}
}