2024-05-25 18:31:09 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
|
2022-08-13 00:18:49 +00:00
|
|
|
// Moves the DOS text cursor to the text RAM cell at
|
|
|
|
// ((max((x - 1), 0), (max((y - 1), 0)).
|
|
|
|
#define text_cursor_move_1_based(x, y) { \
|
|
|
|
printf("\x1B[" #y ";" #x "H"); \
|
|
|
|
}
|
|
|
|
|
2021-11-01 17:01:03 +00:00
|
|
|
// Fills the text layer with spaces.
|
2022-08-12 00:35:50 +00:00
|
|
|
// ZUN bloat: The slowest imaginable version of this operation.
|
2022-08-13 00:18:49 +00:00
|
|
|
#define text_fill_space(tmp_x, tmp_y) { \
|
2021-11-01 17:01:03 +00:00
|
|
|
for(tmp_y = 0; tmp_y < (RES_Y / GLYPH_H); tmp_y++) { \
|
|
|
|
for(tmp_x = 0; tmp_x < (RES_X / GLYPH_HALF_W); tmp_x++) { \
|
2022-08-12 00:35:50 +00:00
|
|
|
printf(" "); \
|
2021-11-01 17:01:03 +00:00
|
|
|
} \
|
|
|
|
} \
|
|
|
|
}
|
|
|
|
|
|
|
|
// Fills the text layer with opaque black.
|
|
|
|
// MODDERS: This should maybe reset the current text mode color.
|
2022-08-12 00:35:50 +00:00
|
|
|
#define text_fill_black(tmp_x, tmp_y) { \
|
|
|
|
printf("\x1B[16;40m"); \
|
2022-08-13 00:18:49 +00:00
|
|
|
text_cursor_move_1_based(0, 0); \
|
|
|
|
text_fill_space(tmp_x, tmp_y); \
|
2022-08-12 00:35:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
inline void text_color_reset(void) {
|
|
|
|
printf("\x1B[0m");
|
2021-11-01 17:01:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Fills the text layer with transparent spaces. Yes, this overwrites the
|
|
|
|
// perfectly suitable master.lib function with the same name.
|
|
|
|
#define text_clear_sloppy(tmp_x, tmp_y) { \
|
2022-08-12 00:35:50 +00:00
|
|
|
text_color_reset(); \
|
2022-08-13 00:18:49 +00:00
|
|
|
text_cursor_move_1_based(1, 1); \
|
|
|
|
text_fill_space(tmp_x, tmp_y); \
|
2021-11-01 17:01:03 +00:00
|
|
|
}
|