20 lines
529 B
C++
20 lines
529 B
C++
// src/render/player.cpp
|
|
|
|
#include "player.h"
|
|
#include "player_mask.h"
|
|
#include <cstdio>
|
|
|
|
void draw_player(int view_width, int view_height) {
|
|
const int sprite_height = PLAYER_MASK_LINES;
|
|
const int sprite_width = 3; // all rows are same width (3 chars)
|
|
|
|
int center_x = view_width / 2 - sprite_width / 2;
|
|
int center_y = view_height / 2 - sprite_height / 2;
|
|
|
|
for (int i = 0; i < sprite_height; i++) {
|
|
printf("\033[%d;%dH%s", center_y + i + 1, center_x + 1, PLAYER_MASK[i]);
|
|
}
|
|
|
|
fflush(stdout);
|
|
}
|