MiniDevil As beautiful as a shell
welcome_ui.h File Reference

Welcome screen structures & prototypes. More...

#include "minishell_ui.h"
+ Include dependency graph for welcome_ui.h:
+ This graph shows which files directly or indirectly include this file:

Detailed Description

Welcome screen structures & prototypes.

Definition in file welcome_ui.h.

Macros

#define HIDE_CURSOR   "\033[?25l"
 
#define SHOW_CURSOR   "\033[?25h"
 
#define C_AURA1   "\033[38;5;52m"
 
#define C_AURA2   "\033[38;5;88m"
 
#define C_AURA3   "\033[38;5;124m"
 
#define C_AURA4   "\033[38;5;160m"
 
#define C_AURA5   "\033[38;5;196m"
 
#define C_M1   "\033[38;5;196m"
 
#define C_M2   "\033[38;5;202m"
 
#define C_M3   "\033[38;5;208m"
 
#define C_M4   "\033[38;5;214m"
 
#define C_M5   "\033[38;5;220m"
 
#define DEMON_WIDTH   60
 
#define DEMON_HEIGHT   16
 
#define DEMON_LINES   16
 

Functions

void draw_welcome (void)
 Draw complete welcome animation sequence and clean up. More...
 
void animate_title (t_welcome_term *t)
 Animate the title appearing character by character. More...
 
void animate_quote (t_welcome_term *t)
 Draw the quote inside a decorative box. More...
 
void animate_credits (t_welcome_term *t)
 Print the credits line centered on the screen. More...
 
void animate_loading (t_welcome_term *t)
 Animate a progress bar. More...
 
void animate_demon (t_welcome_term *t)
 Animate the Demon art with 100ms delay. More...
 
void flash_demon_eyes (t_welcome_term *t)
 Animate the demon's eyes blinking. More...
 
const char * get_demon_art_line (int line)
 Return 1 line of the ASCII Demon art by index. More...
 
void get_welcome_term_size (t_welcome_term *t)
 Get the terminal size and calculate centre coordinates. More...
 
void print_at_pos (int row, int col, const char *str)
 Move the terminal cursor to [row, col] and print str. More...
 
void print_centered (t_welcome_term *t, int row, const char *str, int len)
 Print string centered on the given row. More...
 

Macro Documentation

◆ HIDE_CURSOR

#define HIDE_CURSOR   "\033[?25l"

Definition at line 24 of file welcome_ui.h.

◆ SHOW_CURSOR

#define SHOW_CURSOR   "\033[?25h"

Definition at line 25 of file welcome_ui.h.

◆ C_AURA1

#define C_AURA1   "\033[38;5;52m"

Definition at line 28 of file welcome_ui.h.

◆ C_AURA2

#define C_AURA2   "\033[38;5;88m"

Definition at line 29 of file welcome_ui.h.

◆ C_AURA3

#define C_AURA3   "\033[38;5;124m"

Definition at line 30 of file welcome_ui.h.

◆ C_AURA4

#define C_AURA4   "\033[38;5;160m"

Definition at line 31 of file welcome_ui.h.

◆ C_AURA5

#define C_AURA5   "\033[38;5;196m"

Definition at line 32 of file welcome_ui.h.

◆ C_M1

#define C_M1   "\033[38;5;196m"

Definition at line 35 of file welcome_ui.h.

◆ C_M2

#define C_M2   "\033[38;5;202m"

Definition at line 36 of file welcome_ui.h.

◆ C_M3

#define C_M3   "\033[38;5;208m"

Definition at line 37 of file welcome_ui.h.

◆ C_M4

#define C_M4   "\033[38;5;214m"

Definition at line 38 of file welcome_ui.h.

◆ C_M5

#define C_M5   "\033[38;5;220m"

Definition at line 39 of file welcome_ui.h.

◆ DEMON_WIDTH

#define DEMON_WIDTH   60

Definition at line 60 of file welcome_ui.h.

◆ DEMON_HEIGHT

#define DEMON_HEIGHT   16

Definition at line 61 of file welcome_ui.h.

◆ DEMON_LINES

#define DEMON_LINES   16

Definition at line 62 of file welcome_ui.h.

Function Documentation

◆ draw_welcome()

void draw_welcome ( void  )

Draw complete welcome animation sequence and clean up.

Definition at line 68 of file welcome.c.

References animate_credits(), animate_demon(), animate_loading(), animate_quote(), animate_title(), cleanup_screen(), draw_border_effect(), flash_demon_eyes(), ft_msleep(), get_welcome_term_size(), and init_screen().

Referenced by ui_loop().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ animate_title()

void animate_title ( t_welcome_term t)

Animate the title appearing character by character.

Parameters
tTerminal dimensions

Definition at line 33 of file welcome_effects.c.

References C_AURA3, C_AURA5, t_welcome_term::center_y, ft_msleep(), print_at_pos(), print_mystic_char(), RESET, and t_welcome_term::width.

Referenced by draw_welcome().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ animate_quote()

void animate_quote ( t_welcome_term t)

Draw the quote inside a decorative box.

Parameters
tTerminal dimensions (to center the box)

Definition at line 92 of file welcome_effects.c.

References C_AURA3, t_welcome_term::center_y, ft_msleep(), print_centered(), print_quote_lines(), and RESET.

Referenced by draw_welcome().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ animate_credits()

void animate_credits ( t_welcome_term t)

Print the credits line centered on the screen.

Parameters
tTerminal dimensions

Definition at line 20 of file welcome_loading.c.

References C_AURA4, C_M3, t_welcome_term::center_y, DIM, print_at_pos(), print_centered(), RESET, and t_welcome_term::width.

Referenced by draw_welcome().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ animate_loading()

void animate_loading ( t_welcome_term t)

Animate a progress bar.

Parameters
tTerminal dimensions

Definition at line 37 of file welcome_loading.c.

References C_AURA2, C_M3, t_welcome_term::center_y, ft_msleep(), print_at_pos(), print_centered(), RESET, and t_welcome_term::width.

Referenced by draw_welcome().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ animate_demon()

void animate_demon ( t_welcome_term t)

Animate the Demon art with 100ms delay.

Parameters
tTerminal dimensions for centering and row calculations

Definition at line 99 of file welcome_demon.c.

References t_welcome_term::center_y, DEMON_LINES, ft_msleep(), and print_demon_line().

Referenced by draw_welcome().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ flash_demon_eyes()

void flash_demon_eyes ( t_welcome_term t)

Animate the demon's eyes blinking.

Parameters
tTerminal dimensions to calculate the eye positions

Definition at line 118 of file welcome_demon.c.

References BOLD, C_M1, C_M5, t_welcome_term::center_y, DEMON_WIDTH, ft_msleep(), print_at_pos(), RESET, and t_welcome_term::width.

Referenced by draw_welcome().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_demon_art_line()

const char* get_demon_art_line ( int  line)

Return 1 line of the ASCII Demon art by index.

Parameters
lineLine index (0 to DEMON_LINES - 1)
Returns
Pointer to the art string or NULL if out of range

Definition at line 21 of file welcome_demon.c.

References DEMON_LINES.

Referenced by print_demon_line().

+ Here is the caller graph for this function:

◆ get_welcome_term_size()

void get_welcome_term_size ( t_welcome_term t)

Get the terminal size and calculate centre coordinates.

Falls back to 80x24 if ioctl fails

Parameters
tWelcome terminal structure to fill

Definition at line 52 of file welcome_utils.c.

References t_welcome_term::center_x, t_welcome_term::center_y, t_welcome_term::height, and t_welcome_term::width.

Referenced by draw_welcome().

+ Here is the caller graph for this function:

◆ print_at_pos()

void print_at_pos ( int  row,
int  col,
const char *  str 
)

Move the terminal cursor to [row, col] and print str.

Parameters
rowTarget row (starting at 1)
colTarget column (starting at 1)
strString to print at the given position

Definition at line 77 of file welcome_utils.c.

Referenced by animate_credits(), animate_loading(), animate_title(), cleanup_screen(), draw_border_effect(), flash_demon_eyes(), print_centered(), print_demon_line(), and print_quote_lines().

+ Here is the caller graph for this function:

◆ print_centered()

void print_centered ( t_welcome_term t,
int  row,
const char *  str,
int  len 
)

Print string centered on the given row.

Parameters
tTerminal dimensions
rowRow to print on
strString to print (ANSI supported)
lenVisible character count of str (used for centering)

Definition at line 90 of file welcome_utils.c.

References print_at_pos(), and t_welcome_term::width.

Referenced by animate_credits(), animate_loading(), animate_quote(), and print_quote_lines().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Go to the source code of this file.