diff options
author | untir_l <87096069+untir-l@users.noreply.github.com> | 2022-06-11 15:43:23 +0000 |
---|---|---|
committer | untir_l <87096069+untir-l@users.noreply.github.com> | 2022-06-11 15:49:12 +0000 |
commit | 2aa35e2c108f954949ec001f1e33846379e7cc98 (patch) | |
tree | 1653252d1419d01b7347a70f47416ae45d4fb2c4 /lib | |
parent | e0babc53b16ef49ff40db21bbc4326e6e23185fa (diff) | |
download | hitomezashi-2aa35e2c108f954949ec001f1e33846379e7cc98.tar hitomezashi-2aa35e2c108f954949ec001f1e33846379e7cc98.tar.gz hitomezashi-2aa35e2c108f954949ec001f1e33846379e7cc98.zip |
Web: canvas now updates on the fly based on input
Also some other minor changes to thw web README.md and the Makefile, and
making some stuff const where they weren't throughout the lib/ tree as well.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/hitomezashi.c | 6 | ||||
-rw-r--r-- | lib/hitomezashi.h | 10 | ||||
-rw-r--r-- | lib/hitomezashi_utils.c | 2 | ||||
-rw-r--r-- | lib/hitomezashi_utils.h | 2 |
4 files changed, 10 insertions, 10 deletions
diff --git a/lib/hitomezashi.c b/lib/hitomezashi.c index 9275517..5a3002d 100644 --- a/lib/hitomezashi.c +++ b/lib/hitomezashi.c @@ -7,9 +7,9 @@ SDL_Color HITOMEZASHI_BG_COLOUR = {.r = 255, .g = 255, .b = 255}; enum Hitomezashi_State_Init_Result hitomezashi_state_init(struct Hitomezashi_State *state, int x_pattern_len, - int y_pattern_len, char *x_pattern, char *y_pattern, - int gap, int line_thickness, Uint32 fg_colour, - Uint32 bg_colour) { + int y_pattern_len, const char *x_pattern, + const char *y_pattern, int gap, int line_thickness, + Uint32 fg_colour, Uint32 bg_colour) { assert(x_pattern_len >= 0); assert(y_pattern_len >= 0); assert(gap >= 0); diff --git a/lib/hitomezashi.h b/lib/hitomezashi.h index 51da75b..f1cf2fa 100644 --- a/lib/hitomezashi.h +++ b/lib/hitomezashi.h @@ -14,11 +14,11 @@ struct Hitomezashi_State { /** Pattern used to draw the vertical lines conceptually originating from the * x axis. This is an array of 0s and 1s. */ - char *x_pattern; + const char *x_pattern; /** Pattern used to draw the horizontal lines conceptually originating from * the y axis. This is an array of 0s and 1s. */ - char *y_pattern; + const char *y_pattern; /** Gap between parallel lines. */ int gap; @@ -57,9 +57,9 @@ enum Hitomezashi_Draw_Result { * hitomezashi_draw(). */ enum Hitomezashi_State_Init_Result hitomezashi_state_init(struct Hitomezashi_State *state, int x_pattern_len, - int y_pattern_len, char *x_pattern, char *y_pattern, - int gap, int line_thickness, Uint32 fg_colour, - Uint32 bg_colour); + int y_pattern_len, const char *x_pattern, + const char *y_pattern, int gap, int line_thickness, + Uint32 fg_colour, Uint32 bg_colour); /** Draw the hitomezashi pattern to state->surface. */ enum Hitomezashi_Draw_Result hitomezashi_draw(struct Hitomezashi_State *state); diff --git a/lib/hitomezashi_utils.c b/lib/hitomezashi_utils.c index 32832de..93ec850 100644 --- a/lib/hitomezashi_utils.c +++ b/lib/hitomezashi_utils.c @@ -3,7 +3,7 @@ #include <stddef.h> #include <stdlib.h> -char *hitomezashi_ascii_binary_str_to_ints(char *ascii_str, size_t len) { +char *hitomezashi_ascii_binary_str_to_ints(const char *ascii_str, size_t len) { char *res = malloc(len); for (int i = 0; i < len; ++i) { switch (ascii_str[i]) { diff --git a/lib/hitomezashi_utils.h b/lib/hitomezashi_utils.h index 040ea00..95a5a3f 100644 --- a/lib/hitomezashi_utils.h +++ b/lib/hitomezashi_utils.h @@ -12,6 +12,6 @@ * be freed**. * @param len Length of ascii_str, not including any terminating null bytes. */ -char *hitomezashi_ascii_binary_str_to_ints(char *ascii_str, size_t len); +char *hitomezashi_ascii_binary_str_to_ints(const char *ascii_str, size_t len); #endif // HITOMEZASHI_UTILS_H |