mirror of https://github.com/fairyglade/ly.git
Added comments and changed inline assignments to increase readability for animation functions. Removed draw_free() definition, as it is not used anymore. Added animation free function to the dgn_catch() clause in main.
This commit is contained in:
parent
0eb0050c69
commit
93ddcefc14
|
|
@ -374,9 +374,11 @@ void animate_free(struct term_buf* buf)
|
||||||
{
|
{
|
||||||
if (config.animate)
|
if (config.animate)
|
||||||
{
|
{
|
||||||
int i;
|
int i = config.animation;
|
||||||
if ((i = config.animation) < ANIMATION_NUM)
|
// make sure the animation chosen is valid
|
||||||
|
if (i < ANIMATION_NUM)
|
||||||
{
|
{
|
||||||
|
// load appropriate free function and execute
|
||||||
void (*fun_ptr)(struct term_buf*);
|
void (*fun_ptr)(struct term_buf*);
|
||||||
fun_ptr = ANIM_FREES[i];
|
fun_ptr = ANIM_FREES[i];
|
||||||
(*fun_ptr)(buf);
|
(*fun_ptr)(buf);
|
||||||
|
|
@ -391,9 +393,11 @@ void animate(struct term_buf* buf)
|
||||||
|
|
||||||
if (config.animate)
|
if (config.animate)
|
||||||
{
|
{
|
||||||
int i;
|
int i = config.animation;
|
||||||
if ((i = config.animation) < ANIMATION_NUM)
|
// make sure the animation chosen is valid
|
||||||
|
if (i < ANIMATION_NUM)
|
||||||
{
|
{
|
||||||
|
// runs corresponding animation function
|
||||||
void (*fun_ptr)(struct term_buf*);
|
void (*fun_ptr)(struct term_buf*);
|
||||||
fun_ptr = ANIM_RUNS[i];
|
fun_ptr = ANIM_RUNS[i];
|
||||||
(*fun_ptr)(buf);
|
(*fun_ptr)(buf);
|
||||||
|
|
@ -405,9 +409,12 @@ void animate_init(struct term_buf* buf)
|
||||||
{
|
{
|
||||||
if (config.animate)
|
if (config.animate)
|
||||||
{
|
{
|
||||||
int i;
|
int i = config.animation;
|
||||||
if ((i = config.animation) < ANIMATION_NUM)
|
// make sure the animation chosen is valid
|
||||||
|
if (i < ANIMATION_NUM)
|
||||||
{
|
{
|
||||||
|
// grab the corresponding animation
|
||||||
|
// initialize function and execute
|
||||||
void (*fun_ptr)(struct term_buf*);
|
void (*fun_ptr)(struct term_buf*);
|
||||||
fun_ptr = ANIM_INITS[i];
|
fun_ptr = ANIM_INITS[i];
|
||||||
(*fun_ptr)(buf);
|
(*fun_ptr)(buf);
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,6 @@ struct term_buf
|
||||||
|
|
||||||
|
|
||||||
void draw_init(struct term_buf* buf);
|
void draw_init(struct term_buf* buf);
|
||||||
void draw_free(struct term_buf* buf);
|
|
||||||
void draw_box(struct term_buf* buf);
|
void draw_box(struct term_buf* buf);
|
||||||
|
|
||||||
struct tb_cell* strn_cell(char* s, uint16_t len);
|
struct tb_cell* strn_cell(char* s, uint16_t len);
|
||||||
|
|
|
||||||
|
|
@ -164,6 +164,7 @@ int main(int argc, char** argv)
|
||||||
if (dgn_catch())
|
if (dgn_catch())
|
||||||
{
|
{
|
||||||
config.animate = false;
|
config.animate = false;
|
||||||
|
animate_free(&buf);
|
||||||
dgn_reset();
|
dgn_reset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue