ascii-chat 0.8.38
Real-time terminal-based video chat with ASCII art conversion
Loading...
Searching...
No Matches
options.h File Reference

WASM option accessor declarations. More...

Go to the source code of this file.

Functions

int set_width (int value)
 
int get_width (void)
 
int set_height (int value)
 
int get_height (void)
 
int set_color_mode (int mode)
 
int get_color_mode (void)
 
int set_color_filter (int filter)
 
int get_color_filter (void)
 
int set_palette (const char *palette_name)
 
int get_palette (void)
 
int set_palette_chars (const char *chars)
 
const char * get_palette_chars (void)
 
int set_matrix_rain (int enabled)
 
int get_matrix_rain (void)
 
int set_flip_x (int enabled)
 
int get_flip_x (void)
 
int set_target_fps (int fps)
 
int get_target_fps (void)
 

Detailed Description

WASM option accessor declarations.

Declares setter/getter functions for common web settings. Implementations in options.c are compiled into both mirror.wasm and client.wasm.

Definition in file options.h.

Function Documentation

◆ get_color_filter()

int get_color_filter ( void  )

Definition at line 74 of file src/web/common/options.c.

74 {
75 return GET_OPTION(color_filter);
76}

◆ get_color_mode()

int get_color_mode ( void  )

Definition at line 59 of file src/web/common/options.c.

59 {
60 return GET_OPTION(color_mode);
61}

◆ get_flip_x()

int get_flip_x ( void  )

Definition at line 146 of file src/web/common/options.c.

146 {
147 return GET_OPTION(flip_x) ? 1 : 0;
148}

◆ get_height()

int get_height ( void  )

Definition at line 44 of file src/web/common/options.c.

44 {
45 return GET_OPTION(height);
46}

◆ get_matrix_rain()

int get_matrix_rain ( void  )

Definition at line 131 of file src/web/common/options.c.

131 {
132 return GET_OPTION(matrix_rain) ? 1 : 0;
133}

◆ get_palette()

int get_palette ( void  )

Definition at line 103 of file src/web/common/options.c.

103 {
104 return GET_OPTION(palette_type);
105}

◆ get_palette_chars()

const char * get_palette_chars ( void  )

Definition at line 116 of file src/web/common/options.c.

116 {
117 return GET_OPTION(palette_custom);
118}

◆ get_target_fps()

int get_target_fps ( void  )

Definition at line 178 of file src/web/common/options.c.

178 {
179 return GET_OPTION(fps);
180}

◆ get_width()

int get_width ( void  )

Definition at line 31 of file src/web/common/options.c.

31 {
32 return GET_OPTION(width);
33}

◆ set_color_filter()

int set_color_filter ( int  filter)

Definition at line 68 of file src/web/common/options.c.

68 {
69 asciichat_error_t err = options_set_int("color_filter", filter);
70 return (err == ASCIICHAT_OK) ? 0 : -1;
71}
asciichat_error_t options_set_int(const char *field_name, int value)
Definition rcu.c:449

References options_set_int().

◆ set_color_mode()

int set_color_mode ( int  mode)

Definition at line 53 of file src/web/common/options.c.

53 {
54 asciichat_error_t err = options_set_int("color_mode", mode);
55 return (err == ASCIICHAT_OK) ? 0 : -1;
56}

References options_set_int().

◆ set_flip_x()

int set_flip_x ( int  enabled)

Definition at line 140 of file src/web/common/options.c.

140 {
141 asciichat_error_t err = options_set_bool("flip_x", enabled != 0);
142 return (err == ASCIICHAT_OK) ? 0 : -1;
143}
bool enabled
Is filtering active?
Definition grep.c:78
asciichat_error_t options_set_bool(const char *field_name, bool value)
Definition rcu.c:562

References enabled, and options_set_bool().

◆ set_height()

int set_height ( int  value)

Definition at line 36 of file src/web/common/options.c.

36 {
37 if (value <= 0 || value > 1000)
38 return -1;
39 asciichat_error_t err = options_set_int("height", value);
40 return (err == ASCIICHAT_OK) ? 0 : -1;
41}

References options_set_int().

◆ set_matrix_rain()

int set_matrix_rain ( int  enabled)

Definition at line 125 of file src/web/common/options.c.

125 {
126 asciichat_error_t err = options_set_bool("matrix_rain", enabled != 0);
127 return (err == ASCIICHAT_OK) ? 0 : -1;
128}

References enabled, and options_set_bool().

◆ set_palette()

int set_palette ( const char *  palette_name)

Definition at line 83 of file src/web/common/options.c.

83 {
84 if (!palette_name)
85 return -1;
86
87 palette_type_t palette_value;
88 char *error_msg = NULL;
89
90 if (!parse_palette_type(palette_name, &palette_value, &error_msg)) {
91 if (error_msg) {
92 log_error("Failed to parse palette '%s': %s", palette_name, error_msg);
93 free(error_msg);
94 }
95 return -1;
96 }
97
98 asciichat_error_t err = options_set_int("palette_type", (int)palette_value);
99 return (err == ASCIICHAT_OK) ? 0 : -1;
100}
bool parse_palette_type(const char *arg, void *dest, char **error_msg)
Definition parsers.c:345

References options_set_int(), and parse_palette_type().

◆ set_palette_chars()

int set_palette_chars ( const char *  chars)

Definition at line 108 of file src/web/common/options.c.

108 {
109 if (!chars)
110 return -1;
111 asciichat_error_t err = options_set_string("palette_custom", chars);
112 return (err == ASCIICHAT_OK) ? 0 : -1;
113}
asciichat_error_t options_set_string(const char *field_name, const char *value)
Definition rcu.c:647

References options_set_string().

◆ set_target_fps()

int set_target_fps ( int  fps)

Definition at line 170 of file src/web/common/options.c.

170 {
171 if (fps < 15 || fps > 60)
172 return -1;
173 asciichat_error_t err = options_set_int("fps", fps);
174 return (err == ASCIICHAT_OK) ? 0 : -1;
175}

References options_set_int().

◆ set_width()

int set_width ( int  value)

Definition at line 23 of file src/web/common/options.c.

23 {
24 if (value <= 0 || value > 1000)
25 return -1;
26 asciichat_error_t err = options_set_int("width", value);
27 return (err == ASCIICHAT_OK) ? 0 : -1;
28}

References options_set_int().