34 lines
776 B
C++
34 lines
776 B
C++
// src/render/background.cpp
|
|
|
|
#include "background.h"
|
|
#include "../assets/background_frame.h"
|
|
#include <cstdio>
|
|
#include <cstring>
|
|
|
|
void draw_mask(const char *unused_filename, int shift, const char *text) {
|
|
// Terminal clear + home
|
|
printf("\033[2J\033[H");
|
|
|
|
for (int i = 0; i < VIEW_HEIGHT && i < VIEW_HEIGHT; i++) {
|
|
const char *row = BACKGROUND_MASK[i];
|
|
int width = strlen(row);
|
|
if (width == 0) {
|
|
printf("\r\n");
|
|
continue;
|
|
}
|
|
|
|
int start = shift % width;
|
|
|
|
for (int j = 0; j < VIEW_WIDTH; j++) {
|
|
printf("%c", row[(start + j) % width]);
|
|
}
|
|
printf("\r\n");
|
|
}
|
|
|
|
if (text && text[0] != '\0') {
|
|
printf("\r\n[RX] %s\r\n", text);
|
|
}
|
|
|
|
fflush(stdout);
|
|
}
|