Speech bubbles
This commit is contained in:
@ -57,7 +57,26 @@ sys_color sys_pixel_get(sys_i32 x, sys_i32 y) {
|
||||
return device_pixels[y][x];
|
||||
}
|
||||
|
||||
void sys_print(char* str, sys_i32 x, sys_i32 y, sys_color col) {
|
||||
void sys_measure_text(const char* str, sys_i32* w, sys_i32* h) {
|
||||
sys_i32 x = 0;
|
||||
sys_i32 y = 0;
|
||||
|
||||
sys_i32 max_x = 0;
|
||||
|
||||
for (sys_i32 i = 0;; i++) {
|
||||
max_x = sys_max_i32(x, max_x);
|
||||
uint8_t c = str[i];
|
||||
if (c == 0) { break; }
|
||||
if (c == '\n') { x = 0; y += 8; continue; }
|
||||
if (c == '\r') { x = 0; continue; }
|
||||
x += 8;
|
||||
}
|
||||
|
||||
*w = max_x;
|
||||
*h = y + 8;
|
||||
}
|
||||
|
||||
void sys_print(const char* str, sys_i32 x, sys_i32 y, sys_color col) {
|
||||
x += sys_cam_dx;
|
||||
y += sys_cam_dy;
|
||||
|
||||
|
@ -54,10 +54,16 @@ sys_color sys_pixel_get(
|
||||
|
||||
// TODO: SSET/SGET
|
||||
// TODO: FGET/FSET
|
||||
|
||||
/**
|
||||
* Output the dimensions of the text (x and y)
|
||||
*/
|
||||
void sys_measure_text(const char* str, sys_i32* x, sys_i32* y);
|
||||
|
||||
/**
|
||||
* Print a string `str` in the color `col`
|
||||
*/
|
||||
void sys_print(char* str, sys_i32 x, sys_i32 y, sys_color col);
|
||||
void sys_print(const char* str, sys_i32 x, sys_i32 y, sys_color col);
|
||||
// TODO: CURSOR? COLOR?
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user