diff options
author | Arturs Artamonovs <arturs.artamonovs@protonmail.com> | 2021-07-06 09:15:36 +0100 |
---|---|---|
committer | Arturs Artamonovs <arturs.artamonovs@protonmail.com> | 2021-07-06 09:15:36 +0100 |
commit | 17daec9b5e991afb2ae3b3ff33c02e705ea94abd (patch) | |
tree | 1d71ba482484c22179a89f7e66510644b06ec62c | |
parent | 3e32bd0a0b24d26f3db086da327491123840a16a (diff) | |
download | WasmAudio-17daec9b5e991afb2ae3b3ff33c02e705ea94abd.tar.gz WasmAudio-17daec9b5e991afb2ae3b3ff33c02e705ea94abd.zip |
Initial commit
-rw-r--r-- | Build/Makefile | 19 | ||||
-rw-r--r-- | Build/index.html | 54 | ||||
-rw-r--r-- | WasmAudio/main.c | 31 |
3 files changed, 104 insertions, 0 deletions
diff --git a/Build/Makefile b/Build/Makefile new file mode 100644 index 0000000..30f0543 --- /dev/null +++ b/Build/Makefile @@ -0,0 +1,19 @@ +EMCC=emcc +CC=gcc +SOURCEDIR=../ +LDFLAGS=-lSDL2 -lSDL2_ttf +EM_LDFALGS=-s USE_SDL=2 -s MAX_WEBGL_VERSION=2 -s MIN_WEBGL_VERSION=2 -s LLD_REPORT_UNDEFINED -s USE_GLFW=3 + + + +make: + $(CC) -c $(SOURCEDIR)/main.c -g3 + +emcc: + $(EMCC) $(SOURCEDIR)/main.c -s WASM=1 -O3 -o index.js $(EM_LDFALGS) -s EXTRA_EXPORTED_RUNTIME_METHODS='["ccall", "cwrap"]' + + + +web: + darkhttpd ./ --port 12345 + diff --git a/Build/index.html b/Build/index.html new file mode 100644 index 0000000..a91652f --- /dev/null +++ b/Build/index.html @@ -0,0 +1,54 @@ +<html> + <head> + <meta charset="utf-8"> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> + </head> + <body> + <pre> + Koh fractal. Version: 0.3 + </pre> + <script type='text/javascript'> + var Module = {}; + fetch('index.wasm') + .then(response => + response.arrayBuffer() + ).then(buffer => { + Module.canvas = document.getElementById("canvas"); + Module.wasmBinary = buffer; + var script = document.createElement('script'); + script.src = "index.js"; + script.onload = function() { + console.log("Emscripten boilerplate loaded.") + } + document.body.appendChild(script); + }); + </script> + <div align="center"> + <canvas id="canvas" ></canvas> + </div> + + <pre> + To save right click and "Save image as ..." + Supported keys: + left,right,up,down - change position by 10 pixels + r - reset the configuration + '-' - decrease amount of levels + '=' - increase amount of levels + q - previous color pattern + w - next color pattern + a - decrease size + s - increase size + </pre> + + <pre> + Changelog: + v0.3 - + fixed help -> increase button set to '=' + v0.2 - + fixed increase size bug, when fractal become as point + color pattern bug when go to next color + v0.1 - initial release + </pre> + + </body> +</html>
\ No newline at end of file diff --git a/WasmAudio/main.c b/WasmAudio/main.c index 4e27973..b031629 100644 --- a/WasmAudio/main.c +++ b/WasmAudio/main.c @@ -6,6 +6,37 @@ // #include <stdio.h> +#include <stdio.h> +#include <stdlib.h> +#include <stdio.h> +#include <stdint.h> +#include <strings.h> +#include <getopt.h> +#include <signal.h> +#include <fcntl.h> +#include <pthread.h> + + + +#if __EMSCRIPTEN__ +#include <emscripten/emscripten.h> +#include <SDL/SDL.h> +#include <SDL/SDL_ttf.h> +#include <GLES2/gl2.h> +#else + #include <SDL2/SDL.h> + #ifdef __APPLE__ + #include <SDL2_ttf/SDL_ttf.h> + #else + #include <SDL2/SDL_ttf.h> + #endif + //how to use on mac? + //#include <GLES2/gl2.h> +#endif + + + + int main(int argc, const char * argv[]) { // insert code here... |