Browse Source

example -> demo

rexim 3 years ago
parent
commit
62fc919ed7
7 changed files with 15 additions and 15 deletions
  1. 7 7
      build.sh
  2. 0 0
      demos/3d.c
  3. 0 0
      demos/squish.c
  4. 0 0
      demos/triangle.c
  5. 0 0
      demos/vc.c
  6. 6 6
      index.html
  7. 2 2
      js/vc.js

+ 7 - 7
build.sh

@@ -2,13 +2,13 @@
 
 set -xe
 
-build_vc_example() {
+build_vc_demo() {
     NAME=$1
 
-    clang -Os -fno-builtin -Wall -Wextra -Wswitch-enum --target=wasm32 --no-standard-libraries -Wl,--no-entry -Wl,--export=render -Wl,--export=init -Wl,--allow-undefined -I. -I./build/ -I./thirdparty/ -o ./build/$NAME.wasm -DPLATFORM=WASM_PLATFORM ./examples/$NAME.c
+    clang -Os -fno-builtin -Wall -Wextra -Wswitch-enum --target=wasm32 --no-standard-libraries -Wl,--no-entry -Wl,--export=render -Wl,--export=init -Wl,--allow-undefined -I. -I./build/ -I./thirdparty/ -o ./build/$NAME.wasm -DPLATFORM=WASM_PLATFORM ./demos/$NAME.c
     cp ./build/$NAME.wasm ./wasm/
-    clang -Wall -Wextra -ggdb -I. -I./build/ -I./thirdparty/ -o ./build/$NAME.sdl -DPLATFORM=SDL_PLATFORM ./examples/$NAME.c -lm -lSDL2
-    clang -Wall -Wextra -ggdb -I. -I./build/ -I./thirdparty/ -o ./build/$NAME.term -DPLATFORM=TERM_PLATFORM ./examples/$NAME.c -lm
+    clang -Wall -Wextra -ggdb -I. -I./build/ -I./thirdparty/ -o ./build/$NAME.sdl -DPLATFORM=SDL_PLATFORM ./demos/$NAME.c -lm -lSDL2
+    clang -Wall -Wextra -ggdb -I. -I./build/ -I./thirdparty/ -o ./build/$NAME.term -DPLATFORM=TERM_PLATFORM ./demos/$NAME.c -lm
 }
 
 mkdir -p ./build/
@@ -19,7 +19,7 @@ clang -Wall -Wextra -ggdb -o ./build/png2c -Ithirdparty png2c.c -lm
 mkdir -p ./build/assets/
 ./build/png2c ./assets/tsodinPog.png > ./build/assets/tsodinPog.c
 
-build_vc_example triangle &
-build_vc_example 3d &
-build_vc_example squish &
+build_vc_demo triangle &
+build_vc_demo 3d &
+build_vc_demo squish &
 wait # TODO: the whole script must fail if one of the jobs fails

+ 0 - 0
examples/3d.c → demos/3d.c


+ 0 - 0
examples/squish.c → demos/squish.c


+ 0 - 0
examples/triangle.c → demos/triangle.c


+ 0 - 0
examples/vc.c → demos/vc.c


+ 6 - 6
index.html

@@ -11,22 +11,22 @@
     <p>The source code of the library and the demos is available on GitHub: <a href="https://github.com/tsoding/olive.c">https://github.com/tsoding/olive.c</a></p>
 
     <h2 id="demo-triangle"><a href="#demo-triangle">Triangle</a></h2>
-    <p>Rainbow triangle together with a transparent circle. Source:&nbsp;<a href="https://github.com/tsoding/olive.c/blob/master/examples/triangle.c">examples/triangle.c</a></p>
+    <p>Rainbow triangle together with a transparent circle. Source:&nbsp;<a href="https://github.com/tsoding/olive.c/blob/master/demos/triangle.c">demos/triangle.c</a></p>
     <canvas id="app-triangle"></canvas>
 
     <h2 id="demo-3d"><a href="#demo-3d">3D</a></h2>
-    <p>A bunch of 3D points projected onto your 2D screen plus a text with a builtin monospaced font. Source:&nbsp;<a href="https://github.com/tsoding/olive.c/blob/master/examples/3d.c">examples/3d.c</a></p>
+    <p>A bunch of 3D points projected onto your 2D screen plus a text with a builtin monospaced font. Source:&nbsp;<a href="https://github.com/tsoding/olive.c/blob/master/demos/3d.c">demos/3d.c</a></p>
     <canvas id="app-3d"></canvas>
 
     <h2 id="demo-squish"><a href="#demo-squish">Squish</a></h2>
-    <p>Resizing images on the fly. Source:&nbsp;<a href="https://github.com/tsoding/olive.c/blob/master/examples/squish.c">examples/squish.c</a></p>
+    <p>Resizing images on the fly. Source:&nbsp;<a href="https://github.com/tsoding/olive.c/blob/master/demos/squish.c">demos/squish.c</a></p>
     <canvas id="app-squish"></canvas>
 
     <script src="js/vc.js"></script>
     <script>
-      startExample("app-triangle", "./wasm/triangle.wasm");
-      startExample("app-3d", "./wasm/3d.wasm");
-      startExample("app-squish", "./wasm/squish.wasm");
+      startDemo("app-triangle", "./wasm/triangle.wasm");
+      startDemo("app-3d", "./wasm/3d.wasm");
+      startDemo("app-squish", "./wasm/squish.wasm");
     </script>
   </body>
 </html>

+ 2 - 2
js/vc.js

@@ -18,10 +18,10 @@ const libm = {
     "sqrtf": Math.sqrt,
 };
 
-async function startExample(elementId, wasmPath) {
+async function startDemo(elementId, wasmPath) {
     const app = document.getElementById(elementId);
     if (app === null) {
-        console.error(`Could not find element ${elementId}. Skipping example ${wasmPath}...`);
+        console.error(`Could not find element ${elementId}. Skipping demo ${wasmPath}...`);
         return;
     }