diff options
author | untir_l <87096069+untir-l@users.noreply.github.com> | 2022-02-24 14:57:35 +0000 |
---|---|---|
committer | untir-l <87096069+untir-l@users.noreply.github.com> | 2022-02-25 09:56:49 +0000 |
commit | c23118e8e48d043e4bb9b4d813a498af8d454d73 (patch) | |
tree | 265947d2a848e8a3fb27106be38c8ae95b2fffe0 /web/hitomezashi_web.h | |
parent | 8a7dde79de6edee01571d2eb4a333d8256f4c342 (diff) | |
download | hitomezashi-c23118e8e48d043e4bb9b4d813a498af8d454d73.tar hitomezashi-c23118e8e48d043e4bb9b4d813a498af8d454d73.tar.gz hitomezashi-c23118e8e48d043e4bb9b4d813a498af8d454d73.zip |
Add web app frontend, restructure almost everything
- Add web app frontend code
- Add .html, .js, .wasm to .gitignore
- Restructure Makefile to work with emmake, add build targets for web app,
add .html, .js, .wasm to make clean
- Explain the pattern in the README
- Add explanation of web frontend to README
- Restructure README generally for better clarity
- Remove "make web app version" from todos in README
- Set Doxygen to EXTRACT_ALL so trivial and useless doc comments are not
needed when the naming suffices to be explanatory.
- Move ascii_binary_str_to_ints to library code in new file
hitomezashi_utils.c (and corresponding header) as web app also needs it.
- Fix SDL2 include path so it also works with Emscripten
- Remove some cluttering and unnecessary doc comments
- Improve some doc comments
Diffstat (limited to 'web/hitomezashi_web.h')
-rw-r--r-- | web/hitomezashi_web.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/web/hitomezashi_web.h b/web/hitomezashi_web.h new file mode 100644 index 0000000..5d4f523 --- /dev/null +++ b/web/hitomezashi_web.h @@ -0,0 +1,34 @@ +/** @file */ +#ifndef HITOMEZASHI_WEB_H +#define HITOMEZASHI_WEB_H + +#include "emscripten.h" + +enum Hitomezashi_Web_Result { + Hitomezashi_Web_Result_Success = 0, + Hitomezashi_Web_Result_Err_Get_Params = 1, + Hitomezashi_Web_Result_Err_Sdl_Init = 2, + Hitomezashi_Web_Result_Err_State_Init = 3, +}; + +int hitomezashi_web(int x_pattern_len, int y_pattern_len, char *x_pattern, + char *y_pattern, int gap, int line_thickness); + +/** Parse the URL query string and return the parameters thereof. + * + * This is implemented in JS with EM_JS, in order to access the query string. + * The friction of interoperation is the reason for turning the query string + * into a different string that the C code must parse to the actual values, + * rather than sending the data back individually with the correct types. + * That is probably possible, but it seems unpleasant. + * + * The query string's x_pattern, y_pattern, gap, and line_thickness are + * parsed. If not all of them are present, "i" is returned. If x_pattern or + * y_pattern in the query string have characters other than ASCII digits 0 + * and 1, "i" is returned. Otherwise, the values are returned as a + * newline-delimited string in the order x_pattern, y_pattern, gap, + * line_thickness. + */ +char *hitomezashi_web_get_args(void); + +#endif // HITOMEZASHI_WEB_H |