mirror of https://github.com/fairyglade/ly.git
restart animation on window change
This commit is contained in:
parent
14fc64c2e0
commit
958eb29aec
22
src/draw.c
22
src/draw.c
|
|
@ -776,6 +776,12 @@ static void doom(struct term_buf* term_buf)
|
||||||
{0x2588, 8, 4}, // white
|
{0x2588, 8, 4}, // white
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if ((term_buf->width != term_buf->init_width) || (term_buf->height != term_buf->init_height))
|
||||||
|
{
|
||||||
|
doom_free(term_buf);
|
||||||
|
doom_init(term_buf);
|
||||||
|
}
|
||||||
|
|
||||||
uint16_t src;
|
uint16_t src;
|
||||||
uint16_t random;
|
uint16_t random;
|
||||||
uint16_t dst;
|
uint16_t dst;
|
||||||
|
|
@ -783,11 +789,6 @@ static void doom(struct term_buf* term_buf)
|
||||||
uint16_t w = term_buf->init_width;
|
uint16_t w = term_buf->init_width;
|
||||||
uint8_t* tmp = term_buf->astate.doom->buf;
|
uint8_t* tmp = term_buf->astate.doom->buf;
|
||||||
|
|
||||||
if ((term_buf->width != term_buf->init_width) || (term_buf->height != term_buf->init_height))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct tb_cell* buf = tb_cell_buffer();
|
struct tb_cell* buf = tb_cell_buffer();
|
||||||
|
|
||||||
for (uint16_t x = 0; x < w; ++x)
|
for (uint16_t x = 0; x < w; ++x)
|
||||||
|
|
@ -823,6 +824,12 @@ static void doom(struct term_buf* term_buf)
|
||||||
// Adapted from cmatrix
|
// Adapted from cmatrix
|
||||||
static void matrix(struct term_buf* buf)
|
static void matrix(struct term_buf* buf)
|
||||||
{
|
{
|
||||||
|
if ((buf->width != buf->init_width) || (buf->height != buf->init_height))
|
||||||
|
{
|
||||||
|
matrix_free(buf);
|
||||||
|
matrix_init(buf);
|
||||||
|
}
|
||||||
|
|
||||||
static int frame = 3;
|
static int frame = 3;
|
||||||
const int frame_delay = 8;
|
const int frame_delay = 8;
|
||||||
static int count = 0;
|
static int count = 0;
|
||||||
|
|
@ -835,11 +842,6 @@ static void matrix(struct term_buf* buf)
|
||||||
// Chars change mid-scroll
|
// Chars change mid-scroll
|
||||||
const bool changes = true;
|
const bool changes = true;
|
||||||
|
|
||||||
if ((buf->width != buf->init_width) || (buf->height != buf->init_height))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
count += 1;
|
count += 1;
|
||||||
if (count > frame_delay)
|
if (count > frame_delay)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue