diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..c6384a5 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,39 @@ +name: Deploy to GitHub Pages + +on: + # Trigger the workflow every time you push to the `main` branch + # Using a different branch name? Replace `main` with your branch’s name + push: + branches: [ main ] + # Allows you to run this workflow manually from the Actions tab on GitHub. + workflow_dispatch: + +# Allow this job to clone the repo and create a page deployment +permissions: + contents: read + pages: write + id-token: write + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout your repository using git + uses: actions/checkout@v3 + - name: Install, build, and upload your site + uses: withastro/action@v1 + # with: + # path: . # The root location of your Astro project inside the repository. (optional) + # node-version: 18 # The specific version of Node that should be used to build your site. Defaults to 18. (optional) + # package-manager: pnpm@latest # The Node package manager that should be used to install dependencies and build your site. Automatically detected based on your lockfile. (optional) + + deploy: + needs: build + runs-on: ubuntu-latest + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v1 \ No newline at end of file diff --git a/.gitignore b/.gitignore index ff99b90..6d4c0aa 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,21 @@ -.idea -.venv -__pycache__ +# build output +dist/ + +# generated types +.astro/ + +# dependencies +node_modules/ + +# logs +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* + +# environment variables +.env +.env.production + +# macOS-specific files .DS_Store -*.pdf -*.zip diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..22a1505 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,4 @@ +{ + "recommendations": ["astro-build.astro-vscode"], + "unwantedRecommendations": [] +} diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..d642209 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,11 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "command": "./node_modules/.bin/astro dev", + "name": "Development server", + "request": "launch", + "type": "node-terminal" + } + ] +} diff --git a/README.md b/README.md index 3a5f42d..4b35bc3 100644 --- a/README.md +++ b/README.md @@ -1,27 +1,31 @@ # Yaksha Lang Website & Docs Site -* Documentation directories are `yaksha_docs`, `yaksha_lib_docs`, `yaksha_proposals` and `yaksha_tutorials` - -Require `css-minify` and `html-minifier` in path. - -* STEP 01: Install node.js -* STEP 02: -``` -npm install -g css-minify -npm install -g html-minifier -``` - -Uses Python to build the documentation. -* STEP 01: Create virtual environment -``` -python -m venv .venv -``` -* STEP 02: Activate virtual environment -* STEP 03: Install dependencies -``` -pip install -r requirements.txt -``` -* STEP 04: Run the build.py -``` -python build.py -``` +Build with [Astro](https://astro.build/) + [Tailwindcss](https://tailwindcss.com/) & [DaisyUi](https://daisyui.com/). + +## Quick Start + +0. [Install Yarn](https://classic.yarnpkg.com/lang/en/docs/install/) (will require NodeJs) +1. `yarn # Installs dependecies` +2. `yarn dev # Runs development server` + + +## Astro Brief + +Astro looks for `.astro` or `.md` files in the `src/pages/` directory. Each page is exposed as a route based on its file name. + +There's nothing special about `src/components/`, but that's where we like to put any Astro/React/Vue/Svelte/Preact components. + +Any static assets, like images, can be placed in the `public/` directory. + +## 🧞 Commands + +All commands are run from the root of the project, from a terminal: + +| Command | Action | +| :------------------------ | :----------------------------------------------- | +| `yarn install` | Installs dependencies | +| `yarn dev` | Starts local dev server at `localhost:4321` | +| `yarn build` | Build your production site to `./dist/` | +| `yarn preview` | Preview your build locally, before deploying | +| `yarn astro ...` | Run CLI commands like `astro add`, `astro check` | +| `yarn astro -- --help` | Get help using the Astro CLI | diff --git a/astro.config.mjs b/astro.config.mjs new file mode 100644 index 0000000..9cd8d00 --- /dev/null +++ b/astro.config.mjs @@ -0,0 +1,28 @@ +import { defineConfig } from 'astro/config'; +import tailwind from "@astrojs/tailwind"; + +import mdx from "@astrojs/mdx"; +import fetch from 'node-fetch'; + +// Downloads yaksha grammar from main repo, may change in the future? +const yakshaGrammarUrl = "https://raw.githubusercontent.com/YakshaLang/Yaksha/main/editor/vscode/syntaxes/yaksha.json"; +var resp = await fetch(yakshaGrammarUrl, {method: "GET"}); +let yakshaGrammar = await resp.json(); + + +// https://astro.build/config +export default defineConfig({ + site: 'https://yakshalang.github.io', + base: '/', + integrations: [tailwind(), mdx()], + markdown: { + shikiConfig: { + wrap: true, + langs: [{ + name: 'yaksha', + scopeName: 'source.yaksha', + ...yakshaGrammar + }, "c", "bash", "scheme", "python"] + } + } +}); \ No newline at end of file diff --git a/build.py b/build.py deleted file mode 100644 index 6438657..0000000 --- a/build.py +++ /dev/null @@ -1,24 +0,0 @@ -import os.path -import subprocess - -from docbox_generator import docbox - - -def main(): - path = os.path.abspath(".") - subprocess.run("css-minify -d ./css/ -o ./docs/assets", shell=True) - docbox.conv(["--all-headers-in-toc", "--input", "yaksha_lib_docs", "-o", "docs/library-docs.html", "--title", - "Yaksha Programming Language"], root=path) - docbox.conv(["--all-headers-in-toc", "--input", "yaksha_docs", "-o", "docs/documentation.html", "--title", - "Yaksha Programming Language"], root=path) - docbox.conv(["--md", "--input", "yaksha_tutorials", "-o", "docs/tutorials.html", "--title", - "Yaksha Programming Language"], root=path) - docbox.conv(["--md", "--no-number", "--input", "yaksha_proposals", "-o", "docs/yama.html", "--title", - "Yaksha Programming Language"], root=path) - docbox.conv(["--md", "--no-number", "--input", "yaksha_blog", "-o", "docs/blog.html", "--title", - "Yaksha Programming Language"], root=path) - docbox.conv(["--all-headers-in-toc", "--no-number", "--input", "yaksha_demos", "-o", "docs/demos.html", "--title", - "Yaksha Programming Language"], root=path) -if __name__ == "__main__": - os.chdir(os.path.dirname(os.path.abspath(__file__))) - main() diff --git a/build.sh b/build.sh deleted file mode 100755 index 323ffcf..0000000 --- a/build.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash -python build.py -./build_artifacts.sh -./server.sh diff --git a/build_artifacts.sh b/build_artifacts.sh deleted file mode 100755 index a218f6f..0000000 --- a/build_artifacts.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env bash - -realpath() { - [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}" -} - -cd pdf-builder -docker build -t pdf-builder . - -export DOCS=$(realpath "../docs") - -echo "docs path is $DOCS" - -docker run -v "$DOCS:/workspace" --rm -it pdf-builder --url http://localhost/documentation.html --pdf "yaksha-documentation-$(date +%Y-%m-%d).pdf" -docker run -v "$DOCS:/workspace" --rm -it pdf-builder --url http://localhost/library-docs.html --pdf "yaksha-library-docs-$(date +%Y-%m-%d).pdf" -docker run -v "$DOCS:/workspace" --rm -it pdf-builder --url http://localhost/tutorials.html --pdf "yaksha-tutorials-$(date +%Y-%m-%d).pdf" -docker run -v "$DOCS:/workspace" --rm -it pdf-builder --url http://localhost/yama.html --pdf "yaksha-yama-$(date +%Y-%m-%d).pdf" -docker run -v "$DOCS:/workspace" --rm -it pdf-builder --url http://localhost/blog.html --pdf "yaksha-blog-$(date +%Y-%m-%d).pdf" - -cd .. -rm -f downloadable_artifacts/*.pdf -rm -f downloadable_artifacts/*.zip -mv -f docs/*.pdf downloadable_artifacts/ -cp LICENSE docs/LICENSE -zip -r "downloadable_artifacts/yaksha-docs-html-$(date +%Y-%m-%d).zip" docs -rm -f docs/LICENSE \ No newline at end of file diff --git a/css/large-font.css b/css/large-font.css deleted file mode 100644 index bf07d86..0000000 --- a/css/large-font.css +++ /dev/null @@ -1,3 +0,0 @@ -body { - font-size: 2.0vw; -} \ No newline at end of file diff --git a/css/medium-font.css b/css/medium-font.css deleted file mode 100644 index b75fb06..0000000 --- a/css/medium-font.css +++ /dev/null @@ -1,3 +0,0 @@ -body { - font-size: 1.4vw; -} \ No newline at end of file diff --git a/css/normalize.css b/css/normalize.css deleted file mode 100644 index 192eb9c..0000000 --- a/css/normalize.css +++ /dev/null @@ -1,349 +0,0 @@ -/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */ - -/* Document - ========================================================================== */ - -/** - * 1. Correct the line height in all browsers. - * 2. Prevent adjustments of font size after orientation changes in iOS. - */ - -html { - line-height: 1.15; /* 1 */ - -webkit-text-size-adjust: 100%; /* 2 */ -} - -/* Sections - ========================================================================== */ - -/** - * Remove the margin in all browsers. - */ - -body { - margin: 0; -} - -/** - * Render the `main` element consistently in IE. - */ - -main { - display: block; -} - -/** - * Correct the font size and margin on `h1` elements within `section` and - * `article` contexts in Chrome, Firefox, and Safari. - */ - -h1 { - font-size: 2em; - margin: 0.67em 0; -} - -/* Grouping content - ========================================================================== */ - -/** - * 1. Add the correct box sizing in Firefox. - * 2. Show the overflow in Edge and IE. - */ - -hr { - box-sizing: content-box; /* 1 */ - height: 0; /* 1 */ - overflow: visible; /* 2 */ -} - -/** - * 1. Correct the inheritance and scaling of font size in all browsers. - * 2. Correct the odd `em` font sizing in all browsers. - */ - -pre { - font-family: monospace, monospace; /* 1 */ - font-size: 1em; /* 2 */ -} - -/* Text-level semantics - ========================================================================== */ - -/** - * Remove the gray background on active links in IE 10. - */ - -a { - background-color: transparent; -} - -/** - * 1. Remove the bottom border in Chrome 57- - * 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari. - */ - -abbr[title] { - border-bottom: none; /* 1 */ - text-decoration: underline; /* 2 */ - text-decoration: underline dotted; /* 2 */ -} - -/** - * Add the correct font weight in Chrome, Edge, and Safari. - */ - -b, -strong { - font-weight: bolder; -} - -/** - * 1. Correct the inheritance and scaling of font size in all browsers. - * 2. Correct the odd `em` font sizing in all browsers. - */ - -code, -kbd, -samp { - font-family: monospace, monospace; /* 1 */ - font-size: 1em; /* 2 */ -} - -/** - * Add the correct font size in all browsers. - */ - -small { - font-size: 80%; -} - -/** - * Prevent `sub` and `sup` elements from affecting the line height in - * all browsers. - */ - -sub, -sup { - font-size: 75%; - line-height: 0; - position: relative; - vertical-align: baseline; -} - -sub { - bottom: -0.25em; -} - -sup { - top: -0.5em; -} - -/* Embedded content - ========================================================================== */ - -/** - * Remove the border on images inside links in IE 10. - */ - -img { - border-style: none; -} - -/* Forms - ========================================================================== */ - -/** - * 1. Change the font styles in all browsers. - * 2. Remove the margin in Firefox and Safari. - */ - -button, -input, -optgroup, -select, -textarea { - font-family: inherit; /* 1 */ - font-size: 100%; /* 1 */ - line-height: 1.15; /* 1 */ - margin: 0; /* 2 */ -} - -/** - * Show the overflow in IE. - * 1. Show the overflow in Edge. - */ - -button, -input { /* 1 */ - overflow: visible; -} - -/** - * Remove the inheritance of text transform in Edge, Firefox, and IE. - * 1. Remove the inheritance of text transform in Firefox. - */ - -button, -select { /* 1 */ - text-transform: none; -} - -/** - * Correct the inability to style clickable types in iOS and Safari. - */ - -button, -[type="button"], -[type="reset"], -[type="submit"] { - -webkit-appearance: button; -} - -/** - * Remove the inner border and padding in Firefox. - */ - -button::-moz-focus-inner, -[type="button"]::-moz-focus-inner, -[type="reset"]::-moz-focus-inner, -[type="submit"]::-moz-focus-inner { - border-style: none; - padding: 0; -} - -/** - * Restore the focus styles unset by the previous rule. - */ - -button:-moz-focusring, -[type="button"]:-moz-focusring, -[type="reset"]:-moz-focusring, -[type="submit"]:-moz-focusring { - outline: 1px dotted ButtonText; -} - -/** - * Correct the padding in Firefox. - */ - -fieldset { - padding: 0.35em 0.75em 0.625em; -} - -/** - * 1. Correct the text wrapping in Edge and IE. - * 2. Correct the color inheritance from `fieldset` elements in IE. - * 3. Remove the padding so developers are not caught out when they zero out - * `fieldset` elements in all browsers. - */ - -legend { - box-sizing: border-box; /* 1 */ - color: inherit; /* 2 */ - display: table; /* 1 */ - max-width: 100%; /* 1 */ - padding: 0; /* 3 */ - white-space: normal; /* 1 */ -} - -/** - * Add the correct vertical alignment in Chrome, Firefox, and Opera. - */ - -progress { - vertical-align: baseline; -} - -/** - * Remove the default vertical scrollbar in IE 10+. - */ - -textarea { - overflow: auto; -} - -/** - * 1. Add the correct box sizing in IE 10. - * 2. Remove the padding in IE 10. - */ - -[type="checkbox"], -[type="radio"] { - box-sizing: border-box; /* 1 */ - padding: 0; /* 2 */ -} - -/** - * Correct the cursor style of increment and decrement buttons in Chrome. - */ - -[type="number"]::-webkit-inner-spin-button, -[type="number"]::-webkit-outer-spin-button { - height: auto; -} - -/** - * 1. Correct the odd appearance in Chrome and Safari. - * 2. Correct the outline style in Safari. - */ - -[type="search"] { - -webkit-appearance: textfield; /* 1 */ - outline-offset: -2px; /* 2 */ -} - -/** - * Remove the inner padding in Chrome and Safari on macOS. - */ - -[type="search"]::-webkit-search-decoration { - -webkit-appearance: none; -} - -/** - * 1. Correct the inability to style clickable types in iOS and Safari. - * 2. Change font properties to `inherit` in Safari. - */ - -::-webkit-file-upload-button { - -webkit-appearance: button; /* 1 */ - font: inherit; /* 2 */ -} - -/* Interactive - ========================================================================== */ - -/* - * Add the correct display in Edge, IE 10+, and Firefox. - */ - -details { - display: block; -} - -/* - * Add the correct display in all browsers. - */ - -summary { - display: list-item; -} - -/* Misc - ========================================================================== */ - -/** - * Add the correct display in IE 10+. - */ - -template { - display: none; -} - -/** - * Add the correct display in IE 10. - */ - -[hidden] { - display: none; -} diff --git a/css/printing.css b/css/printing.css deleted file mode 100644 index 37ca329..0000000 --- a/css/printing.css +++ /dev/null @@ -1,155 +0,0 @@ -body { - margin-left: 1em; - -webkit-print-color-adjust: exact !important; - print-color-adjust: exact !important; - font-family: 'Roboto Mono', monospace !important; -} - -#yaksha-logo { - display: block; - width: 100%; -} - -nav, -button, -#pages-text-toc, -.banner-image, -summary { - display: none !important; -} - -.table-of-contents { - background-color: transparent !important; -} - -img, -svg { - display: table !important; - max-width: 100% !important; -} - -ul { - display: table; - break-inside: avoid !important; -} - -div.boxes::after { - content: "Copyright (c) Bhathiya Perera"; - display: block; - text-align: center; - font-size: 1.3em; -} - -.container, -.boxes, -.box, -.content, -.note { - display: table; -} - -.content { - display: table; - page-break-inside: avoid; - break-inside: avoid; -} - -code { - font-family: 'Source Code Pro', monospace !important; - border: 1px solid transparent; - color: rgb(11, 89, 64); - background-color: transparent; - font-weight: bold; -} - -ul { - margin-left: 1.45em; -} - -ul > li { - margin-left: 0.2em; -} - -.highlight, -pre { - font-family: 'Source Code Pro', monospace !important; - page-break-inside: avoid; - break-inside: avoid; - border: 2px solid transparent; - background-color: transparent !important; -} - -h1 { - break-before: always; - font-family: 'Roboto', monospace !important; - line-height: 2.3em !important; -} - -h2, -h3, -h3, -h4, -h5, -h6 { - break-before: auto; - font-family: 'Roboto', monospace !important; - line-height: 2.1em !important; -} - -table td { - page-break-inside: avoid; - break-inside: avoid; -} - -.note { - padding: 0 0.1em; - width: calc(100% - 2.5em); - margin-left: 1em !important; - float: none; -} - -.content { - padding: 0 0.1em; - width: calc(100% - 2.5em) -} - -.boxes { - width: 100% -} - -.table-of-contents { - width: 100%; - position: relative; - padding-left: 0.3em; - margin-top: -2em; - overflow: visible -} - -.table-of-contents .real-toc { - display: table; - width: 100%; -} - -.yellow-status { - display: table; - page-break-inside: avoid; - break-inside: avoid; -} - -.green-status { - display: table; - page-break-inside: avoid; - break-inside: avoid; -} - -.red-status { - display: table; - page-break-inside: avoid; - break-inside: avoid; -} - -.blue-status { - display: table; - page-break-inside: avoid; - break-inside: avoid; -} \ No newline at end of file diff --git a/css/small-font.css b/css/small-font.css deleted file mode 100644 index 813e097..0000000 --- a/css/small-font.css +++ /dev/null @@ -1,3 +0,0 @@ -body { - font-size: 0.6vw; -} \ No newline at end of file diff --git a/css/style.css b/css/style.css deleted file mode 100644 index 1cae919..0000000 --- a/css/style.css +++ /dev/null @@ -1,898 +0,0 @@ -* { - margin: 0; - padding: 0; -} - -body { - font-family: Roboto Mono, monospace; -} - -.toc-item { - display: block; - width: calc(100% - 10px); - overflow: hidden; - margin-bottom: 0.3em; -} - -.toc-item a { - text-decoration: none; -} - -.timestamp { - font-size: 0.6em; - color: #98e372; -} - -a:link { - color: #13e15d -} - -a:visited { - color: #bb82ff -} - -a:hover { - color: #30cef3; - font-weight: bold -} - -/* From https://codepen.io/AllThingsSmitty/pen/MyqmdM */ -table { - border: 0.1em solid #14ea61; - border-collapse: collapse; - margin: 0; - padding: 0; - width: 100%; - table-layout: fixed; -} - -table caption { - font-size: 0.9em; - margin: .5em 0 .75em; -} - -table tr { - background-color: #1c1a1a; - border: 0.1em solid #14ea61; - padding: .35em; -} - -table td:nth-child(odd), table th:nth-child(odd) { - background-color: #3d3939; -} - -table th, -table td { - padding: .625em; - text-align: center; -} - -table th { - font-size: .85em; - letter-spacing: .1em; - text-transform: uppercase; -} - -@media screen and (max-width: 600px) { - table { - border: 0; - } - - table caption { - font-size: 0.9em; - } - - table thead { - border: none; - clip: rect(0 0 0 0); - height: 1px; - margin: -1px; - overflow: hidden; - padding: 0; - position: absolute; - width: 1px; - } - - table tr { - border-bottom: 3px solid #ddd; - display: block; - margin-bottom: .625em; - } - - table td { - border-bottom: 1px solid #ddd; - display: block; - font-size: .8em; - text-align: right; - } - - table td::before { - /* - * aria-label has no advantage, it won't be read inside a table - content: attr(aria-label); - */ - content: attr(data-label); - float: left; - font-weight: bold; - text-transform: uppercase; - } - - table td:last-child { - border-bottom: 0; - } -} - -h1, h2, h3, h4, h5, h6, .highlight { - margin-bottom: 0.5em; - margin-top: 0.5em; - font-family: Ubuntu, sans-serif !important; - color: #33d0de; -} - -h1 { - font-size: 2.3em; -} - -h2 { - font-size: 1.9em; -} - -h3 { - font-size: 1.8em; -} - -h4 { - font-size: 1.7em; -} - -h5 { - font-size: 1.6em; -} - -h6 { - font-size: 1.5em; -} - -.highlight { - padding: 4px; -} - -/* Based on https://www.w3schools.com/css/css3_buttons.asp */ -.button { - background-color: #4CAF50; /* Green */ - border: none; - color: white; - text-align: center; - text-decoration: none; - display: inline-block; - margin: 4px 2px; - transition-duration: 0.4s; - cursor: pointer; -} - -.action-button { - background-color: #078f7b; - color: white; - border: 2px solid #078f7b -} - -.action-button:hover { - background-color: white; - color: black; - border: 2px solid #078f7b -} - -a.read-more { - display: inline-block; - border: 1px dashed #144e4a; - color: #063632; - padding: 0 5px; - margin: auto 2px; - font-size: .8em; - text-decoration: none -} - -a.read-more:hover { - border: 1px dashed #665117; - background: #3b351b; - color: #e9b82c -} - -ul { - margin-left: 2em; -} - -ul > li { - margin-left: 1em -} - -body, html { - background-color: #2b2b2b; - color: #ffffff; - line-height: 1.45em; - width: 100% -} - -.table-of-contents { - font-size: .7em; - line-height: 1.3em; - width: 20%; - overflow-y: auto; - position: fixed; - padding-left: 0.3em; - top: 2em; - bottom: 0 -} - -.container { - width: 100%; - display: inline-block; - height: 100% -} - -.boxes { - width: 80%; - float: right; - display: inline-block -} - -.box { - display: inline-block; - width: calc(100% - 0.4em); - padding: 0.2em; - overflow-wrap: anywhere -} - -.content { - width: calc(70% - 2.5em); - padding: 0 1em; - display: inline-block; - float: left; - overflow: wrap; - overflow-wrap: anywhere -} - -.note { - display: inline-block; - width: calc(30% - 0.5em); - padding-left: 0.5em; - float: right; - font-size: .7em -} - -.box::after { - content: ""; - clear: both; - display: table -} - -code { - border: 0.05em dashed #eeeeee; - background: #10423c; - padding-left: 0.1em; - margin-top: 0.6em; -} - -.highlight { - border: 0.1em dashed #1eff00; - background-color: #000 -} - -pre { - white-space: pre-wrap; - white-space: -moz-pre-wrap; - white-space: -pre-wrap; - white-space: -o-pre-wrap; - word-wrap: break-word -} - -hr { - border: none; - border-top: 0.1em solid transparent; - margin-bottom: 1.5em -} - -.center-text { - margin-bottom: 2em; - margin-top: 2em; - text-align: center -} - -/* https://codepen.io/tbugai/pen/DBNBdm */ - - -.yellow-status:before { - background-color: #FFC182; - border-color: #FFB161; - box-shadow: 0 0 0.4em 0.1em #FFC182; - content: ' '; - display: inline-block; - width: 0.7em; - height: 0.7em; - margin-right: 1em; - border-width: 0.1em; - border-style: solid; - border-radius: 0.7em; -} - -.yellow-status { - display: inline-block; - border: 0.1em solid #FFC182; - color: #FFC182; - padding: 0 0.5em; - margin: auto 0.2em; - font-size: .8em; - border-radius: 0.7em; - font-weight: bold; -} - -.green-status:before { - background-color: #94E185; - border-color: #78D965; - box-shadow: 0 0 0.4em 0.1em #94E185; - content: ' '; - display: inline-block; - width: 0.7em; - height: 0.7em; - margin-right: 1em; - border-width: 0.1em; - border-style: solid; - border-radius: 0.7em; -} - -.green-status { - display: inline-block; - border: 0.1em solid #94E185; - color: #94E185; - padding: 0 0.5em; - margin: auto 0.2em; - font-size: .8em; - border-radius: 0.7em; - font-weight: bold; -} - -.red-status:before { - background-color: #C9404D; - border-color: #C42C3B; - box-shadow: 0 0 0.4em 0.1em #C9404D; - content: ' '; - display: inline-block; - width: 0.7em; - height: 0.7em; - margin-right: 1em; - border-width: 0.1em; - border-style: solid; - border-radius: 0.7em; -} - -.red-status { - display: inline-block; - border: 0.1em solid #C9404D; - color: #C9404D; - padding: 0 0.5em; - margin: auto 0.2em; - font-size: .8em; - border-radius: 0.7em; - font-weight: bold; -} - -.blue-status:before { - background-color: #40c4c9; - border-color: #2cb7c4; - box-shadow: 0 0 0.4em 0.1em #40c9c9; - content: ' '; - display: inline-block; - width: 0.7em; - height: 0.7em; - margin-right: 1em; - border-width: 0.1em; - border-style: solid; - border-radius: 0.7em; -} - -.blue-status { - display: inline-block; - border: 0.1em solid #40c9c9; - color: #40c9c9; - padding: 0 0.5em; - margin: auto 0.2em; - font-size: .8em; - border-radius: 0.7em; - font-weight: bold; -} - - -@media (max-width: 800px) { - body, html { - font-size: 1em; - line-height: 1.2em - } - - .note { - padding: 0 0.1em; - width: calc(100% - 2.5em) - } - - .content { - padding: 0 0.1em; - width: calc(100% - 2.5em) - } - - .boxes { - width: 100% - } - - .table-of-contents { - width: 100%; - position: sticky; - top: 0; - background: #defbff; - padding-left: 0.3em; - overflow: hidden - } - - .table-of-contents .real-toc { - display: none - } -} - -.highlight { - font-family: 'Source Code Pro', monospace !important; - font-size: 0.8em; -} - -pre { - line-height: 125%; - font-family: 'Source Code Pro', monospace !important; -} - -td.linenos .normal { - color: inherit; - background-color: transparent; - padding-left: 0.5em; - padding-right: 0.5em; -} - -span.linenos { - color: inherit; - background-color: transparent; - padding-left: 0.5em; - padding-right: 0.5em; -} - -td.linenos .special { - color: #000000; - background-color: #ffffc0; - padding-left: 0.5em; - padding-right: 0.5em; -} - -span.linenos.special { - color: #000000; - background-color: #ffffc0; - padding-left: 0.5em; - padding-right: 0.5em; -} - -.highlight .hll { - background-color: #0000ff -} - -.highlight { - background: #000000; - color: #dddddd -} - -.highlight .c { - color: #00ff00 -} - -/* Comment */ -.highlight .err { - color: #dddddd -} - -/* Error */ -.highlight .esc { - color: #dddddd -} - -/* Escape */ -.highlight .g { - color: #dddddd -} - -/* Generic */ -.highlight .k { - color: #ff0000 -} - -/* Keyword */ -.highlight .l { - color: #dddddd -} - -/* Literal */ -.highlight .n { - color: #dddddd -} - -/* Name */ -.highlight .o { - color: #dddddd -} - -/* Operator */ -.highlight .x { - color: #dddddd -} - -/* Other */ -.highlight .p { - color: #dddddd -} - -/* Punctuation */ -.highlight .ch { - color: #00ff00 -} - -/* Comment.Hashbang */ -.highlight .cm { - color: #00ff00 -} - -/* Comment.Multiline */ -.highlight .cp { - color: #e5e5e5 -} - -/* Comment.Preproc */ -.highlight .cpf { - color: #00ff00 -} - -/* Comment.PreprocFile */ -.highlight .c1 { - color: #00ff00 -} - -/* Comment.Single */ -.highlight .cs { - color: #00ff00 -} - -/* Comment.Special */ -.highlight .gd { - color: #dddddd -} - -/* Generic.Deleted */ -.highlight .ge { - color: #dddddd -} - -/* Generic.Emph */ -.highlight .ges { - color: #dddddd -} - -/* Generic.EmphStrong */ -.highlight .gr { - color: #dddddd -} - -/* Generic.Error */ -.highlight .gh { - color: #dddddd -} - -/* Generic.Heading */ -.highlight .gi { - color: #dddddd -} - -/* Generic.Inserted */ -.highlight .go { - color: #dddddd -} - -/* Generic.Output */ -.highlight .gp { - color: #dddddd -} - -/* Generic.Prompt */ -.highlight .gs { - color: #dddddd -} - -/* Generic.Strong */ -.highlight .gu { - color: #dddddd -} - -/* Generic.Subheading */ -.highlight .gt { - color: #dddddd -} - -/* Generic.Traceback */ -.highlight .kc { - color: #ff0000 -} - -/* Keyword.Constant */ -.highlight .kd { - color: #ff0000 -} - -/* Keyword.Declaration */ -.highlight .kn { - color: #ff0000 -} - -/* Keyword.Namespace */ -.highlight .kp { - color: #ff0000 -} - -/* Keyword.Pseudo */ -.highlight .kr { - color: #ff0000 -} - -/* Keyword.Reserved */ -.highlight .kt { - color: #ee82ee -} - -/* Keyword.Type */ -.highlight .ld { - color: #dddddd -} - -/* Literal.Date */ -.highlight .m { - color: #dddddd -} - -/* Literal.Number */ -.highlight .s { - color: #87ceeb -} - -/* Literal.String */ -.highlight .na { - color: #dddddd -} - -/* Name.Attribute */ -.highlight .nb { - color: #dddddd -} - -/* Name.Builtin */ -.highlight .nc { - color: #dddddd -} - -/* Name.Class */ -.highlight .no { - color: #7fffd4 -} - -/* Name.Constant */ -.highlight .nd { - color: #dddddd -} - -/* Name.Decorator */ -.highlight .ni { - color: #dddddd -} - -/* Name.Entity */ -.highlight .ne { - color: #dddddd -} - -/* Name.Exception */ -.highlight .nf { - color: #ffff00 -} - -/* Name.Function */ -.highlight .nl { - color: #dddddd -} - -/* Name.Label */ -.highlight .nn { - color: #dddddd -} - -/* Name.Namespace */ -.highlight .nx { - color: #dddddd -} - -/* Name.Other */ -.highlight .py { - color: #dddddd -} - -/* Name.Property */ -.highlight .nt { - color: #dddddd -} - -/* Name.Tag */ -.highlight .nv { - color: #eedd82 -} - -/* Name.Variable */ -.highlight .ow { - color: #dddddd -} - -/* Operator.Word */ -.highlight .pm { - color: #dddddd -} - -/* Punctuation.Marker */ -.highlight .w { - color: #dddddd -} - -/* Text.Whitespace */ -.highlight .mb { - color: #dddddd -} - -/* Literal.Number.Bin */ -.highlight .mf { - color: #dddddd -} - -/* Literal.Number.Float */ -.highlight .mh { - color: #dddddd -} - -/* Literal.Number.Hex */ -.highlight .mi { - color: #dddddd -} - -/* Literal.Number.Integer */ -.highlight .mo { - color: #dddddd -} - -/* Literal.Number.Oct */ -.highlight .sa { - color: #87ceeb -} - -/* Literal.String.Affix */ -.highlight .sb { - color: #87ceeb -} - -/* Literal.String.Backtick */ -.highlight .sc { - color: #87ceeb -} - -/* Literal.String.Char */ -.highlight .dl { - color: #87ceeb -} - -/* Literal.String.Delimiter */ -.highlight .sd { - color: #87ceeb -} - -/* Literal.String.Doc */ -.highlight .s2 { - color: #87ceeb -} - -/* Literal.String.Double */ -.highlight .se { - color: #87ceeb -} - -/* Literal.String.Escape */ -.highlight .sh { - color: #87ceeb -} - -/* Literal.String.Heredoc */ -.highlight .si { - color: #87ceeb -} - -/* Literal.String.Interpol */ -.highlight .sx { - color: #87ceeb -} - -/* Literal.String.Other */ -.highlight .sr { - color: #87ceeb -} - -/* Literal.String.Regex */ -.highlight .s1 { - color: #87ceeb -} - -/* Literal.String.Single */ -.highlight .ss { - color: #87ceeb -} - -/* Literal.String.Symbol */ -.highlight .bp { - color: #dddddd -} - -/* Name.Builtin.Pseudo */ -.highlight .fm { - color: #ffff00 -} - -/* Name.Function.Magic */ -.highlight .vc { - color: #eedd82 -} - -/* Name.Variable.Class */ -.highlight .vg { - color: #eedd82 -} - -/* Name.Variable.Global */ -.highlight .vi { - color: #eedd82 -} - -/* Name.Variable.Instance */ -.highlight .vm { - color: #eedd82 -} - -/* Name.Variable.Magic */ -.highlight .il { - color: #dddddd -} - -/* Literal.Number.Integer.Long */ - - -h1 { - line-height: 1.9em; -} - -h2, -h3, -h3, -h4, -h5, -h6 { - line-height: 1.6em; -} - -ul { - margin-left: 1.3em; -} - -ul > li { - margin-left: 0.15em; -} - diff --git a/css/style.light.css b/css/style.light.css deleted file mode 100644 index ae29a0a..0000000 --- a/css/style.light.css +++ /dev/null @@ -1,870 +0,0 @@ -* { - margin: 0; - padding: 0; -} - -body { - font-family: Roboto Mono, monospace; -} - -.toc-item { - display: block; - width: calc(100% - 10px); - overflow: hidden; - margin-bottom: 0.3em; -} - -.toc-item a { - text-decoration: none; -} - -.timestamp { - font-size: 0.6em; - color: #636363; -} - -a:link { - color: #0b722d -} - -a:visited { - color: #33046c -} - -a:hover { - color: #00a0c3; - font-weight: bold -} - -/* From https://codepen.io/AllThingsSmitty/pen/MyqmdM */ -table { - border: 0.1em solid #ccc; - border-collapse: collapse; - margin: 0; - padding: 0; - width: 100%; - table-layout: fixed; -} - -table caption { - font-size: 0.9em; - margin: .5em 0 .75em; -} - -table tr { - background-color: #f8f8f8; - border: 0.1em solid #ddd; - padding: .35em; -} - -table td:nth-child(odd), table th:nth-child(odd) { - background-color: #eeeeee; -} - -table th, -table td { - padding: .625em; - text-align: center; -} - -table th { - font-size: .85em; - letter-spacing: .1em; - text-transform: uppercase; -} - -@media screen and (max-width: 600px) { - table { - border: 0; - } - - table caption { - font-size: 0.9em; - } - - table thead { - border: none; - clip: rect(0 0 0 0); - height: 1px; - margin: -1px; - overflow: hidden; - padding: 0; - position: absolute; - width: 1px; - } - - table tr { - border-bottom: 3px solid #ddd; - display: block; - margin-bottom: .625em; - } - - table td { - border-bottom: 1px solid #ddd; - display: block; - font-size: .8em; - text-align: right; - } - - table td::before { - /* - * aria-label has no advantage, it won't be read inside a table - content: attr(aria-label); - */ - content: attr(data-label); - float: left; - font-weight: bold; - text-transform: uppercase; - } - - table td:last-child { - border-bottom: 0; - } -} - -h1, h2, h3, h4, h5, h6, .highlight { - margin-bottom: 0.5em; - margin-top: 0.5em; - font-family: Ubuntu, sans-serif !important; - color: #064146; -} - -h1 { - font-size: 2.3em; -} - -h2 { - font-size: 1.9em; -} - -h3 { - font-size: 1.8em; -} - -h4 { - font-size: 1.7em; -} - -h5 { - font-size: 1.6em; -} - -h6 { - font-size: 1.5em; -} - -.highlight { - padding: 4px; -} - -/* Based on https://www.w3schools.com/css/css3_buttons.asp */ -.button { - background-color: #4CAF50; /* Green */ - border: none; - color: white; - text-align: center; - text-decoration: none; - display: inline-block; - margin: 4px 2px; - transition-duration: 0.4s; - cursor: pointer; -} - -.action-button { - background-color: #078f7b; - color: white; - border: 2px solid #078f7b -} - -.action-button:hover { - background-color: white; - color: black; - border: 2px solid #078f7b -} - -a.read-more { - display: inline-block; - border: 1px dashed #144e4a; - color: #063632; - padding: 0 5px; - margin: auto 2px; - font-size: .8em; - text-decoration: none -} - -a.read-more:hover { - border: 1px dashed #665117; - background: #3b351b; - color: #e9b82c -} - -ul { - margin-left: 2em; -} - -ul > li { - margin-left: 1em -} - -body, html { - background-color: #ffffff; - color: #2b2b2b; - line-height: 1.45em; - width: 100% -} - -.table-of-contents { - font-size: .7em; - line-height: 1.3em; - width: 20%; - overflow-y: auto; - position: fixed; - padding-left: 0.3em; - top: 2em; - bottom: 0 -} - -.container { - width: 100%; - display: inline-block; - height: 100% -} - -.boxes { - width: 80%; - float: right; - display: inline-block -} - -.box { - display: inline-block; - width: calc(100% - 0.4em); - padding: 0.2em; - overflow-wrap: anywhere -} - -.content { - width: calc(70% - 2.5em); - padding: 0 1em; - display: inline-block; - float: left; - overflow: wrap; - overflow-wrap: anywhere -} - -.note { - display: inline-block; - width: calc(30% - 0.5em); - padding-left: 0.5em; - float: right; - font-size: .7em -} - -.box::after { - content: ""; - clear: both; - display: table -} - -code { - border: 0.05em dashed #10423c; - background: #eeeeee; - padding-left: 0.1em; - margin-top: 0.6em; -} - -.highlight { - border: 0.1em dashed gray; - background-color: #000 -} - -pre { - white-space: pre-wrap; - white-space: -moz-pre-wrap; - white-space: -pre-wrap; - white-space: -o-pre-wrap; - word-wrap: break-word -} - -hr { - border: none; - border-top: 0.1em solid transparent; - margin-bottom: 1.5em -} - -.center-text { - margin-bottom: 2em; - margin-top: 2em; - text-align: center -} - -/* https://codepen.io/tbugai/pen/DBNBdm */ - - -.yellow-status:before { - background-color: #FFC182; - border-color: #FFB161; - box-shadow: 0 0 0.4em 0.1em #FFC182; - content: ' '; - display: inline-block; - width: 0.7em; - height: 0.7em; - margin-right: 1em; - border-width: 0.1em; - border-style: solid; - border-radius: 0.7em; -} - -.yellow-status { - display: inline-block; - border: 0.1em solid #7a542c; - color: #7a542c; - padding: 0 0.5em; - margin: auto 0.2em; - font-size: .8em; - border-radius: 0.7em; - font-weight: bold; -} - -.green-status:before { - background-color: #94E185; - border-color: #78D965; - box-shadow: 0 0 0.4em 0.1em #94E185; - content: ' '; - display: inline-block; - width: 0.7em; - height: 0.7em; - margin-right: 1em; - border-width: 0.1em; - border-style: solid; - border-radius: 0.7em; -} - -.green-status { - display: inline-block; - border: 0.1em solid #48833e; - color: #48833e; - padding: 0 0.5em; - margin: auto 0.2em; - font-size: .8em; - border-radius: 0.7em; - font-weight: bold; -} - -.red-status:before { - background-color: #C9404D; - border-color: #C42C3B; - box-shadow: 0 0 0.4em 0.1em #C9404D; - content: ' '; - display: inline-block; - width: 0.7em; - height: 0.7em; - margin-right: 1em; - border-width: 0.1em; - border-style: solid; - border-radius: 0.7em; -} - -.red-status { - display: inline-block; - border: 0.1em solid #7a1d27; - color: #7a1d27; - padding: 0 0.5em; - margin: auto 0.2em; - font-size: .8em; - border-radius: 0.7em; - font-weight: bold; -} - -.blue-status:before { - background-color: #40c4c9; - border-color: #2cb7c4; - box-shadow: 0 0 0.4em 0.1em #40c9c9; - content: ' '; - display: inline-block; - width: 0.7em; - height: 0.7em; - margin-right: 1em; - border-width: 0.1em; - border-style: solid; - border-radius: 0.7em; -} - -.blue-status { - display: inline-block; - border: 0.1em solid #1b727c; - color: #1b727c; - padding: 0 0.5em; - margin: auto 0.2em; - font-size: .8em; - border-radius: 0.7em; - font-weight: bold; -} - - -@media (max-width: 800px) { - body, html { - font-size: 1em; - line-height: 1.2em - } - - .note { - padding: 0 0.1em; - width: calc(100% - 2.5em) - } - - .content { - padding: 0 0.1em; - width: calc(100% - 2.5em) - } - - .boxes { - width: 100% - } - - .table-of-contents { - width: 100%; - position: sticky; - top: 0; - background: #defbff; - padding-left: 0.3em; - overflow: hidden - } - - .table-of-contents .real-toc { - display: none - } -} - -.highlight { - font-family: 'Source Code Pro', monospace !important; - font-size: 0.8em; -} - -pre { - line-height: 125%; - font-family: 'Source Code Pro', monospace !important; -} - -td.linenos .normal { - color: inherit; - background-color: transparent; - padding-left: 0.5em; - padding-right: 0.5em; -} - -span.linenos { - color: inherit; - background-color: transparent; - padding-left: 0.5em; - padding-right: 0.5em; -} - -td.linenos .special { - color: #000000; - background-color: #ffffc0; - padding-left: 0.5em; - padding-right: 0.5em; -} - -span.linenos.special { - color: #000000; - background-color: #ffffc0; - padding-left: 0.5em; - padding-right: 0.5em; -} - -.highlight .hll { - background-color: #ffffcc -} - -.highlight { - background: #f8f8f8; -} - -.highlight .c { - color: #3D7B7B; - font-weight: bold -} - -/* Comment */ -.highlight .err { - /*border: 1px solid #FF0000*/ -} - -/* Error */ -.highlight .k { - color: #008000; - font-weight: bold -} - -/* Keyword */ -.highlight .o { - color: #666666 -} - -/* Operator */ -.highlight .ch { - color: #3D7B7B; - font-style: italic -} - -/* Comment.Hashbang */ -.highlight .cm { - color: #3D7B7B; - font-style: italic -} - -/* Comment.Multiline */ -.highlight .cp { - color: #9C6500 -} - -/* Comment.Preproc */ -.highlight .cpf { - color: #3D7B7B; - font-weight: bold -} - -/* Comment.PreprocFile */ -.highlight .c1 { - color: #3D7B7B; - font-weight: bold -} - -/* Comment.Single */ -.highlight .cs { - color: #3D7B7B; - font-weight: bold -} - -/* Comment.Special */ -.highlight .gd { - color: #A00000 -} - -/* Generic.Deleted */ -.highlight .ge { - font-style: italic -} - -/* Generic.Emph */ -.highlight .ges { - font-weight: bold; -} - -/* Generic.EmphStrong */ -.highlight .gr { - color: #E40000 -} - -/* Generic.Error */ -.highlight .gh { - color: #000080; - font-weight: bold -} - -/* Generic.Heading */ -.highlight .gi { - color: #008400 -} - -/* Generic.Inserted */ -.highlight .go { - color: #717171 -} - -/* Generic.Output */ -.highlight .gp { - color: #000080; - font-weight: bold -} - -/* Generic.Prompt */ -.highlight .gs { - font-weight: bold -} - -/* Generic.Strong */ -.highlight .gu { - color: #800080; - font-weight: bold -} - -/* Generic.Subheading */ -.highlight .gt { - color: #0044DD -} - -/* Generic.Traceback */ -.highlight .kc { - color: #008000; - font-weight: bold -} - -/* Keyword.Constant */ -.highlight .kd { - color: #008000; - font-weight: bold -} - -/* Keyword.Declaration */ -.highlight .kn { - color: #008000; - font-weight: bold -} - -/* Keyword.Namespace */ -.highlight .kp { - color: #008000 -} - -/* Keyword.Pseudo */ -.highlight .kr { - color: #008000; - font-weight: bold -} - -/* Keyword.Reserved */ -.highlight .kt { - color: #B00040 -} - -/* Keyword.Type */ -.highlight .m { - color: #666666 -} - -/* Literal.Number */ -.highlight .s { - color: #BA2121 -} - -/* Literal.String */ -.highlight .na { - color: #687822 -} - -/* Name.Attribute */ -.highlight .nb { - color: #008000 -} - -/* Name.Builtin */ -.highlight .nc { - color: #0000FF; - font-weight: bold -} - -/* Name.Class */ -.highlight .no { - color: #880000 -} - -/* Name.Constant */ -.highlight .nd { - color: #AA22FF -} - -/* Name.Decorator */ -.highlight .ni { - color: #717171; - font-weight: bold -} - -/* Name.Entity */ -.highlight .ne { - color: #CB3F38; - font-weight: bold -} - -/* Name.Exception */ -.highlight .nf { - color: #0000FF -} - -/* Name.Function */ -.highlight .nl { - color: #767600 -} - -/* Name.Label */ -.highlight .nn { - color: #0000FF; - font-weight: bold -} - -/* Name.Namespace */ -.highlight .nt { - color: #008000; - font-weight: bold -} - -/* Name.Tag */ -.highlight .nv { - color: #19177C -} - -/* Name.Variable */ -.highlight .ow { - color: #AA22FF; - font-weight: bold -} - -/* Operator.Word */ -.highlight .w { - color: #bbbbbb -} - -/* Text.Whitespace */ -.highlight .mb { - color: #666666 -} - -/* Literal.Number.Bin */ -.highlight .mf { - color: #666666 -} - -/* Literal.Number.Float */ -.highlight .mh { - color: #666666 -} - -/* Literal.Number.Hex */ -.highlight .mi { - color: #666666 -} - -/* Literal.Number.Integer */ -.highlight .mo { - color: #666666 -} - -/* Literal.Number.Oct */ -.highlight .sa { - color: #BA2121 -} - -/* Literal.String.Affix */ -.highlight .sb { - color: #BA2121 -} - -/* Literal.String.Backtick */ -.highlight .sc { - color: #BA2121 -} - -/* Literal.String.Char */ -.highlight .dl { - color: #BA2121 -} - -/* Literal.String.Delimiter */ -.highlight .sd { - color: #BA2121; - font-weight: bold -} - -/* Literal.String.Doc */ -.highlight .s2 { - color: #BA2121 -} - -/* Literal.String.Double */ -.highlight .se { - color: #AA5D1F; - font-weight: bold -} - -/* Literal.String.Escape */ -.highlight .sh { - color: #BA2121 -} - -/* Literal.String.Heredoc */ -.highlight .si { - color: #A45A77; - font-weight: bold -} - -/* Literal.String.Interpol */ -.highlight .sx { - color: #008000 -} - -/* Literal.String.Other */ -.highlight .sr { - color: #A45A77 -} - -/* Literal.String.Regex */ -.highlight .s1 { - color: #BA2121 -} - -/* Literal.String.Single */ -.highlight .ss { - color: #19177C -} - -/* Literal.String.Symbol */ -.highlight .bp { - color: #008000 -} - -/* Name.Builtin.Pseudo */ -.highlight .fm { - color: #0000FF -} - -/* Name.Function.Magic */ -.highlight .vc { - color: #19177C -} - -/* Name.Variable.Class */ -.highlight .vg { - color: #19177C -} - -/* Name.Variable.Global */ -.highlight .vi { - color: #19177C -} - -/* Name.Variable.Instance */ -.highlight .vm { - color: #19177C -} - -/* Name.Variable.Magic */ -.highlight .il { - color: #666666 -} - -/* Literal.Number.Integer.Long */ - - -h1 { - line-height: 1.9em; -} - -h2, -h3, -h3, -h4, -h5, -h6 { - line-height: 1.6em; -} - -ul { - margin-left: 1.3em; -} - -ul > li { - margin-left: 0.15em; -} - diff --git a/css/style_home.css b/css/style_home.css deleted file mode 100644 index 4f80137..0000000 --- a/css/style_home.css +++ /dev/null @@ -1,1001 +0,0 @@ -:root { - --color-primary: #9D1631; - --color-primary-lighter: #E85E7A; - --color-primary-darker: #650d1f; - --color-secondary: #F48115; - --color-secondary-lighter: #f6ac65; - --color-secondary-darker: #834002; - --color-tertiary: #151414; - --color-tertiary-lighter: #989393; - --color-bg-primary: #f6f4f4; - --color-bg-secondary: #f8f2f4; - --gradient-primary: linear-gradient(to top left, #9D1631, #f5aebc); - --gradient-secondary: linear-gradient(to top left, #F48115, #f6ac65); -} - -* { - margin: 0; - padding: 0; - box-sizing: inherit; -} - -html { - font-size: 100%; - box-sizing: border-box; -} - - -body { - font-family: 'Roboto Mono', 'Ubuntu', 'sans-serif'; - color: var(--color-tertiary); - line-height: 1.9; - background-color: var(--color-bg-primary); -} - -/********************************************************/ -/* HEADER SECTION */ -.header { - height: 90vh; - padding: 0.1rem; - display: flex; - flex-direction: column; - align-items: center; -} - -/* Top nav bar */ -.nav__bar { - display: flex; - justify-content: space-between; - align-items: center; - height: 8rem; - width: 100%; - padding: 0 5rem; - z-index: 100; - margin: 0; -} - -.nav__bar__logo { - height: 4.6rem; -} - -.nav__bar__links { - display: flex; - align-items: center; - list-style: none; - gap: 2rem; -} - -.nav__bar__item { - margin-left: 4rem; -} - -.nav__bar__link { - font-size: 1.3rem; - color: inherit; - text-decoration: none; - display: block; -} - -.nav__bar__link:hover { - text-decoration: underline; - color: var(--color-primary); -} - -.nav__bar.sticky { - position: fixed; - background-color: var(--color-bg-primary); -} - -/* Header content */ -.header__content { - margin-top: auto; - margin-bottom: auto; - display: flex; - flex-direction: row; - gap: 5rem; -} - -.header__text { - margin-top: auto; - margin-bottom: auto; -} - -.header__text h1 { - font-size: 2.5rem; - line-height: 1.45; -} - -.header__text h4 { - font-size: 1.2rem; - line-height: 1.45; -} - -.header__text__effect { - position: relative; -} - -.header__text__effect::after { - content: ''; - position: absolute; - left: 0; - height: 105%; - width: 102%; - z-index: -5; - opacity: 0.5; - transform: scale(1.09, 1.09) skewX(-25deg); - background-image: var(--gradient-primary); -} - -.header__text h4 .header__text__effect::after { - opacity: 0.8; - background-image: var(--gradient-secondary); -} - -.header__content__img { - max-width: 20rem; - height: 17.15rem; -} - -.header__icon, -.header__text { - vertical-align: middle; - display: inline-block; -} - -/* END OF HEADER SECTION */ - -/********************************************************/ -/* SAMPLE PROGRAMS SECTION */ -.sample__programs { - max-width: 100rem; - margin: 4rem auto 0 auto; -} - -.programs__tab-container { - display: flex; - justify-content: center; -} - -.program__tab { - display: inline-block; - margin: 2rem; - font-size: 1rem; - padding: 1rem 2rem; - border: none; - border-radius: 10rem; - cursor: pointer; -} - -.program__tab--link-1 { - background-color: var(--color-primary); - color: var(--color-bg-primary); - text-decoration: none; -} - -.program__tab--link-2 { - background-color: var(--color-secondary); - color: var(--color-bg-primary); - text-decoration: none; -} - -.program__tab--link-1:hover { - background-color: var(--color-primary-lighter); - color: var(--color-tertiary); - text-decoration: none; -} - -.program__tab--link-2:hover { - background-color: var(--color-secondary-lighter); - color: var(--color-tertiary); - text-decoration: none; -} - -.program__tab--1 { - background-color: var(--color-primary); - color: var(--color-bg-primary); -} - -.program__tab--2 { - background-color: var(--color-secondary); - color: var(--color-bg-primary); -} - -.program__tab--3 { - background-color: var(--color-tertiary); - color: var(--color-bg-primary); -} - -.program__tab--1:hover { - background-color: var(--color-primary-lighter); - color: var(--color-tertiary); -} - -.program__tab--2:hover { - background-color: var(--color-secondary-lighter); - color: var(--color-tertiary); -} - -.program__tab--3:hover { - background-color: var(--color-tertiary-lighter); - color: var(--color-tertiary); -} - -.tab__contents { - display: flex; - flex-direction: column; - align-items: center; - margin: 1rem auto 0 auto; - max-width: 60rem; - padding: 2rem; -} - -.tab__content--2, .tab__content--3, .code__sample--2, .code__sample--3 { - display: none; -} - -.code__sample { - max-width: 60rem; - font-size: 0.8rem; - background-color: #f8ece2; - margin: 0 auto; - padding: 1rem; - font-family: 'Source Code Pro', monospace !important; -} - -.green { - color: darkgreen; -} - -.blue { - color: blue; -} - -.purple { - color: purple; -} - -.brown { - color: brown; -} - -/* END OF SAMPLE PROGRAMS SECTION */ - -/********************************************************/ -/* PHILOSOPHY, END USER SECTIONS */ -.section { - height: auto; - padding: 7rem 3rem; - border-top: 1px solid #ddd; -} - -#section--1, #section--3 { - background-color: var(--color-bg-secondary); -} - -#section--2 { - background-color: var(--color-bg-primary); -} - -.section h2 { - font-size: 1.0rem; - color: var(--color-primary); -} - -.section__content { - padding-top: 26rem; - display: flex; - flex-direction: row; - gap: 50px; - justify-content: center; -} - -.section__text { - margin-top: auto; - margin-bottom: auto; -} - -/* END OF PHILOSOPHY, END USER SECTIONS */ - -/********************************************************/ -/* FOOTER SECTION */ -.footer { - background-color: var(--color-tertiary); - display: flex; - flex-direction: column; - align-items: center; - height: auto; - padding: 7rem 3rem; -} - -.footer__links { - display: flex; - flex-direction: row; -} - -.footer__link { - font-size: 1.3rem; - color: var(--color-secondary); - text-decoration: none; - display: block; - padding: 2rem 5rem; -} - -.footer__link:hover { - text-decoration: underline; - color: var(--color-bg-primary); -} - -.footer__logo { - height: 8rem; - margin: 2rem; -} - -/* END OF FOOTER SECTION */ - -/********************************************************/ -/* CSS FOR RESPONSIVENESS */ - -/* 8K minimum - High resolution screens */ -@media screen and (min-width: 7600px) { - .nav__bar { - padding: 10rem; - } - - .nav__bar__logo { - height: 18rem; - } - - .nav__bar__links { - gap: 15rem; - } - - .nav__bar__link { - font-size: 6rem; - } - - .header__content { - gap: 60rem; - } - - .header__text h1 { - font-size: 8rem; - } - - .header__text h4 { - font-size: 5rem; - } - - .header__content__img { - max-width: 100rem; - height: 85.72rem - } - - .section { - padding: 25rem; - } - - .section h2 { - font-size: 5rem; - } - - .section h1 { - font-size: 7rem; - } - - .sample__programs { - max-width: 200rem; - } - - .program__tab { - margin: 7rem; - font-size: 4.5rem; - padding: 5rem 10rem; - } - - .tab__contents { - margin: auto; - max-width: 200rem; - } - - .tab__contents h4 { - font-size: 4.5rem; - } - - .tab__contents img { - margin: 12rem; - } - - .code__sample { - max-width: 400rem; - font-size: 4rem; - } - - .section__content { - gap: 30rem; - } - - .section__text { - font-size: 4.5rem; - } - - .footer { - padding: 10rem 0; - } - - .footer__link { - font-size: 7rem; - } - - .footer__logo { - height: 24rem; - margin: 10rem auto 0 auto; - } -} - -/* 4K - 8K resolution */ -@media screen and (max-width: 7599px) { - .nav__bar { - padding: 7rem; - } - - .nav__bar__logo { - height: 13rem; - } - - .nav__bar__links { - gap: 7rem; - } - - .nav__bar__link { - font-size: 4rem; - } - - .header__content { - gap: 30rem; - } - - .header__text h1 { - font-size: 6rem; - } - - .header__text h4 { - font-size: 4rem; - } - - .header__content__img { - max-width: 80rem; - height: 68.57rem - } - - .section { - padding: 14rem; - } - - .section h2 { - font-size: 4rem; - } - - .section h1 { - font-size: 5rem; - } - - .sample__programs { - max-width: 200rem; - } - - .program__tab { - margin: 4rem; - font-size: 4rem; - padding: 3rem 6rem; - } - - .tab__contents { - margin: auto; - max-width: 200rem; - } - - .tab__contents h4 { - font-size: 4rem; - } - - .tab__contents img { - margin: 10rem; - } - - .code__sample { - max-width: 200rem; - font-size: 3.5rem; - } - - .section__content { - gap: 30rem; - padding-top: 15rem; - } - - .section__text { - font-size: 4rem; - } - - .footer { - padding: 20rem 0; - } - - .footer__link { - font-size: 5rem; - } - - .footer__logo { - height: 18rem; - margin: 8rem auto 0 auto; - } -} - -/* 4K : High resolution screens */ -@media screen and (max-width: 5100px) { - .nav__bar { - padding: 5rem; - } - - .nav__bar__logo { - height: 9rem; - } - - .nav__bar__links { - gap: 7rem; - } - - .nav__bar__link { - font-size: 3rem; - } - - .header__content { - gap: 30rem; - } - - .header__text h1 { - font-size: 4rem; - } - - .header__text h4 { - font-size: 2.5rem; - } - - .header__content__img { - max-width: 50rem; - height: 42.86rem; - } - - .section { - padding: 12rem; - } - - .section h2 { - font-size: 2.5rem; - } - - .section h1 { - font-size: 3.5rem; - } - - .sample__programs { - max-width: 100rem; - } - - .program__tab { - margin: 3.5rem; - font-size: 2.5rem; - padding: 2rem 5rem; - } - - .tab__contents { - margin: auto; - max-width: 100rem; - } - - .tab__contents h4 { - font-size: 2rem; - } - - .tab__contents img { - margin: 6rem; - } - - .code__sample { - max-width: 200rem; - font-size: 2rem; - } - - .section__content { - gap: 20rem; - padding-top: 13rem; - } - - .section__text { - font-size: 2.25rem; - } - - .footer { - padding: 10rem 0; - } - - .footer__link { - font-size: 3.5rem; - } - - .footer__logo { - height: 12rem; - margin: 8rem auto 0 auto; - } -} - -/* 2K - 4K resolution */ -@media screen and (max-width: 3100px) { - .nav__bar { - padding: 1rem; - } - - .nav__bar__logo { - height: 6rem; - } - - .nav__bar__links { - gap: 5rem; - } - - .nav__bar__link { - font-size: 2rem; - } - - .header__content { - gap: 15rem; - } - - .header__text h1 { - font-size: 3rem; - } - - .header__text h4 { - font-size: 2rem; - } - - .header__content__img { - max-width: 30rem; - height: 25.71rem - } - - .section { - padding: 4rem; - } - - .section h2 { - font-size: 1.6rem; - } - - .section h1 { - font-size: 2.3rem; - } - - .sample__programs { - max-width: 60rem; - } - - .program__tab { - margin: 1rem; - font-size: 2rem; - padding: 1rem 3rem; - } - - .tab__contents { - margin: auto; - max-width: 60rem; - } - - .tab__contents h4 { - font-size: 1.6rem; - } - - .tab__contents img { - margin: 2.5rem; - } - - .code__sample { - max-width: 60rem; - font-size: 1.4rem; - } - - .section__content { - gap: 10rem; - padding-top: 6rem; - } - - .section__text { - font-size: 1.4rem; - } - - .footer { - padding: 5rem 0; - } - - .footer__link { - font-size: 2rem; - } - - .footer__logo { - height: 6rem; - margin: 4rem auto 0 auto; - } -} - -/* 1080p */ -@media screen and (max-width: 2100px) { - .header { - height: auto; - } - - .nav__bar { - height: auto; - padding: 1rem; - } - - .nav__bar__logo { - height: 3.5rem; - } - - .nav__bar__links { - gap: 1.5rem; - } - - .nav__bar__link { - font-size: 1.2rem; - } - - .header__content { - margin: 10rem auto; - } - - .header__text h1 { - font-size: 2rem; - } - - .header__text h4 { - font-size: 1rem; - } - - .header__content__img { - max-width: 18rem; - height: 15.43rem; - } - - .section { - padding: 3rem; - } - - .section h2 { - font-size: 1rem; - } - - .section h1 { - font-size: 1.3rem; - } - - .sample__programs { - max-width: 80rem; - } - - .program__tab { - margin: 0.5rem 1rem; - font-size: 1rem; - padding: 1rem 2rem; - } - - .tab__contents { - margin: auto; - max-width: 80rem; - } - - .tab__contents h4 { - font-size: 1rem; - } - - .tab__contents img { - margin: 1.2rem; - } - - .code__sample { - max-width: 60rem; - font-size: 1rem; - } - - .section__content { - gap: 5rem; - padding-top: 2rem; - } - - .section__text { - font-size: 1rem; - } - - .footer { - padding: 2rem 0; - } - - .footer__link { - font-size: 1rem; - } - - .footer__logo { - height: 3rem; - margin: 2rem auto 0 auto; - } -} - -/* 720p */ -@media screen and (max-width: 1280px) { - .nav__bar { - padding: 1rem; - flex-direction: column; - } - - .nav__bar__logo { - height: 4rem; - } - - .nav__bar__links { - gap: 2rem; - } - - .nav__bar__link { - font-size: 1.4rem; - } - - .header__content { - flex-direction: column; - gap: 3rem; - align-items: center; - margin: 5rem auto; - } - - .header__text h1 { - font-size: 2rem; - } - - .header__text h4 { - font-size: 1rem; - } - - .header__content__img { - max-width: 18rem; - height: 15.43rem; - } - - .section { - padding: 3rem; - } - - .section h2 { - font-size: 1rem; - } - - .section h1 { - font-size: 1.3rem; - } - - .sample__programs { - max-width: 60rem; - } - - .program__tab { - margin: 0.5rem; - font-size: 1rem; - padding: 1rem 2rem; - } - - .tab__contents { - margin: auto; - max-width: 40rem; - } - - .tab__contents h4 { - font-size: 1rem; - } - - .tab__contents img { - margin: 1rem; - } - - .code__sample { - max-width: 40rem; - font-size: 1rem; - } - - .section__content { - gap: 5rem; - padding-top: 2rem; - } - - .section__text { - font-size: 1rem; - } - - .footer { - padding: 2rem 0; - } - - .footer__link { - font-size: 1rem; - } - - .footer__logo { - height: 3rem; - margin: 2rem auto 0 auto; - } -} - -/* 480p */ -@media screen and (max-width: 750px) { - .section { - margin: 1rem 0; - padding: 4rem 1rem; - } - - .section__content { - flex-direction: column; - align-items: center; - } - - .programs__tab-container { - margin: 1.5rem 0; - } - - .sample__programs { - margin: 0; - } - - .tab__contents { - padding: 0; - } -} - -/* Small screens - less than 640px */ -@media screen and (max-width: 640px) { - .nav__bar { - padding: 0.25rem; - } - - .nav__bar__logo { - height: 3rem; - } - - .nav__bar__links { - gap: 0.5rem; - } - - .nav__bar__link { - font-size: 0.9rem; - } - - .footer__link { - padding: 1.5rem; - } - -} - -/* Smaller screens - less than 510px */ -@media screen and (max-width: 510px) { - .nav__bar__links { - gap: 0; - } - - .nav__bar__item { - margin: auto 1rem; - } - - .nav__bar__link { - font-size: 0.9rem; - } - - .program__tab { - font-size: 0.9rem; - padding: 1rem 0.5rem; - } -} diff --git a/docbox_generator/.gitignore b/docbox_generator/.gitignore deleted file mode 100644 index e4e0ac0..0000000 --- a/docbox_generator/.gitignore +++ /dev/null @@ -1,131 +0,0 @@ -# Byte-compiled / optimized / DLL files -__pycache__/ -*.py[cod] -*$py.class - -# C extensions -*.so - -# Distribution / packaging -.Python -build/ -develop-eggs/ -dist/ -downloads/ -eggs/ -.eggs/ -lib/ -lib64/ -parts/ -sdist/ -var/ -wheels/ -pip-wheel-metadata/ -share/python-wheels/ -*.egg-info/ -.installed.cfg -*.egg -MANIFEST - -# PyInstaller -# Usually these files are written by a python script from a template -# before PyInstaller builds the exe, so as to inject date/other infos into it. -*.manifest -*.spec - -# Installer logs -pip-log.txt -pip-delete-this-directory.txt - -# Unit test / coverage reports -htmlcov/ -.tox/ -.nox/ -.coverage -.coverage.* -.cache -nosetests.xml -coverage.xml -*.cover -*.py,cover -.hypothesis/ -.pytest_cache/ - -# Translations -*.mo -*.pot - -# Django stuff: -*.log -local_settings.py -db.sqlite3 -db.sqlite3-journal - -# Flask stuff: -instance/ -.webassets-cache - -# Scrapy stuff: -.scrapy - -# Sphinx documentation -docs/_build/ - -# PyBuilder -target/ - -# Jupyter Notebook -.ipynb_checkpoints - -# IPython -profile_default/ -ipython_config.py - -# pyenv -.python-version - -# pipenv -# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. -# However, in case of collaboration, if having platform-specific dependencies or dependencies -# having no cross-platform support, pipenv may install dependencies that don't work, or not -# install all needed dependencies. -#Pipfile.lock - -# PEP 582; used by e.g. github.com/David-OConnor/pyflow -__pypackages__/ - -# Celery stuff -celerybeat-schedule -celerybeat.pid - -# SageMath parsed files -*.sage.py - -# Environments -.env -.venv -env/ -venv/ -ENV/ -env.bak/ -venv.bak/ - -# Spyder project settings -.spyderproject -.spyproject - -# Rope project settings -.ropeproject - -# mkdocs documentation -/site - -# mypy -.mypy_cache/ -.dmypy.json -dmypy.json - -# Pyre type checker -.pyre/ - -.idea \ No newline at end of file diff --git a/docbox_generator/LICENSE b/docbox_generator/LICENSE deleted file mode 100644 index 5439747..0000000 --- a/docbox_generator/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2022 YakshaLang - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/docbox_generator/README.md b/docbox_generator/README.md deleted file mode 100644 index 1b988e2..0000000 --- a/docbox_generator/README.md +++ /dev/null @@ -1,4 +0,0 @@ -# DocBox -DocBox Documentation Generator - -require `css-minify` and `html-minifier` in path. \ No newline at end of file diff --git a/docbox_generator/__init__.py b/docbox_generator/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/docbox_generator/docbox.py b/docbox_generator/docbox.py deleted file mode 100644 index a40b206..0000000 --- a/docbox_generator/docbox.py +++ /dev/null @@ -1,952 +0,0 @@ -"""# DocBox Format ---- -Rather simple file format to generate 2 sided content+note style documentation/web pages from a given template. -;Which means I was lazy. ---- -## Different types of content that's allowed ---- -*`RAW_HTML` - Any line that starts with `!!` read all lines until another `!!`, whole thing is raw HTML section -**Alternatively line starting with `!!!` is a single line of raw html. -*`HEADER` - Any line that starts with a `#` is `h2`, `##` is `h3`, `###` is `h4`, and so forth until `h6`. -*`BULLET` - Any line that starts with `*` is a bullet point, `**` is a bullet point inside a bullet point -*`SEPARATOR` - if line contains `---` only (otherwise it's a normal line), this separate notes -*`NOTE` - if a line starts with `;` it is a note, which we will add to same cell on right side -*`NOTE_RAW_HTML` - if a line starts with `;!` same as note but in raw HTML -*`CODE` - lines between two triple backticks. -*`DEFAULT` - default lines. -*All lines without RAW HTML content are also treated as markdown. -;I wanted a quick and dirty solution, so this does not show any errors for bad input. -;If all content doesn't show up you probably made a mistake. ---- -## Output HTML file format ---- -We basically just replace `$TITLE$` with title, `$DESCRIPTION$` with description. -Table of contents are generated from headers and should go to `$TOC$`. -Also, `$STYLES$` is replaced with pygments style. -Each section of the document is written as below. ---- -```text -+-----------+-------------+------------+ -| | | | -| Table | Content | Note | -| of | Part 01 | Part 01 | -| Contents | | | -| | | | -| | | | -| +-------------+------------+ -| | | | -| | Content | Note | -| | Part 02 | Part 02 | -| | | | -| | | | -+-----------+-------------+------------+ -``` -;I created this from asciiflow site. ---- -## Template files ---- -Template directory should contain following -*`cell.html` - Format of a single content+note cell. -*`main0.html` - HTML before cells. -*`main1.html` - HTML after cells. -;All content goes between `main0.html` and `main1.html` ---- -""" -import argparse -import html -import keyword -import os.path -import re -import subprocess -from datetime import datetime -from enum import Enum -from typing import List, Tuple - -import markdown -from pygments import highlight -from pygments import unistring as uni -from pygments.formatters.html import HtmlFormatter -from pygments.lexer import include, bygroups, using, \ - default, combined, this -from pygments.lexer import words, RegexLexer -from pygments.lexers import get_lexer_by_name, guess_lexer -from pygments.styles import get_style_by_name -from pygments.token import Keyword, String -from pygments.token import Text, Comment, Operator, Name, Number, Punctuation -from pygments.util import shebang_matches - -WEBSITE_DEFAULT_DESC = "Personal website of Bhathiya Perera. I use this as both a micro blog and a place to " \ - "publish structured articles. I mostly write about software " \ - "engineering and programming." -WEBSITE_DEFAULT_TITLE = "Bhathiya's Site 😸" -MINIFIER_COMMAND = "html-minifier --collapse-whitespace --remove-comments --remove-optional-tags " \ - "--remove-redundant-attributes --remove-script-type-attributes " \ - "--remove-tag-whitespace --use-short-doctype " \ - "--minify-css true --minify-js true -o \"$OUT$\" \"$OUT$\"" -GIT_FILE_HISTORY_DAYS = "git log --follow --pretty=format:\"%ad\" --date=short -- $FILE$" -NEWLINE = '\n' # Unix newline character -NOT_ALLOWED = re.compile(r"[^a-z\d]") -TWO_OR_MORE_DASHES = re.compile(r"-+") -PYG_STYLE = get_style_by_name('dracula') -PYG_FORMATTER = HtmlFormatter(style=PYG_STYLE) -ALL_HEADER_MAX_WIDTH = 9 - - -class YakshaLexer(RegexLexer): - name = 'Yaksha' - aliases = ['yaksha', 'yaka'] - filenames = [ - '*.yaka', - ] - mimetypes = ['text/x-yaksha'] - - flags = re.MULTILINE | re.UNICODE - - uni_name = "[%s][%s]*" % (uni.xid_start, uni.xid_continue) - - def innerstring_rules(ttype): - return [ - # the old style '%s' % (...) string formatting (still valid in Py3) - (r'%(\(\w+\))?[-#0 +]*([0-9]+|[*])?(\.([0-9]+|[*]))?' - '[hlL]?[E-GXc-giorsaux%]', String.Interpol), - # the new style '{}'.format(...) string formatting - (r'\{' - r'((\w+)((\.\w+)|(\[[^\]]+\]))*)?' # field name - r'(\![sra])?' # conversion - r'(\:(.?[<>=\^])?[-+ ]?#?0?(\d+)?,?(\.\d+)?[E-GXb-gnosx%]?)?' - r'\}', String.Interpol), - - # backslashes, quotes and formatting signs must be parsed one at a time - (r'[^\\\'"%{\n]+', ttype), - (r'[\'"\\]', ttype), - # unhandled string formatting sign - (r'%|(\{{1,2})', ttype) - # newlines are an error (use "nl" state) - ] - - def fstring_rules(ttype): - return [ - # Assuming that a '}' is the closing brace after format specifier. - # Sadly, this means that we won't detect syntax error. But it's - # more important to parse correct syntax correctly, than to - # highlight invalid syntax. - (r'\}', String.Interpol), - (r'\{', String.Interpol, 'expr-inside-fstring'), - # backslashes, quotes and formatting signs must be parsed one at a time - (r'[^\\\'"{}\n]+', ttype), - (r'[\'"\\]', ttype), - # newlines are an error (use "nl" state) - ] - - tokens = { - 'root': [ - (r'\n', Text), - (r'^(\s*)([rRuUbB]{,2})("""(?:.|\n)*?""")', - bygroups(Text, String.Affix, String.Doc)), - (r"^(\s*)([rRuUbB]{,2})('''(?:.|\n)*?''')", - bygroups(Text, String.Affix, String.Doc)), - (r'\A#!.+$', Comment.Hashbang), - (r'#.*$', Comment.Single), - (r'\\\n', Text), - (r'\\', Text), - include('keywords'), - include('soft-keywords'), - (r'(def)((?:\s|\\\s)+)', bygroups(Keyword, Text), 'funcname'), - (r'(class)((?:\s|\\\s)+)', bygroups(Keyword, Text), 'classname'), - (r'(struct)((?:\s|\\\s)+)', bygroups(Keyword, Text), 'classname'), - (r'(from)((?:\s|\\\s)+)', bygroups(Keyword.Namespace, Text), - 'fromimport'), - (r'(import)((?:\s|\\\s)+)', bygroups(Keyword.Namespace, Text), - 'import'), - include('expr'), - ], - 'expr': [ - # raw f-strings - ('(?i)(rf|fr)(""")', - bygroups(String.Affix, String.Double), - combined('rfstringescape', 'tdqf')), - ("(?i)(rf|fr)(''')", - bygroups(String.Affix, String.Single), - combined('rfstringescape', 'tsqf')), - ('(?i)(rf|fr)(")', - bygroups(String.Affix, String.Double), - combined('rfstringescape', 'dqf')), - ("(?i)(rf|fr)(')", - bygroups(String.Affix, String.Single), - combined('rfstringescape', 'sqf')), - # non-raw f-strings - ('([fF])(""")', bygroups(String.Affix, String.Double), - combined('fstringescape', 'tdqf')), - ("([fF])(''')", bygroups(String.Affix, String.Single), - combined('fstringescape', 'tsqf')), - ('([fF])(")', bygroups(String.Affix, String.Double), - combined('fstringescape', 'dqf')), - ("([fF])(')", bygroups(String.Affix, String.Single), - combined('fstringescape', 'sqf')), - # raw strings - ('(?i)(rb|br|r)(""")', - bygroups(String.Affix, String.Double), 'tdqs'), - ("(?i)(rb|br|r)(''')", - bygroups(String.Affix, String.Single), 'tsqs'), - ('(?i)(rb|br|r)(")', - bygroups(String.Affix, String.Double), 'dqs'), - ("(?i)(rb|br|r)(')", - bygroups(String.Affix, String.Single), 'sqs'), - # non-raw strings - ('([uUbB]?)(""")', bygroups(String.Affix, String.Double), - combined('stringescape', 'tdqs')), - ("([uUbB]?)(''')", bygroups(String.Affix, String.Single), - combined('stringescape', 'tsqs')), - ('([uUbB]?)(")', bygroups(String.Affix, String.Double), - combined('stringescape', 'dqs')), - ("([uUbB]?)(')", bygroups(String.Affix, String.Single), - combined('stringescape', 'sqs')), - (r'[^\S\n]+', Text), - include('numbers'), - (r'!=|==|<<|>>|:=|[-~+/*%=<>&^|.!]', Operator), - (r'[]{}:(),;[]', Punctuation), - (r'(in|is|and|or|not)\b', Operator.Word), - include('expr-keywords'), - include('builtins'), - include('magicfuncs'), - include('magicvars'), - include('name'), - ], - 'expr-inside-fstring': [ - (r'[{([]', Punctuation, 'expr-inside-fstring-inner'), - # without format specifier - (r'(=\s*)?' # debug (https://bugs.python.org/issue36817) - r'(\![sraf])?' # conversion - r'\}', String.Interpol, '#pop'), - # with format specifier - # we'll catch the remaining '}' in the outer scope - (r'(=\s*)?' # debug (https://bugs.python.org/issue36817) - r'(\![sraf])?' # conversion - r':', String.Interpol, '#pop'), - (r'\s+', Text), # allow new lines - include('expr'), - ], - 'expr-inside-fstring-inner': [ - (r'[{([]', Punctuation, 'expr-inside-fstring-inner'), - (r'[])}]', Punctuation, '#pop'), - (r'\s+', Text), # allow new lines - include('expr'), - ], - 'expr-keywords': [ - # Based on https://docs.python.org/3/reference/expressions.html - (words(( - 'async for', 'await', 'else', 'for', 'if', 'lambda', - 'yield', 'yield from'), suffix=r'\b'), - Keyword), - (words(('True', 'False', 'None'), suffix=r'\b'), Keyword.Constant), - ], - 'keywords': [ - (words(( - 'assert', 'async', 'await', 'break', 'continue', 'del', 'elif', - 'else', 'except', 'finally', 'for', 'global', 'if', 'lambda', - 'pass', 'raise', 'nonlocal', 'return', 'try', 'while', 'yield', - 'defer', '@native', '@template', '@device', '@nativedefine', '@nativemacro', '@dotaccess', 'ccode', - 'yield from', 'as', 'with', 'macros'), suffix=r'\b'), - Keyword), - (words(('True', 'False', 'None'), suffix=r'\b'), Keyword.Constant), - ], - 'soft-keywords': [ - # `match`, `case` and `_` soft keywords - (r'(^[ \t]*)' # at beginning of line + possible indentation - r'(match|case)\b' # a possible keyword - r'(?![ \t]*(?:' # not followed by... - r'[:,;=^&|@~)\]}]|(?:' + # characters and keywords that mean this isn't - r'|'.join(keyword.kwlist) + r')\b))', # pattern matching - bygroups(Text, Keyword), 'soft-keywords-inner'), - ], - 'soft-keywords-inner': [ - # optional `_` keyword - (r'(\s+)([^\n_]*)(_\b)', bygroups(Text, using(this), Keyword)), - default('#pop') - ], - 'builtins': [ - (words(( - 'bool', 'float', 'f32', 'f64', 'int', 'i32', 'u32', 'i8', 'u8', 'i16', 'u16', 'i64', 'u64', 'str', - 'len', 'print', 'println', - 'sizeof', 'format', 'reversed', 'sorted', 'charat', - 'getref', 'unref', - 'arrput', 'arrpop', - 'shget', 'shgeti', 'shput', 'shnew', - 'hmget', 'hmgeti', 'hmput', 'hmnew', - 'Array', 'SMEntry', 'MEntry', 'Ptr', 'Const', 'PtrConst', 'Function', 'Input', 'Output'), - prefix=r'(? str: - if lexer == "yaksha": - lex = YakshaLexer() - elif lexer: - lex = get_lexer_by_name(lexer) - else: - lex = guess_lexer(code) - return highlight(code, lex, PYG_FORMATTER) - - -class IdGen: - def __init__(self): - self._unique = set() - - def reset(self): - self._unique = set() - - def generate(self, text: str): - counter = 1 - result = TWO_OR_MORE_DASHES.sub("-", NOT_ALLOWED.sub("-", text.lower())).strip("-") - if result and result not in self._unique: - return result - new_result = result + str(counter) - while new_result in self._unique: - counter += 1 - new_result = result + str(counter) - return new_result - - -class TitleNumGen: - def __init__(self): - self._prev_level = -1 - self._counters = [] - - def reset(self): - self._prev_level = -1 - self._counters = [] - - def generate(self, level): - if level == 1: - if self._counters: - self._counters = self._counters[:1] - else: - self._counters = [0] - elif self._prev_level < level: - for _ in range(level - self._prev_level): - self._counters.append(0) - elif self._prev_level > level: - for _ in range(self._prev_level - level): - self._counters.pop() - - self._counters[-1] = self._counters[-1] + 1 - self._prev_level = level - return self._conv() - - def _conv(self): - return ".".join([str(x) for x in self._counters]) + " " - - -class NullNumGen: - def generate(self, _): - return "" - - def reset(self): - pass - - -# NOTE: All token type data should be html escaped see --> https://docs.python.org/3/library/html.html -# however, RAW_HTML & NOTE_RAW_HTML is written as it is -class TokenType(Enum): - """ - Token types - """ - RAW_HTML = 1 # Any line that starts with `!!` read all lines until another `!!`, whole thing is raw HTML section - # Alternatively line starting with !!! is a single line of raw html. - HEADER = 2 # Any line that starts with a `#` is

, `##` is h2, `###` is h3, and so forth until h6. - BULLET = 3 # Any line that starts with `*` is a bullet point, `**` is a bullet point inside a bullet point - SEPARATOR = 4 # if line contains `---` only (otherwise it's a normal line), this separate notes - NOTE = 5 # if a line starts with `;` it is a note, which we will add to same cell on right side - NOTE_RAW_HTML = 6 # if a line starts with `;!` same as note but in raw HTML - CODE = 7 # lines between two ``` - DEFAULT = 10 # Normal line - - -class Token: - def __init__(self, token_type_: TokenType, data_: str, raw_data_: str, level_: int = 0): - """ - Create a token object - :param token_type_: type of the token - :param data_: data for the token - :param raw_data_: un processed data - :param level_: level used for header and bullets (* is 1, ** is 2, # is 1 and ## is two) - """ - self.token_type: TokenType = token_type_ - self.data: str = data_ - self.raw_data: str = raw_data_ - self.level: int = level_ - self.header_id: str = "" - self.header_num: str = "" - self.header_indent: str = "" - - -def count_and_strip(text: str, char: str) -> (int, str): - output = [] - count = 0 - counting = True - for x in text: - if counting and x == char: - count += 1 - continue - counting = False - output.append(x) - return count, "".join(output) - - -class DocBoxFile: - """ - A DocBox file object - * This reads and breaks a file to tokens that HtmlConverter can write as HTML - """ - - def __init__(self, file_path: str, num_gen, id_gen, text: str = "", md: bool = False): - self.file_path = file_path - self._num_gen = num_gen - self._id_gen = id_gen - self._text = text - self.limit = -1 - self.read_more = "" - self._markdown_mode = md - - def _get_lines(self): - if self._markdown_mode: - yield "---" - if self._text: - for line in self._text.splitlines(): - yield line - else: - with open(self.file_path, "r+", encoding="utf-8") as f: - for line in f: - yield line - if self._markdown_mode: - yield "---" - - def parse(self) -> List[Token]: - tokens: List[Token] = [] - mode = "any" - html_lines = [] - code_lines = [] - possible_type = "python" - sections = 0 - for line in self._get_lines(): - if 0 < self.limit <= sections: - read_more = 'Read More'.format(self.read_more) - tokens.append(Token(TokenType.SEPARATOR, "", "")) - tokens.append(Token(TokenType.RAW_HTML, read_more, read_more)) - tokens.append(Token(TokenType.SEPARATOR, "", "")) - break - # remove all spaces from left side of the line - # as we do ignore those - stripped_line = line.lstrip() - if mode != "code" and not stripped_line: - continue - if mode == "html": - if stripped_line.startswith("!!"): - tokens.append(Token(TokenType.RAW_HTML, NEWLINE.join(html_lines), NEWLINE.join(html_lines))) - mode = "any" - continue - html_lines.append(stripped_line) - elif mode == "code": - if stripped_line.startswith("```"): - code = NEWLINE.join(code_lines) - tokens.append(Token(TokenType.RAW_HTML, pyg_highlight(code, possible_type), code)) - mode = "any" - possible_type = "python" - continue - code_lines.append(line.rstrip()) - elif stripped_line.startswith("*"): - level, text = count_and_strip(stripped_line, "*") - tokens.append(Token(TokenType.BULLET, markdown.markdown(text), text, level)) - elif stripped_line.startswith("#"): - level, text = count_and_strip(stripped_line, "#") - num = self._num_gen.generate(level) - id_ = self._id_gen.generate(text) - mk_header = markdown.markdown(text) - if mk_header.startswith("

") and mk_header.endswith("

"): - mk_header = mk_header[3:-4] - token = Token(TokenType.HEADER, mk_header, text, level) - token.header_id = id_ - token.header_num = num - token.header_indent = " " * ((len(num) // 2) - 1) - tokens.append(token) - elif stripped_line.startswith(";!"): - tokens.append(Token(TokenType.NOTE_RAW_HTML, stripped_line[2:], stripped_line[2:])) - elif stripped_line.startswith(";"): - tokens.append( - Token(TokenType.NOTE, markdown.markdown((stripped_line[1:])), stripped_line[1:])) - elif stripped_line.startswith("!!!"): - tokens.append(Token(TokenType.RAW_HTML, stripped_line[3:], stripped_line[3:])) - elif stripped_line.startswith("!!"): - mode = "html" # TokenType.RAW_HTML - html_lines = [] # this clears our temporary buffer - elif stripped_line.startswith("```"): - mode = "code" - if len(stripped_line) > 3: - type_ = stripped_line[3:].strip().lower() - if type_: - possible_type = type_ - code_lines = [] - elif stripped_line.rstrip() == "---": - tokens.append(Token(TokenType.SEPARATOR, "", "")) - sections += 1 - else: - tokens.append( - Token(TokenType.DEFAULT, markdown.markdown((stripped_line)), stripped_line)) - - return tokens - - def extract_created_last_mod(self) -> Tuple[str, str]: - cmd = GIT_FILE_HISTORY_DAYS.replace("$FILE$", self.file_path) - text = subprocess.check_output(cmd, shell=True, universal_newlines=True) - days = text.splitlines() - if not days: - today_str = datetime.now().strftime("%Y-%m-%d") - return today_str, today_str - # Return created and last modified days - if len(days) > 1: - return days[-1], days[0] - return days[0], days[0] - - -class Cell: - def __init__(self, content_: str, note_: str): - """ - Constructor for cell object - :param content_: content html - :param note_: note html - """ - self.content = content_ - self.note = note_ - - -class HtmlConverter: - def __init__(self, files: List[DocBoxFile], target: str, template_cell: str, template_start: str, - template_end: str, minifier_command: str, title: str, desc: str, all_headers: bool, - include_meta_after_first_header=True): - """ - Html Converter - convert set of docbox files to a single html - :param files: list of DocBoxFile objects - :param target: target file - :param template_cell: how a single cell is converted to HTML - :param template_start: start of template before we put all cells in target - :param template_end: end of template - :param minifier_command: shell command to minify html - :param title: html title - :param desc: html description - :param all_headers: All headers in ToC? - :param include_meta_after_first_header: include meta data such as created time after first header - """ - self._files = files - self._target = target - with open(template_cell, "r+", encoding="utf-8") as h: - self._cell_template = h.read() - with open(template_start, "r+", encoding="utf-8") as h: - self._main_template0 = h.read() - with open(template_end, "r+", encoding="utf-8") as h: - self._main_template1 = h.read() - self._minifier_command = minifier_command - self._title = title - self._desc = desc - self._all_headers = all_headers - self._toc = "" - self._include_meta_after_first_header = include_meta_after_first_header - - def convert(self): - """ - Capture tokens to cells with content and notes - write cells to html format - """ - cells: List[Cell] = [] - content: List[str] = [] - note: List[str] = [] - toc: List[str] = [] - prev_bullet = -1 - doc_file = None - possible_first_header = True - for section, doc in self._get_sections(): - if doc_file != doc.file_path: - doc_file = doc.file_path - possible_first_header = True - if section.token_type == TokenType.BULLET: - # depend on level place bullet points - # see below example - # - # [[input]] - # - # * banana 1 - # * banana 2 - # ** this is a special banana - # ** very special indeed - # * banana 3 - # * banana 4 - # - # [[output]] - # - # - # - if prev_bullet == -1: - content.append("") - elif prev_bullet < section.level: - content.append("") - prev_bullet = -1 - if section.token_type == TokenType.NOTE or section.token_type == TokenType.NOTE_RAW_HTML: - note.append(section.data) - elif section.token_type == TokenType.RAW_HTML: - content.append(section.data) - elif section.token_type == TokenType.HEADER: - if self._all_headers or section.level == 1: - if len(section.header_num) <= ALL_HEADER_MAX_WIDTH: - toc.append( - "
{indent}{title}
".format( - id_=section.header_id, - title=section.data, indent=section.header_indent)) - content.append( - "{num}{title}".format(id_=section.header_id, - title=section.data, - level=section.level + 1, - num=section.header_num)) - if self._include_meta_after_first_header and possible_first_header: - created_dt, last_mod_dt = doc.extract_created_last_mod() - content.append( - "Created {}, Last Updated {}".format( - created_dt, last_mod_dt) - ) - possible_first_header = False - elif section.token_type == TokenType.SEPARATOR: - # You can create a cell now with acquired content and note stuffs - cells.append(Cell(NEWLINE.join(content), NEWLINE.join(note))) - content = [] - note = [] - else: # SectionType.DEFAULT - content.append(section.data) - self._toc = NEWLINE.join(toc) - self._write_html(cells) - - def _write_html(self, cells: List[Cell]): - with open(self._target, "w+", encoding="utf-8") as h: - h.write(self._fill_main_template(self._main_template0)) - for cell in self._put_cell_in_template(cells): - h.write(cell) - h.write(self._fill_main_template(self._main_template1)) - subprocess.run(self._minifier_command, shell=True, check=True) - - def _fill_main_template(self, template_text: str): - return template_text.replace("$TITLE$", self._title) \ - .replace("$DESCRIPTION$", self._desc).replace("$TOC$", self._toc) \ - .replace("$STYLES$", PYG_FORMATTER.get_style_defs('.highlight')) - - def _put_cell_in_template(self, cells): - for cell in cells: - yield self._cell_template.replace("$CONTENT$", cell.content) \ - .replace("$NOTE$", cell.note) - - def _get_sections(self): - for doc in self._files: - for section in doc.parse(): - yield section, doc - yield Token(TokenType.RAW_HTML, "
", "
"), doc - yield Token(TokenType.NOTE_RAW_HTML, "
", "
"), doc - - -DOC_BOX_ROOT = os.path.dirname(os.path.abspath(__file__)) - - -class DocBoxApp: - def __init__(self, root=DOC_BOX_ROOT): - self._root = root - self._input_dir = os.path.join(self._root, "posts") - self._template_root = os.path.join(self._root, "template") - self._template_cell = os.path.join(self._template_root, "cell.html") - self._template_main0 = os.path.join(self._template_root, "main0.html") - self._template_main1 = os.path.join(self._template_root, "main1.html") - self._output_file = os.path.join(self._root, "docs", "index.html") - self._title = html.escape(WEBSITE_DEFAULT_TITLE) - self._desc = html.escape(WEBSITE_DEFAULT_DESC) - self._minifier_command = MINIFIER_COMMAND - self._id_gen = IdGen() - self._num_gen = TitleNumGen() - - def convert(self, arguments): - parsed_args = self._parse_arguments(arguments) - self._use_args(parsed_args) - if parsed_args.posts: - self._convert_posts(parsed_args.r, parsed_args.allheaders, parsed_args.posts) - else: - self._convert(parsed_args.r, parsed_args.allheaders) - - def convert_text(self, arguments, single_file_text: str): - parsed_args = self._parse_arguments(arguments) - self._use_args(parsed_args) - doc_objects = [DocBoxFile("-", self._num_gen, self._id_gen, text=single_file_text, md=self._use_markdown_files)] - HtmlConverter(doc_objects, self._output_file, self._template_cell, - self._template_main0, self._template_main1, - self._minifier_command, self._title, self._desc, parsed_args.allheaders).convert() - - def _parse_arguments(self, arguments): - parser = argparse.ArgumentParser("docbox", description="Docbox HTML Generator") - parser.add_argument("-o,--output", dest="out", type=str, default=self._output_file, help="Output file") - parser.add_argument("--input", dest="inp", type=str, default=self._input_dir, help="Input dir") - parser.add_argument("--template", dest="template", type=str, default=self._template_root, - help="Use a different template directory") - parser.add_argument("--title", dest="title", type=str, default=WEBSITE_DEFAULT_TITLE, help="Set a title") - parser.add_argument("--desc", dest="desc", type=str, default=WEBSITE_DEFAULT_DESC, help="Set a description") - parser.add_argument("-r,--reverse", dest="r", default=False, action="store_true", - help="Create output using input files in reverse order") - parser.add_argument("--no-number", dest="nonum", default=False, action="store_true", - help="Do not put numbers in titles") - parser.add_argument("--all-headers-in-toc", dest="allheaders", default=False, action="store_true", - help="Include all levels of headers in ToC and not just level 1 headers") - parser.add_argument("--posts", dest="posts", default=None, type=str, help="Use posts mode.") - parser.add_argument("--md", dest="md", default=False, action="store_true", help="Use .md files instead of .docbox files") - if arguments: - result = parser.parse_args(arguments) - else: - result = parser.parse_args() - return result - - def _use_args(self, result): - self._input_dir = result.inp - self._output_file = result.out - self._minifier_command = MINIFIER_COMMAND.replace("$OUT$", self._output_file) - self._title = html.escape(result.title) - self._desc = html.escape(result.title) - self._template_root = result.template - if result.nonum: - self._num_gen = NullNumGen() - self._template_cell = os.path.join(self._template_root, "cell.html") - self._template_main0 = os.path.join(self._template_root, "main0.html") - self._template_main1 = os.path.join(self._template_root, "main1.html") - self._id_gen.reset() - self._num_gen.reset() - self._use_markdown_files = result.md - - def _convert(self, reversed_=False, all_headers=False): - doc_objects = self._get_docs(reversed_) - HtmlConverter(doc_objects, self._output_file, self._template_cell, - self._template_main0, self._template_main1, - self._minifier_command, self._title, self._desc, all_headers).convert() - - def _convert_posts(self, reversed_=False, all_headers=False, posts: str = "posts"): - doc_objects = self._get_docs(reversed_) - # Limit posts to just 2 sections - for d in doc_objects: - d.limit = 2 - if self._use_markdown_files: - d.read_more = os.path.join(posts, os.path.basename(d.file_path)[5:].replace(".md", ".html")) - else: - d.read_more = os.path.join(posts, os.path.basename(d.file_path)[5:].replace(".docbox", ".html")) - d.read_more = d.read_more.replace("\\", "/") - parent_dir = os.path.dirname(self._output_file) - HtmlConverter(doc_objects, self._output_file, self._template_cell, - self._template_main0, self._template_main1, - self._minifier_command, self._title, self._desc, all_headers).convert() - for d in doc_objects: - d.limit = -1 - target = os.path.join(parent_dir, d.read_more) - self._id_gen.reset() - self._num_gen.reset() - HtmlConverter([d], target, self._template_cell, - self._template_main0, self._template_main1, - MINIFIER_COMMAND.replace("$OUT$", target), - self._title, self._desc, all_headers=True).convert() - - def _get_docs(self, reversed_): - if self._use_markdown_files: - ext = ".md" - else: - ext = ".docbox" - docs = [x for x in os.listdir(self._input_dir) if x.endswith(ext)] - if reversed_: - docs = sorted(docs, key=lambda x: -int(x[:4])) - else: - docs = sorted(docs, key=lambda x: int(x[:4])) - docs = [os.path.join(self._input_dir, x) for x in docs] - doc_objects = [DocBoxFile(x, self._num_gen, self._id_gen, md=self._use_markdown_files) for x in docs] - return doc_objects - - -def conv(arguments=None, root=DOC_BOX_ROOT): - DocBoxApp(root).convert(arguments) - - -if __name__ == '__main__': - conv() diff --git a/docbox_generator/requirements.txt b/docbox_generator/requirements.txt deleted file mode 100644 index c811331..0000000 Binary files a/docbox_generator/requirements.txt and /dev/null differ diff --git a/docs/assets/.keep b/docs/assets/.keep deleted file mode 100644 index c693f13..0000000 --- a/docs/assets/.keep +++ /dev/null @@ -1 +0,0 @@ -keep \ No newline at end of file diff --git a/docs/assets/big-font.min.css b/docs/assets/big-font.min.css deleted file mode 100644 index 409f466..0000000 --- a/docs/assets/big-font.min.css +++ /dev/null @@ -1 +0,0 @@ -body{font-size:1.4vw} \ No newline at end of file diff --git a/docs/assets/large-font.min.css b/docs/assets/large-font.min.css deleted file mode 100644 index d1e1688..0000000 --- a/docs/assets/large-font.min.css +++ /dev/null @@ -1 +0,0 @@ -body{font-size:2vw} \ No newline at end of file diff --git a/docs/assets/medium-font.min.css b/docs/assets/medium-font.min.css deleted file mode 100644 index 409f466..0000000 --- a/docs/assets/medium-font.min.css +++ /dev/null @@ -1 +0,0 @@ -body{font-size:1.4vw} \ No newline at end of file diff --git a/docs/assets/normalize.min.css b/docs/assets/normalize.min.css deleted file mode 100644 index 317bae0..0000000 --- a/docs/assets/normalize.min.css +++ /dev/null @@ -1 +0,0 @@ -/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */html{-webkit-text-size-adjust:100%;line-height:1.15}body{margin:0}main{display:block}h1{font-size:2em;margin:.67em 0}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{border-style:none;padding:0}[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring,button:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:.35em .75em .625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details{display:block}summary{display:list-item}[hidden],template{display:none} \ No newline at end of file diff --git a/docs/assets/printing.min.css b/docs/assets/printing.min.css deleted file mode 100644 index a300b70..0000000 --- a/docs/assets/printing.min.css +++ /dev/null @@ -1 +0,0 @@ -body{font-family:Roboto Mono,monospace!important;margin-left:1em;-webkit-print-color-adjust:exact!important;print-color-adjust:exact!important}#yaksha-logo{display:block;width:100%}#pages-text-toc,.banner-image,button,nav,summary{display:none!important}.table-of-contents{background-color:transparent!important}img,svg{display:table!important;max-width:100%!important}ul{break-inside:avoid!important;display:table}div.boxes:after{content:"Copyright (c) Bhathiya Perera";display:block;font-size:1.3em;text-align:center}.box,.boxes,.container,.content,.note{display:table}.content{break-inside:avoid;page-break-inside:avoid}code{background-color:transparent;border:1px solid transparent;color:#0b5940;font-family:Source Code Pro,monospace!important;font-weight:700}ul{margin-left:1.45em}ul>li{margin-left:.2em}.highlight,pre{background-color:transparent!important;border:2px solid transparent;break-inside:avoid;font-family:Source Code Pro,monospace!important;page-break-inside:avoid}h1{break-before:always;line-height:2.3em!important}h1,h2,h3,h4,h5,h6{font-family:Roboto,monospace!important}h2,h3,h4,h5,h6{break-before:auto;line-height:2.1em!important}table td{break-inside:avoid;page-break-inside:avoid}.note{float:none;margin-left:1em!important}.content,.note{padding:0 .1em;width:calc(100% - 2.5em)}.boxes{width:100%}.table-of-contents{margin-top:-2em;overflow:visible;padding-left:.3em;position:relative;width:100%}.table-of-contents .real-toc{display:table;width:100%}.blue-status,.green-status,.red-status,.yellow-status{break-inside:avoid;display:table;page-break-inside:avoid} \ No newline at end of file diff --git a/docs/assets/script_home.js b/docs/assets/script_home.js deleted file mode 100644 index 0fe8b15..0000000 --- a/docs/assets/script_home.js +++ /dev/null @@ -1,83 +0,0 @@ -'use strict'; -const navBar = document.querySelector('.nav__bar'); - -/////////////////////////////////////////////////////////////////// -// Nav bar - making other links fade when hovering -const navBarHover = function (event) { - if (event.target.classList.contains('nav__bar__link')) { - const currentNavLink = event.target; - const allNavLinks = currentNavLink.closest('.nav__bar').querySelectorAll('.nav__bar__link'); - - allNavLinks.forEach(link => { - if (link !== currentNavLink) link.style.opacity = this; - }); - } -} - -navBar.addEventListener('mouseover', navBarHover.bind(0.5)); -navBar.addEventListener('mouseout', navBarHover.bind(1)); - -/////////////////////////////////////////////////////////////////// -// Implementing sticky navigation bar -const header = document.querySelector('.header'); -const navHeight = navBar.getBoundingClientRect().height; - -const stickyNav = function (entries) { - const [entry] = entries; - // Sticky class must only be added if header is not intersecting with viewport - if (!entry.isIntersecting) navBar.classList.add('sticky'); - else navBar.classList.remove('sticky'); -}; - -const headerObserver = new IntersectionObserver(stickyNav, { - root: null, - threshold: 0, - rootMargin: `-${navHeight}px`, -}); - -headerObserver.observe(header); - -/////////////////////////////////////////////////////////////////// -// Implementing tabbed component - -const tab1 = document.querySelector('.program__tab--1'); -const tab2 = document.querySelector('.program__tab--2'); -const tab3 = document.querySelector('.program__tab--3'); - -const tabContent1 = document.querySelector('.tab__content--1'); -const tabContent2 = document.querySelector('.tab__content--2'); -const tabContent3 = document.querySelector('.tab__content--3'); - -const codeSample1 = document.querySelector('.code__sample--1'); -const codeSample2 = document.querySelector('.code__sample--2'); -const codeSample3 = document.querySelector('.code__sample--3'); - -// When tab 1 is clicked -tab1.addEventListener('click', function () { - tabContent2.style.display = 'None'; - tabContent3.style.display = 'None'; - tabContent1.style.display = 'flex'; - codeSample2.style.display = 'None'; - codeSample3.style.display = 'None'; - codeSample1.style.display = 'flex'; -}); - -// When tab 2 is clicked -tab2.addEventListener('click', function () { - tabContent1.style.display = 'None'; - tabContent3.style.display = 'None'; - tabContent2.style.display = 'flex'; - codeSample1.style.display = 'None'; - codeSample3.style.display = 'None'; - codeSample2.style.display = 'flex'; -}); - -// When tab 3 is clicked -tab3.addEventListener('click', function () { - tabContent1.style.display = 'None'; - tabContent2.style.display = 'None'; - tabContent3.style.display = 'flex'; - codeSample1.style.display = 'None'; - codeSample2.style.display = 'None'; - codeSample3.style.display = 'flex'; -}); \ No newline at end of file diff --git a/docs/assets/small-font.min.css b/docs/assets/small-font.min.css deleted file mode 100644 index e454841..0000000 --- a/docs/assets/small-font.min.css +++ /dev/null @@ -1 +0,0 @@ -body{font-size:.6vw} \ No newline at end of file diff --git a/docs/assets/style.light.min.css b/docs/assets/style.light.min.css deleted file mode 100644 index 4e972f3..0000000 --- a/docs/assets/style.light.min.css +++ /dev/null @@ -1 +0,0 @@ -*{margin:0;padding:0}body{font-family:Roboto Mono,monospace}.toc-item{display:block;margin-bottom:.3em;overflow:hidden;width:calc(100% - 10px)}.toc-item a{text-decoration:none}.timestamp{color:#636363;font-size:.6em}a:link{color:#0b722d}a:visited{color:#33046c}a:hover{color:#00a0c3;font-weight:700}table{border:.1em solid #ccc;border-collapse:collapse;margin:0;padding:0;table-layout:fixed;width:100%}table caption{font-size:.9em;margin:.5em 0 .75em}table tr{background-color:#f8f8f8;border:.1em solid #ddd;padding:.35em}table td:nth-child(odd),table th:nth-child(odd){background-color:#eee}table td,table th{padding:.625em;text-align:center}table th{font-size:.85em;letter-spacing:.1em;text-transform:uppercase}@media screen and (max-width:600px){table{border:0}table caption{font-size:.9em}table thead{clip:rect(0 0 0 0);border:none;height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}table tr{border-bottom:3px solid #ddd;display:block;margin-bottom:.625em}table td{border-bottom:1px solid #ddd;display:block;font-size:.8em;text-align:right}table td:before{content:attr(data-label);float:left;font-weight:700;text-transform:uppercase}table td:last-child{border-bottom:0}}.highlight,h1,h2,h3,h4,h5,h6{color:#064146;font-family:Ubuntu,sans-serif!important;margin-bottom:.5em;margin-top:.5em}h1{font-size:2.3em}h2{font-size:1.9em}h3{font-size:1.8em}h4{font-size:1.7em}h5{font-size:1.6em}h6{font-size:1.5em}.highlight{padding:4px}.button{background-color:#4caf50;border:none;color:#fff;cursor:pointer;display:inline-block;margin:4px 2px;text-align:center;text-decoration:none;transition-duration:.4s}.action-button{background-color:#078f7b;border:2px solid #078f7b;color:#fff}.action-button:hover{background-color:#fff;border:2px solid #078f7b;color:#000}a.read-more{border:1px dashed #144e4a;color:#063632;display:inline-block;font-size:.8em;margin:auto 2px;padding:0 5px;text-decoration:none}a.read-more:hover{background:#3b351b;border:1px dashed #665117;color:#e9b82c}ul{margin-left:2em}ul>li{margin-left:1em}body,html{background-color:#fff;color:#2b2b2b;line-height:1.45em;width:100%}.table-of-contents{bottom:0;font-size:.7em;line-height:1.3em;overflow-y:auto;padding-left:.3em;position:fixed;top:2em;width:20%}.container{height:100%;width:100%}.boxes,.container{display:inline-block}.boxes{float:right;width:80%}.box{overflow-wrap:anywhere;padding:.2em;width:calc(100% - .4em)}.box,.content{display:inline-block}.content{float:left;overflow:wrap;overflow-wrap:anywhere;padding:0 1em;width:calc(70% - 2.5em)}.note{display:inline-block;float:right;font-size:.7em;padding-left:.5em;width:calc(30% - .5em)}.box:after{clear:both;content:"";display:table}code{background:#eee;border:.05em dashed #10423c;margin-top:.6em;padding-left:.1em}.highlight{background-color:#000;border:.1em dashed gray}pre{word-wrap:break-word;white-space:pre-wrap;white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap}hr{border:none;border-top:.1em solid transparent;margin-bottom:1.5em}.center-text{margin-bottom:2em;margin-top:2em;text-align:center}.yellow-status:before{background-color:#ffc182;border:.1em solid #ffb161;border-radius:.7em;box-shadow:0 0 .4em .1em #ffc182;content:" ";display:inline-block;height:.7em;margin-right:1em;width:.7em}.yellow-status{border:.1em solid #7a542c;border-radius:.7em;color:#7a542c;display:inline-block;font-size:.8em;font-weight:700;margin:auto .2em;padding:0 .5em}.green-status:before{background-color:#94e185;border:.1em solid #78d965;border-radius:.7em;box-shadow:0 0 .4em .1em #94e185;content:" ";display:inline-block;height:.7em;margin-right:1em;width:.7em}.green-status{border:.1em solid #48833e;border-radius:.7em;color:#48833e;display:inline-block;font-size:.8em;font-weight:700;margin:auto .2em;padding:0 .5em}.red-status:before{background-color:#c9404d;border:.1em solid #c42c3b;border-radius:.7em;box-shadow:0 0 .4em .1em #c9404d;content:" ";display:inline-block;height:.7em;margin-right:1em;width:.7em}.red-status{border:.1em solid #7a1d27;border-radius:.7em;color:#7a1d27;display:inline-block;font-size:.8em;font-weight:700;margin:auto .2em;padding:0 .5em}.blue-status:before{background-color:#40c4c9;border:.1em solid #2cb7c4;border-radius:.7em;box-shadow:0 0 .4em .1em #40c9c9;content:" ";display:inline-block;height:.7em;margin-right:1em;width:.7em}.blue-status{border:.1em solid #1b727c;border-radius:.7em;color:#1b727c;display:inline-block;font-size:.8em;font-weight:700;margin:auto .2em;padding:0 .5em}@media (max-width:800px){body,html{font-size:1em;line-height:1.2em}.content,.note{padding:0 .1em;width:calc(100% - 2.5em)}.boxes{width:100%}.table-of-contents{background:#defbff;overflow:hidden;padding-left:.3em;position:sticky;top:0;width:100%}.table-of-contents .real-toc{display:none}}.highlight{font-size:.8em}.highlight,pre{font-family:Source Code Pro,monospace!important}pre{line-height:125%}span.linenos,td.linenos .normal{background-color:transparent;color:inherit;padding-left:.5em;padding-right:.5em}span.linenos.special,td.linenos .special{background-color:#ffffc0;color:#000;padding-left:.5em;padding-right:.5em}.highlight .hll{background-color:#ffc}.highlight{background:#f8f8f8}.highlight .c{color:#3d7b7b;font-weight:700}.highlight .k{color:green;font-weight:700}.highlight .o{color:#666}.highlight .ch,.highlight .cm{color:#3d7b7b;font-style:italic}.highlight .cp{color:#9c6500}.highlight .c1,.highlight .cpf,.highlight .cs{color:#3d7b7b;font-weight:700}.highlight .gd{color:#a00000}.highlight .ge{font-style:italic}.highlight .ges{font-weight:700}.highlight .gr{color:#e40000}.highlight .gh{color:navy;font-weight:700}.highlight .gi{color:#008400}.highlight .go{color:#717171}.highlight .gp{color:navy}.highlight .gp,.highlight .gs,.highlight .gu{font-weight:700}.highlight .gu{color:purple}.highlight .gt{color:#04d}.highlight .kc,.highlight .kd,.highlight .kn{color:green;font-weight:700}.highlight .kp{color:green}.highlight .kr{color:green;font-weight:700}.highlight .kt{color:#b00040}.highlight .m{color:#666}.highlight .s{color:#ba2121}.highlight .na{color:#687822}.highlight .nb{color:green}.highlight .nc{color:#00f;font-weight:700}.highlight .no{color:#800}.highlight .nd{color:#a2f}.highlight .ni{color:#717171;font-weight:700}.highlight .ne{color:#cb3f38;font-weight:700}.highlight .nf{color:#00f}.highlight .nl{color:#767600}.highlight .nn{color:#00f;font-weight:700}.highlight .nt{color:green;font-weight:700}.highlight .nv{color:#19177c}.highlight .ow{color:#a2f;font-weight:700}.highlight .w{color:#bbb}.highlight .mb,.highlight .mf,.highlight .mh,.highlight .mi,.highlight .mo{color:#666}.highlight .dl,.highlight .sa,.highlight .sb,.highlight .sc{color:#ba2121}.highlight .sd{color:#ba2121;font-weight:700}.highlight .s2{color:#ba2121}.highlight .se{color:#aa5d1f;font-weight:700}.highlight .sh{color:#ba2121}.highlight .si{color:#a45a77;font-weight:700}.highlight .sx{color:green}.highlight .sr{color:#a45a77}.highlight .s1{color:#ba2121}.highlight .ss{color:#19177c}.highlight .bp{color:green}.highlight .fm{color:#00f}.highlight .vc,.highlight .vg,.highlight .vi,.highlight .vm{color:#19177c}.highlight .il{color:#666}h1{line-height:1.9em}h2,h3,h4,h5,h6{line-height:1.6em}ul{margin-left:1.3em}ul>li{margin-left:.15em} \ No newline at end of file diff --git a/docs/assets/style.min.css b/docs/assets/style.min.css deleted file mode 100644 index e3afed4..0000000 --- a/docs/assets/style.min.css +++ /dev/null @@ -1 +0,0 @@ -*{margin:0;padding:0}body{font-family:Roboto Mono,monospace}.toc-item{display:block;margin-bottom:.3em;overflow:hidden;width:calc(100% - 10px)}.toc-item a{text-decoration:none}.timestamp{color:#98e372;font-size:.6em}a:link{color:#13e15d}a:visited{color:#bb82ff}a:hover{color:#30cef3;font-weight:700}table{border:.1em solid #14ea61;border-collapse:collapse;margin:0;padding:0;table-layout:fixed;width:100%}table caption{font-size:.9em;margin:.5em 0 .75em}table tr{background-color:#1c1a1a;border:.1em solid #14ea61;padding:.35em}table td:nth-child(odd),table th:nth-child(odd){background-color:#3d3939}table td,table th{padding:.625em;text-align:center}table th{font-size:.85em;letter-spacing:.1em;text-transform:uppercase}@media screen and (max-width:600px){table{border:0}table caption{font-size:.9em}table thead{clip:rect(0 0 0 0);border:none;height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}table tr{border-bottom:3px solid #ddd;display:block;margin-bottom:.625em}table td{border-bottom:1px solid #ddd;display:block;font-size:.8em;text-align:right}table td:before{content:attr(data-label);float:left;font-weight:700;text-transform:uppercase}table td:last-child{border-bottom:0}}.highlight,h1,h2,h3,h4,h5,h6{color:#33d0de;font-family:Ubuntu,sans-serif!important;margin-bottom:.5em;margin-top:.5em}h1{font-size:2.3em}h2{font-size:1.9em}h3{font-size:1.8em}h4{font-size:1.7em}h5{font-size:1.6em}h6{font-size:1.5em}.highlight{padding:4px}.button{background-color:#4caf50;border:none;color:#fff;cursor:pointer;display:inline-block;margin:4px 2px;text-align:center;text-decoration:none;transition-duration:.4s}.action-button{background-color:#078f7b;border:2px solid #078f7b;color:#fff}.action-button:hover{background-color:#fff;border:2px solid #078f7b;color:#000}a.read-more{border:1px dashed #144e4a;color:#063632;display:inline-block;font-size:.8em;margin:auto 2px;padding:0 5px;text-decoration:none}a.read-more:hover{background:#3b351b;border:1px dashed #665117;color:#e9b82c}ul{margin-left:2em}ul>li{margin-left:1em}body,html{background-color:#2b2b2b;color:#fff;line-height:1.45em;width:100%}.table-of-contents{bottom:0;font-size:.7em;line-height:1.3em;overflow-y:auto;padding-left:.3em;position:fixed;top:2em;width:20%}.container{height:100%;width:100%}.boxes,.container{display:inline-block}.boxes{float:right;width:80%}.box{overflow-wrap:anywhere;padding:.2em;width:calc(100% - .4em)}.box,.content{display:inline-block}.content{float:left;overflow:wrap;overflow-wrap:anywhere;padding:0 1em;width:calc(70% - 2.5em)}.note{display:inline-block;float:right;font-size:.7em;padding-left:.5em;width:calc(30% - .5em)}.box:after{clear:both;content:"";display:table}code{background:#10423c;border:.05em dashed #eee;margin-top:.6em;padding-left:.1em}.highlight{background-color:#000;border:.1em dashed #1eff00}pre{word-wrap:break-word;white-space:pre-wrap;white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap}hr{border:none;border-top:.1em solid transparent;margin-bottom:1.5em}.center-text{margin-bottom:2em;margin-top:2em;text-align:center}.yellow-status:before{background-color:#ffc182;border:.1em solid #ffb161;border-radius:.7em;box-shadow:0 0 .4em .1em #ffc182;content:" ";display:inline-block;height:.7em;margin-right:1em;width:.7em}.yellow-status{border:.1em solid #ffc182;border-radius:.7em;color:#ffc182;display:inline-block;font-size:.8em;font-weight:700;margin:auto .2em;padding:0 .5em}.green-status:before{background-color:#94e185;border:.1em solid #78d965;border-radius:.7em;box-shadow:0 0 .4em .1em #94e185;content:" ";display:inline-block;height:.7em;margin-right:1em;width:.7em}.green-status{border:.1em solid #94e185;border-radius:.7em;color:#94e185;display:inline-block;font-size:.8em;font-weight:700;margin:auto .2em;padding:0 .5em}.red-status:before{background-color:#c9404d;border:.1em solid #c42c3b;border-radius:.7em;box-shadow:0 0 .4em .1em #c9404d;content:" ";display:inline-block;height:.7em;margin-right:1em;width:.7em}.red-status{border:.1em solid #c9404d;border-radius:.7em;color:#c9404d;display:inline-block;font-size:.8em;font-weight:700;margin:auto .2em;padding:0 .5em}.blue-status:before{background-color:#40c4c9;border:.1em solid #2cb7c4;border-radius:.7em;box-shadow:0 0 .4em .1em #40c9c9;content:" ";display:inline-block;height:.7em;margin-right:1em;width:.7em}.blue-status{border:.1em solid #40c9c9;border-radius:.7em;color:#40c9c9;display:inline-block;font-size:.8em;font-weight:700;margin:auto .2em;padding:0 .5em}@media (max-width:800px){body,html{font-size:1em;line-height:1.2em}.content,.note{padding:0 .1em;width:calc(100% - 2.5em)}.boxes{width:100%}.table-of-contents{background:#defbff;overflow:hidden;padding-left:.3em;position:sticky;top:0;width:100%}.table-of-contents .real-toc{display:none}}.highlight{font-size:.8em}.highlight,pre{font-family:Source Code Pro,monospace!important}pre{line-height:125%}span.linenos,td.linenos .normal{background-color:transparent;color:inherit;padding-left:.5em;padding-right:.5em}span.linenos.special,td.linenos .special{background-color:#ffffc0;color:#000;padding-left:.5em;padding-right:.5em}.highlight .hll{background-color:#00f}.highlight{background:#000;color:#ddd}.highlight .c{color:#0f0}.highlight .err,.highlight .esc,.highlight .g{color:#ddd}.highlight .k{color:red}.highlight .l,.highlight .n,.highlight .o,.highlight .p,.highlight .x{color:#ddd}.highlight .ch,.highlight .cm{color:#0f0}.highlight .cp{color:#e5e5e5}.highlight .c1,.highlight .cpf,.highlight .cs{color:#0f0}.highlight .gd,.highlight .ge,.highlight .ges,.highlight .gh,.highlight .gi,.highlight .go,.highlight .gp,.highlight .gr,.highlight .gs,.highlight .gt,.highlight .gu{color:#ddd}.highlight .kc,.highlight .kd,.highlight .kn,.highlight .kp,.highlight .kr{color:red}.highlight .kt{color:violet}.highlight .ld,.highlight .m{color:#ddd}.highlight .s{color:#87ceeb}.highlight .na,.highlight .nb,.highlight .nc{color:#ddd}.highlight .no{color:#7fffd4}.highlight .nd,.highlight .ne,.highlight .ni{color:#ddd}.highlight .nf{color:#ff0}.highlight .nl,.highlight .nn,.highlight .nt,.highlight .nx,.highlight .py{color:#ddd}.highlight .nv{color:#eedd82}.highlight .mb,.highlight .mf,.highlight .mh,.highlight .mi,.highlight .mo,.highlight .ow,.highlight .pm,.highlight .w{color:#ddd}.highlight .dl,.highlight .s1,.highlight .s2,.highlight .sa,.highlight .sb,.highlight .sc,.highlight .sd,.highlight .se,.highlight .sh,.highlight .si,.highlight .sr,.highlight .ss,.highlight .sx{color:#87ceeb}.highlight .bp{color:#ddd}.highlight .fm{color:#ff0}.highlight .vc,.highlight .vg,.highlight .vi,.highlight .vm{color:#eedd82}.highlight .il{color:#ddd}h1{line-height:1.9em}h2,h3,h4,h5,h6{line-height:1.6em}ul{margin-left:1.3em}ul>li{margin-left:.15em} \ No newline at end of file diff --git a/docs/assets/style_home.min.css b/docs/assets/style_home.min.css deleted file mode 100644 index 14b7bde..0000000 --- a/docs/assets/style_home.min.css +++ /dev/null @@ -1 +0,0 @@ -:root{--color-primary:#9d1631;--color-primary-lighter:#e85e7a;--color-primary-darker:#650d1f;--color-secondary:#f48115;--color-secondary-lighter:#f6ac65;--color-secondary-darker:#834002;--color-tertiary:#151414;--color-tertiary-lighter:#989393;--color-bg-primary:#f6f4f4;--color-bg-secondary:#f8f2f4;--gradient-primary:linear-gradient(to top left,#9d1631,#f5aebc);--gradient-secondary:linear-gradient(to top left,#f48115,#f6ac65)}*{box-sizing:inherit;margin:0;padding:0}html{box-sizing:border-box;font-size:100%}body{background-color:var(--color-bg-primary);color:var(--color-tertiary);font-family:Roboto Mono,Ubuntu,"sans-serif";line-height:1.9}.header{flex-direction:column;height:90vh;padding:.1rem}.header,.nav__bar{align-items:center;display:flex}.nav__bar{height:8rem;justify-content:space-between;margin:0;padding:0 5rem;width:100%;z-index:100}.nav__bar__logo{height:4.6rem}.nav__bar__links{align-items:center;display:flex;gap:2rem;list-style:none}.nav__bar__item{margin-left:4rem}.nav__bar__link{color:inherit;display:block;font-size:1.3rem;text-decoration:none}.nav__bar__link:hover{color:var(--color-primary);text-decoration:underline}.nav__bar.sticky{background-color:var(--color-bg-primary);position:fixed}.header__content{display:flex;flex-direction:row;gap:5rem}.header__content,.header__text{margin-bottom:auto;margin-top:auto}.header__text h1{font-size:2.5rem;line-height:1.45}.header__text h4{font-size:1.2rem;line-height:1.45}.header__text__effect{position:relative}.header__text__effect:after{background-image:var(--gradient-primary);content:"";height:105%;left:0;opacity:.5;position:absolute;transform:scale(1.09) skewX(-25deg);width:102%;z-index:-5}.header__text h4 .header__text__effect:after{background-image:var(--gradient-secondary);opacity:.8}.header__content__img{height:17.15rem;max-width:20rem}.header__icon,.header__text{display:inline-block;vertical-align:middle}.sample__programs{margin:4rem auto 0;max-width:100rem}.programs__tab-container{display:flex;justify-content:center}.program__tab{border:none;border-radius:10rem;cursor:pointer;display:inline-block;font-size:1rem;margin:2rem;padding:1rem 2rem}.program__tab--link-1{background-color:var(--color-primary)}.program__tab--link-1,.program__tab--link-2{color:var(--color-bg-primary);text-decoration:none}.program__tab--link-2{background-color:var(--color-secondary)}.program__tab--link-1:hover{background-color:var(--color-primary-lighter);color:var(--color-tertiary);text-decoration:none}.program__tab--link-2:hover{background-color:var(--color-secondary-lighter);color:var(--color-tertiary);text-decoration:none}.program__tab--1{background-color:var(--color-primary);color:var(--color-bg-primary)}.program__tab--2{background-color:var(--color-secondary);color:var(--color-bg-primary)}.program__tab--3{background-color:var(--color-tertiary);color:var(--color-bg-primary)}.program__tab--1:hover{background-color:var(--color-primary-lighter);color:var(--color-tertiary)}.program__tab--2:hover{background-color:var(--color-secondary-lighter);color:var(--color-tertiary)}.program__tab--3:hover{background-color:var(--color-tertiary-lighter);color:var(--color-tertiary)}.tab__contents{align-items:center;display:flex;flex-direction:column;margin:1rem auto 0;max-width:60rem;padding:2rem}.code__sample--2,.code__sample--3,.tab__content--2,.tab__content--3{display:none}.code__sample{background-color:#f8ece2;font-family:Source Code Pro,monospace!important;font-size:.8rem;margin:0 auto;max-width:60rem;padding:1rem}.green{color:#006400}.blue{color:blue}.purple{color:purple}.brown{color:brown}.section{border-top:1px solid #ddd;height:auto;padding:7rem 3rem}#section--1,#section--3{background-color:var(--color-bg-secondary)}#section--2{background-color:var(--color-bg-primary)}.section h2{color:var(--color-primary);font-size:1rem}.section__content{display:flex;flex-direction:row;gap:50px;justify-content:center;padding-top:26rem}.section__text{margin-bottom:auto;margin-top:auto}.footer{align-items:center;background-color:var(--color-tertiary);display:flex;flex-direction:column;height:auto;padding:7rem 3rem}.footer__links{display:flex;flex-direction:row}.footer__link{color:var(--color-secondary);display:block;font-size:1.3rem;padding:2rem 5rem;text-decoration:none}.footer__link:hover{color:var(--color-bg-primary);text-decoration:underline}.footer__logo{height:8rem;margin:2rem}@media screen and (min-width:7600px){.nav__bar{padding:10rem}.nav__bar__logo{height:18rem}.nav__bar__links{gap:15rem}.nav__bar__link{font-size:6rem}.header__content{gap:60rem}.header__text h1{font-size:8rem}.header__text h4{font-size:5rem}.header__content__img{height:85.72rem;max-width:100rem}.section{padding:25rem}.section h2{font-size:5rem}.section h1{font-size:7rem}.sample__programs{max-width:200rem}.program__tab{font-size:4.5rem;margin:7rem;padding:5rem 10rem}.tab__contents{margin:auto;max-width:200rem}.tab__contents h4{font-size:4.5rem}.tab__contents img{margin:12rem}.code__sample{font-size:4rem;max-width:400rem}.section__content{gap:30rem}.section__text{font-size:4.5rem}.footer{padding:10rem 0}.footer__link{font-size:7rem}.footer__logo{height:24rem;margin:10rem auto 0}}@media screen and (max-width:7599px){.nav__bar{padding:7rem}.nav__bar__logo{height:13rem}.nav__bar__links{gap:7rem}.nav__bar__link{font-size:4rem}.header__content{gap:30rem}.header__text h1{font-size:6rem}.header__text h4{font-size:4rem}.header__content__img{height:68.57rem;max-width:80rem}.section{padding:14rem}.section h2{font-size:4rem}.section h1{font-size:5rem}.sample__programs{max-width:200rem}.program__tab{font-size:4rem;margin:4rem;padding:3rem 6rem}.tab__contents{margin:auto;max-width:200rem}.tab__contents h4{font-size:4rem}.tab__contents img{margin:10rem}.code__sample{font-size:3.5rem;max-width:200rem}.section__content{gap:30rem;padding-top:15rem}.section__text{font-size:4rem}.footer{padding:20rem 0}.footer__link{font-size:5rem}.footer__logo{height:18rem;margin:8rem auto 0}}@media screen and (max-width:5100px){.nav__bar{padding:5rem}.nav__bar__logo{height:9rem}.nav__bar__links{gap:7rem}.nav__bar__link{font-size:3rem}.header__content{gap:30rem}.header__text h1{font-size:4rem}.header__text h4{font-size:2.5rem}.header__content__img{height:42.86rem;max-width:50rem}.section{padding:12rem}.section h2{font-size:2.5rem}.section h1{font-size:3.5rem}.sample__programs{max-width:100rem}.program__tab{font-size:2.5rem;margin:3.5rem;padding:2rem 5rem}.tab__contents{margin:auto;max-width:100rem}.tab__contents h4{font-size:2rem}.tab__contents img{margin:6rem}.code__sample{font-size:2rem;max-width:200rem}.section__content{gap:20rem;padding-top:13rem}.section__text{font-size:2.25rem}.footer{padding:10rem 0}.footer__link{font-size:3.5rem}.footer__logo{height:12rem;margin:8rem auto 0}}@media screen and (max-width:3100px){.nav__bar{padding:1rem}.nav__bar__logo{height:6rem}.nav__bar__links{gap:5rem}.nav__bar__link{font-size:2rem}.header__content{gap:15rem}.header__text h1{font-size:3rem}.header__text h4{font-size:2rem}.header__content__img{height:25.71rem;max-width:30rem}.section{padding:4rem}.section h2{font-size:1.6rem}.section h1{font-size:2.3rem}.sample__programs{max-width:60rem}.program__tab{font-size:2rem;margin:1rem;padding:1rem 3rem}.tab__contents{margin:auto;max-width:60rem}.tab__contents h4{font-size:1.6rem}.tab__contents img{margin:2.5rem}.code__sample{font-size:1.4rem;max-width:60rem}.section__content{gap:10rem;padding-top:6rem}.section__text{font-size:1.4rem}.footer{padding:5rem 0}.footer__link{font-size:2rem}.footer__logo{height:6rem;margin:4rem auto 0}}@media screen and (max-width:2100px){.header,.nav__bar{height:auto}.nav__bar{padding:1rem}.nav__bar__logo{height:3.5rem}.nav__bar__links{gap:1.5rem}.nav__bar__link{font-size:1.2rem}.header__content{margin:10rem auto}.header__text h1{font-size:2rem}.header__text h4{font-size:1rem}.header__content__img{height:15.43rem;max-width:18rem}.section{padding:3rem}.section h2{font-size:1rem}.section h1{font-size:1.3rem}.sample__programs{max-width:80rem}.program__tab{font-size:1rem;margin:.5rem 1rem;padding:1rem 2rem}.tab__contents{margin:auto;max-width:80rem}.tab__contents h4{font-size:1rem}.tab__contents img{margin:1.2rem}.code__sample{font-size:1rem;max-width:60rem}.section__content{gap:5rem;padding-top:2rem}.section__text{font-size:1rem}.footer{padding:2rem 0}.footer__link{font-size:1rem}.footer__logo{height:3rem;margin:2rem auto 0}}@media screen and (max-width:1280px){.nav__bar{flex-direction:column;padding:1rem}.nav__bar__logo{height:4rem}.nav__bar__links{gap:2rem}.nav__bar__link{font-size:1.4rem}.header__content{align-items:center;flex-direction:column;gap:3rem;margin:5rem auto}.header__text h1{font-size:2rem}.header__text h4{font-size:1rem}.header__content__img{height:15.43rem;max-width:18rem}.section{padding:3rem}.section h2{font-size:1rem}.section h1{font-size:1.3rem}.sample__programs{max-width:60rem}.program__tab{font-size:1rem;margin:.5rem;padding:1rem 2rem}.tab__contents{margin:auto;max-width:40rem}.tab__contents h4{font-size:1rem}.tab__contents img{margin:1rem}.code__sample{font-size:1rem;max-width:40rem}.section__content{gap:5rem;padding-top:2rem}.section__text{font-size:1rem}.footer{padding:2rem 0}.footer__link{font-size:1rem}.footer__logo{height:3rem;margin:2rem auto 0}}@media screen and (max-width:750px){.section{margin:1rem 0;padding:4rem 1rem}.section__content{align-items:center;flex-direction:column}.programs__tab-container{margin:1.5rem 0}.sample__programs{margin:0}.tab__contents{padding:0}}@media screen and (max-width:640px){.nav__bar{padding:.25rem}.nav__bar__logo{height:3rem}.nav__bar__links{gap:.5rem}.nav__bar__link{font-size:.9rem}.footer__link{padding:1.5rem}}@media screen and (max-width:510px){.nav__bar__links{gap:0}.nav__bar__item{margin:auto 1rem}.nav__bar__link,.program__tab{font-size:.9rem}.program__tab{padding:1rem .5rem}} \ No newline at end of file diff --git a/docs/blog.html b/docs/blog.html deleted file mode 100644 index 2ed7a17..0000000 --- a/docs/blog.html +++ /dev/null @@ -1 +0,0 @@ -Yaksha Programming Language

New website structure

Created 2023-08-13, Last Updated 2023-09-07
  • Author: Bhathiya Perera

Website

I have been working hard on updating the website infrastructure. New local PDF building feature is going to come in handy for downloadable documentation builds.

Additionally, (b)log section will be used for any updates.

New sr string feature

This is going to help avoid copying and freeing strings by simply referencing these strings. However, note that sr can hold references to both statically allocated string literals and to dynamically allocated strings. Statically allocated strings will also store fixed length of the underlying string.

If you delete an sr it will delete underlying string (except when it is a statically allocated string (literal)).

More features to come!

I have been writing new features I want to add as YAMA articles. Now they are in the same website and can be easily accessed.

CSS

Ha! CSS is hard. Very hard. Perhaps I should have used some prebuilt theme.

Docbox

Now this is moved into the website package itself.

\ No newline at end of file diff --git a/docs/demos.html b/docs/demos.html deleted file mode 100644 index e6d1dae..0000000 --- a/docs/demos.html +++ /dev/null @@ -1,1120 +0,0 @@ -Yaksha Programming Language

Fractal tree implementation

Created 2023-08-13, Last Updated 2023-09-07

Hint: Refresh to get a new random tree

Code
import raylib as rl
-import raylib.utils
-import libs.numbers as num
-import libs.perlin
-import libs.random
-
-
-class State:
-    width: float
-    height: float
-    angle: float
-    frame_count: u64
-    blue: rl.Color
-    green: rl.Color
-    color3: rl.Color
-
-
-def branch(x: float, y: float, length: float, angle: float, s: State) -> None:
-    if length < 4.0f:
-        leaf_width = random.random_betweenf(1.0f, 3.0f)
-        leaf_height = random.random_betweenf(3.0f, 6.0f)
-        lerped_green = utils.lerp_color(s.green, s.blue, utils.remap(x, 0.0f, s.width, 0.0f, 1.0f) * 2.0f)
-        color = utils.lerp_color(lerped_green, s.color3, utils.remap(y, 0.0f, s.height, 0.0f, 1.0f) * 1.5f)
-        rl.draw_ellipse(num.f2i(x), num.f2i(y), leaf_height, leaf_width, color)
-        return
-    wind = utils.sin_deg(perlin.noise1df(num.uu2f(s.frame_count) / 50.0f)) * 100.0f * utils.sin_deg(num.uu2f(s.frame_count) / 2.0f)
-    next_y = y - length * utils.cos_deg(angle)
-    next_x = x + length * utils.sin_deg(angle)
-    thick = utils.remap(length, 0.0f, s.height / 4.0f, 2.0f, 6.0f)
-    rl.draw_line_ex(rl.vector2(x, y), rl.vector2(next_x, next_y), thick, rl.color(152, 50, 1, 255))
-    r1 = random.random_betweenf(0.3f, 0.9f)
-    r2 = random.random_betweenf(0.5f, 0.8f)
-    branch(next_x, next_y, (length * r2), angle + s.angle + wind * 10.0f, s)
-    branch(next_x, next_y, (length * r1), angle - s.angle + wind * 10.0f, s)
-
-
-def update_draw_frame(s: State) -> None:
-    rl.clear_background(rl.color(255, 255, 255, 255))
-    branch(s.width / 2.0f, s.height, s.height / 4.0f, 0.0f, s)
-
-
-def main() -> int:
-    s: State = State()
-    s.angle = random.random_betweenf(30.0f, 45.0f)
-    s.width = 600.0f
-    s.height = 600.0f
-    s.frame_count = 0u64
-    s.blue = rl.color(0, 255, 214, 255)
-    s.green = rl.color(0, 255, 0, 255)
-    s.color3 = rl.color(255, 45, 156, 255)
-    rl.init_window(num.f2i(s.width), num.f2i(s.height), "Fractal Tree in the Wind")
-    rl.set_target_fps(120)
-    seed: u64 = random.init_random()
-    while not rl.window_should_close():
-        rl.begin_drawing()
-        update_draw_frame(s)
-        rl.draw_fps(0, 0)
-        rl.end_drawing()
-        s.frame_count += 1u64
-        random.set_seed(seed)
-    rl.close_window()
-    del s
-    return 0
-
Show demo in a new tab
Show demo inline


Space blast

Created 2023-08-13, Last Updated 2023-09-07

Hint: You need a keyboard to play this

Code
# All assets from https://www.kenney.nl/assets/
-# Code ported to Yaksha based on https://github.com/tashvit/space-blast
-
-import raylib as rl
-import raylib.utils
-import libs.numbers as num
-import libs.perlin
-import libs.random
-
-SCENE_TITLE: Const[u8] = 0u8
-SCENE_PLAY: Const[u8] = 1u8
-SCENE_GAME_OVER: Const[u8] = 2u8
-GAME_W: Const[int] = 1920
-GAME_H: Const[int] = 1080
-STAR_COUNT: Const[int] = 100
-ENEMY_COUNT: Const[int] = 20
-FPS_TARGET: Const[int] = 60
-PLAYER_BULLETS: Const[int] = 10
-ENEMY_BULLET_MAX: Const[int] = 5
-
-@onstack
-class Star:
-    x: int
-    y: int
-    speed: int
-    r: int
-
-@onstack
-class Bullet:
-    x: int
-    y: int
-
-@onstack
-class Enemy:
-    x: int
-    y: int
-    speed: int
-    type: int
-    swing: int
-    bullet: Bullet
-
-class State:
-    frame_count: u64
-    assets: Assets
-    player_x: int
-    player_y: int
-    speed: int
-    stars: Array[Star]
-    enemies: Array[Enemy]
-    scene: u8
-    player_moving: bool
-    player_bullets: Array[Bullet]
-    player_score: int
-
-class Assets:
-    loaded: bool
-    bg: rl.Color
-    white: rl.Color
-    player: rl.Texture2D
-    enemy1: rl.Texture2D
-    enemy2: rl.Texture2D
-    enemy3: rl.Texture2D
-    enemy4: rl.Texture2D
-    enemy5: rl.Texture2D
-    meteor: rl.Texture2D
-    enemy_laser: rl.Texture2D
-    player_laser: rl.Texture2D
-    enemy_laser_sound: rl.Sound
-    player_laser_sound: rl.Sound
-    explosion_sound: rl.Sound
-
-def update_stars(s: State) -> None:
-    for star: Star in s.stars:
-        star.y += star.speed
-        # if we are out of the screen recreate the star
-        if star.y > GAME_H + 10:
-            star.y = -10
-            star.x = rl.get_random_value(0, GAME_W)
-            star.r = rl.get_random_value(1, 4)
-
-def update_player_bullets(s: State, pressed_fire: bool) -> None:
-    to_fire: bool = pressed_fire
-    for bullet: Bullet in s.player_bullets:
-        if bullet.y == -999 and to_fire and s.frame_count % 8u64 == 0u64:
-            bullet.y = s.player_y - 32
-            bullet.x = s.player_x - 32
-            rl.play_sound(s.assets.player_laser_sound)
-            to_fire = False
-        if bullet.y < 0:
-            bullet.y = -999
-            bullet.x = -999
-        if bullet.y != -999:
-            bullet.y -= 10
-
-def update_player(s: State) -> None:
-    w2: int = cast("int", s.assets.player.width) / 2
-    h2: int = cast("int", s.assets.player.height) / 2
-    s.player_moving = False
-    # User pressed a key -> move the player
-    if rl.is_key_down(rl.KEY_W) or rl.is_key_down(rl.KEY_UP):
-        s.player_y -= s.speed
-        s.player_moving = True
-    if rl.is_key_down(rl.KEY_A) or rl.is_key_down(rl.KEY_LEFT):
-        s.player_x -= s.speed
-        s.player_moving = True
-    if rl.is_key_down(rl.KEY_S) or rl.is_key_down(rl.KEY_DOWN):
-        s.player_y += s.speed
-        s.player_moving = True
-    if rl.is_key_down(rl.KEY_D) or rl.is_key_down(rl.KEY_RIGHT):
-        s.player_x += s.speed
-        s.player_moving = True
-    update_player_bullets(s, rl.is_key_down(rl.KEY_SPACE))
-
-    # Ensure that the player width/height is constrained
-    # So we cannot go out of the bounds
-    if s.player_x <= w2:
-        s.player_x = w2
-    if s.player_x >= GAME_W - w2:
-        s.player_x = GAME_W - w2
-    if s.player_y <= h2:
-        s.player_y = h2
-    if s.player_y >= GAME_H - h2:
-        s.player_y = GAME_H - h2
-    # Check collisions with enemies
-    for enemy: Enemy in s.enemies:
-        enemy_collide: bool = collides(get_enemy_ship(s, enemy.type), enemy.x, enemy.y, s.assets.player, s.player_x, s.player_y)
-        bullet_collide: bool = collides(s.assets.enemy_laser, enemy.bullet.x, enemy.bullet.y, s.assets.player, s.player_x, s.player_y)
-        if enemy_collide or bullet_collide:
-            s.scene = SCENE_GAME_OVER
-            rl.play_sound(s.assets.explosion_sound)
-            break
-        for bullet: Bullet in s.player_bullets:
-            enemy_in_fire: bool = collides(get_enemy_ship(s, enemy.type), enemy.x, enemy.y, s.assets.player_laser, bullet.x, bullet.y)
-            bulllets_collide: bool = collides(s.assets.enemy_laser, enemy.bullet.x, enemy.bullet.y, s.assets.player_laser, bullet.x, bullet.y)
-            if bullet.y != -999 and enemy_in_fire:
-                s.player_score += 10
-                enemy.y = GAME_H + 50
-                bullet.y = -999
-                bullet.x = -999
-                rl.play_sound(s.assets.explosion_sound)
-            if bullet.y != -999 and bulllets_collide:
-                enemy.bullet.x = -999
-                enemy.bullet.y = -999
-                bullet.y = -999
-                bullet.x = -999
-
-def update_enemies(s: State) -> None:
-    active_bullets: int = 0
-    for enemy: Enemy in s.enemies:
-        if enemy.bullet.y != -999:
-            active_bullets += 1
-
-    for enemy: Enemy in s.enemies:
-        enemy.y += enemy.speed
-        swing: u64 = cast("u64", enemy.swing) + s.frame_count
-        enemy.x += enemy.speed * iif(swing % 60u64 < 30u64, 1, -1)
-        if enemy.y > GAME_H + 50:
-            enemy.y = -rl.get_random_value(60, 100)
-            enemy.x = rl.get_random_value(0, GAME_W)
-            enemy.type = rl.get_random_value(1, 5)
-            enemy.swing = rl.get_random_value(100, 10000)
-        elif swing % 6u64 == 0u64 and enemy.bullet.y == -999 and enemy.y > 5 and active_bullets < ENEMY_BULLET_MAX:
-            enemy.bullet.x = enemy.x + 32
-            enemy.bullet.y = enemy.y + 32
-            rl.play_sound(s.assets.enemy_laser_sound)
-            active_bullets += 1
-        if enemy.bullet.y > GAME_H + 50:
-            enemy.bullet.x = -999
-            enemy.bullet.y = -999
-            active_bullets -= 1
-        elif enemy.bullet.y != -999:
-            enemy.bullet.y += 6
-
-def draw_stars(s: State) -> None:
-    for star: Star in s.stars:
-        if star.r == 4:
-            draw_image(s.assets.meteor, star.x, star.y)
-        else:
-            rl.draw_circle(star.x, star.y, cast("float", star.r), s.assets.white)
-
-def draw_enemies(s: State) -> None:
-    for enemy: Enemy in s.enemies:
-        draw_image(get_enemy_ship(s, enemy.type), enemy.x, enemy.y)
-        if enemy.bullet.y != -999:
-            draw_image(s.assets.enemy_laser, enemy.bullet.x, enemy.bullet.y)
-
-def draw_player(s: State) -> None:
-    draw_image(s.assets.player, s.player_x, s.player_y)
-    for bullet: Bullet in s.player_bullets:
-        if bullet.y != -999:
-            draw_image(s.assets.player_laser, bullet.x, bullet.y)
-
-def game_step(d: utils.Data) -> None:
-    s: State = cast("State", d)
-    ensure_assets(s)
-    rl.begin_drawing()
-    rl.clear_background(s.assets.bg)
-    # ----------------------------------------------
-    # ----------------------------------------------
-    if s.scene == SCENE_PLAY:
-        update_player(s)
-        update_stars(s)
-        update_enemies(s)
-        if s.frame_count % 60u64 == 0u64:
-            s.player_score += 1
-    draw_stars(s)
-    draw_player(s)
-    draw_enemies(s)
-    if s.scene == SCENE_TITLE:
-        if (s.frame_count / 50u64) % 2u64 == 0u64:
-            rl.draw_text("Press [enter] to start", GAME_W / 2 - 450, GAME_H / 2 - 30, 80, s.assets.white)
-        if rl.is_key_down(rl.KEY_ENTER):
-            s.scene = SCENE_PLAY
-    if s.scene == SCENE_GAME_OVER:
-        if (s.frame_count / 50u64) % 2u64 == 0u64:
-            rl.draw_text("Game over ", GAME_W / 2 - 200, GAME_H / 2 - 30, 80, s.assets.white)
-            rl.draw_text("Press [enter] to start", GAME_W / 2 - 450, GAME_H / 2 + 50, 80, s.assets.white)
-        if rl.is_key_down(rl.KEY_ENTER):
-            s.scene = SCENE_PLAY
-            reset_state(s)
-    # -----------------------------------------------
-    # ----------------------------------------------
-    rl.draw_fps(0, 0)
-    rl.draw_text(num.i2s(s.player_score), GAME_W - 300, 0, 64, rl.color(0, 255, 0, 255))
-    rl.end_drawing()
-    s.frame_count = s.frame_count + 1u64
-
-def init_state() -> State:
-    s: State = State()
-    s.frame_count = 0u64
-    s.assets = Assets()
-    s.assets.loaded = False
-    s.stars = arrnew("Star", STAR_COUNT)
-    s.enemies = arrnew("Enemy", ENEMY_COUNT)
-    s.player_bullets = arrnew("Bullet", PLAYER_BULLETS)
-    random.init_random()
-    reset_state(s)
-    return s
-
-def reset_state(s: State) -> None:
-    s.player_x = GAME_H / 2
-    s.player_y = GAME_W / 2
-    s.speed = 5
-    s.player_score = 0
-
-    for bullet: Bullet in s.player_bullets:
-        bullet.x = -999
-        bullet.y = -999
-
-    for star: Star in s.stars:
-        star.x = rl.get_random_value(0, GAME_W)
-        star.y = rl.get_random_value(0, GAME_H)
-        star.speed = rl.get_random_value(1, 4)
-        star.r = rl.get_random_value(1, 4)
-
-    for enemy: Enemy in s.enemies:
-        enemy.x = rl.get_random_value(0, GAME_W)
-        enemy.y = -rl.get_random_value(60, 100)
-        enemy.speed = rl.get_random_value(1, 5)
-        enemy.type = rl.get_random_value(1, 5)
-        enemy.swing = rl.get_random_value(100, 10000)
-        enemy.bullet.x = -999
-        enemy.bullet.y = -999
-
-def ensure_assets(s: State) -> None:
-    if s.assets.loaded:
-        return
-    s.assets.bg = rl.color(0, 0, 0, 255)
-    s.assets.white = rl.color(255, 255, 255, 255)
-    s.assets.player = load_image("playerShip1_blue.png")
-    s.assets.enemy1 = load_image("shipBeige_manned.png")
-    s.assets.enemy2 = load_image("shipBlue_manned.png")
-    s.assets.enemy3 = load_image("shipPink_manned.png")
-    s.assets.enemy4 = load_image("shipGreen_manned.png")
-    s.assets.enemy5 = load_image("shipYellow_manned.png")
-    s.assets.meteor = load_image("meteorGrey_tiny2.png")
-    s.assets.enemy_laser = load_image("laserRed03.png")
-    s.assets.player_laser = load_image("laserBlue03.png")
-    s.assets.player_laser_sound = load_sound("laserRetro_000.ogg")
-    s.assets.enemy_laser_sound = load_sound("laserRetro_004.ogg")
-    s.assets.explosion_sound = load_sound("explosionCrunch_000.ogg")
-    s.assets.loaded = True
-
-def del_state(current: utils.Data) -> None:
-    s: State = cast("State", current)
-    if s.assets.loaded:
-        rl.unload_texture(s.assets.player)
-        rl.unload_texture(s.assets.enemy1)
-        rl.unload_texture(s.assets.enemy2)
-        rl.unload_texture(s.assets.enemy3)
-        rl.unload_texture(s.assets.enemy4)
-        rl.unload_texture(s.assets.enemy5)
-        rl.unload_texture(s.assets.enemy_laser)
-        rl.unload_texture(s.assets.player_laser)
-        rl.unload_sound(s.assets.player_laser_sound)
-        rl.unload_sound(s.assets.enemy_laser_sound)
-        rl.unload_sound(s.assets.explosion_sound)
-    del s.enemies
-    del s.stars
-    del s.assets
-    del s.player_bullets
-    del s
-
-def main() -> int:
-    s: State = init_state()
-    s.scene = SCENE_TITLE
-    rl.init_window(GAME_W, GAME_H, "Space blast")
-    rl.set_target_fps(60)
-    rl.init_audio_device()
-    while not rl.window_should_close():
-        game_step(cast("utils.Data", s))
-    del_state(cast("utils.Data", s))
-    rl.close_audio_device()
-    rl.close_window()
-    return 0
-
-# ------------ Utilities -----------
-
-def load_image(s: str) -> rl.Texture2D:
-    path: str
-    path = "assets/img/" + s
-    return rl.load_texture(path)
-
-def load_sound(s: str) -> rl.Sound:
-    path: str
-    path = "assets/audio/" + s
-    return rl.load_sound(path)
-
-def draw_image(img: rl.Texture2D, x: int, y: int) -> None:
-    w: int = cast("int", img.width)
-    h: int = cast("int", img.height)
-    rl.draw_texture(img, x - w / 2, y - h / 2, rl.color(255, 255, 255, 255))
-
-def rectangle(img: rl.Texture2D, x: int, y: int) -> rl.Rectangle:
-    w: int = cast("int", img.width) - 2
-    h: int = cast("int", img.height) - 2
-    actual_x: float = cast("float", x - w / 2) + 1.0f
-    actual_y: float = cast("float", y - h / 2) + 1.0f
-    return rl.rectangle(actual_x, actual_y, cast("float", w), cast("float", h))
-
-def collides(img1: rl.Texture2D, x1: int, y1: int, img2: rl.Texture2D, x2: int, y2: int) -> bool:
-    return rl.check_collision_recs(rectangle(img1, x1, y1), rectangle(img2, x2, y2))
-
-def get_enemy_ship(s: State, asset: int) -> rl.Texture2D:
-    enemy: rl.Texture2D
-    if asset == 1:
-        enemy = s.assets.enemy1
-    if asset == 2:
-        enemy = s.assets.enemy2
-    if asset == 3:
-        enemy = s.assets.enemy3
-    if asset == 4:
-        enemy = s.assets.enemy4
-    if asset == 5:
-        enemy = s.assets.enemy5
-    return enemy
-
Show demo in a new tab
Show demo inline


GUI Demo

Created 2023-08-13, Last Updated 2023-09-07

Try pressing the counter buttons below

Code
import raylib as rl
-import raylib.utils
-import raylib.gui
-import libs.numbers as num
-
-def main() -> int:
-    width = 200
-    height = 160
-    counter1 = 0
-    counter2 = 0
-    rl.init_window(width, height, "Counter")
-    rl.set_target_fps(120)
-    while not rl.window_should_close():
-        rl.begin_drawing()
-        rl.clear_background(rl.color(255, 255, 255, 255))
-        gui.gui_panel(rl.rectangle(10.0f, 10.0f, num.i2f(width) - 20.0f, num.i2f(height) - 20.0f), "<Counter>")
-        widget_width = num.i2f(width) - 40.0f
-        # Counter 1
-        gui.gui_label(rl.rectangle(20.0f, 40.0f, widget_width, 20.0f), "Count:" + num.i2s(counter1))
-        if gui.gui_button(rl.rectangle(20.0f, 60.0f, widget_width, 20.0f), "Count"):
-            counter1 = counter1 + 1
-        # Counter 2
-        gui.gui_label(rl.rectangle(20.0f, 80.0f, widget_width, 20.0f), "Count:" + num.i2s(counter2))
-        if gui.gui_button(rl.rectangle(20.0f, 100.0f, widget_width, 20.0f), "Count"):
-            counter2 = counter2 + 1
-        # Asciimoji status bar
-        animation = (counter1 + counter2) % 3
-        if animation == 1:
-            gui.gui_status_bar(rl.rectangle(10.0f, num.i2f(height) - 30.0f, num.i2f(width) - 20.0f, 20.0f), " \\- (- _ -) -/")
-        else:
-            gui.gui_status_bar(rl.rectangle(10.0f, num.i2f(height) - 30.0f, num.i2f(width) - 20.0f, 20.0f), " \\- (o _ o) -/")
-        rl.draw_fps(20, 540)
-        rl.end_drawing()
-    rl.close_window()
-    return 0
-
Show demo in a new tab
Show demo inline


WASM4 Demo - notes

Created 2023-08-13, Last Updated 2023-09-07

Hint: Something like Nokia ringtone maker for WASM4

Code
# =========================================================================================
-#        ________________________________
-#       /    o   oooo ooo oooo   o o o  /\
-#      /    oo  ooo  oo  oooo   o o o  / /
-#     /    _________________________  / /
-#    / // / // /// // /// // /// / / / /
-#   /___ //////////////////////////_/ /
-#   \____\________________________\_\/
-#
-#  **notes**: Application by -- Bhathiya Perera --
-#        For WASM4 Fantasy Console
-#
-# =========================================================================================
-# ASCII ART by Forrest Cook -- reference https://asciiart.website/index.php?art=music/pianos
-# Note Frequencies          -- reference https://pages.mtu.edu/~suits/notefreqs.html
-# Nokia composer web app    -- reference https://zserge.com/nokia-composer/h/
-# =========================================================================================
-# Nokia Tune:
-# 3e3 3d3 2f#2 2g#2 3c#3 3b2 2d2 2e2 3b2 3a2 2c#2 2e2 1a2 1R
-# =========================================================================================
-import w4
-import libs.numbers as num
-import libs.perlin
-import libs.random
-import libs.c as mini_clib
-
-# Total notes allowed
-MAX_NOTES       :Const[int] = 256
-FONT_WIDTH      :Const[int] = 8
-NOTE_WRAP_AROUND:Const[int] = 55
-# ======= Notes ===========
-NOTE_C:   Const[u8] = 1u8
-NOTE_C_S: Const[u8] = 2u8
-NOTE_D:   Const[u8] = 3u8
-NOTE_D_S: Const[u8] = 4u8
-NOTE_E:   Const[u8] = 5u8
-NOTE_F:   Const[u8] = 6u8
-NOTE_F_S: Const[u8] = 7u8
-NOTE_G:   Const[u8] = 8u8
-NOTE_G_S: Const[u8] = 9u8
-NOTE_A:   Const[u8] = 10u8
-NOTE_A_S: Const[u8] = 11u8
-NOTE_B:   Const[u8] = 12u8
-NOTE_REST:Const[u8] = 13u8
-# Play until we find this
-NOTE_NULL:Const[u8] = 0u8
-
-# ======= Notes Time ======
-# 1/pow(2, TIME)
-TIME_64:  Const[u8] = 6u8
-TIME_32:  Const[u8] = 5u8
-TIME_16:  Const[u8] = 4u8
-TIME_8:   Const[u8] = 3u8
-TIME_4:   Const[u8] = 2u8
-TIME_HALF:Const[u8] = 1u8
-TIME_FULL:Const[u8] = 0u8
-
-# ====Note Octaves ========
-OCTAVE_1 :Const[u8] = 0u8
-OCTAVE_2 :Const[u8] = 1u8
-OCTAVE_3 :Const[u8] = 2u8
-
-# == Editing Modes ========
-MODE_TIME:Const[u8] = 0u8
-MODE_NOTE:Const[u8] = 1u8
-MODE_OCT :Const[u8] = 2u8
-MODE_DEL :Const[u8] = 3u8
-# max, min mode
-TOTAL_MODES :Const[u8] = 4u8
-
-
-class State:
-    width: int
-    height: int
-    frame_count: u64
-    gamepad_prev: u8
-    text_buf: Array[u8]
-    # Tuple [u8 - time, u8 - note, u8 - octave, u8 - extra]
-    note_buf: Array[Tuple[u8,u8,u8,u8]]
-    note_freq: Array[int]
-    note_time: Array[int]
-    # Cursor position
-    cursor: int
-    prev_cursor: int
-    v_start: int
-    v_end: int
-    note_count: int
-    mode: u8
-    playing: bool
-    play_on: u64
-
-def clear_buf(target: Array[u8]) -> None:
-    target[0] = 0u8
-    target[1] = 0u8
-    target[2] = 0u8
-    target[3] = 0u8
-    target[4] = 0u8
-    target[5] = 0u8
-    target[6] = 0u8
-    target[7] = 0u8
-    target[8] = 0u8
-    target[9] = 0u8
-    target[10] = 0u8
-
-def i2s(x: int, target: Array[u8]) -> bool:
-    # Convert given integer to a string
-    # Support up to 10 character output (size 11 buffer is required)
-    charset: Ptr[Const[u8]] = binarydata("0123456789- \0")
-    clear_buf(target)
-    pos: int = 0
-    y: int = x
-    if x > 9999999999 or x < -999999999:
-        target[0] = cast("u8", charat(cast("str", charset), 10))
-        return False
-    if x < 0:
-        y *= -1
-        target[pos] = cast("u8", charat(cast("str", charset), 10))
-    else:
-        target[pos] = cast("u8", charat(cast("str", charset), 11))
-    pos += 1
-    if y == 0:
-        target[pos] = cast("u8", charat(cast("str", charset), 0))
-        pos += 1
-    while y != 0:
-        character: int = y % 10
-        target[pos] = cast("u8", charat(cast("str", charset), character))
-        pos += 1
-        y /= 10
-    # Reverse from 1 to pos
-    rpos: int = 1
-    rmax: int = (pos / 2) + 1
-    while rpos < rmax:
-        temp: u8 = target[rpos]
-        target[rpos] = target[pos - rpos]
-        target[pos - rpos] = temp
-        rpos += 1
-    return True
-
-def del_note(s: State) -> None:
-    if s.note_count == 0:
-        return
-    x: int = s.cursor + 1
-    last: int = s.note_count - 1
-    while x <= last:
-        s.note_buf[x - 1][0] = s.note_buf[x][0]
-        s.note_buf[x - 1][1] = s.note_buf[x][1]
-        s.note_buf[x - 1][2] = s.note_buf[x][2]
-        s.note_buf[x - 1][3] = s.note_buf[x][3]
-        x += 1
-    s.note_buf[last][0] = NOTE_NULL
-    s.note_buf[last][1] = NOTE_NULL
-    s.note_buf[last][2] = NOTE_NULL
-    s.note_buf[last][3] = NOTE_NULL
-    s.note_count -= 1
-    if s.cursor >= s.note_count:
-        s.cursor = s.note_count - 1
-    if s.cursor < 0:
-        s.cursor = 0
-
-def add_left(s: State) -> None:
-    # We are full
-    if s.note_count == MAX_NOTES:
-        return
-    if s.note_count == 0:
-        s.note_buf[0][0] = TIME_4
-        s.note_buf[0][1] = NOTE_C
-        s.note_buf[0][2] = OCTAVE_2
-        s.note_buf[0][3] = 0u8
-        s.note_count = 1
-        s.cursor = 0
-        return
-    # Add at cursor location + 1
-    # Move everything from right most to + 1 position
-    x: int = s.note_count - 1
-    while x >= s.cursor:
-        s.note_buf[x + 1][0] = s.note_buf[x][0]
-        s.note_buf[x + 1][1] = s.note_buf[x][1]
-        s.note_buf[x + 1][2] = s.note_buf[x][2]
-        s.note_buf[x + 1][3] = s.note_buf[x][3]
-        x -= 1
-    s.note_buf[s.cursor][0] = TIME_4
-    # Alternatively add note c and note rest
-    if s.note_count % 2 != 0:
-        s.note_buf[s.cursor][1] = NOTE_C
-    else:
-        s.note_buf[s.cursor][1] = NOTE_REST
-    s.note_buf[s.cursor][2] = OCTAVE_2
-    s.note_buf[s.cursor][3] = 0u8
-    s.note_count += 1
-
-def add_right(s: State) -> None:
-    # We are full
-    if s.note_count == MAX_NOTES:
-        return
-    if s.note_count == 0:
-        s.note_buf[0][0] = TIME_4
-        s.note_buf[0][1] = NOTE_C
-        s.note_buf[0][2] = OCTAVE_2
-        s.note_buf[0][3] = 0u8
-        s.note_count = 1
-        s.cursor = 0
-        return
-    # Add at cursor location + 1
-    # Move everything from right most to + 1 position
-    x: int = s.note_count - 1
-    while x >= s.cursor + 1:
-        s.note_buf[x + 1][0] = s.note_buf[x][0]
-        s.note_buf[x + 1][1] = s.note_buf[x][1]
-        s.note_buf[x + 1][2] = s.note_buf[x][2]
-        s.note_buf[x + 1][3] = s.note_buf[x][3]
-        x -= 1
-    s.note_buf[s.cursor + 1][0] = TIME_4
-    # Alternatively add note c and note rest
-    if s.note_count % 2 != 0:
-        s.note_buf[s.cursor + 1][1] = NOTE_C
-    else:
-        s.note_buf[s.cursor + 1][1] = NOTE_REST
-    s.note_buf[s.cursor + 1][2] = OCTAVE_2
-    s.note_buf[s.cursor + 1][3] = 0u8
-    s.note_count += 1
-    s.cursor += 1
-
-def up_note(s: State) -> None:
-    if s.note_count == 0:
-        return
-    if s.mode == MODE_TIME:
-        s.note_buf[s.cursor][0] += 1u8
-        if s.note_buf[s.cursor][0] > TIME_64:
-            s.note_buf[s.cursor][0] = TIME_FULL
-    if s.mode == MODE_NOTE:
-        s.note_buf[s.cursor][1] += 1u8
-        if s.note_buf[s.cursor][1] > NOTE_REST:
-            s.note_buf[s.cursor][1] = NOTE_C
-    if s.mode == MODE_OCT:
-        s.note_buf[s.cursor][2] += 1u8
-        if s.note_buf[s.cursor][2] > OCTAVE_3:
-            s.note_buf[s.cursor][2] = OCTAVE_1
-
-def down_note(s: State) -> None:
-    if s.note_count == 0:
-        return
-    if s.mode == MODE_TIME:
-        if s.note_buf[s.cursor][0] == TIME_FULL:
-            s.note_buf[s.cursor][0] = TIME_64
-        else:
-            s.note_buf[s.cursor][0] -= 1u8
-    if s.mode == MODE_NOTE:
-        if s.note_buf[s.cursor][1] == NOTE_C:
-            s.note_buf[s.cursor][1] = NOTE_REST
-        else:
-            s.note_buf[s.cursor][1] -= 1u8
-    if s.mode == MODE_OCT:
-        if s.note_buf[s.cursor][2] == OCTAVE_1:
-            s.note_buf[s.cursor][2] = OCTAVE_3
-        else:
-            s.note_buf[s.cursor][2] -= 1u8
-
-def handle_input(s: State) -> None:
-    just_pressed: u8 = w4.gamepad1() & (w4.gamepad1() ^ s.gamepad_prev)
-    if just_pressed & w4.BUTTON_2 != 0u8:
-        if s.playing:
-            # Stop
-            s.playing = False
-            s.cursor = s.prev_cursor
-            s.mode = MODE_NOTE
-        elif w4.gamepad1() & w4.BUTTON_1 != 0u8:
-            # Play
-            if s.note_count == 0:
-                return
-            s.prev_cursor = s.cursor
-            s.cursor = 0
-            s.playing = True
-        elif s.mode == MODE_DEL:
-            # Delete
-            del_note(s)
-        elif s.mode == MODE_OCT:
-            # Add left
-            add_left(s)
-        else:
-            add_right(s)
-    # Only if we are not playing
-    if not s.playing:
-        if just_pressed & w4.BUTTON_1 != 0u8:
-            s.mode += 1u8
-            s.mode %= TOTAL_MODES
-        if just_pressed & w4.BUTTON_UP != 0u8:
-            up_note(s)
-        if just_pressed & w4.BUTTON_DOWN != 0u8:
-            down_note(s)
-        if just_pressed & w4.BUTTON_LEFT != 0u8:
-            s.cursor -= 1
-            # Wrap around
-            if s.cursor < 0:
-                s.cursor = s.note_count - 1
-        if just_pressed & w4.BUTTON_RIGHT != 0u8:
-            s.cursor += 1
-            # Wrap around
-            if s.cursor > s.note_count - 1:
-                s.cursor = 0
-    s.gamepad_prev = w4.gamepad1()
-
-def draw_board(s: State) -> None:
-    w4.set_draw_colors(0x0014u16)
-    w4.text_u8(binarydata("mode:\0"), 2, 2)
-    i2s(s.note_count, s.text_buf)
-    w4.text_u8(cast("Ptr[Const[u8]]", s.text_buf), 120, 2)
-    w4.vline(118, 0, 10u32)
-    w4.vline(79, 0, 10u32)
-    w4.set_draw_colors(0x0012u16)
-    if s.note_count == 0:
-        i2s(0, s.text_buf)
-    else:
-        i2s(s.cursor + 1, s.text_buf)
-    w4.text_u8(cast("Ptr[Const[u8]]", s.text_buf), 80, 2)
-    w4.hline(0, 10, 160u32)
-    w4.hline(0, s.height - 10, 160u32)
-    if s.playing:
-        w4.text_u8(binarydata("play\0"), 44, 2)
-        w4.text_u8(binarydata("stop\0"), 55, s.height - 10 + 2)
-    elif s.mode == MODE_TIME:
-        w4.text_u8(binarydata("time\0"), 44, 2)
-        w4.text_u8(binarydata("add\x85\0"), 55, s.height - 10 + 2)
-    elif s.mode == MODE_NOTE:
-        w4.text_u8(binarydata("note\0"), 44, 2)
-        w4.text_u8(binarydata("add\x85\0"), 55, s.height - 10 + 2)
-    elif s.mode == MODE_OCT:
-        w4.text_u8(binarydata("octa\0"), 44, 2)
-        w4.text_u8(binarydata("add\x84\0"), 55, s.height - 10 + 2)
-    elif s.mode == MODE_DEL:
-        w4.set_draw_colors(0x0013u16)
-        w4.text_u8(binarydata("del \0"), 44, 2)
-        w4.text_u8(binarydata("del \0"), 55, s.height - 10 + 2)
-    w4.set_draw_colors(0x0014u16)
-    if not s.playing:
-        w4.text_u8(binarydata("\x80\0"), 2, s.height - 10 + 2)
-    w4.text_u8(binarydata("\x81\0"), 45, s.height - 10 + 2)
-    if not s.playing:
-        w4.text_u8(binarydata("\x80+\x81\0"), 88, s.height - 10 + 2)
-        w4.set_draw_colors(0x0012u16)
-        w4.text_u8(binarydata("mode\0"), 12, s.height - 10 + 2)
-    if not s.playing:
-        w4.text_u8(binarydata("play\0"), 114, s.height - 10 + 2)
-
-def draw_note(s: State, grid_pos: int, note_pos: int, cursor: bool) -> None:
-    note_data: Array[u8] = cast("Array[u8]", binarydata("cdefgabR#0"))
-    # Do not draw empty notes
-    if s.note_buf[note_pos][1] == NOTE_NULL:
-        return
-    x: int = 4 + (grid_pos % 4) * 40
-    y: int = 12 + (grid_pos / 4) * 10
-    x_delta: int = 0
-    clear_buf(s.text_buf)
-    # Put the time indicator to the buffer
-    s.text_buf[0] = note_data[9] + s.note_buf[note_pos][0]
-    if cursor:
-        w4.set_draw_colors(0x0042u16)
-    else:
-        w4.set_draw_colors(0x0012u16)
-    w4.text_u8(cast("Ptr[Const[u8]]", s.text_buf), x + x_delta, y)
-    x_delta += FONT_WIDTH
-    # Put note indicator
-    note: u8 = s.note_buf[note_pos][1]
-    if note == NOTE_C or note == NOTE_C_S:
-        s.text_buf[0] = note_data[0]
-    if note == NOTE_D or note == NOTE_D_S:
-        s.text_buf[0] = note_data[1]
-    if note == NOTE_E:
-        s.text_buf[0] = note_data[2]
-    if note == NOTE_F or note == NOTE_F_S:
-        s.text_buf[0] = note_data[3]
-    if note == NOTE_G or note == NOTE_G_S:
-        s.text_buf[0] = note_data[4]
-    if note == NOTE_A or note == NOTE_A_S:
-        s.text_buf[0] = note_data[5]
-    if note == NOTE_B:
-        s.text_buf[0] = note_data[6]
-    if note == NOTE_REST:
-        s.text_buf[0] = note_data[7]
-    elif note == NOTE_C_S or note == NOTE_D_S or note == NOTE_F_S or note == NOTE_G_S or note == NOTE_A_S:
-        s.text_buf[1] = note_data[8]
-    if cursor:
-        w4.set_draw_colors(0x0043u16)
-    else:
-        w4.set_draw_colors(0x0013u16)
-    w4.text_u8(cast("Ptr[Const[u8]]", s.text_buf), x + x_delta, y)
-    x_delta += FONT_WIDTH
-    if s.text_buf[1] != 0u8:
-        # handle '#' sign
-        x_delta += FONT_WIDTH
-    s.text_buf[1] = 0u8
-    # Put octave indicator
-    if note != NOTE_REST:
-        s.text_buf[0] = note_data[9] + 1u8 + s.note_buf[note_pos][2]
-        if cursor:
-            w4.set_draw_colors(0x0041u16)
-        else:
-            w4.set_draw_colors(0x0014u16)
-        w4.text_u8(cast("Ptr[Const[u8]]", s.text_buf), x + x_delta, y)
-
-def draw_notes(s: State) -> None:
-    # Nothing to draw
-    if s.note_count == 0:
-        return
-    if s.cursor < s.v_start:
-        # moved left
-        s.v_start = s.cursor
-        s.v_end = s.v_start + NOTE_WRAP_AROUND
-    elif s.cursor > s.v_end:
-        # moved right
-        s.v_end = s.cursor
-        s.v_start = s.v_end - NOTE_WRAP_AROUND
-    else:
-        s.v_end = s.v_start + NOTE_WRAP_AROUND
-    if s.v_start < 0:
-        s.v_start = 0
-    if s.v_end > s.note_count - 1:
-        s.v_end = s.note_count - 1
-    x: int = s.v_start
-    grid_pos: int  = 0
-    while x < s.note_count and x <= s.v_end:
-        current: bool = x == s.cursor
-        # Show current playing in playing mode
-        if s.playing:
-            prev: int = x - 1
-            if prev < 0:
-                prev = s.note_count - 1
-            current = prev == s.cursor
-        draw_note(s, grid_pos, x, current)
-        x += 1
-        grid_pos += 1
-
-def play_notes(s: State) -> None:
-    if not s.playing:
-        return
-    # Play the next note on nth frame
-    if s.play_on > s.frame_count:
-        return
-    time: u8 = s.note_buf[s.cursor][0]
-    note: u8 = s.note_buf[s.cursor][1]
-    octv: u8 = s.note_buf[s.cursor][2]
-    actual_note: u8 = octv * 12u8 + note
-    note_time: u32 = cast("u32", s.note_time[time])
-    s.play_on = s.frame_count + cast("u64", note_time)
-    if note != NOTE_REST:
-        note_freq: u32 = cast("u32", s.note_freq[actual_note])
-        w4.tone(note_freq, note_time, 50u32, 0u32)
-    s.cursor += 1
-    if s.cursor > s.note_count - 1:
-        s.cursor = 0
-
-def game_step(d: AnyPtr) -> None:
-    s: State = cast("State", d)
-    s.frame_count += 1u64
-    handle_input(s)
-    draw_board(s)
-    draw_notes(s)
-    play_notes(s)
-
-def init_state() -> State:
-    s: State = State()
-    s.width = 160
-    s.height = 160
-    s.frame_count = 0u64
-    s.play_on = 0u64
-    s.gamepad_prev = 0u8
-    s.cursor = 0
-    s.note_count = 0
-    s.v_start = 0
-    s.v_end = 0
-    s.mode = MODE_NOTE
-    s.playing = False
-    s.note_freq = array("int",0,262,277,294,311,330,349,370,392,415,440,466,495,523,554,587,622,659,698,740,784,830,880,932,988,1047,1109,1175,1245,1319,1397,1480,1568,1661,1760,1865,1976)
-    s.note_time = array("int",60,30,15,8,4,2,1)
-    # 11 character buffer for writing stuff
-    s.text_buf = cast("Array[u8]", mini_clib.calloc(cast("mini_clib.Size", 1), cast("mini_clib.Size", 11)))
-    # Set total number of notes to max notes
-    arrsetlen(s.note_buf, MAX_NOTES)
-    # Mark it all as null
-    x: int = 0
-    while x < MAX_NOTES:
-        s.note_buf[x][0] = NOTE_NULL
-        s.note_buf[x][1] = NOTE_NULL
-        s.note_buf[x][2] = NOTE_NULL
-        s.note_buf[x][3] = NOTE_NULL
-        x += 1
-    return s
-
-def del_state(current: AnyPtr) -> None:
-    del current
-
-def main() -> int:
-    # based on palette
-    # https://lospec.com/palette-list/sweet-28
-    # https://lospec.com/palette-list/bread-berry
-    w4.set_palette(0xfff678u32, 0x1fa4bfu32, 0xda4fbcu32, 0x1b1b5cu32)
-    s: State = init_state()
-    w4.set_game_state(cast("AnyPtr", s))
-    return 0
-
Show demo in a new tab
Show demo inline


WASM4 Demo - snake

Created 2023-08-13, Last Updated 2023-09-07

Hint: Snake game in Yaksha for WASM4 (ported)

Code
import w4
-import libs.random
-
-class Point:
-    # Point (x, y)
-    x: i16
-    y: i16
-
-class Snake:
-    # Snake's body and direction
-    body: Array[Point]
-    direction: Point
-
-class State:
-    # Game state
-    snake: Snake
-    fruit_sprite: Ptr[Const[u8]]
-    fruit: Point
-    frame_count: u32
-    gamepad_prev: u8
-
-def point(x: i16, y: i16) -> Point:
-    my_point: Point = Point()
-    my_point.x = x
-    my_point.y = y
-    return my_point
-
-def set_random_point(p: Point) -> Point:
-    x: i16 = cast("i16", random.random_u64() % 20u64)
-    y: i16 = cast("i16", random.random_u64() % 20u64)
-    p.x = x
-    p.y = y
-
-def random_point() -> Point:
-    p: Point = Point()
-    return set_random_point(p)
-
-def draw_snake(snake: Snake) -> None:
-    # Body
-    w4.set_draw_colors(0x0043u16)
-    i: int = 0
-    while i < len(snake.body):
-        body_part: Point = snake.body[i]
-        x: int = cast("int", body_part.x * 8i16)
-        y: int = cast("int", body_part.y * 8i16)
-        w4.rect(x, y, 8u32, 8u32)
-        i += 1
-    # Head
-    w4.set_draw_colors(0x0004u16)
-    body_part: Point = snake.body[0]
-    x: int = cast("int", body_part.x * 8i16)
-    y: int = cast("int", body_part.y * 8i16)
-    w4.rect(x, y, 8u32, 8u32)
-
-def snake_push(snake: Snake, p: Point) -> None:
-    arrput(snake.body, p)
-
-def snake_update(snake: Snake) -> None:
-    # Move snake a level up
-    position: int = len(snake.body) - 1
-    while position > 0:
-        snake.body[position].x = snake.body[position - 1].x
-        snake.body[position].y = snake.body[position - 1].y
-        position -= 1
-    snake.body[0].x = (snake.body[0].x + snake.direction.x) % 20i16
-    snake.body[0].y = (snake.body[0].y + snake.direction.y) % 20i16
-    if snake.body[0].x < 0i16:
-        snake.body[0].x = 19i16
-    if snake.body[0].y < 0i16:
-        snake.body[0].y = 19i16
-
-def snake_up(snake: Snake) -> None:
-    if snake.direction.y == 0i16:
-        snake.direction.x = 0i16
-        snake.direction.y = -1i16
-
-def snake_down(snake: Snake) -> None:
-    if snake.direction.y == 0i16:
-        snake.direction.x = 0i16
-        snake.direction.y = 1i16
-
-def snake_left(snake: Snake) -> None:
-    if snake.direction.x == 0i16:
-        snake.direction.x = -1i16
-        snake.direction.y = 0i16
-
-def snake_right(snake: Snake) -> None:
-    if snake.direction.x == 0i16:
-        snake.direction.x = 1i16
-        snake.direction.y = 0i16
-
-def snake_isdead(snake: Snake) -> bool:
-    part: int = 1
-    while part < len(snake.body):
-        if snake.body[part].x == snake.body[0].x and snake.body[part].y == snake.body[0].y:
-            return True
-        part += 1
-    return False
-
-def del_point(p: Point, ignored: int) -> bool:
-    del p
-    return True
-
-def snake_reset(snake: Snake) -> None:
-    foreach(snake.body, del_point, 0)
-    del snake.body
-    body: Array[Point]
-    arrput(body, point(2i16, 0i16))
-    arrput(body, point(1i16, 0i16))
-    arrput(body, point(0i16, 0i16))
-    snake.body = body
-    snake.direction.x = 1i16
-    snake.direction.y = 0i16
-
-def handle_input(state: State) -> None:
-    just_pressed: u8 = w4.gamepad1() & (w4.gamepad1() ^ state.gamepad_prev)
-    if just_pressed & w4.BUTTON_UP != 0u8:
-        snake_up(state.snake)
-    if just_pressed & w4.BUTTON_DOWN != 0u8:
-        snake_down(state.snake)
-    if just_pressed & w4.BUTTON_LEFT != 0u8:
-        snake_left(state.snake)
-    if just_pressed & w4.BUTTON_RIGHT != 0u8:
-        snake_right(state.snake)
-    state.gamepad_prev = w4.gamepad1()
-
-def game_step(data: AnyPtr) -> None:
-    state: State = cast("State", data)
-    state.frame_count += 1u32
-    random.set_seed(cast("u64", state.frame_count))
-    x: int = 8 * cast("int", state.fruit.x)
-    y: int = 8 * cast("int", state.fruit.y)
-
-    handle_input(state)
-    if state.frame_count % 15u32 == 0u32:
-        snake_update(state.snake)
-        if snake_isdead(state.snake):
-            snake_reset(state.snake)
-            state.fruit = set_random_point(state.fruit)
-        # Ate fruit
-        if state.snake.body[0].x == state.fruit.x and state.snake.body[0].y == state.fruit.y:
-            penultimate: int = len(state.snake.body) - 1
-            snake_push(state.snake, point(state.snake.body[penultimate].x, state.snake.body[penultimate].y))
-            state.fruit = set_random_point(state.fruit)
-
-    draw_snake(state.snake)
-    # Draw sprite
-    w4.set_draw_colors(0x4320u16)
-    w4.blit(state.fruit_sprite, x, y, 8u32, 8u32, w4.BLIT_2BPP)
-
-def main() -> int:
-    random.set_seed(0x20u64)
-    w4.set_palette(0xfbf7f3u32, 0xe5b083u32, 0x426e5du32, 0x20283du32)
-    state: State = State()
-    state.snake = Snake()
-    state.fruit = point(10i16, 8i16)
-    state.snake.direction = point(1i16, 0i16)
-    state.frame_count = 0u32
-    state.gamepad_prev = 0u8
-    body: Array[Point]
-    arrput(body, point(2i16, 0i16))
-    arrput(body, point(1i16, 0i16))
-    arrput(body, point(0i16, 0i16))
-    state.snake.body = body
-    state.fruit_sprite = binarydata("\x00\xa0\x02\x00\x0e\xf0\x36\x5c\xd6\x57\xd5\x57\x35\x5c\x0f\xf0")
-    w4.set_game_state(cast("AnyPtr", state))
-    return 0
-
Show demo in a new tab
Show demo inline
\ No newline at end of file diff --git a/docs/documentation.html b/docs/documentation.html deleted file mode 100644 index 0e87fab..0000000 --- a/docs/documentation.html +++ /dev/null @@ -1,412 +0,0 @@ -Yaksha Programming Language

1 Language Features

Created 2022-08-09, Last Updated 2023-09-03

1.1 Data Types

1.1.1 Wrapped String References

done

Wrapped string literals sr wraps multiple source strings in an uniform structure. There is no reason to delete a sr unless you want to de-allocate, referred data of the string.

You can add two sr using + operator. However, resulting value will be of type str, as memory allocation is required. It is recommended to use a string buffer for concatenating a string.

a: sr = "A"
-b: sr = "B"
-c = a + b
-# Type of c would be str
-

Type inference during creating a variable will create a value of sr type whenever "string literal" is used on RHS.

my_sr = "Hello World"
-another_sr: sr = "Hello World"
-

1.1.2 String literals

done

Internally string literals such as "hello world" are neither str or sr. They utilize a hidden data type :s: for string literal.

String literals are efficient and does not require any additional memory allocation.

If you + two string literals that will be done at compile time.

String literals are automatically converted to sr or str.

1.1.3 (Semi)Managed Strings

done

  • String allocations and de-allocations are abstracted away, so strings are immutable and automatically deleted.

  • Assignment copy values and automatically delete previous value.

  • Strings are also copied every time you create a new variable or pass it to a function or assign it to a container (object, array, etc).

  • It is not meant to be fast. It is meant to be easily usable.

  • At C code level yk__sds data structure will be used. (yk__sds is a char* with special header placed just before).

  • 💀️ Managed strings are not deleted when used in arrays, maps, or objects. (This is intentional and not a bug.)

    • You need to manage deletion of str object in this case.

    • Use libs.strings.array.del_str_array() to delete a string array.

  • Supports + operator to join two str values.

a: str = "hello world"
-# support -> datatype ✅ | literal ✅
-println(a)
-

Data Type - str

Internally this is a binary string.

sds library (part of runtime lib) takes care of the heavy lifting.

1.1.4 Standard integers

done

  • Default integer is a 32bit signed integer.

  • This is compiled to int32_t on all platforms.

a: int = 4       # datatype ✅ | literal ✅
-print("Four =")
-println(a)
-

Data Type - int or i32

1.1.5 Integer types

in progress

  • Signed types - i8, i16, i32, i64

  • Unsigned types - u8, u16, u32, u64

# Default integer type is i32
-a: int = 1       # datatype ✅ | literal ✅
-b: i32 = 2       # datatype ✅ | literal ✅
-c: i8 = 3i8      # datatype ✅ | literal ✅
-d: i16 = 4i16    # datatype ✅ | literal ✅
-e: i32 = 5i32    # datatype ✅ | literal ✅
-f: i64 = 6i64    # datatype ✅ | literal ✅
-
-# Unsigned
-g: u8 = 3u8      # datatype ✅ | literal ✅
-h: u16 = 4u16    # datatype ✅ | literal ✅
-i: u32 = 4u32    # datatype ✅ | literal ✅
-j: u64 = 5u64    # datatype ✅ | literal ✅
-

1.1.6 Float types

done

  • f32 or float - single precision floats.

  • f64 - double precision floats.

a: f32 = 1.0f    # datatype ✅ | literal ✅
-b: f64 = 2.0     # datatype ✅ | literal ✅
-c: float = 3.0f  # datatype ✅ | literal ✅
-

Data Type - f32, float and f64

1.2 Syntax features

1.2.1 Let statement

done

  • Create a new variable.

  • If you want to assign to a variable, it needs to be created.

  • If no value is provided default value for data type is used.

Default value for str is an empty string.

def main() -> int:
-    a: int = 10
-    print(a)
-    return 0
-

1.2.2 Functions

1.2.2.1 Basic functions

done

  • Return type must be mentioned always.

  • If return type is None it means no data is returned. (void in C world.)

def main() -> int:
-    print("Hello World\n")
-    return 0
-
1.2.2.2 Exposing C functions
  • 💀 You can only call @nativexxx functions from normal functions.

  • 💀 @nativexxx functions cannot call each other or normal functions.

done

1.2.2.2.1 @native - native functions
@native("getarg")
-def get_arg(n: int) -> str:
-    pass
-
-@native
-def get_global_arg(n: int) -> str:
-    ccode "yk__sdsdup(global_args[yy__n])"
-
Click to see output C code
yk__sds yy__get_arg(int32_t nn__n) { return getarg(nn__n); }
-yk__sds yy__get_global_arg(int32_t nn__n)
-{
-    yk__sdsdup(global_args[yy__n]);
-}
-

If ccode is there instead of an argument, then it is used as the message body.

1.2.2.2.2 @nativemacro - macros with arguments
@nativemacro
-def min_int(a: int, b:int) -> int:
-    ccode "((nn__a < nn__b) ? nn__a : nn__b)"
-
-@nativemacro("((nn__a > nn__b) ? nn__a : nn__b)")
-def max_int(a: int, b:int) -> int:
-    pass
-
Click to see output C code
#define yy__min_int(nn__a, nn__b) ((nn__a < nn__b) ? nn__a : nn__b)
-#define yy__max_int(nn__a, nn__b) ((nn__a > nn__b) ? nn__a : nn__b)
-
1.2.2.2.3 @nativedefine - simple #define
@nativedefine("banana")
-def banana(a: int, b: int, c:int) -> int:
-    pass
-
Click to see output C code
#define yy__banana banana
-
1.2.2.2.4 @varargs - variable argument functions
  • 💀 Can only be used with @nativedefine.

@nativedefine("yk__newsdsarray")
-@varargs
-def new(count: int, s: str) -> Array[str]:
-    pass
-
Click to see output C code
#define yy__new yk__newsdsarray
-// Assume that yk__newsdsarray is something like below
-// yk__sds *yk__newsdsarray(size_t count, ...)
-
1.2.2.3 Template functions

not started

  • Return type can also be a template-arg if that template-arg is used in parameters.

  • String passed inside @template( should be single upper case characters separated by commas.

This means it is limited to 26 template arguments max.

@native("yk__arrput")
-@template("T")
-def arrput(a: Array[T], v: T) -> None:
-    pass
-
-@native("yk__hmput")
-@template("K,V")
-def hmput(a: HashMap[K,V], key: K, value: V) -> None:
-    pass
-
-@native("yk__hmget")
-@template("K,V")
-def hmget(a: HashMap[K,V], key: K) -> V:
-    pass
-
1.2.2.4 GPU/OpenCL device functions

not startedplanned for v0.5

  • Easy access to GPU through OpenCL.

@device
-def calculate(n: int) -> int:
-   return 1 + 1
-

1.2.3 Defer statement

done

  • Defer something to happen at the end of the scope.

  • Before any return from a function.

  • Before break, continue or end of while loop body.

    • This behaviour is different from what you see in go-lang.

  • Before end of if body or end of else body.

defer works as a stack.

That means deferred expressions are executed in last deferred first executed order.

def onexit() -> int:
-    println("All done")
-    return 0
-
-def main() -> int:
-    defer onexit()
-    println("Hello World")
-    return 0
-

Output:

Hello World
-All done
-

1.2.4 Del statement

In progress

  • Delete values.

  • Delete arrays, and other builtin data structures without deleting content.

def main() -> int:
-    a: Array[int]
-    defer del a
-    arrput(a, 1)
-    arrput(a, 2)
-    arrput(a, 3)
-    println(a[0])
-    return 0
-

Compiles to free or other runtime functions.

1.2.5 Class statement

in progress

  • Create a custom data structure.

  • 💀 Templated structures are not supported yet.

  • 💀 Inheritance is not supported yet.

class Student:
-    student_id: int
-    name: str
-    address: str
-
-class Teacher:
-    teacher_id: int
-    name: str
-    address: str
-
1.2.5.1 Creating and freeing objects
def main() -> int:
-    # Non primitive types are initialized to None
-    john: Student
-    # Creating an instance, will be allocated in heap
-    # Results in a malloc
-    john = Student()
-    defer del john
-    # Set fields
-    john.student_id = 10
-    # str objects in structures are not freed automatically
-    john.name = "John Smith"
-    john.address = "1 Road, Negombo"
-    defer del john.name
-    defer del john.address
-    return 0
-

It might be better to create a custom function to delete custom objects.

def del_student(st: Student) -> None:
-    del st.name
-    del st.address
-    del st
-
-def main() -> int:
-    john: Student = Student()
-    defer del_student(john)
-
-    john.student_id = 10
-    john.name = "John Smith"
-    john.address = "1 Road, Negombo"
-    return 0
-
1.2.5.2 Exposing native structures
@nativedefine("something")
-class Something:
-    something_id: int
-
-# Use @dotaccess for purely stack allocated structs
-@nativedefine("Color")
-@dotaccess
-class Color:
-    r: int
-    g: int
-    b: int
-
Click to see output C code
#define yy__Something something
-#define yy__Color Color
-

1.2.6 Import statement

in progress

  • Import a file.

import io
-
-def main() -> int:
-    file: io.File = io.open("Haha")
-    defer io.close(file)
-    if file == None:
-        println("-- failed to read file --")
-        return 1
-    data: str = io.readall(file)
-    println("-- read file --")
-    println(data)
-    return 0
-

Name mangling takes place for this.

1.2.7 While loop

done

Loop as long as the expression evaluates to True.

def main() -> int:
-    a = 10
-    while a > 0:
-        println(a)
-        a -= 1
-    return 0
-

1.2.8 Foreach loop

done

For each allow you to iterate each element of a given array.

def main() -> int:
-    e1: Array[int] = array("int", 1, 2, 3)
-    e2 = array("int", 4, 5, 6, 7)
-    for i: int in e1:
-        for j in e2:
-            print(i)
-            print(" - ")
-            println(j)
-    del e1
-    del e2
-    return 0
-

1.2.9 Endless for loop

done

Endless for loop will iterate until break is executed.

def main() -> int:
-    c: int = 0
-    for:
-        if c == 2:
-            break
-        println(1)
-        c += 1
-    return 0
-

1.2.10 C-For loop

done

Standard for loop from C family of languages.

def add(a: int, b: int) -> int: a + b
-
-def main() -> int:
-    for (x = 0; x < 10; x = x + 1):
-        println(x)
-
-    a: str = ""
-    for (x = 0; x < 4; x += 1):
-        a += "hello "
-    println(a)
-
-    b: str = ""
-    c: str = "x"
-    for (b += c; b != "xxx"; b += c): pass
-    println(b)
-
-    for (x = 0; x < 10i8; x = add(x, 2i8)):
-        println(x)
-
-    return 0
-

Note that Yaksha allows omitting return, assuming last expression matches the return data type.

This is why add function does not have a return statement.

1.3 Builtin Functions

in progress

  • print(primitive) -> None - Print without a new line

  • println(primitive) -> None - Print + new line

  • len(Array[T]) -> int - Get length of arrays,maps

  • arrput(Array[T], T) -> None - Put item to an array

  • arrpop(Array[T]) -> T - Remove last item from an array and return it

  • arrnew("T", int) -> Array[T] - Create a new array of given size. (Uninitialized elements)

  • arrsetcap(Array[T], int) -> None - Set array capacity / grow memory. Does not affect length.

  • arrsetlen(Array[T], int) -> None - Set array length. Each element will be an uninitialized element.

  • array("T", T...) -> Array[T] - Create a new array from given elements

  • getref(T) -> Ptr[T] - Get a pointer to given object

  • unref(Ptr[T]) -> T - Dereference a pointer

  • charat(str, int) -> int - Get a character at a specific location in string

  • shnew(Array[SMEntry[T]]) -> None - Initialize Array[SMEntry[T]] object

  • shput(Array[SMEntry[T]], str, T) -> None - Put item to an Array[SMEntry[T]]

  • shget(Array[SMEntry[T]], str) -> T - Get item from an Array[SMEntry[T]]

  • shgeti(Array[SMEntry[T]], str) -> int - Get item index from an Array[SMEntry[T]] (-1 if not found)

  • hmnew(Array[MEntry[K,T]]) -> None - Initialize Array[MEntry[K,T]] object

  • hmput(Array[MEntry[K,T]], K, T) -> None - Put item to an Array[MEntry[K,T]]

  • hmget(Array[MEntry[K,T]], K) -> T - Get item from an Array[MEntry[K,T]]

  • hmgeti(Array[MEntry[K,T]], K) -> int - Get item index from an Array[MEntry[K,T]] (-1 if not found)

  • cast("T", X) -> T - Data type casting builtin

  • qsort(Array[T],Function[In[Const[AnyPtrToConst],Const[AnyPtrToConst]],Out[int]]) -> bool - Sort an array, returns True if successful

  • iif(bool, T, T) -> T - Ternary functionality

  • foreach(Array[T],Function[In[T,V],Out[bool]],V) -> bool - For each element in array execute given function

  • countif(Array[T],Function[In[T,V],Out[bool]],V) -> int - For each element in array count if function returns true

  • filter(Array[T],Function[In[T,V],Out[bool]],V) -> Array[T] - Create a new array with filtered elements based on return value of given function

  • map(Array[T],Function[In[T,V],Out[K]],V) -> Array[K] - Create a new array with result of given function

  • binarydata("data") -> Const[Ptr[Const[u8]]] - Create constant binary data (must pass in a string literal). Returns Const[Ptr[Const[u8]]] that does not need to be deleted.

  • make("T") -> Ptr[T] - Allocate a single object.

  • inlinec("T", "code") -> T - Inline C code resulting in T data type. Example - inlinec("int", "sizeof(char)")

Builtin functions may call different implementations based on input.

1.4 Non primitive data types

This section describes other essential types of builtin structures.

1.4.1 Dynamic Arrays

in progress

def main() -> int:
-    a: Array[i32]
-    # Prior to calling arrput pointer is set to None
-    defer del a
-    arrput(a, 1)
-    arrput(a, 2)
-    # Array access works with `[]`
-    print(a[0])
-    return 0
-

Must ensure array elements are freed. int need not be deleted as they are primitive types.

1.4.2 String Hash Map

in progress

HashMap with str keys and given data type values.

Values need to be deleted when no longer needed.

def main() -> int:
-    m: Array[SMEntry[int]]
-    # shnew must be called before using the array as a String Hash Map
-    shnew(m)
-    defer del m
-    shput(m, "banana", 10)
-    r: int = shget(m, "banana")
-    return r
-

Array[SMEntry[?]] keys are deleted automatically when del is invoked.

len will give the total number of elements of the String Hash Map.

1.4.3 Hash Map

in progress

Simple single key single value hashmaps.

Data type Array[MEntry[K,T]].

key and value both need to be deleted.

1.5 Macros & YakshaLisp

in progress

documentation - in progress

YakshaLisp macros are one of the most important features of Yaksha. You can think of it as an interpreted language that lives in Yaksha compiler.

Because that is what it is!

It has it's own built in functions, can use import, read/write files and even use metamacro directive to create quoted input functions(similar to defun, except input args are not evaluated and returns quoted output that is immediately evaluated). Has multiple data types (list, map, callable, string, expression). Support's q-expressions {1 2 3} (inspired by build-your-own-lisp's lisp dialect), and special forms. A simple mark and sweep garbage collector is used. Provides a mediocre REPL and ability to execute standalone lisp code using a command. Not only that, it also support reflection using builtin callables such as this and parent (which returns a mutable current or parent scope as a map).

Yo dog!, I heard you like macros, so I added meta-macro support in your macro processor.

So you can meta-program while you meta-program.

1.5.1 Philosophy?

YakshaLisp provide the ability to write token-list to token-list conversion macros. One can use my_macro!{t t t} style expansion to achieve this. So why YakshaLisp? because it needs to process a list of tokens.

Additionally, Yaksha and YakshaLisp are polar opposites of each other, therefore I think they can compliment each other nicely.

Think Yin-Yang!

1.5.1.1 What are the differences?

Language differences

YakshaYakshaLispC99
manual memory managementgarbage collectedmanual memory management
compiled (to C99)interpretedcompiled by most compilers to target platform.
can be multi-threadedonly single threadedcan be multi-threaded, etc
indent based syntaxparenthesis based syntaxC family {} scope syntax
c-like function pointersclosures, function body not evaluated unless called. First class functions/lambdafunction pointers
multiple integer types and float / double / boolonly 64bit signed integer is supported.multiple integer types and float / double / bool, enums & unions
hygienic macros using $name syntax (automated gensym), non-hygienic macros are also supported (do not use the $ prefix for identifiers), can also generate C style macros/code with nativexxx annotations and ccode keyword in some cases.metamacro / eval / parse / this / parent / q-expressions#define / #include
has statements and expressionsexpressions onlyhas statements and expressions
no support for exceptionsexceptions are a string that you can throw and catchsetjmp
no support for reflectionsupports reflection - repr / this / parentno support for reflection

1.5.2 Builtin functions, values & prelude

done

All below listed functions are available at the moment.

  • nil - this has value of {} (an empty list)

  • true - value of 1

  • false - value of 0

  • newline - value of \r\n or \n as a string.

  • +, -, *, /, modulo - basic functions

  • ==, !=, <, >, <=, >= - comparison functions

  • and, or, not - boolean operator functions

  • bitwise_and, bitwise_or, bitwise_not, bitwise_xor, bitwise_left_shift, bitwise_right_shift - bitwise operator functions to be applied to number values (underlying structure of a number is a 64bit signed integer)

  • filter, map, reduce - basic functional-programming functions

  • map_get, map_has, map_set, map_remove, map_values, map_keys - functions to manipulate map-objects.

  • access_module - access an element from another root environment (uses same imports at the top of the file as in Yaksha)

  • this, parent - returns current scope or parent scope as a map-object (can be modified)

  • magic_dot - wrapper around map_get and access_module (supports both type of objects) to read a value. Special syntax sugar symbol1::symbol2 expands to (magic_dot symbol1 symbol2)

  • io_read_file, io_write_file, print, println, input - I/O functions

  • def/define - define an undefined value in current environment with a given symbol.

  • setq - update an already defined value

  • = - combination of setq and def. try to def and if it fails use setq.

  • quote - create a list with non-evaluated expressions parsed as arguments. This has a somewhat-similar (but not 100% similar) effect to {}

  • list - create a list with all arguments to list function evaluated.

  • eval, parse, repr - evaluate a list or single expression, parse to q-expression, convert values to strings.

  • raise_error, try, try_catch - functions to use exceptions during evaluation.

  • head, tail, cons, push, pop, insert, remove - list manipulation functions

  • for, while - looping functions

  • scope, do - do these expressions in a child scope scope or in current scope (do)

  • is_list, is_list, is_int, is_string, is_truthy, is_callable, is_nil, is_metamacro, is_module - check types

  • defun, lambda - create named and anonymous functions

  • cond, if - conditions

  • random - random number between given range

  • time - unix time as number

1.5.3 Macro environments

Inside Yaksha a root (known as builtins_root) environment is created. It will house builtin functions and results of executing prelude code.

A single .yaka file in imports (or current compiled file) will have their own root environment that is a child of builtins_root.

During garbage collection, mark phase will start marking from builtins_root and file level roots.

Environment is an unordered_map with string keys. Environments and maps use same data type internally.

1.5.4 How does it look like

# ╔═╗┌─┐┌┬┐┌─┐┬┬  ┌─┐  ╔╦╗┬┌┬┐┌─┐
-# ║  │ ││││├─┘││  ├┤    ║ ││││├┤
-# ╚═╝└─┘┴ ┴┴  ┴┴─┘└─┘   ╩ ┴┴ ┴└─┘
-# ╔═╗┬┌─┐┌─┐  ╔╗ ┬ ┬┌─┐┌─┐
-# ╠╣ │┌─┘┌─┘  ╠╩╗│ │┌─┘┌─┘
-# ╚  ┴└─┘└─┘  ╚═╝└─┘└─┘└─┘
-macros!{
-    (defun to_fb (n) (+ (if (== n 1) "" " ") (cond
-        ((== 0 (modulo n 15)) "FizzBuzz")
-        ((== 0 (modulo n 3)) "Fizz")
-        ((== 0 (modulo n 5)) "Buzz")
-        (true (to_string n))
-        )))
-    (defun fizzbuzz () (list (yk_create_token YK_TOKEN_STRING (reduce + (map to_fb (range 1 101))))))
-    (yk_register {dsl fizzbuzz fizzbuzz})
-}
-
-def main() -> int:
-    println(fizzbuzz!{})
-    return 0
-


2 Yaksha library

Created 2022-08-18, Last Updated 2023-07-01

Yaksha library uses multiple 3rd party libraries, set of python scripts and few other nuts and bolts to create library sources.

Core parts of runtime library functionality starts with yk__ or YK__.

Yaksha programming language preserves anything that starts with yk__ or YK__ while prefixing any other name with yy__.

This avoids collisions with C standard library functions or keywords.

2.1 Standard Library Components

2.1.1 Core Library

in progress

Small core library with useful features.

import libs
-

2.1.2 UI Library

in progress

Use raygui with raylib.

import raylib.gui
-

2.1.3 raylib - Graphics/Game/Audio Library

in progress

Use raylib to build games and such

import raylib
-

2.1.4 CL Library

not started

Access to OpenCL features and parallel programming.

import cl
-
-@device
-def my_program(n: int) -> int:
-    return 1 + 1
-
-def main() -> int:
-    dvc: cl.device = cl.get_device(0)
-    cl.run(dvc, my_program)
-

Placeholder code, API is not designed yet.



3 Language Grammar

Created 2022-08-09, Last Updated 2023-08-05

Warning! this section needs rewriting

This describes Yaksha language grammar.

Lot learned from Crafting Interpreters book and Python grammar page.

in progress

3.1 Statements

This section describes statements and program structure. Program is made from one or more program statements. Standard statements are what goes inside functions.

program: import_statement* program_declaration*
-program_declarations:
-    | const_statement
-    | struct_statement
-    | def_statement
-standard_statement:
-    | compound_statement
-    | simple_statement
-compound_statement:
-    | if_statement
-    | while_statement
-simple_statement:
-    | let_statement
-    | return_statement
-    | defer_statement
-    | "pass"
-    | "break"
-    | "continue"
-    | expr_statement
-    | del_statement
-    | c_code_statement
-# Because defer can use del statement or any another expression.
-# Del statement has two components with and without statement end.
-base_del_statement: "del" expr
-del_statement: base_del_statement st_end
-# Defer can use a del statement or an expr
-defer_statement: "defer" (base_del_statement | expr) st_end
-# Functions
-def_statement: annotation* "def" name "(" parameters? ")" block st_end
-# Let statement creates variables
-let_statement: name ":" data_type ("=" expr)? st_end
-# If statement
-if_statement: "if" block ("else" block)?
-# While statement
-while_statement: "while" block
-# Custom data structures
-# Struct value data types must be present
-struct_value: name ":" data_type st_end
-struct_block: ":" newline ba_indent struct_value+ ba_dedent
-stuct_statement: annotation* "class" name struct_block
-# Expression statements, calling functions etc.
-expr_statement: expr st_end
-# Return statement
-return_statement: "return" expr st_end
-# Constants compiles to #defines.
-const_statement: "const" name "=" (number | string)
-# Import statements include other source files and perform name mangling
-# You need to always rename level 2+ imports
-import_statement: "import" name ( ("." name)+ "as" name )? st_end
-# Dumps unmodified C code. It would be better to encapsulate these.
-# When used with @native functions compiles to a c macro
-c_code_statement: "ccode" (string | triple_quote_string) st_end
-# Multiline or single simple statement blocks
-block: ":" (newline ba_indent standard_statement+ ba_dedent | simple_statement)
-

defer statement is special, it can take either a del statement or any expression.

This allows you to defer a del.

3.2 Data Type

data_type: data_type_part | name ("." name)? ("[" data_type_args "]")?
-data_type_args: data_type ("," data_type)*
-data_type_part: name | primitive_data_type
-primitive_data_type: "int" | "i8" | "i16" | "i32" | "i64" |
-        "u8" | "u16" | "u32" | "u64" | "str" | "float" | "bool" | "None" |
-        "f32" | "f64"
-

Data type describes, primitives, custom data types and non primitives.

3.3 Expressions

Expressions are itsy bitsy pieces that make up parts of statements.

expr: assignment
-assignment: (fncall ".")? name "=" assignment
-    | logical_not;
-logical_not: "not" logic_or
-logic_or: logic_and ("or" logic_and)*
-logic_and: equality ("and" equality)*
-equality: comparision (("!=" | "==") comparision)*
-comparision: term ((">" | ">=" | "<" | "<=") term)*
-term: factor (("-" | "+") factor)*
-factor: unary (("/" | "*") unary)*
-unary: "-" unary | fncall
-fncall: primary ( "(" arguments? ")" | "[" expr "]" | "." name )*
-primary: "True" | "False" | "None" | number | string | triple_quote_string | name |
-          "(" expr ")"
-

3.4 Useful utils

# Annotations are used to define types of functions or structures
-# Currently only @device, @native and @generic annotations are available.
-# Annotations may have a single string parameter.
-annotation: "@" name ( "(" (string | triple_quote_string ) ")" ) newline
-parameters: parameter ("," parameter)*
-parameter: name ":" datatype
-st_end: newline | eof
-newline: "\n" | "\r\n"
-eof: "end of file"
-ba_indent: "increase in indentation"
-ba_dedent: "decrease is indentation"
-

ba_indent and ba_dedent gets calculated before parsing in block_analyzer phase.



4 Compiler Internals

Created 2022-08-18, Last Updated 2023-08-13

This section describes how compiler works.

Total of 12+ passes are planned for the compiler.

4.1 What happens when you compile a .yaka file?

4.1.1 Let's look at a sample

4.1.1.1 Input code
def factorial(x: int) -> int:
-    if x <= 0:
-        return 1
-    return x * factorial(x - 1)
-
-
-def main() -> int:
-    a: int = 10
-    b: str = "b"
-    while a > 0:
-        print(factorial(a))
-        print("\n")
-        a = a - 1
-        b = "a" + b
-    print(b)
-    print("\n")
-    return 0
-
4.1.1.2 Output C code
// --yaksha header section--
-#include "yk__lib.h"
-int32_t yy__factorial(int32_t);
-int32_t yy__main();
-// --yaksha body section--
-int32_t yy__factorial(int32_t yy__x) {
-  if ((yy__x <= 0)) { return 1; }
-  return (yy__x * yy__factorial((yy__x - 1)));
-}
-int32_t yy__main() {
-  int32_t yy__a = 10;
-  yk__sds t__0 = yk__sdsnew("b");
-  yk__sds yy__b = yk__sdsdup(t__0);
-  while (1) {
-    if (!((yy__a > 0))) { break; }
-    {
-      printf("%d", (yy__factorial(yy__a)));
-      yk__sds t__1 = yk__sdsnew("\n");
-      printf("%s", (t__1));
-      yy__a = (yy__a - 1);
-      yk__sds t__2 = yk__sdsnew("a");
-      yk__sds t__3 = yk__sdscatsds(yk__sdsdup(t__2), yy__b);
-      yk__sdsfree(yy__b);
-      yy__b = yk__sdsdup(t__3);
-      yk__sdsfree(t__3);
-      yk__sdsfree(t__2);
-      yk__sdsfree(t__1);
-    }
-  }
-  printf("%s", (yy__b));
-  yk__sds t__4 = yk__sdsnew("\n");
-  printf("%s", (t__4));
-  yk__sdsfree(t__4);
-  yk__sdsfree(t__0);
-  yk__sdsfree(yy__b);
-  return 0;
-}
-// --yaksha footer section--
-int main(void) { return (int) yy__main(); }
-

Notice yk__sdsfree is automatically generated for simple string uses. This makes strings immutable. Currently, it is doing a lot of unnecessary processing. 😓

4.2 Phases of the compiler

4.2.1 Tokenizer

in progress

  • Tokenizer breaks down input to individual tokens and Identifies Keywords.

  • Parse numbers and strings and check if they are valid according to the grammar.

If any error is detected at this point we still continue up to parser so we can identify maximum number of errors.

4.2.2 Block analyzer

in progress

  • Convert indentation to ba_indent, ba_dedent type tokens.

  • Remove comments.

  • Remove extra new lines.

Only 2-spaces, 4-spaces or tab based indents are supported. Will try to guess indentation type.

Still continue to parser even after errors.

4.2.3 Parser

in progress

  • Parses tokens returned by block analyzer an AST.

  • AST is represented as a std::vector of stmt*.

Any errors from previous stages and parsing stage is printed here and program will exit.

4.2.4 Import analyzer

in progress

Import Analyzer
  • Analyzes imports.

  • Parses imported files.

  • This step will use more instances of Tokenizer, Parser and Compiler objects.

4.2.5 Def-Struct-Const Visitor

in progress

  • Visit def statements and collect functions to a map.

  • Visit class statements and collect structures to a map.

  • Visit global constants.

4.2.6 Return path analyzer

in progress

  • Analyzes return paths.

  • Ensure all functions return.

4.2.7 Type checker

in progress

  • Type checker visits AST and check for invalid types.

  • Checks for undefined variables.

  • Checks for undefined functions.

  • Checks for undefined structures.

  • Check all return types are same as that of the encapsulating functions.

4.2.8 Template Compiler

not started

  • Rewrite @template to be normal functions based on what's passed to them.

  • Rewrite fncall expressions to use newly created functions.

4.2.9 Optimizer

not started

  • Remove dead code.

  • Basic constant folding.

4.2.10 To-CL-Compiler

not startedplanned for v0.5

  • Convert @device code to OpenCL program code.

  • Copy necessary structures.

  • Check validity - no generics, no str, no allocations.

4.2.11 To-C-Compiler

in progress

  • Writes C code from AST.

  • Do any simple optimizations.

  • Handle defer statements.

  • Handle str deletions.

  • Create struct and function declarations.

4.2.12 C-To-C Compiler

not started

  • We generate code to a single C file which can then be further optimized.

  • Parse and optimize subset of generated C code.

4.3 How does the Yaksha-lang library get packaged?

Multiple sources are packaged into a single header file.

Library functionality is exposed by prefixing with yk__ or YK__.

4.3.1 Packer components

  • packer.py - Run packer DSL scripts and create packaged single header libraries.

  • inctree.py - Topological sort #include DAG to determine best order for combining headers.

  • cids.exe - Use stb_c_lexer.h library to parse C code and extract identifiers.

  • single_header_packer.py - ApoorvaJ's single header C code packager. Repo

  • python-patch - techtonik's patch script. Repo

  • fcpp- Frexx C Preprocessor by Daniel Stenberg. (Patch for Windows compilation was needed, failed to compile with MSVC, works with MingW with patch).

DAG - Directed Acyclic Graph.

4.3.2 Third Party Libraries

  • sds - Salvatore Sanfilippo's string library. (Needed a patch to support MSVC 2019)

  • stb - Single header libraries by Sean Barrett.

  • libs - Mattias Gustavsson's single header C libraries.

  • utf8proc - UTF-8 library - Jan Behrens, Public Software Group and Julia developers.

If you stack few giants, you can stand very tall on top of them.


Note - currently only sds and stb_ds is used. This selection of libraries may change.

4.3.3 Packer DSL

import re
-use_source("libs")
-for lib in ["ini", "thread", "http"]:
-    ids = extract_ids(lib + ".h")
-    P = [x for x in ids if x.startswith(lib)]
-    PU = [x for x in ids if x.startswith(lib.upper())]
-    prefix(lib + ".h", PREFIX, P)
-    prefix(lib + ".h", PREFIX_U, PU)
-    rename(lib + ".h", [[re.escape(r'yk__http://'), 'http://'],
-                        ["YK__THREAD_PRIORITY_HIGHEST", "THREAD_PRIORITY_HIGHEST"]])
-    copy_file(lib + ".h", PREFIX + lib + ".h", is_temp=False)
-    clang_format(PREFIX + lib + ".h", is_temp=False)
-

It is just Python 3.x with extra functions added and evaluated.🤫

\ No newline at end of file diff --git a/docs/images_home/apple-touch-icon.png b/docs/images_home/apple-touch-icon.png deleted file mode 100644 index ce7a082..0000000 Binary files a/docs/images_home/apple-touch-icon.png and /dev/null differ diff --git a/docs/images_home/counter_app.gif b/docs/images_home/counter_app.gif deleted file mode 100644 index 9524cd7..0000000 Binary files a/docs/images_home/counter_app.gif and /dev/null differ diff --git a/docs/images_home/factorial.gif b/docs/images_home/factorial.gif deleted file mode 100644 index 5904e1a..0000000 Binary files a/docs/images_home/factorial.gif and /dev/null differ diff --git a/docs/images_home/favicon-16x16.png b/docs/images_home/favicon-16x16.png deleted file mode 100644 index 73ab6db..0000000 Binary files a/docs/images_home/favicon-16x16.png and /dev/null differ diff --git a/docs/images_home/favicon-32x32.png b/docs/images_home/favicon-32x32.png deleted file mode 100644 index 19a83b0..0000000 Binary files a/docs/images_home/favicon-32x32.png and /dev/null differ diff --git a/docs/images_home/safari-pinned-tab.svg b/docs/images_home/safari-pinned-tab.svg deleted file mode 100644 index fc524c9..0000000 --- a/docs/images_home/safari-pinned-tab.svg +++ /dev/null @@ -1,49 +0,0 @@ - - - - -Created by potrace 1.14, written by Peter Selinger 2001-2017 - - - - - - - - diff --git a/docs/images_home/site.webmanifest b/docs/images_home/site.webmanifest deleted file mode 100644 index a1553eb..0000000 --- a/docs/images_home/site.webmanifest +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "", - "short_name": "", - "icons": [ - { - "src": "/android-chrome-192x192.png", - "sizes": "192x192", - "type": "image/png" - }, - { - "src": "/android-chrome-384x384.png", - "sizes": "384x384", - "type": "image/png" - } - ], - "theme_color": "#ffffff", - "background_color": "#ffffff", - "display": "standalone" -} diff --git a/docs/index.html b/docs/index.html deleted file mode 100644 index 7ae03ab..0000000 --- a/docs/index.html +++ /dev/null @@ -1,415 +0,0 @@ - - - - - Yaksha Programming Language - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -
-
-

- A - manual - memory managed, -

-

compiled to C99,

-

- programming language with off-side rule - syntax -

-
- Yaksha language gif -
- - - -
- - - -
-

SAMPLE PROGRAMS

-

ALL FURY, NO FUSS

- -
- -
- - - - - - -
- - -
-

A randomly generated tree moving in the wind.

- Yaksha language gif -
- -
-
- Click to see code sample -
- import raylib as rl
- import raylib.utils
- import libs.numbers as num
- import libs.perlin
- import libs.random
-
-
- class State:
-     width: float
-     height: float
-     angle: float
-     frame_count: u64
-     blue: rl.Color
-     green: rl.Color
-     color3: rl.Color
-
-
- def branch(x: float, y: float, length: float, angle: float, s: State) -> None:
-     if length < 4.0f:
-         leaf_width = random.random_betweenf(1.0f, 3.0f)
-         leaf_height = random.random_betweenf(3.0f, 6.0f)
-         lerped_green = utils.lerp_color(s.green, s.blue, utils.remap(x, 0.0f, s.width, 0.0f, 1.0f) * 2.0f)
-         color = utils.lerp_color(lerped_green, s.color3, utils.remap(y, 0.0f, s.height, 0.0f, 1.0f) * 1.5f)
-         rl.draw_ellipse(num.f2i(x), num.f2i(y), leaf_height, leaf_width, color)
-         return
-     wind = utils.sin_deg(perlin.noise1df(num.uu2f(s.frame_count) / 50.0f)) * 100.0f * utils.sin_deg(num.uu2f(s.frame_count) / 2.0f)
-     next_y = y - length * utils.cos_deg(angle)
-     next_x = x + length * utils.sin_deg(angle)
-     thick = utils.remap(length, 0.0f, s.height / 4.0f, 2.0f, 6.0f)
-     rl.draw_line_ex(rl.vector2(x, y), rl.vector2(next_x, next_y), thick, rl.color(152, 50, 1, 255))
-     r1 = random.random_betweenf(0.3f, 0.9f)
-     r2 = random.random_betweenf(0.5f, 0.8f)
-     branch(next_x, next_y, (length * r2), angle + s.angle + wind * 10.0f, s)
-     branch(next_x, next_y, (length * r1), angle - s.angle + wind * 10.0f, s)
-
-
- def update_draw_frame(s: State) -> None:
-     rl.clear_background(rl.color(255, 255, 255, 255))
-     branch(s.width / 2.0f, s.height, s.height / 4.0f, 0.0f, s)
-
-
- def main() -> int:
-     s: State = State()
-     s.angle = random.random_betweenf(30.0f, 45.0f)
-     s.width = 600.0f
-     s.height = 600.0f
-     s.frame_count = 0u64
-     s.blue = rl.color(0, 255, 214, 255)
-     s.green = rl.color(0, 255, 0, 255)
-     s.color3 = rl.color(255, 45, 156, 255)
-     rl.init_window(num.f2i(s.width), num.f2i(s.height), "Fractal Tree in the Wind")
-     rl.set_target_fps(120)
-     seed: u64 = random.init_random()
-     while not rl.window_should_close():
-         rl.begin_drawing()
-         update_draw_frame(s)
-         rl.draw_fps(0, 0)
-         rl.end_drawing()
-         s.frame_count += 1u64
-         random.set_seed(seed)
-     rl.close_window()
-     del s
-     return 0
- - -
-
- -
-

An inefficient factorial calculation using recursion

- Recursion code output image -
- -
-
- Click to see code sample -
- import libs.console
-
-
- def factorial(x: int) -> int:
-     if x <= 0:
-         return 1
-     return x * factorial(x - 1)
-
-
- def main() -> int:
-     a = 0
-     while a < 10:
-         console.cyan( "factorial")
-         console.red( "(")
-         print(a)
-         console.red( ") = ")
-         println(factorial(a))
-         a = a + 1
-     return 0
- -
-
- -
-

A 2-in-1 counter as a web application (WASM)

- Counter web application gif -
- -
-
- Click to see code sample -
- import raylib as rl
- import raylib.utils
- import raylib.gui
- import libs.numbers as num
-
- def main() -> int:
-     width = 200
-     height = 160
-     counter1 = 0
-     counter2 = 0
-     rl.init_window(width, height, "Counter")
-     rl.set_target_fps(120)
-     while not rl.window_should_close():
-         rl.begin_drawing()
-         rl.clear_background(rl.color(255, 255, 255, 255))
-         gui.gui_panel(rl.rectangle(10.0f, 10.0f, num.i2f(width) - 20.0f, num.i2f(height) - 20.0f), "<Counter>")
-         widget_width = num.i2f(width) - 40.0f
-         #  Counter 1
-         gui.gui_label(rl.rectangle(20.0f, 40.0f, widget_width, 20.0f), "Count:"+ num.i2s(counter1))
-         if gui.gui_button(rl.rectangle(20.0f, 60.0f, widget_width, 20.0f), "Count"):
-             counter1 = counter1 + 1
-         #  Counter 2
-         gui.gui_label(rl.rectangle(20.0f, 80.0f, widget_width, 20.0f), "Count:"+ num.i2s(counter2))
-         if gui.gui_button(rl.rectangle(20.0f, 100.0f, widget_width, 20.0f), "Count"):
-             counter2 = counter2 + 1
-         #  Asciimoji status bar
-         animation = (counter1 + counter2) % 3
-         if animation == 1:
-             gui.gui_status_bar(rl.rectangle(10.0f, num.i2f(height) - 30.0f, num.i2f(width) - 20.0f, 20.0f), " \\\\- (- _ -) -/")
-         else:
-             gui.gui_status_bar(rl.rectangle(10.0f, num.i2f(height) - 30.0f, num.i2f(width) - 20.0f, 20.0f), " \\\\- (o _ o) -/")
-         rl.draw_fps(20, 540)
-         rl.end_drawing()
-     rl.close_window()
-     return 0
- - -
-
-
-
- - - -
-

PHILOSOPHY

-

SIMPLE. STRICT. SPEEDY.

-
- Yaksha language gif -
-

Language syntax is minimalistic and has similarities to Python.

-

Manual memory management is required.

-

New developers should be able to pick up the full syntax in a few hours.

-
-
-
- - - -
-

END USERS

-

A VERSATILE NEW TOOL

-
-
-

Yaksha aims to be a simple general purpose language with a minimalistic standard library.

-

One goal is to have easy access to GPU/parallel programming (this has not yet begun, and hopefully we can get there) using OpenCL.

-

There will be first class support for Windows.

-

At the moment, the author plans on using the language (once it reaches a usable level) in personal - projects.

-
- Yaksha language gif -
-
- - - - - - - diff --git a/docs/library-docs.html b/docs/library-docs.html deleted file mode 100644 index 796831d..0000000 --- a/docs/library-docs.html +++ /dev/null @@ -1,3625 +0,0 @@ -Yaksha Programming Language

1 Core Library

Created 2022-08-09, Last Updated 2023-03-19

Core library can be accessed by importing libs.

This import name is subject to change.

1.1 libs

def version() -> str
-# This returns standard library version
-# (Note: this is hardcoded)
-

1.2 libs.argparse

ARGPARSE_DEFAULT: Const[int]
-# Default behaviour of argparse
-ARGPARSE_IGNORE_UNKNOWN_ARGS: Const[int]
-# Ignore unknown arguments
-ARGPARSE_STOP_AT_NON_AND_IGNORE_UNKNWON: Const[int]
-# Do both stopping at unknown options and ignoring unknown arguments
-ARGPARSE_STOP_AT_NON_OPTION: Const[int]
-# Stop at non option
-class ArgParse
-# Arg parse state object
-class ArgParseRemainder
-# Remaining arguments after parsing given arguments:
-    argc: int
-    remainder: Array[str]
-class ArgParseWrapper
-# Argument parser wrapper:
-    state: ArgParse
-class Option
-# An argparse option
-# These objects are deleted when del_argparse() is called
-# However, Array[Option] is not
-def del_argparse(object: ArgParseWrapper) -> None
-# Delete arg parser
-def del_remainder(a: ArgParseRemainder) -> None
-# Delete given argparse remainder object
-def new(options: Array[Option], usages: Array[str]) -> ArgParseWrapper
-# Initialize a new argument parser
-# Note: options array last element must be opt_end()
-def new_ex(options: Array[Option], usages: Array[str], flag: int) -> ArgParseWrapper
-# Initialize a new argument parser (with flags)
-# Note: options array last element must be opt_end()
-def opt_boolean(short: str, large: str, result: Ptr[int], help: str) -> Option
-# create a boolean option
-def opt_end() -> Option
-# End of options
-def opt_float(short: str, large: str, result: Ptr[f32], help: str) -> Option
-# create a float option
-def opt_group(name: str) -> Option
-# Create a command group here
-def opt_help() -> Option
-# Help option
-def opt_integer(short: str, large: str, result: Ptr[int], help: str) -> Option
-# create an integer option
-def opt_string(short: str, large: str, result: Ptr[libs.c.CStr], help: str) -> Option
-# create a boolean option
-def parse(argp: ArgParse, arguments: Array[str]) -> ArgParseRemainder
-# Parse given arguments with given argparser object
-# Any remaining values are returned
-# You need to delete the remainder with del_argparse_remainder()
-def set_description(argp: ArgParse, description: str, epilog: str) -> None
-# Set description for help message
-def usage(argp: ArgParse) -> None
-# Disaplay usage
-

1.3 libs.c

class CBool
-class CChar
-class CDouble
-class CFloat
-class CInt
-class CLong
-class CShort
-class CStr
-# A char* string
-class CUChar
-class CUInt
-class CULong
-class CUShort
-class Size
-# size_t in C code
-class VoidPtr
-# Any pointer type
-# void* in C
-def acos(x: CDouble) -> CDouble
-def asin(x: CDouble) -> CDouble
-def atan(x: CDouble) -> CDouble
-def atan2(x: CDouble, y: CDouble) -> CDouble
-def calloc(n: Size, size: Size) -> VoidPtr
-def ceil(x: CDouble) -> CDouble
-def cos(x: CDouble) -> CDouble
-def cosh(x: CDouble) -> CDouble
-def fabs(x: CDouble) -> CDouble
-def floor(x: CDouble) -> CDouble
-def fmod(x: CDouble, y: CDouble) -> CDouble
-def free(ptr: VoidPtr) -> None
-def has_command_processor() -> bool
-# Can we run system commands?
-def itosize(i: int) -> Size
-def log(x: CDouble) -> CDouble
-def log10(x: CDouble) -> CDouble
-def log2(x: CDouble) -> CDouble
-def malloc(size: Size) -> VoidPtr
-def memcmp(str1: VoidPtr, str2: VoidPtr, size: Size) -> CInt
-def memcpy(dest: VoidPtr, src: VoidPtr, size: Size) -> VoidPtr
-def memmove(dest: VoidPtr, src: VoidPtr, size: Size) -> VoidPtr
-def memset(dest: VoidPtr, character: CInt, size: Size) -> VoidPtr
-def pow(x: CDouble, y: CDouble) -> CDouble
-def realloc(ptr: VoidPtr, size: Size) -> VoidPtr
-def sin(x: CDouble) -> CDouble
-def sinh(x: CDouble) -> CDouble
-def sqrt(x: CDouble) -> CDouble
-def system(program: CStr) -> None
-# Run a system command without caring what it will do
-# Wait for exit
-def tan(x: CDouble) -> CDouble
-def tanh(x: CDouble) -> CDouble
-

1.4 libs.console

BLUE: Const[int]
-# Apply blue foreground color
-CYAN: Const[int]
-# Apply cyan foreground color
-GREEN: Const[int]
-# Apply green foreground color
-PURPLE: Const[int]
-# Apply purple foreground color
-RED: Const[int]
-# Apply red foreground color
-REWIND: Const[int]
-# Use rewind with set_color to stop applying any color
-WHITE: Const[int]
-# Apply white foreground color
-YELLOW: Const[int]
-# Apply yellow foreground color
-def blue(x: str) -> None
-# Print text in console, in blue color
-def clear() -> None
-# Clear console
-def color_print(color: int, x: str) -> None
-# Print in given color and then rewind
-def cyan(x: str) -> None
-# Print text in console, in cyan color
-def getch() -> int
-# Get a single character / key press
-# Can be used as a pause
-def green(x: str) -> None
-# Print text in console, in green color
-def purple(x: str) -> None
-# Print text in console, in purple color
-def red(x: str) -> None
-# Print text in console, in red color
-def set_color(c: int) -> None
-# Set given color
-def white(x: str) -> None
-# Print text in console, in white color
-def yellow(x: str) -> None
-# Print text in console, in yellow color
-

1.5 libs.fileformats.ini

class Ini
-# INI Object
-def del_ini(object: Ini) -> None
-# Delete INI object
-def from_str(ini_data: str) -> Ini
-# Parse INI file from given string data
-def get(object: Ini, section: str, property: str) -> str
-# Get a property in given section
-# Empty string is returned if we cannot find the section
-

1.6 libs.fileformats.toml

class Table
-# TOML Table object
-# This is like a dictionary
-class TomlArray
-# Array of any type
-def array_len(x: TomlArray) -> int
-# Get length of array
-def bool_at(x: TomlArray, pos: int) -> bool
-# Get bool from array at location or false
-def bool_at_default(x: TomlArray, pos: int, default: bool) -> bool
-# Get bool from array at location or given default
-def del_table(x: Table) -> None
-# Delete a table. Note that you do not need to delete child tables
-def from_str(x: str) -> Table
-# Parse to a TOML Table from given string
-def get_array(x: Table, name: str) -> TomlArray
-# Get any array from table object
-def get_bool(x: Table, name: str) -> bool
-# Get a bool from table or false if fails
-def get_bool_default(x: Table, name: str, default: bool) -> bool
-# Get a bool from table or given default
-def get_int(x: Table, name: str) -> int
-# Get an int from table or 0 if fails
-def get_int_default(x: Table, name: str, default: int) -> int
-# Get an int from table or given default
-def get_string(x: Table, name: str) -> str
-# Get a string from table or empty if fails
-def get_string_array(x: Table, name: str) -> Array[str]
-# Get an array as native string array
-def get_string_default(x: Table, name: str, default: str) -> str
-# Get a string from table or given default
-def get_table(x: Table, name: str) -> Table
-# Get a Table from given name
-def int_at(x: TomlArray, pos: int) -> int
-# Get int from array at location or 0
-def int_at_default(x: TomlArray, pos: int, default: int) -> int
-# Get int from array at locaiton or given default
-def string_at(x: TomlArray, pos: int) -> str
-# Get string from array at location or empty
-def string_at_default(x: TomlArray, pos: int, default: str) -> str
-# Get string from array at location or given default
-def valid_array(x: TomlArray) -> bool
-# Is this a valid array?
-def valid_table(x: Table) -> bool
-# Is this a valid table?
-

1.7 libs.io

def readfile(fname: str) -> str
-# Read a file to as string, on error returns empty
-def writefile(fname: str, data: str) -> bool
-# Write a file
-

1.8 libs.numbers

def cdbl2d(a: libs.c.CDouble) -> f64
-# c.CDouble to f64 (double precision)
-def cstr2i(a: libs.c.CStr) -> int
-# Convert a c-string to an integer
-def d2cdbl(a: f64) -> libs.c.CDouble
-# f64 (double precision) to c.CDouble
-def d2f(a: f64) -> float
-# f64 (double precision) to float/f32 (single precision)
-# Warning: precision might be lost/truncated
-def d2i(a: f64) -> int
-# f64 (double precision) to int/i32
-# Warning: value is truncated
-def d2uu(a: f64) -> u64
-def f2d(a: float) -> f64
-# float/f32 (single precision) to f64 (double precision)
-def f2i(a: float) -> int
-# f32 (single precision) to int/i32
-# Warning: value is truncated
-def f2uu(a: float) -> u64
-def i2d(a: int) -> f64
-# int/i32 to f64 (double precision)
-def i2f(a: int) -> float
-# int/i32 to f32 (single precision)
-def i2s(a: int) -> str
-def i2u(a: int) -> u32
-def i2uu(a: int) -> u64
-def s2i(s: str) -> int
-# Convert a str to integer
-def u2i(a: u32) -> int
-def uu2d(a: u64) -> f64
-def uu2f(a: u64) -> float
-def uu2i(a: u64) -> int
-

1.9 libs.os

class Arguments
-# UTF-8 converted arguments and argument count
-# Do not delete, Do not modify:
-    argc: int
-    argv: Array[str]
-class ProcessResult
-# Results of run() execution
-# Must be deleted:
-    ok: bool
-    output: str
-    return_code: int
-def cwd() -> str
-# Get current working directory, or empty string (if failed) on return
-def del_process_result(pr: ProcessResult) -> None
-# Delete process result object
-def exe() -> str
-# Get exe file path, or empty string (if failed) on return
-def exe_path() -> str
-# Get exe directory path, or empty string (if failed) on return
-def get_args() -> Arguments
-# Get arguments
-def getenv(name: str) -> str
-# Get environment variable, empty if not found or error
-def is_macos() -> bool
-# Are we running MacOS?
-def is_windows() -> bool
-# Are we running Windows?
-def run(args: Array[str]) -> ProcessResult
-# Run give [process, arg1, arg2] command line
-def which(binary: str) -> str
-# Try to find full path to binary in $PATH, no need .exe for windows
-# If we cannot find in $PATH, This will fallback to current path and exe path as well
-#
-# Example find zig compiler path:
-#
-# os.which("zig")
-

1.10 libs.os.cpu

class Cpu
-# Extracted CPU information:
-    n_processors: int
-    n_processors_max: int
-    is_guess: bool
-def info() -> Cpu
-# Extract CPU information
-

1.11 libs.os.path

def basename(p: str) -> str
-# Get just the filename of given path
-def dirname(p: str) -> str
-# Get dir name of given path
-def end_with_dot(a: str) -> bool
-# Does the given string end with slash?
-def end_with_slash(a: str) -> bool
-# Does the given string end with slash?
-def executable(p: str) -> bool
-# Is an executable?
-def exists(p: str) -> bool
-# Does the file exist?
-def forward_slash() -> bool
-# Are we using forward slash or not?
-# Same as using libs.os.is_windows()
-def join(a: str, b: str) -> str
-# Do a path join
-def mkdir(p: str) -> bool
-# Create given folder. (Linux uses 0755 permissions)
-# Returns True if successful
-def readable(p: str) -> bool
-# Is a readable?
-def remove_extension(p: str) -> str
-# Remove extension
-def writable(p: str) -> bool
-# Is a writable?
-

1.12 libs.perlin

def noise1d(x: f64) -> f64
-# Get perlin noise in 1d (Calls 3d noise with hardcoded y, z values)
-def noise1df(x: float) -> float
-def noise2d(x: f64, y: f64) -> f64
-# Get perlin noise in 2d
-def noise2df(x: float, y: float) -> float
-# Get perlin noise in 2d
-def noise3d(x: f64, y: f64, z: f64) -> f64
-# Get perlin noise in 3d
-def noise3df(x: float, y: float, z: float) -> float
-# Get perlin noise in 3d
-

1.13 libs.random

def init_random() -> u64
-# Set a seed to random number generator using time (crypto unsafe)
-def random() -> f64
-# Get a random value between 0 - 1 (crypto unsafe)
-def random_between(a: f64, b: f64) -> f64
-# Get a random value between a and b (crypto unsafe)
-def random_betweenf(a: float, b: float) -> float
-# Get a random value between a and b (crypto unsafe)
-def random_u64() -> u64
-# Random unsigned 64bit
-# Uses rand() (crypto unsafe)
-def randomf() -> float
-# Get a random value between 0 - 1 (crypto unsafe)
-def set_seed(seed: u64) -> None
-# Set a seed to random number generator (crypto unsafe)
-

1.14 libs.strings

def contains(haystack: str, needle: str) -> bool
-# Does the string needle contain in string haystack?
-def cut_from(a: str, position: int) -> str
-# Cut a string from given position
-def del_cstr(a: libs.c.CStr) -> None
-# Delete a native c-string created from other other functions (calls free)
-def del_str(a: libs.c.CStr) -> None
-# Delete a normal string that was cast as a c-str with to_cstr
-# You only need to use this if CStr was cast from standard str
-def endswith(a: str, b: str) -> bool
-# Does string a ends with string b
-def find_char(value: str, ch: int) -> int
-# Find first occurance of given character
-def from_cstr(a: libs.c.CStr) -> str
-# Create a string from CStr
-def from_cstrlen(a: libs.c.CStr, length: int) -> str
-# Create a string from CStr with a given length
-def from_cstrlen_after(a: libs.c.CStr, length: int, after: int) -> str
-# Create a new string from CStr from given after location for given length
-def get(s: str, pos: int) -> int
-# Get a single byte from given string and position
-# Warning: Does not do a length check
-# Warning: This copies the string to just get a single byte
-def get_cstr(s: libs.c.CStr, pos: int) -> int
-# Get a single byte from given CStr
-# Warning: Does not do a length check
-def isempty(s: str) -> bool
-# Is this string empty?
-def isempty_cstr(s: libs.c.CStr) -> bool
-# Is an empty CStr?
-def lpad(a: str, count: int) -> str
-# Pad string to left to ensure string length is large or equal to count
-def mid(a: str, position: int, number: int) -> str
-# Cut a string from given position for number characters
-# Returns empty() if input is invalid
-def null_cstr() -> libs.c.CStr
-def ord(s: str) -> int
-# Get first byte of string
-def ord_cstr(s: libs.c.CStr) -> int
-# Get first byte of CStr
-def rpad(a: str, count: int) -> str
-# Pad string to right to ensure string length is large or equal to count
-def set_cstr(s: libs.c.CStr, pos: int, v: int) -> None
-# Set a byte to given CStr position
-# Warning: Does not do a length check
-def spaces(count: int) -> str
-# Get a spaces only string of given count
-def split(value: str, sep: str) -> Array[str]
-# Split a string to a string array
-def startswith(a: str, b: str) -> bool
-# Does the given string a starts with b
-def to_cstr(a: str) -> libs.c.CStr
-# Yaksha copies managed strings that you pass in so must free this
-def valid_cstr(s: libs.c.CStr) -> bool
-# Is a valid CStr
-

1.15 libs.strings.array

def del_str_array(sa: Array[str]) -> None
-# Delete a string array by deleting individual string objects and array itself
-def dup(sa: Array[str]) -> Array[str]
-# Duplicate given array to a new array
-# Both new array and string copies are created
-def extend(a: Array[str], b: Array[str]) -> Array[str]
-# Copy all strings from b to a and return a
-# Warning! You must assign this back to a (as 'a' might be reallocated to a new address)
-def join(values: Array[str], sep: str) -> str
-# Join given string array with given separator and return a single string
-def new(count: int, s: str) -> Array[str]
-# Create new string array
-# Example:
-#
-# import libs.strings.array as sarr
-# my_array: Array[str] = sarr.new(4, "A", "B", "C", "D")
-def prefix(sa: Array[str], prefix_str: str) -> Array[str]
-# Mutate all strings in this array by prefixing with prefix_str
-def suffix(sa: Array[str], suffix_str: str) -> Array[str]
-# Mutate all strings in this array by suffixing with suffix_str
-

1.16 libs.strings.buffer

class StringBuffer
-# String buffer object
-def append(buf: StringBuffer, v: str) -> None
-# Append a string to string buffer
-def del_buf(buf: StringBuffer) -> None
-# Delete string buffer object
-def join(buf: StringBuffer, values: Array[str], sep: str) -> None
-# Join given values in array with provided seperator and append this to string
-def new() -> StringBuffer
-# Create a new empty string buffer
-def new_size(s: int) -> StringBuffer
-# Create a string buffer with capacity s
-def prepend(buf: StringBuffer, v: str) -> None
-# Prepend a string to string buffer
-def to_str(buf: StringBuffer) -> str
-# Get a new string out of string buffer
-

1.17 libs.strings.utf8

class Utf8IterateState
-# Iterator state for UTF-8 iteration
-# See the codepoint for current character:
-    step_size: int
-    codepoint: int
-def del_iter(s: Utf8IterateState) -> None
-# Delete the iterator object after done
-def iterate(s: Utf8IterateState) -> bool
-# Go to next character
-# Returns false if nothing to read or we ran out of length of string
-def new_iter(s: str) -> Utf8IterateState
-# Create a new iterator from given string
-

1.18 libs.thread

BUSY: Const[int]
-# The requested operation failed because a tesource requested by a test and return function is already in use
-ERROR: Const[int]
-# The requested operation failed
-NOMEM: Const[int]
-# The requested operation failed because it was unable to allocate memory
-SLEEP_SUCCES: Const[int]
-# Sleep is successful
-SUCCESS: Const[int]
-# The requested operation succeeded
-TIMEOUT: Const[int]
-# The time specified in the call was reached without acquiring the requested resource
-class Thread
-# Thread Object
-def create(thr: Ptr[Thread], func: Function[In[AnyPtr], Out[int]]) -> int
-# Create a thread with None data. Otherwise same as create_with_data()
-def create_with_data(thr: Ptr[Thread], func: Function[In[AnyPtr], Out[int]], data: AnyPtr) -> int
-# Create a new thread with given reference to Thread and a function that takes AnyPtr and return int
-def current() -> Thread
-# Get current thread object
-def detach(thr: Thread) -> int
-def equal(thr1: Thread, thr2: Thread) -> int
-# Are these two equal?
-def exit(res: int) -> None
-# Exit current thread giving result value
-def join(thr: Thread) -> int
-def join_with_result(thr: Thread, res: Ptr[int]) -> int
-def sleep(seconds: int) -> int
-# Sleep for given seconds
-# SLEEP_SUCCES is returned if successful
-def sleep_ex(duration: Ptr[libs.timespec.TimeSpec], remainder: Ptr[libs.timespec.TimeSpec]) -> int
-# remainder - this parameter will hold the remaining time until time_point upon return
-# SLEEP_SUCCES is returned if successful
-def yield() -> None
-

1.19 libs.thread.condition

class Condition
-# Condition Object
-def broadcast(cnd: Ptr[Condition]) -> int
-def destroy(cnd: Ptr[Condition]) -> None
-def init(cnd: Ptr[Condition]) -> int
-def signal(cnd: Ptr[Condition]) -> int
-def timed_wait(cnd: Ptr[Condition], mtx: Ptr[libs.thread.mutex.Mutex], ts: Ptr[libs.timespec.TimeSpec]) -> int
-def wait(cnd: Ptr[Condition], mtx: Ptr[libs.thread.mutex.Mutex]) -> int
-

1.20 libs.thread.mutex

PLAIN: Const[int]
-RECURSIVE: Const[int]
-TIMED: Const[int]
-class Mutex
-# Mutex Object
-def destroy(mtx: Ptr[Mutex]) -> None
-def init(mtx: Ptr[Mutex], type: int) -> int
-def lock(mtx: Ptr[Mutex]) -> int
-def trylock(mtx: Ptr[Mutex]) -> int
-def unlock(mtx: Ptr[Mutex]) -> int
-

1.21 libs.thread.pool

ERROR_INVALID: Const[int]
-ERROR_LOCK_FAILURE: Const[int]
-ERROR_QUEUE_FULL: Const[int]
-ERROR_SHUTDOWN: Const[int]
-ERROR_THREAD_FAILURE: Const[int]
-GRACEFUL_SHUTDOWN: Const[int]
-# We are waiting for tasks to be completed
-IMMEDIATE_SHUTDOWN: Const[int]
-# Default (shutdown all threads forcefully) and close the pool
-MAX_QUEUE_SIZE: Const[u32]
-# Maximum queue size for thread pool
-MAX_THREAD_SIZE: Const[u8]
-# Maximum threads we can create is 64
-NO_SHUTDOWN: Const[int]
-# Not going to shutdown
-SUCCESS: Const[int]
-class ThreadPool
-# Thread pool object:
-    lock: libs.thread.mutex.Mutex
-    notify: libs.thread.condition.Condition
-    threads: Array[libs.thread.Thread]
-    queue: Array[Tuple[Function[In[AnyPtr], Out], AnyPtr]]
-    thread_count: int
-    queue_size: int
-    head: int
-    tail: int
-    count: int
-    shutdown: int
-    started: int
-def add(tpool: ThreadPool, func: Function[In[AnyPtr], Out], arg: AnyPtr) -> int
-# Add given task to the thread pool to be executed
-# returns SUCCESS if successful
-def create(thread_count: u8, queue_size: u32) -> ThreadPool
-# Create a new thread pool with given thread count and queue size
-# On success ThreadPool is returned else, it should be equal to None
-def destroy(tpool: ThreadPool, graceful: bool) -> int
-# Attempt to destroy thread pool, if SUCCESS is returned pool is deallocated as well
-def internal_del_pool(tpool: ThreadPool) -> int
-# Clean up thread pool data
-def internal_tpool_work(tpool_obj: AnyPtr) -> int
-# Perform work as a thread in the managed thread pool
-

1.22 libs.thread.tss

class Key
-# Key to access/create thread specific storage
-# Declare a variable and use with getref() when calling create()
-def create(key: Ptr[Key]) -> int
-# Create with no auto deletion
-def create_with_deleter(key: Ptr[Key], deleter: Function[In[AnyPtr], Out]) -> int
-# Create TSS with a custom deleter function
-def del_data(key: Key) -> None
-def get(key: Key) -> AnyPtr
-def set(key: Key, data: AnyPtr) -> int
-

1.23 libs.timespec

class TimeSpec
-def add_nanoseconds(a: Ptr[TimeSpec], n: i64) -> None
-def add_seconds(a: Ptr[TimeSpec], n: int) -> None
-def compare_ex(a: Ptr[TimeSpec], b: Ptr[TimeSpec]) -> i64
-def create() -> TimeSpec
-def create_ex(seconds: int) -> TimeSpec
-def equal(a: TimeSpec, b: TimeSpec) -> bool
-# is a == b
-def get_nanoseconds(t: TimeSpec) -> i64
-def get_seconds(t: TimeSpec) -> int
-def get_utc_now(t: Ptr[TimeSpec]) -> bool
-# Load UTC now into given pointer
-# If successful True is returned
-def greater(a: TimeSpec, b: TimeSpec) -> bool
-# is a > b ?
-def in_future(seconds: int) -> TimeSpec
-def in_future_ex(seconds: int, nanoseconds: i64) -> TimeSpec
-def lessser(a: TimeSpec, b: TimeSpec) -> bool
-# is a < b ?
-def now() -> TimeSpec
-


2 Raylib

Created 2022-08-14, Last Updated 2023-04-07

Raylib can be accessed by importing raylib.

raylib is created by Ramon Santamaria and contributors.

Yaksha wraps raylib using a generator script.

2.1 raylib

BLEND_ADDITIVE: Const[int]
-# Blend textures adding colors
-BLEND_ADD_COLORS: Const[int]
-# Blend textures adding colors (alternative)
-BLEND_ALPHA: Const[int]
-# Blend textures considering alpha (default)
-BLEND_ALPHA_PREMULTIPLY: Const[int]
-# Blend premultiplied textures considering alpha
-BLEND_CUSTOM: Const[int]
-# Blend textures using custom src/dst factors (use rlSetBlendFactors())
-BLEND_CUSTOM_SEPARATE: Const[int]
-# Blend textures using custom rgb/alpha separate src/dst factors (use rlSetBlendFactorsSeparate())
-BLEND_MULTIPLIED: Const[int]
-# Blend textures multiplying colors
-BLEND_SUBTRACT_COLORS: Const[int]
-# Blend textures subtracting colors (alternative)
-CAMERA_CUSTOM: Const[int]
-# Custom camera
-CAMERA_FIRST_PERSON: Const[int]
-# First person camera
-CAMERA_FREE: Const[int]
-# Free camera
-CAMERA_ORBITAL: Const[int]
-# Orbital camera
-CAMERA_ORTHOGRAPHIC: Const[int]
-# Orthographic projection
-CAMERA_PERSPECTIVE: Const[int]
-# Perspective projection
-CAMERA_THIRD_PERSON: Const[int]
-# Third person camera
-CUBEMAP_LAYOUT_AUTO_DETECT: Const[int]
-# Automatically detect layout type
-CUBEMAP_LAYOUT_CROSS_FOUR_BY_THREE: Const[int]
-# Layout is defined by a 4x3 cross with cubemap faces
-CUBEMAP_LAYOUT_CROSS_THREE_BY_FOUR: Const[int]
-# Layout is defined by a 3x4 cross with cubemap faces
-CUBEMAP_LAYOUT_LINE_HORIZONTAL: Const[int]
-# Layout is defined by a horizontal line with faces
-CUBEMAP_LAYOUT_LINE_VERTICAL: Const[int]
-# Layout is defined by a vertical line with faces
-CUBEMAP_LAYOUT_PANORAMA: Const[int]
-# Layout is defined by a panorama image (equirrectangular map)
-FLAG_FULLSCREEN_MODE: Const[int]
-# Set to run program in fullscreen
-FLAG_INTERLACED_HINT: Const[int]
-# Set to try enabling interlaced video format (for V3D)
-FLAG_MSAA_4X_HINT: Const[int]
-# Set to try enabling MSAA 4X
-FLAG_VSYNC_HINT: Const[int]
-# Set to try enabling V-Sync on GPU
-FLAG_WINDOW_ALWAYS_RUN: Const[int]
-# Set to allow windows running while minimized
-FLAG_WINDOW_HIDDEN: Const[int]
-# Set to hide window
-FLAG_WINDOW_HIGHDPI: Const[int]
-# Set to support HighDPI
-FLAG_WINDOW_MAXIMIZED: Const[int]
-# Set to maximize window (expanded to monitor)
-FLAG_WINDOW_MINIMIZED: Const[int]
-# Set to minimize window (iconify)
-FLAG_WINDOW_MOUSE_PASSTHROUGH: Const[int]
-# Set to support mouse passthrough, only supported when FLAG_WINDOW_UNDECORATED
-FLAG_WINDOW_RESIZABLE: Const[int]
-# Set to allow resizable window
-FLAG_WINDOW_TOPMOST: Const[int]
-# Set to window always on top
-FLAG_WINDOW_TRANSPARENT: Const[int]
-# Set to allow transparent framebuffer
-FLAG_WINDOW_UNDECORATED: Const[int]
-# Set to disable window decoration (frame and buttons)
-FLAG_WINDOW_UNFOCUSED: Const[int]
-# Set to window non focused
-FONT_BITMAP: Const[int]
-# Bitmap font generation, no anti-aliasing
-FONT_DEFAULT: Const[int]
-# Default font generation, anti-aliased
-FONT_SDF: Const[int]
-# SDF font generation, requires external shader
-GAMEPAD_AXIS_LEFT_TRIGGER: Const[int]
-# Gamepad back trigger left, pressure level: [1..-1]
-GAMEPAD_AXIS_LEFT_X: Const[int]
-# Gamepad left stick X axis
-GAMEPAD_AXIS_LEFT_Y: Const[int]
-# Gamepad left stick Y axis
-GAMEPAD_AXIS_RIGHT_TRIGGER: Const[int]
-# Gamepad back trigger right, pressure level: [1..-1]
-GAMEPAD_AXIS_RIGHT_X: Const[int]
-# Gamepad right stick X axis
-GAMEPAD_AXIS_RIGHT_Y: Const[int]
-# Gamepad right stick Y axis
-GAMEPAD_BUTTON_LEFT_FACE_DOWN: Const[int]
-# Gamepad left DPAD down button
-GAMEPAD_BUTTON_LEFT_FACE_LEFT: Const[int]
-# Gamepad left DPAD left button
-GAMEPAD_BUTTON_LEFT_FACE_RIGHT: Const[int]
-# Gamepad left DPAD right button
-GAMEPAD_BUTTON_LEFT_FACE_UP: Const[int]
-# Gamepad left DPAD up button
-GAMEPAD_BUTTON_LEFT_THUMB: Const[int]
-# Gamepad joystick pressed button left
-GAMEPAD_BUTTON_LEFT_TRIGGER_1: Const[int]
-# Gamepad top/back trigger left (first), it could be a trailing button
-GAMEPAD_BUTTON_LEFT_TRIGGER_2: Const[int]
-# Gamepad top/back trigger left (second), it could be a trailing button
-GAMEPAD_BUTTON_MIDDLE: Const[int]
-# Gamepad center buttons, middle one (i.e. PS3: PS, Xbox: XBOX)
-GAMEPAD_BUTTON_MIDDLE_LEFT: Const[int]
-# Gamepad center buttons, left one (i.e. PS3: Select)
-GAMEPAD_BUTTON_MIDDLE_RIGHT: Const[int]
-# Gamepad center buttons, right one (i.e. PS3: Start)
-GAMEPAD_BUTTON_RIGHT_FACE_DOWN: Const[int]
-# Gamepad right button down (i.e. PS3: Cross, Xbox: A)
-GAMEPAD_BUTTON_RIGHT_FACE_LEFT: Const[int]
-# Gamepad right button left (i.e. PS3: Circle, Xbox: B)
-GAMEPAD_BUTTON_RIGHT_FACE_RIGHT: Const[int]
-# Gamepad right button right (i.e. PS3: Square, Xbox: X)
-GAMEPAD_BUTTON_RIGHT_FACE_UP: Const[int]
-# Gamepad right button up (i.e. PS3: Triangle, Xbox: Y)
-GAMEPAD_BUTTON_RIGHT_THUMB: Const[int]
-# Gamepad joystick pressed button right
-GAMEPAD_BUTTON_RIGHT_TRIGGER_1: Const[int]
-# Gamepad top/back trigger right (one), it could be a trailing button
-GAMEPAD_BUTTON_RIGHT_TRIGGER_2: Const[int]
-# Gamepad top/back trigger right (second), it could be a trailing button
-GAMEPAD_BUTTON_UNKNOWN: Const[int]
-# Unknown button, just for error checking
-GESTURE_DOUBLETAP: Const[int]
-# Double tap gesture
-GESTURE_DRAG: Const[int]
-# Drag gesture
-GESTURE_HOLD: Const[int]
-# Hold gesture
-GESTURE_NONE: Const[int]
-# No gesture
-GESTURE_PINCH_IN: Const[int]
-# Pinch in gesture
-GESTURE_PINCH_OUT: Const[int]
-# Pinch out gesture
-GESTURE_SWIPE_DOWN: Const[int]
-# Swipe down gesture
-GESTURE_SWIPE_LEFT: Const[int]
-# Swipe left gesture
-GESTURE_SWIPE_RIGHT: Const[int]
-# Swipe right gesture
-GESTURE_SWIPE_UP: Const[int]
-# Swipe up gesture
-GESTURE_TAP: Const[int]
-# Tap gesture
-KEY_A: Const[int]
-# Key: A | a
-KEY_APOSTROPHE: Const[int]
-# Key: '
-KEY_B: Const[int]
-# Key: B | b
-KEY_BACK: Const[int]
-# Key: Android back button
-KEY_BACKSLASH: Const[int]
-# Key: '\'
-KEY_BACKSPACE: Const[int]
-# Key: Backspace
-KEY_C: Const[int]
-# Key: C | c
-KEY_CAPS_LOCK: Const[int]
-# Key: Caps lock
-KEY_COMMA: Const[int]
-# Key: ,
-KEY_D: Const[int]
-# Key: D | d
-KEY_DELETE: Const[int]
-# Key: Del
-KEY_DOWN: Const[int]
-# Key: Cursor down
-KEY_E: Const[int]
-# Key: E | e
-KEY_EIGHT: Const[int]
-# Key: 8
-KEY_END: Const[int]
-# Key: End
-KEY_ENTER: Const[int]
-# Key: Enter
-KEY_EQUAL: Const[int]
-# Key: =
-KEY_ESCAPE: Const[int]
-# Key: Esc
-KEY_F: Const[int]
-# Key: F | f
-KEY_F1: Const[int]
-# Key: F1
-KEY_F10: Const[int]
-# Key: F10
-KEY_F11: Const[int]
-# Key: F11
-KEY_F12: Const[int]
-# Key: F12
-KEY_F2: Const[int]
-# Key: F2
-KEY_F3: Const[int]
-# Key: F3
-KEY_F4: Const[int]
-# Key: F4
-KEY_F5: Const[int]
-# Key: F5
-KEY_F6: Const[int]
-# Key: F6
-KEY_F7: Const[int]
-# Key: F7
-KEY_F8: Const[int]
-# Key: F8
-KEY_F9: Const[int]
-# Key: F9
-KEY_FIVE: Const[int]
-# Key: 5
-KEY_FOUR: Const[int]
-# Key: 4
-KEY_G: Const[int]
-# Key: G | g
-KEY_GRAVE: Const[int]
-# Key: `
-KEY_H: Const[int]
-# Key: H | h
-KEY_HOME: Const[int]
-# Key: Home
-KEY_I: Const[int]
-# Key: I | i
-KEY_INSERT: Const[int]
-# Key: Ins
-KEY_J: Const[int]
-# Key: J | j
-KEY_K: Const[int]
-# Key: K | k
-KEY_KB_MENU: Const[int]
-# Key: KB menu
-KEY_KP_0: Const[int]
-# Key: Keypad 0
-KEY_KP_1: Const[int]
-# Key: Keypad 1
-KEY_KP_2: Const[int]
-# Key: Keypad 2
-KEY_KP_3: Const[int]
-# Key: Keypad 3
-KEY_KP_4: Const[int]
-# Key: Keypad 4
-KEY_KP_5: Const[int]
-# Key: Keypad 5
-KEY_KP_6: Const[int]
-# Key: Keypad 6
-KEY_KP_7: Const[int]
-# Key: Keypad 7
-KEY_KP_8: Const[int]
-# Key: Keypad 8
-KEY_KP_9: Const[int]
-# Key: Keypad 9
-KEY_KP_ADD: Const[int]
-# Key: Keypad +
-KEY_KP_DECIMAL: Const[int]
-# Key: Keypad .
-KEY_KP_DIVIDE: Const[int]
-# Key: Keypad /
-KEY_KP_ENTER: Const[int]
-# Key: Keypad Enter
-KEY_KP_EQUAL: Const[int]
-# Key: Keypad =
-KEY_KP_MULTIPLY: Const[int]
-# Key: Keypad *
-KEY_KP_SUBTRACT: Const[int]
-# Key: Keypad -
-KEY_L: Const[int]
-# Key: L | l
-KEY_LEFT: Const[int]
-# Key: Cursor left
-KEY_LEFT_ALT: Const[int]
-# Key: Alt left
-KEY_LEFT_BRACKET: Const[int]
-# Key: [
-KEY_LEFT_CONTROL: Const[int]
-# Key: Control left
-KEY_LEFT_SHIFT: Const[int]
-# Key: Shift left
-KEY_LEFT_SUPER: Const[int]
-# Key: Super left
-KEY_M: Const[int]
-# Key: M | m
-KEY_MENU: Const[int]
-# Key: Android menu button
-KEY_MINUS: Const[int]
-# Key: -
-KEY_N: Const[int]
-# Key: N | n
-KEY_NINE: Const[int]
-# Key: 9
-KEY_NULL: Const[int]
-# Key: NULL, used for no key pressed
-KEY_NUM_LOCK: Const[int]
-# Key: Num lock
-KEY_O: Const[int]
-# Key: O | o
-KEY_ONE: Const[int]
-# Key: 1
-KEY_P: Const[int]
-# Key: P | p
-KEY_PAGE_DOWN: Const[int]
-# Key: Page down
-KEY_PAGE_UP: Const[int]
-# Key: Page up
-KEY_PAUSE: Const[int]
-# Key: Pause
-KEY_PERIOD: Const[int]
-# Key: .
-KEY_PRINT_SCREEN: Const[int]
-# Key: Print screen
-KEY_Q: Const[int]
-# Key: Q | q
-KEY_R: Const[int]
-# Key: R | r
-KEY_RIGHT: Const[int]
-# Key: Cursor right
-KEY_RIGHT_ALT: Const[int]
-# Key: Alt right
-KEY_RIGHT_BRACKET: Const[int]
-# Key: ]
-KEY_RIGHT_CONTROL: Const[int]
-# Key: Control right
-KEY_RIGHT_SHIFT: Const[int]
-# Key: Shift right
-KEY_RIGHT_SUPER: Const[int]
-# Key: Super right
-KEY_S: Const[int]
-# Key: S | s
-KEY_SCROLL_LOCK: Const[int]
-# Key: Scroll down
-KEY_SEMICOLON: Const[int]
-# Key: ;
-KEY_SEVEN: Const[int]
-# Key: 7
-KEY_SIX: Const[int]
-# Key: 6
-KEY_SLASH: Const[int]
-# Key: /
-KEY_SPACE: Const[int]
-# Key: Space
-KEY_T: Const[int]
-# Key: T | t
-KEY_TAB: Const[int]
-# Key: Tab
-KEY_THREE: Const[int]
-# Key: 3
-KEY_TWO: Const[int]
-# Key: 2
-KEY_U: Const[int]
-# Key: U | u
-KEY_UP: Const[int]
-# Key: Cursor up
-KEY_V: Const[int]
-# Key: V | v
-KEY_VOLUME_DOWN: Const[int]
-# Key: Android volume down button
-KEY_VOLUME_UP: Const[int]
-# Key: Android volume up button
-KEY_W: Const[int]
-# Key: W | w
-KEY_X: Const[int]
-# Key: X | x
-KEY_Y: Const[int]
-# Key: Y | y
-KEY_Z: Const[int]
-# Key: Z | z
-KEY_ZERO: Const[int]
-# Key: 0
-LOG_ALL: Const[int]
-# Display all logs
-LOG_DEBUG: Const[int]
-# Debug logging, used for internal debugging, it should be disabled on release builds
-LOG_ERROR: Const[int]
-# Error logging, used on unrecoverable failures
-LOG_FATAL: Const[int]
-# Fatal logging, used to abort program: exit(EXIT_FAILURE)
-LOG_INFO: Const[int]
-# Info logging, used for program execution info
-LOG_NONE: Const[int]
-# Disable logging
-LOG_TRACE: Const[int]
-# Trace logging, intended for internal use only
-LOG_WARNING: Const[int]
-# Warning logging, used on recoverable failures
-MATERIAL_MAP_ALBEDO: Const[int]
-# Albedo material (same as: MATERIAL_MAP_DIFFUSE)
-MATERIAL_MAP_BRDF: Const[int]
-# Brdf material
-MATERIAL_MAP_CUBEMAP: Const[int]
-# Cubemap material (NOTE: Uses GL_TEXTURE_CUBE_MAP)
-MATERIAL_MAP_EMISSION: Const[int]
-# Emission material
-MATERIAL_MAP_HEIGHT: Const[int]
-# Heightmap material
-MATERIAL_MAP_IRRADIANCE: Const[int]
-# Irradiance material (NOTE: Uses GL_TEXTURE_CUBE_MAP)
-MATERIAL_MAP_METALNESS: Const[int]
-# Metalness material (same as: MATERIAL_MAP_SPECULAR)
-MATERIAL_MAP_NORMAL: Const[int]
-# Normal material
-MATERIAL_MAP_OCCLUSION: Const[int]
-# Ambient occlusion material
-MATERIAL_MAP_PREFILTER: Const[int]
-# Prefilter material (NOTE: Uses GL_TEXTURE_CUBE_MAP)
-MATERIAL_MAP_ROUGHNESS: Const[int]
-# Roughness material
-MOUSE_BUTTON_BACK: Const[int]
-# Mouse button back (advanced mouse device)
-MOUSE_BUTTON_EXTRA: Const[int]
-# Mouse button extra (advanced mouse device)
-MOUSE_BUTTON_FORWARD: Const[int]
-# Mouse button forward (advanced mouse device)
-MOUSE_BUTTON_LEFT: Const[int]
-# Mouse button left
-MOUSE_BUTTON_MIDDLE: Const[int]
-# Mouse button middle (pressed wheel)
-MOUSE_BUTTON_RIGHT: Const[int]
-# Mouse button right
-MOUSE_BUTTON_SIDE: Const[int]
-# Mouse button side (advanced mouse device)
-MOUSE_CURSOR_ARROW: Const[int]
-# Arrow shape
-MOUSE_CURSOR_CROSSHAIR: Const[int]
-# Cross shape
-MOUSE_CURSOR_DEFAULT: Const[int]
-# Default pointer shape
-MOUSE_CURSOR_IBEAM: Const[int]
-# Text writing cursor shape
-MOUSE_CURSOR_NOT_ALLOWED: Const[int]
-# The operation-not-allowed shape
-MOUSE_CURSOR_POINTING_HAND: Const[int]
-# Pointing hand cursor
-MOUSE_CURSOR_RESIZE_ALL: Const[int]
-# The omnidirectional resize/move cursor shape
-MOUSE_CURSOR_RESIZE_EW: Const[int]
-# Horizontal resize/move arrow shape
-MOUSE_CURSOR_RESIZE_NESW: Const[int]
-# The top-right to bottom-left diagonal resize/move arrow shape
-MOUSE_CURSOR_RESIZE_NS: Const[int]
-# Vertical resize/move arrow shape
-MOUSE_CURSOR_RESIZE_NWSE: Const[int]
-# Top-left to bottom-right diagonal resize/move arrow shape
-NPATCH_NINE_PATCH: Const[int]
-# Npatch layout: 3x3 tiles
-NPATCH_THREE_PATCH_HORIZONTAL: Const[int]
-# Npatch layout: 3x1 tiles
-NPATCH_THREE_PATCH_VERTICAL: Const[int]
-# Npatch layout: 1x3 tiles
-PIXELFORMAT_COMPRESSED_ASTC_4x4_RGBA: Const[int]
-# 8 bpp
-PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA: Const[int]
-# 2 bpp
-PIXELFORMAT_COMPRESSED_DXT1_RGB: Const[int]
-# 4 bpp (no alpha)
-PIXELFORMAT_COMPRESSED_DXT1_RGBA: Const[int]
-# 4 bpp (1 bit alpha)
-PIXELFORMAT_COMPRESSED_DXT3_RGBA: Const[int]
-# 8 bpp
-PIXELFORMAT_COMPRESSED_DXT5_RGBA: Const[int]
-# 8 bpp
-PIXELFORMAT_COMPRESSED_ETC1_RGB: Const[int]
-# 4 bpp
-PIXELFORMAT_COMPRESSED_ETC2_EAC_RGBA: Const[int]
-# 8 bpp
-PIXELFORMAT_COMPRESSED_ETC2_RGB: Const[int]
-# 4 bpp
-PIXELFORMAT_COMPRESSED_PVRT_RGB: Const[int]
-# 4 bpp
-PIXELFORMAT_COMPRESSED_PVRT_RGBA: Const[int]
-# 4 bpp
-PIXELFORMAT_UNCOMPRESSED_GRAYSCALE: Const[int]
-# 8 bit per pixel (no alpha)
-PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA: Const[int]
-# 8*2 bpp (2 channels)
-PIXELFORMAT_UNCOMPRESSED_R32: Const[int]
-# 32 bpp (1 channel - float)
-PIXELFORMAT_UNCOMPRESSED_R32G32B32: Const[int]
-# 32*3 bpp (3 channels - float)
-PIXELFORMAT_UNCOMPRESSED_R32G32B32A32: Const[int]
-# 32*4 bpp (4 channels - float)
-PIXELFORMAT_UNCOMPRESSED_R4G4B4A4: Const[int]
-# 16 bpp (4 bit alpha)
-PIXELFORMAT_UNCOMPRESSED_R5G5B5A1: Const[int]
-# 16 bpp (1 bit alpha)
-PIXELFORMAT_UNCOMPRESSED_R5G6B5: Const[int]
-# 16 bpp
-PIXELFORMAT_UNCOMPRESSED_R8G8B8: Const[int]
-# 24 bpp
-PIXELFORMAT_UNCOMPRESSED_R8G8B8A8: Const[int]
-# 32 bpp
-SHADER_ATTRIB_FLOAT: Const[int]
-# Shader attribute type: float
-SHADER_ATTRIB_VEC2: Const[int]
-# Shader attribute type: vec2 (2 float)
-SHADER_ATTRIB_VEC3: Const[int]
-# Shader attribute type: vec3 (3 float)
-SHADER_ATTRIB_VEC4: Const[int]
-# Shader attribute type: vec4 (4 float)
-SHADER_LOC_COLOR_AMBIENT: Const[int]
-# Shader location: vector uniform: ambient color
-SHADER_LOC_COLOR_DIFFUSE: Const[int]
-# Shader location: vector uniform: diffuse color
-SHADER_LOC_COLOR_SPECULAR: Const[int]
-# Shader location: vector uniform: specular color
-SHADER_LOC_MAP_ALBEDO: Const[int]
-# Shader location: sampler2d texture: albedo (same as: SHADER_LOC_MAP_DIFFUSE)
-SHADER_LOC_MAP_BRDF: Const[int]
-# Shader location: sampler2d texture: brdf
-SHADER_LOC_MAP_CUBEMAP: Const[int]
-# Shader location: samplerCube texture: cubemap
-SHADER_LOC_MAP_EMISSION: Const[int]
-# Shader location: sampler2d texture: emission
-SHADER_LOC_MAP_HEIGHT: Const[int]
-# Shader location: sampler2d texture: height
-SHADER_LOC_MAP_IRRADIANCE: Const[int]
-# Shader location: samplerCube texture: irradiance
-SHADER_LOC_MAP_METALNESS: Const[int]
-# Shader location: sampler2d texture: metalness (same as: SHADER_LOC_MAP_SPECULAR)
-SHADER_LOC_MAP_NORMAL: Const[int]
-# Shader location: sampler2d texture: normal
-SHADER_LOC_MAP_OCCLUSION: Const[int]
-# Shader location: sampler2d texture: occlusion
-SHADER_LOC_MAP_PREFILTER: Const[int]
-# Shader location: samplerCube texture: prefilter
-SHADER_LOC_MAP_ROUGHNESS: Const[int]
-# Shader location: sampler2d texture: roughness
-SHADER_LOC_MATRIX_MODEL: Const[int]
-# Shader location: matrix uniform: model (transform)
-SHADER_LOC_MATRIX_MVP: Const[int]
-# Shader location: matrix uniform: model-view-projection
-SHADER_LOC_MATRIX_NORMAL: Const[int]
-# Shader location: matrix uniform: normal
-SHADER_LOC_MATRIX_PROJECTION: Const[int]
-# Shader location: matrix uniform: projection
-SHADER_LOC_MATRIX_VIEW: Const[int]
-# Shader location: matrix uniform: view (camera transform)
-SHADER_LOC_VECTOR_VIEW: Const[int]
-# Shader location: vector uniform: view
-SHADER_LOC_VERTEX_COLOR: Const[int]
-# Shader location: vertex attribute: color
-SHADER_LOC_VERTEX_NORMAL: Const[int]
-# Shader location: vertex attribute: normal
-SHADER_LOC_VERTEX_POSITION: Const[int]
-# Shader location: vertex attribute: position
-SHADER_LOC_VERTEX_TANGENT: Const[int]
-# Shader location: vertex attribute: tangent
-SHADER_LOC_VERTEX_TEXCOORD01: Const[int]
-# Shader location: vertex attribute: texcoord01
-SHADER_LOC_VERTEX_TEXCOORD02: Const[int]
-# Shader location: vertex attribute: texcoord02
-SHADER_UNIFORM_FLOAT: Const[int]
-# Shader uniform type: float
-SHADER_UNIFORM_INT: Const[int]
-# Shader uniform type: int
-SHADER_UNIFORM_IVEC2: Const[int]
-# Shader uniform type: ivec2 (2 int)
-SHADER_UNIFORM_IVEC3: Const[int]
-# Shader uniform type: ivec3 (3 int)
-SHADER_UNIFORM_IVEC4: Const[int]
-# Shader uniform type: ivec4 (4 int)
-SHADER_UNIFORM_SAMPLER2D: Const[int]
-# Shader uniform type: sampler2d
-SHADER_UNIFORM_VEC2: Const[int]
-# Shader uniform type: vec2 (2 float)
-SHADER_UNIFORM_VEC3: Const[int]
-# Shader uniform type: vec3 (3 float)
-SHADER_UNIFORM_VEC4: Const[int]
-# Shader uniform type: vec4 (4 float)
-TEXTURE_FILTER_ANISOTROPIC_16X: Const[int]
-# Anisotropic filtering 16x
-TEXTURE_FILTER_ANISOTROPIC_4X: Const[int]
-# Anisotropic filtering 4x
-TEXTURE_FILTER_ANISOTROPIC_8X: Const[int]
-# Anisotropic filtering 8x
-TEXTURE_FILTER_BILINEAR: Const[int]
-# Linear filtering
-TEXTURE_FILTER_POINT: Const[int]
-# No filter, just pixel approximation
-TEXTURE_FILTER_TRILINEAR: Const[int]
-# Trilinear filtering (linear with mipmaps)
-TEXTURE_WRAP_CLAMP: Const[int]
-# Clamps texture to edge pixel in tiled mode
-TEXTURE_WRAP_MIRROR_CLAMP: Const[int]
-# Mirrors and clamps to border the texture in tiled mode
-TEXTURE_WRAP_MIRROR_REPEAT: Const[int]
-# Mirrors and repeats the texture in tiled mode
-TEXTURE_WRAP_REPEAT: Const[int]
-# Repeats texture in tiled mode
-class AudioStream
-# AudioStream, custom audio stream
-class BoneInfo
-# Bone, skeletal animation bone
-class BoundingBox
-# BoundingBox:
-    min: Vector3
-    max: Vector3
-class CChar32
-class CFloat2
-class CFloat4
-class Camera
-# Camera type fallback, defaults to Camera3D:
-    position: Vector3
-    target: Vector3
-    up: Vector3
-    fovy: float
-    projection: libs.c.CInt
-class Camera2D
-# Camera2D, defines position/orientation in 2d space:
-    offset: Vector2
-    target: Vector2
-    rotation: float
-    zoom: float
-class Camera3D
-# Camera, defines position/orientation in 3d space:
-    position: Vector3
-    target: Vector3
-    up: Vector3
-    fovy: float
-    projection: libs.c.CInt
-class Color
-# Color, 4 components, R8G8B8A8 (32bit):
-    r: libs.c.CUChar
-    g: libs.c.CUChar
-    b: libs.c.CUChar
-    a: libs.c.CUChar
-class DTMatrix2
-class FilePathList
-# File path list
-class Font
-# Font, font texture and GlyphInfo array data:
-    baseSize: libs.c.CInt
-    glyphCount: libs.c.CInt
-    glyphPadding: libs.c.CInt
-    texture: Texture2D
-    recs: Ptr[Rectangle]
-    glyphs: Ptr[GlyphInfo]
-class GlyphInfo
-# GlyphInfo, font characters glyphs info:
-    value: libs.c.CInt
-    offsetX: libs.c.CInt
-    offsetY: libs.c.CInt
-    advanceX: libs.c.CInt
-    image: Image
-class Image
-# Image, pixel data stored in CPU memory (RAM):
-    data: AnyPtr
-    width: libs.c.CInt
-    height: libs.c.CInt
-    mipmaps: libs.c.CInt
-    format: libs.c.CInt
-class Material
-# Material, includes shader and maps
-class MaterialMap
-# MaterialMap:
-    texture: Texture2D
-    color: Color
-    value: float
-class Matrix
-# Matrix, 4x4 components, column major, OpenGL style, right-handed:
-    m0: float
-    m4: float
-    m8: float
-    m12: float
-    m1: float
-    m5: float
-    m9: float
-    m13: float
-    m2: float
-    m6: float
-    m10: float
-    m14: float
-    m3: float
-    m7: float
-    m11: float
-    m15: float
-class Mesh
-# Mesh, vertex data and vao/vbo
-class Model
-# Model, meshes, materials and animation data
-class ModelAnimation
-# ModelAnimation
-class Music
-# Music, audio stream, anything longer than ~10 seconds should be streamed:
-    stream: AudioStream
-    frameCount: libs.c.CUInt
-    looping: bool
-    ctxType: libs.c.CInt
-    ctxData: AnyPtr
-class NPatchInfo
-# NPatchInfo, n-patch layout info:
-    source: Rectangle
-    left: libs.c.CInt
-    top: libs.c.CInt
-    right: libs.c.CInt
-    bottom: libs.c.CInt
-    layout: libs.c.CInt
-class Quaternion
-# Quaternion, 4 components (Vector4 alias):
-    x: float
-    y: float
-    z: float
-    w: float
-class RAudioBufferPtr
-class RAudioProcessorPtr
-class Ray
-# Ray, ray for raycasting:
-    position: Vector3
-    direction: Vector3
-class RayCollision
-# RayCollision, ray hit information:
-    hit: bool
-    distance: float
-    point: Vector3
-    normal: Vector3
-class Rectangle
-# Rectangle, 4 components:
-    x: float
-    y: float
-    width: float
-    height: float
-class RenderTexture
-# RenderTexture, fbo for texture rendering:
-    id: libs.c.CUInt
-    texture: Texture
-    depth: Texture
-class RenderTexture2D
-# RenderTexture2D, same as RenderTexture:
-    id: libs.c.CUInt
-    p_texture: Texture
-    depth: Texture
-class Shader
-# Shader
-class Sound
-# Sound:
-    stream: AudioStream
-    frameCount: libs.c.CUInt
-class Texture
-# Texture, tex data stored in GPU memory (VRAM):
-    id: libs.c.CUInt
-    width: libs.c.CInt
-    height: libs.c.CInt
-    mipmaps: libs.c.CInt
-    format: libs.c.CInt
-class Texture2D
-# Texture2D, same as Texture:
-    id: libs.c.CUInt
-    width: libs.c.CInt
-    height: libs.c.CInt
-    mipmaps: libs.c.CInt
-    format: libs.c.CInt
-class TextureCubemap
-# TextureCubemap, same as Texture:
-    id: libs.c.CUInt
-    width: libs.c.CInt
-    height: libs.c.CInt
-    mipmaps: libs.c.CInt
-    format: libs.c.CInt
-class Transform
-# Transform, vertex transformation data:
-    translation: Vector3
-    rotation: Quaternion
-    scale: Vector3
-class Vector2
-# Vector2, 2 components:
-    x: float
-    y: float
-class Vector3
-# Vector3, 3 components:
-    x: float
-    y: float
-    z: float
-class Vector4
-# Vector4, 4 components:
-    x: float
-    y: float
-    z: float
-    w: float
-class VrDeviceInfo
-# VrDeviceInfo, Head-Mounted-Display device parameters
-class VrStereoConfig
-# VrStereoConfig, VR stereo rendering configuration for simulator
-class Wave
-# Wave, audio wave data:
-    frameCount: libs.c.CUInt
-    sampleRate: libs.c.CUInt
-    sampleSize: libs.c.CUInt
-    channels: libs.c.CUInt
-    data: AnyPtr
-def begin_blend_mode(mode: int) -> None
-# Begin blending mode (alpha, additive, multiplied, subtract, custom)
-def begin_drawing() -> None
-# Setup canvas (framebuffer) to start drawing
-def begin_mode_2d(p_camera: Camera2D) -> None
-# Begin 2D mode with custom camera (2D)
-def begin_mode_3d(p_camera: Camera3D) -> None
-# Begin 3D mode with custom camera (3D)
-def begin_scissor_mode(x: int, y: int, width: int, height: int) -> None
-# Begin scissor mode (define screen area for following drawing)
-def begin_shader_mode(shader: Shader) -> None
-# Begin custom shader drawing
-def begin_texture_mode(target: RenderTexture2D) -> None
-# Begin drawing to render texture
-def begin_vr_stereo_mode(config: VrStereoConfig) -> None
-# Begin stereo rendering (requires VR simulator)
-def bounding_box(min: Vector3, max: Vector3) -> BoundingBox
-# Factory function for: BoundingBox
-def camera(position: Vector3, target: Vector3, up: Vector3, fovy: float, projection: int) -> Camera
-# Factory function for: Camera
-def camera_2d(offset: Vector2, target: Vector2, rotation: float, zoom: float) -> Camera2D
-# Factory function for: Camera2D
-def camera_3d(position: Vector3, target: Vector3, up: Vector3, fovy: float, projection: int) -> Camera3D
-# Factory function for: Camera3D
-def change_directory(dir: str) -> bool
-# Change working directory, return true on success
-def check_collision_box_sphere(box: BoundingBox, center: Vector3, radius: float) -> bool
-# Check collision between box and sphere
-def check_collision_boxes(box1: BoundingBox, box2: BoundingBox) -> bool
-# Check collision between two bounding boxes
-def check_collision_circle_rec(center: Vector2, radius: float, rec: Rectangle) -> bool
-# Check collision between circle and rectangle
-def check_collision_circles(center1: Vector2, radius1: float, center2: Vector2, radius2: float) -> bool
-# Check collision between two circles
-def check_collision_lines(start_pos1: Vector2, end_pos1: Vector2, start_pos2: Vector2, end_pos2: Vector2, collision_point: Ptr[Vector2]) -> bool
-# Check the collision between two lines defined by two points each, returns collision point by reference
-def check_collision_point_circle(point: Vector2, center: Vector2, radius: float) -> bool
-# Check if point is inside circle
-def check_collision_point_line(point: Vector2, p1: Vector2, p2: Vector2, threshold: int) -> bool
-# Check if point belongs to line created between two points [p1] and [p2] with defined margin in pixels [threshold]
-def check_collision_point_poly(point: Vector2, points: Ptr[Vector2], point_count: int) -> bool
-# Check if point is within a polygon described by array of vertices
-def check_collision_point_rec(point: Vector2, rec: Rectangle) -> bool
-# Check if point is inside rectangle
-def check_collision_point_triangle(point: Vector2, p1: Vector2, p2: Vector2, p3: Vector2) -> bool
-# Check if point is inside a triangle
-def check_collision_recs(rec1: Rectangle, rec2: Rectangle) -> bool
-# Check collision between two rectangles
-def check_collision_spheres(center1: Vector3, radius1: float, center2: Vector3, radius2: float) -> bool
-# Check collision between two spheres
-def clear_background(p_color: Color) -> None
-# Set background color (framebuffer clear color)
-def clear_window_state(flags: u32) -> None
-# Clear window configuration state flags
-def close_audio_device() -> None
-# Close the audio device and context
-def close_window() -> None
-# Close window and unload OpenGL context
-def codepoint_to_utf8(codepoint: int, utf8_size: Ptr[libs.c.CInt]) -> Ptr[Const[libs.c.CChar]]
-# Encode one codepoint into UTF-8 byte array (array length returned as parameter)
-def color(r: int, g: int, b: int, a: int) -> Color
-# Factory function for: Color
-def color_alpha(p_color: Color, alpha: float) -> Color
-# Get color with alpha applied, alpha goes from 0.0f to 1.0f
-def color_alpha_blend(dst: Color, src: Color, tint: Color) -> Color
-# Get src alpha-blended into dst color with tint
-def color_brightness(p_color: Color, factor: float) -> Color
-# Get color with brightness correction, brightness factor goes from -1.0f to 1.0f
-def color_contrast(p_color: Color, contrast: float) -> Color
-# Get color with contrast correction, contrast values between -1.0f and 1.0f
-def color_from_hsv(hue: float, saturation: float, value: float) -> Color
-# Get a Color from HSV values, hue [0..360], saturation/value [0..1]
-def color_from_normalized(normalized: Vector4) -> Color
-# Get Color from normalized values [0..1]
-def color_normalize(p_color: Color) -> Vector4
-# Get Color normalized as float [0..1]
-def color_tint(p_color: Color, tint: Color) -> Color
-# Get color multiplied with another color
-def color_to_hsv(p_color: Color) -> Vector3
-# Get HSV values for a Color, hue [0..360], saturation/value [0..1]
-def color_to_int(p_color: Color) -> int
-# Get hexadecimal value for a Color
-def compress_data(data: Ptr[Const[libs.c.CUChar]], data_size: int, comp_data_size: Ptr[libs.c.CInt]) -> Ptr[libs.c.CUChar]
-# Compress data (DEFLATE algorithm), memory must be MemFree()
-def decode_data_base64(data: Ptr[Const[libs.c.CUChar]], output_size: Ptr[libs.c.CInt]) -> Ptr[libs.c.CUChar]
-# Decode Base64 string data, memory must be MemFree()
-def decompress_data(comp_data: Ptr[Const[libs.c.CUChar]], comp_data_size: int, data_size: Ptr[libs.c.CInt]) -> Ptr[libs.c.CUChar]
-# Decompress data (DEFLATE algorithm), memory must be MemFree()
-def directory_exists(dir_path: str) -> bool
-# Check if a directory path exists
-def disable_cursor() -> None
-# Disables cursor (lock cursor)
-def disable_event_waiting() -> None
-# Disable waiting for events on EndDrawing(), automatic events polling
-def draw_billboard(p_camera: Camera, p_texture: Texture2D, position: Vector3, size: float, tint: Color) -> None
-# Draw a billboard texture
-def draw_billboard_pro(p_camera: Camera, p_texture: Texture2D, source: Rectangle, position: Vector3, up: Vector3, size: Vector2, origin: Vector2, rotation: float, tint: Color) -> None
-# Draw a billboard texture defined by source and rotation
-def draw_billboard_rec(p_camera: Camera, p_texture: Texture2D, source: Rectangle, position: Vector3, size: Vector2, tint: Color) -> None
-# Draw a billboard texture defined by source
-def draw_bounding_box(box: BoundingBox, p_color: Color) -> None
-# Draw bounding box (wires)
-def draw_capsule(start_pos: Vector3, end_pos: Vector3, radius: float, slices: int, rings: int, p_color: Color) -> None
-# Draw a capsule with the center of its sphere caps at startPos and endPos
-def draw_capsule_wires(start_pos: Vector3, end_pos: Vector3, radius: float, slices: int, rings: int, p_color: Color) -> None
-# Draw capsule wireframe with the center of its sphere caps at startPos and endPos
-def draw_circle(center_x: int, center_y: int, radius: float, p_color: Color) -> None
-# Draw a color-filled circle
-def draw_circle_3d(center: Vector3, radius: float, rotation_axis: Vector3, rotation_angle: float, p_color: Color) -> None
-# Draw a circle in 3D world space
-def draw_circle_gradient(center_x: int, center_y: int, radius: float, color1: Color, color2: Color) -> None
-# Draw a gradient-filled circle
-def draw_circle_lines(center_x: int, center_y: int, radius: float, p_color: Color) -> None
-# Draw circle outline
-def draw_circle_sector(center: Vector2, radius: float, start_angle: float, end_angle: float, segments: int, p_color: Color) -> None
-# Draw a piece of a circle
-def draw_circle_sector_lines(center: Vector2, radius: float, start_angle: float, end_angle: float, segments: int, p_color: Color) -> None
-# Draw circle sector outline
-def draw_circle_v(center: Vector2, radius: float, p_color: Color) -> None
-# Draw a color-filled circle (Vector version)
-def draw_cube(position: Vector3, width: float, height: float, length: float, p_color: Color) -> None
-# Draw cube
-def draw_cube_v(position: Vector3, size: Vector3, p_color: Color) -> None
-# Draw cube (Vector version)
-def draw_cube_wires(position: Vector3, width: float, height: float, length: float, p_color: Color) -> None
-# Draw cube wires
-def draw_cube_wires_v(position: Vector3, size: Vector3, p_color: Color) -> None
-# Draw cube wires (Vector version)
-def draw_cylinder(position: Vector3, radius_top: float, radius_bottom: float, height: float, slices: int, p_color: Color) -> None
-# Draw a cylinder/cone
-def draw_cylinder_ex(start_pos: Vector3, end_pos: Vector3, start_radius: float, end_radius: float, sides: int, p_color: Color) -> None
-# Draw a cylinder with base at startPos and top at endPos
-def draw_cylinder_wires(position: Vector3, radius_top: float, radius_bottom: float, height: float, slices: int, p_color: Color) -> None
-# Draw a cylinder/cone wires
-def draw_cylinder_wires_ex(start_pos: Vector3, end_pos: Vector3, start_radius: float, end_radius: float, sides: int, p_color: Color) -> None
-# Draw a cylinder wires with base at startPos and top at endPos
-def draw_ellipse(center_x: int, center_y: int, radius_h: float, radius_v: float, p_color: Color) -> None
-# Draw ellipse
-def draw_ellipse_lines(center_x: int, center_y: int, radius_h: float, radius_v: float, p_color: Color) -> None
-# Draw ellipse outline
-def draw_fps(pos_x: int, pos_y: int) -> None
-# Draw current FPS
-def draw_grid(slices: int, spacing: float) -> None
-# Draw a grid (centered at (0, 0, 0))
-def draw_line(start_pos_x: int, start_pos_y: int, end_pos_x: int, end_pos_y: int, p_color: Color) -> None
-# Draw a line
-def draw_line_3d(start_pos: Vector3, end_pos: Vector3, p_color: Color) -> None
-# Draw a line in 3D world space
-def draw_line_bezier(start_pos: Vector2, end_pos: Vector2, thick: float, p_color: Color) -> None
-# Draw a line using cubic-bezier curves in-out
-def draw_line_bezier_cubic(start_pos: Vector2, end_pos: Vector2, start_control_pos: Vector2, end_control_pos: Vector2, thick: float, p_color: Color) -> None
-# Draw line using cubic bezier curves with 2 control points
-def draw_line_bezier_quad(start_pos: Vector2, end_pos: Vector2, control_pos: Vector2, thick: float, p_color: Color) -> None
-# Draw line using quadratic bezier curves with a control point
-def draw_line_ex(start_pos: Vector2, end_pos: Vector2, thick: float, p_color: Color) -> None
-# Draw a line defining thickness
-def draw_line_strip(points: Ptr[Vector2], point_count: int, p_color: Color) -> None
-# Draw lines sequence
-def draw_line_v(start_pos: Vector2, end_pos: Vector2, p_color: Color) -> None
-# Draw a line (Vector version)
-def draw_mesh(mesh: Mesh, material: Material, p_transform: Matrix) -> None
-# Draw a 3d mesh with material and transform
-def draw_mesh_instanced(mesh: Mesh, material: Material, transforms: Ptr[Const[Matrix]], instances: int) -> None
-# Draw multiple mesh instances with material and different transforms
-def draw_model(model: Model, position: Vector3, scale: float, tint: Color) -> None
-# Draw a model (with texture if set)
-def draw_model_ex(model: Model, position: Vector3, rotation_axis: Vector3, rotation_angle: float, scale: Vector3, tint: Color) -> None
-# Draw a model with extended parameters
-def draw_model_wires(model: Model, position: Vector3, scale: float, tint: Color) -> None
-# Draw a model wires (with texture if set)
-def draw_model_wires_ex(model: Model, position: Vector3, rotation_axis: Vector3, rotation_angle: float, scale: Vector3, tint: Color) -> None
-# Draw a model wires (with texture if set) with extended parameters
-def draw_pixel(pos_x: int, pos_y: int, p_color: Color) -> None
-# Draw a pixel
-def draw_pixel_v(position: Vector2, p_color: Color) -> None
-# Draw a pixel (Vector version)
-def draw_plane(center_pos: Vector3, size: Vector2, p_color: Color) -> None
-# Draw a plane XZ
-def draw_point_3d(position: Vector3, p_color: Color) -> None
-# Draw a point in 3D space, actually a small line
-def draw_poly(center: Vector2, sides: int, radius: float, rotation: float, p_color: Color) -> None
-# Draw a regular polygon (Vector version)
-def draw_poly_lines(center: Vector2, sides: int, radius: float, rotation: float, p_color: Color) -> None
-# Draw a polygon outline of n sides
-def draw_poly_lines_ex(center: Vector2, sides: int, radius: float, rotation: float, line_thick: float, p_color: Color) -> None
-# Draw a polygon outline of n sides with extended parameters
-def draw_ray(p_ray: Ray, p_color: Color) -> None
-# Draw a ray line
-def draw_rectangle(pos_x: int, pos_y: int, width: int, height: int, p_color: Color) -> None
-# Draw a color-filled rectangle
-def draw_rectangle_gradient_ex(rec: Rectangle, col1: Color, col2: Color, col3: Color, col4: Color) -> None
-# Draw a gradient-filled rectangle with custom vertex colors
-def draw_rectangle_gradient_h(pos_x: int, pos_y: int, width: int, height: int, color1: Color, color2: Color) -> None
-# Draw a horizontal-gradient-filled rectangle
-def draw_rectangle_gradient_v(pos_x: int, pos_y: int, width: int, height: int, color1: Color, color2: Color) -> None
-# Draw a vertical-gradient-filled rectangle
-def draw_rectangle_lines(pos_x: int, pos_y: int, width: int, height: int, p_color: Color) -> None
-# Draw rectangle outline
-def draw_rectangle_lines_ex(rec: Rectangle, line_thick: float, p_color: Color) -> None
-# Draw rectangle outline with extended parameters
-def draw_rectangle_pro(rec: Rectangle, origin: Vector2, rotation: float, p_color: Color) -> None
-# Draw a color-filled rectangle with pro parameters
-def draw_rectangle_rec(rec: Rectangle, p_color: Color) -> None
-# Draw a color-filled rectangle
-def draw_rectangle_rounded(rec: Rectangle, roundness: float, segments: int, p_color: Color) -> None
-# Draw rectangle with rounded edges
-def draw_rectangle_rounded_lines(rec: Rectangle, roundness: float, segments: int, line_thick: float, p_color: Color) -> None
-# Draw rectangle with rounded edges outline
-def draw_rectangle_v(position: Vector2, size: Vector2, p_color: Color) -> None
-# Draw a color-filled rectangle (Vector version)
-def draw_ring(center: Vector2, inner_radius: float, outer_radius: float, start_angle: float, end_angle: float, segments: int, p_color: Color) -> None
-# Draw ring
-def draw_ring_lines(center: Vector2, inner_radius: float, outer_radius: float, start_angle: float, end_angle: float, segments: int, p_color: Color) -> None
-# Draw ring outline
-def draw_sphere(center_pos: Vector3, radius: float, p_color: Color) -> None
-# Draw sphere
-def draw_sphere_ex(center_pos: Vector3, radius: float, rings: int, slices: int, p_color: Color) -> None
-# Draw sphere with extended parameters
-def draw_sphere_wires(center_pos: Vector3, radius: float, rings: int, slices: int, p_color: Color) -> None
-# Draw sphere wires
-def draw_text(text: str, pos_x: int, pos_y: int, font_size: int, p_color: Color) -> None
-# Draw text (using default font)
-def draw_text_codepoint(p_font: Font, codepoint: int, position: Vector2, font_size: float, tint: Color) -> None
-# Draw one character (codepoint)
-def draw_text_codepoints(p_font: Font, codepoints: Ptr[Const[libs.c.CInt]], count: int, position: Vector2, font_size: float, spacing: float, tint: Color) -> None
-# Draw multiple character (codepoint)
-def draw_text_ex(p_font: Font, text: str, position: Vector2, font_size: float, spacing: float, tint: Color) -> None
-# Draw text using font and additional parameters
-def draw_text_pro(p_font: Font, text: str, position: Vector2, origin: Vector2, rotation: float, font_size: float, spacing: float, tint: Color) -> None
-# Draw text using Font and pro parameters (rotation)
-def draw_texture(p_texture: Texture2D, pos_x: int, pos_y: int, tint: Color) -> None
-# Draw a Texture2D
-def draw_texture_ex(p_texture: Texture2D, position: Vector2, rotation: float, scale: float, tint: Color) -> None
-# Draw a Texture2D with extended parameters
-def draw_texture_n_patch(p_texture: Texture2D, p_n_patch_info: NPatchInfo, dest: Rectangle, origin: Vector2, rotation: float, tint: Color) -> None
-# Draws a texture (or part of it) that stretches or shrinks nicely
-def draw_texture_pro(p_texture: Texture2D, source: Rectangle, dest: Rectangle, origin: Vector2, rotation: float, tint: Color) -> None
-# Draw a part of a texture defined by a rectangle with 'pro' parameters
-def draw_texture_rec(p_texture: Texture2D, source: Rectangle, position: Vector2, tint: Color) -> None
-# Draw a part of a texture defined by a rectangle
-def draw_texture_v(p_texture: Texture2D, position: Vector2, tint: Color) -> None
-# Draw a Texture2D with position defined as Vector2
-def draw_triangle(v1: Vector2, v2: Vector2, v3: Vector2, p_color: Color) -> None
-# Draw a color-filled triangle (vertex in counter-clockwise order!)
-def draw_triangle_3d(v1: Vector3, v2: Vector3, v3: Vector3, p_color: Color) -> None
-# Draw a color-filled triangle (vertex in counter-clockwise order!)
-def draw_triangle_fan(points: Ptr[Vector2], point_count: int, p_color: Color) -> None
-# Draw a triangle fan defined by points (first vertex is the center)
-def draw_triangle_lines(v1: Vector2, v2: Vector2, v3: Vector2, p_color: Color) -> None
-# Draw triangle outline (vertex in counter-clockwise order!)
-def draw_triangle_strip(points: Ptr[Vector2], point_count: int, p_color: Color) -> None
-# Draw a triangle strip defined by points
-def draw_triangle_strip_3d(points: Ptr[Vector3], point_count: int, p_color: Color) -> None
-# Draw a triangle strip defined by points
-def enable_cursor() -> None
-# Enables cursor (unlock cursor)
-def enable_event_waiting() -> None
-# Enable waiting for events on EndDrawing(), no automatic event polling
-def encode_data_base64(data: Ptr[Const[libs.c.CUChar]], data_size: int, output_size: Ptr[libs.c.CInt]) -> libs.c.CStr
-# Encode data to Base64 string, memory must be MemFree()
-def end_blend_mode() -> None
-# End blending mode (reset to default: alpha blending)
-def end_drawing() -> None
-# End canvas drawing and swap buffers (double buffering)
-def end_mode_2d() -> None
-# Ends 2D mode with custom camera
-def end_mode_3d() -> None
-# Ends 3D mode and returns to default 2D orthographic mode
-def end_scissor_mode() -> None
-# End scissor mode
-def end_shader_mode() -> None
-# End custom shader drawing (use default shader)
-def end_texture_mode() -> None
-# Ends drawing to render texture
-def end_vr_stereo_mode() -> None
-# End stereo rendering (requires VR simulator)
-def export_data_as_code(data: Ptr[Const[libs.c.CUChar]], size: u32, file_name: str) -> bool
-# Export data to code (.h), returns true on success
-def export_font_as_code(p_font: Font, file_name: str) -> bool
-# Export font as code file, returns true on success
-def export_image(p_image: Image, file_name: str) -> bool
-# Export image data to file, returns true on success
-def export_image_as_code(p_image: Image, file_name: str) -> bool
-# Export image as code file defining an array of bytes, returns true on success
-def export_mesh(mesh: Mesh, file_name: str) -> bool
-# Export mesh data to file, returns true on success
-def export_wave(p_wave: Wave, file_name: str) -> bool
-# Export wave data to file, returns true on success
-def export_wave_as_code(p_wave: Wave, file_name: str) -> bool
-# Export wave sample data to code (.h), returns true on success
-def fade(p_color: Color, alpha: float) -> Color
-# Get color with alpha applied, alpha goes from 0.0f to 1.0f
-def file_exists(file_name: str) -> bool
-# Check if file exists
-def font(base_size: int, glyph_count: int, glyph_padding: int, p_texture: Texture2D, recs: Ptr[Rectangle], glyphs: Ptr[GlyphInfo]) -> Font
-# Factory function for: Font
-def gen_image_cellular(width: int, height: int, tile_size: int) -> Image
-# Generate image: cellular algorithm, bigger tileSize means bigger cells
-def gen_image_checked(width: int, height: int, checks_x: int, checks_y: int, col1: Color, col2: Color) -> Image
-# Generate image: checked
-def gen_image_color(width: int, height: int, p_color: Color) -> Image
-# Generate image: plain color
-def gen_image_font_atlas(chars: Ptr[Const[GlyphInfo]], recs: Ptr[Ptr[Rectangle]], glyph_count: int, font_size: int, padding: int, pack_method: int) -> Image
-# Generate image font atlas using chars info
-def gen_image_gradient_h(width: int, height: int, left: Color, right: Color) -> Image
-# Generate image: horizontal gradient
-def gen_image_gradient_radial(width: int, height: int, density: float, inner: Color, outer: Color) -> Image
-# Generate image: radial gradient
-def gen_image_gradient_v(width: int, height: int, top: Color, bottom: Color) -> Image
-# Generate image: vertical gradient
-def gen_image_perlin_noise(width: int, height: int, offset_x: int, offset_y: int, scale: float) -> Image
-# Generate image: perlin noise
-def gen_image_text(width: int, height: int, text: str) -> Image
-# Generate image: grayscale image from text data
-def gen_image_white_noise(width: int, height: int, factor: float) -> Image
-# Generate image: white noise
-def gen_mesh_cone(radius: float, height: float, slices: int) -> Mesh
-# Generate cone/pyramid mesh
-def gen_mesh_cube(width: float, height: float, length: float) -> Mesh
-# Generate cuboid mesh
-def gen_mesh_cubicmap(cubicmap: Image, cube_size: Vector3) -> Mesh
-# Generate cubes-based map mesh from image data
-def gen_mesh_cylinder(radius: float, height: float, slices: int) -> Mesh
-# Generate cylinder mesh
-def gen_mesh_heightmap(heightmap: Image, size: Vector3) -> Mesh
-# Generate heightmap mesh from image data
-def gen_mesh_hemi_sphere(radius: float, rings: int, slices: int) -> Mesh
-# Generate half-sphere mesh (no bottom cap)
-def gen_mesh_knot(radius: float, size: float, rad_seg: int, sides: int) -> Mesh
-# Generate trefoil knot mesh
-def gen_mesh_plane(width: float, length: float, res_x: int, res_z: int) -> Mesh
-# Generate plane mesh (with subdivisions)
-def gen_mesh_poly(sides: int, radius: float) -> Mesh
-# Generate polygonal mesh
-def gen_mesh_sphere(radius: float, rings: int, slices: int) -> Mesh
-# Generate sphere mesh (standard sphere)
-def gen_mesh_tangents(mesh: Ptr[Mesh]) -> None
-# Compute mesh tangents
-def gen_mesh_torus(radius: float, size: float, rad_seg: int, sides: int) -> Mesh
-# Generate torus mesh
-def gen_texture_mipmaps(p_texture: Ptr[Texture2D]) -> None
-# Generate GPU mipmaps for a texture
-def get_application_directory() -> Ptr[Const[libs.c.CChar]]
-# Get the directory if the running application (uses static string)
-def get_camera_matrix(p_camera: Camera) -> Matrix
-# Get camera transform matrix (view matrix)
-def get_camera_matrix_2d(p_camera: Camera2D) -> Matrix
-# Get camera 2d transform matrix
-def get_char_pressed() -> int
-# Get char pressed (unicode), call it multiple times for chars queued, returns 0 when the queue is empty
-def get_clipboard_text() -> Ptr[Const[libs.c.CChar]]
-# Get clipboard text content
-def get_codepoint(text: str, codepoint_size: Ptr[libs.c.CInt]) -> int
-# Get next codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failure
-def get_codepoint_count(text: str) -> int
-# Get total number of codepoints in a UTF-8 encoded string
-def get_codepoint_next(text: str, codepoint_size: Ptr[libs.c.CInt]) -> int
-# Get next codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failure
-def get_codepoint_previous(text: str, codepoint_size: Ptr[libs.c.CInt]) -> int
-# Get previous codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failure
-def get_collision_rec(rec1: Rectangle, rec2: Rectangle) -> Rectangle
-# Get collision rectangle for two rectangles collision
-def get_color(hex_value: u32) -> Color
-# Get Color structure from hexadecimal value
-def get_current_monitor() -> int
-# Get current connected monitor
-def get_directory_path(file_path: str) -> Ptr[Const[libs.c.CChar]]
-# Get full path for a given fileName with path (uses static string)
-def get_file_extension(file_name: str) -> Ptr[Const[libs.c.CChar]]
-# Get pointer to extension for a filename string (includes dot: '.png')
-def get_file_length(file_name: str) -> int
-# Get file length in bytes (NOTE: GetFileSize() conflicts with windows.h)
-def get_file_mod_time(file_name: str) -> i64
-# Get file modification time (last write time)
-def get_file_name(file_path: str) -> Ptr[Const[libs.c.CChar]]
-# Get pointer to filename for a path string
-def get_file_name_without_ext(file_path: str) -> Ptr[Const[libs.c.CChar]]
-# Get filename string without extension (uses static string)
-def get_font_default() -> Font
-# Get the default Font
-def get_fps() -> int
-# Get current FPS
-def get_frame_time() -> float
-# Get time in seconds for last frame drawn (delta time)
-def get_gamepad_axis_count(gamepad: int) -> int
-# Get gamepad axis count for a gamepad
-def get_gamepad_axis_movement(gamepad: int, axis: int) -> float
-# Get axis movement value for a gamepad axis
-def get_gamepad_button_pressed() -> int
-# Get the last gamepad button pressed
-def get_gamepad_name(gamepad: int) -> Ptr[Const[libs.c.CChar]]
-# Get gamepad internal name id
-def get_gesture_detected() -> int
-# Get latest detected gesture
-def get_gesture_drag_angle() -> float
-# Get gesture drag angle
-def get_gesture_drag_vector() -> Vector2
-# Get gesture drag vector
-def get_gesture_hold_duration() -> float
-# Get gesture hold time in milliseconds
-def get_gesture_pinch_angle() -> float
-# Get gesture pinch angle
-def get_gesture_pinch_vector() -> Vector2
-# Get gesture pinch delta
-def get_glyph_atlas_rec(p_font: Font, codepoint: int) -> Rectangle
-# Get glyph rectangle in font atlas for a codepoint (unicode character), fallback to '?' if not found
-def get_glyph_index(p_font: Font, codepoint: int) -> int
-# Get glyph index position in font for a codepoint (unicode character), fallback to '?' if not found
-def get_glyph_info(p_font: Font, codepoint: int) -> GlyphInfo
-# Get glyph font info data for a codepoint (unicode character), fallback to '?' if not found
-def get_image_alpha_border(p_image: Image, threshold: float) -> Rectangle
-# Get image alpha border rectangle
-def get_image_color(p_image: Image, x: int, y: int) -> Color
-# Get image pixel color at (x, y) position
-def get_key_pressed() -> int
-# Get key pressed (keycode), call it multiple times for keys queued, returns 0 when the queue is empty
-def get_mesh_bounding_box(mesh: Mesh) -> BoundingBox
-# Compute mesh bounding box limits
-def get_model_bounding_box(model: Model) -> BoundingBox
-# Compute model bounding box limits (considers all meshes)
-def get_monitor_count() -> int
-# Get number of connected monitors
-def get_monitor_height(monitor: int) -> int
-# Get specified monitor height (current video mode used by monitor)
-def get_monitor_name(monitor: int) -> Ptr[Const[libs.c.CChar]]
-# Get the human-readable, UTF-8 encoded name of the primary monitor
-def get_monitor_physical_height(monitor: int) -> int
-# Get specified monitor physical height in millimetres
-def get_monitor_physical_width(monitor: int) -> int
-# Get specified monitor physical width in millimetres
-def get_monitor_position(monitor: int) -> Vector2
-# Get specified monitor position
-def get_monitor_refresh_rate(monitor: int) -> int
-# Get specified monitor refresh rate
-def get_monitor_width(monitor: int) -> int
-# Get specified monitor width (current video mode used by monitor)
-def get_mouse_delta() -> Vector2
-# Get mouse delta between frames
-def get_mouse_position() -> Vector2
-# Get mouse position XY
-def get_mouse_ray(mouse_position: Vector2, p_camera: Camera) -> Ray
-# Get a ray trace from mouse position
-def get_mouse_wheel_move() -> float
-# Get mouse wheel movement for X or Y, whichever is larger
-def get_mouse_wheel_move_v() -> Vector2
-# Get mouse wheel movement for both X and Y
-def get_mouse_x() -> int
-# Get mouse position X
-def get_mouse_y() -> int
-# Get mouse position Y
-def get_music_time_length(p_music: Music) -> float
-# Get music time length (in seconds)
-def get_music_time_played(p_music: Music) -> float
-# Get current music time played (in seconds)
-def get_pixel_color(src_ptr: AnyPtr, format: int) -> Color
-# Get Color from a source pixel pointer of certain format
-def get_pixel_data_size(width: int, height: int, format: int) -> int
-# Get pixel data size in bytes for certain format
-def get_prev_directory_path(dir_path: str) -> Ptr[Const[libs.c.CChar]]
-# Get previous directory path for a given path (uses static string)
-def get_random_value(min: int, max: int) -> int
-# Get a random value between min and max (both included)
-def get_ray_collision_box(p_ray: Ray, box: BoundingBox) -> RayCollision
-# Get collision info between ray and box
-def get_ray_collision_mesh(p_ray: Ray, mesh: Mesh, p_transform: Matrix) -> RayCollision
-# Get collision info between ray and mesh
-def get_ray_collision_quad(p_ray: Ray, p1: Vector3, p2: Vector3, p3: Vector3, p4: Vector3) -> RayCollision
-# Get collision info between ray and quad
-def get_ray_collision_sphere(p_ray: Ray, center: Vector3, radius: float) -> RayCollision
-# Get collision info between ray and sphere
-def get_ray_collision_triangle(p_ray: Ray, p1: Vector3, p2: Vector3, p3: Vector3) -> RayCollision
-# Get collision info between ray and triangle
-def get_render_height() -> int
-# Get current render height (it considers HiDPI)
-def get_render_width() -> int
-# Get current render width (it considers HiDPI)
-def get_screen_height() -> int
-# Get current screen height
-def get_screen_to_world_2d(position: Vector2, p_camera: Camera2D) -> Vector2
-# Get the world space position for a 2d camera screen space position
-def get_screen_width() -> int
-# Get current screen width
-def get_shader_location(shader: Shader, uniform_name: str) -> int
-# Get shader uniform location
-def get_shader_location_attrib(shader: Shader, attrib_name: str) -> int
-# Get shader attribute location
-def get_time() -> f64
-# Get elapsed time in seconds since InitWindow()
-def get_touch_point_count() -> int
-# Get number of touch points
-def get_touch_point_id(index: int) -> int
-# Get touch point identifier for given index
-def get_touch_position(index: int) -> Vector2
-# Get touch position XY for a touch point index (relative to screen size)
-def get_touch_x() -> int
-# Get touch position X for touch point 0 (relative to screen size)
-def get_touch_y() -> int
-# Get touch position Y for touch point 0 (relative to screen size)
-def get_window_handle() -> AnyPtr
-# Get native window handle
-def get_window_position() -> Vector2
-# Get window position XY on monitor
-def get_window_scale_dpi() -> Vector2
-# Get window scale DPI factor
-def get_working_directory() -> Ptr[Const[libs.c.CChar]]
-# Get current working directory (uses static string)
-def get_world_to_screen(position: Vector3, p_camera: Camera) -> Vector2
-# Get the screen space position for a 3d world space position
-def get_world_to_screen_2d(position: Vector2, p_camera: Camera2D) -> Vector2
-# Get the screen space position for a 2d camera world space position
-def get_world_to_screen_ex(position: Vector3, p_camera: Camera, width: int, height: int) -> Vector2
-# Get size position for a 3d world space position
-def glyph_info(value: int, offset_x: int, offset_y: int, advance_x: int, p_image: Image) -> GlyphInfo
-# Factory function for: GlyphInfo
-def hide_cursor() -> None
-# Hides cursor
-def image(data: AnyPtr, width: int, height: int, mipmaps: int, format: int) -> Image
-# Factory function for: Image
-def image_alpha_clear(p_image: Ptr[Image], p_color: Color, threshold: float) -> None
-# Clear alpha channel to desired color
-def image_alpha_crop(p_image: Ptr[Image], threshold: float) -> None
-# Crop image depending on alpha value
-def image_alpha_mask(p_image: Ptr[Image], alpha_mask: Image) -> None
-# Apply alpha mask to image
-def image_alpha_premultiply(p_image: Ptr[Image]) -> None
-# Premultiply alpha channel
-def image_blur_gaussian(p_image: Ptr[Image], blur_size: int) -> None
-# Apply Gaussian blur using a box blur approximation
-def image_clear_background(dst: Ptr[Image], p_color: Color) -> None
-# Clear image background with given color
-def image_color_brightness(p_image: Ptr[Image], brightness: int) -> None
-# Modify image color: brightness (-255 to 255)
-def image_color_contrast(p_image: Ptr[Image], contrast: float) -> None
-# Modify image color: contrast (-100 to 100)
-def image_color_grayscale(p_image: Ptr[Image]) -> None
-# Modify image color: grayscale
-def image_color_invert(p_image: Ptr[Image]) -> None
-# Modify image color: invert
-def image_color_replace(p_image: Ptr[Image], p_color: Color, replace: Color) -> None
-# Modify image color: replace color
-def image_color_tint(p_image: Ptr[Image], p_color: Color) -> None
-# Modify image color: tint
-def image_copy(p_image: Image) -> Image
-# Create an image duplicate (useful for transformations)
-def image_crop(p_image: Ptr[Image], crop: Rectangle) -> None
-# Crop an image to a defined rectangle
-def image_dither(p_image: Ptr[Image], r_bpp: int, g_bpp: int, b_bpp: int, a_bpp: int) -> None
-# Dither image data to 16bpp or lower (Floyd-Steinberg dithering)
-def image_draw(dst: Ptr[Image], src: Image, src_rec: Rectangle, dst_rec: Rectangle, tint: Color) -> None
-# Draw a source image within a destination image (tint applied to source)
-def image_draw_circle(dst: Ptr[Image], center_x: int, center_y: int, radius: int, p_color: Color) -> None
-# Draw a filled circle within an image
-def image_draw_circle_lines(dst: Ptr[Image], center_x: int, center_y: int, radius: int, p_color: Color) -> None
-# Draw circle outline within an image
-def image_draw_circle_lines_v(dst: Ptr[Image], center: Vector2, radius: int, p_color: Color) -> None
-# Draw circle outline within an image (Vector version)
-def image_draw_circle_v(dst: Ptr[Image], center: Vector2, radius: int, p_color: Color) -> None
-# Draw a filled circle within an image (Vector version)
-def image_draw_line(dst: Ptr[Image], start_pos_x: int, start_pos_y: int, end_pos_x: int, end_pos_y: int, p_color: Color) -> None
-# Draw line within an image
-def image_draw_line_v(dst: Ptr[Image], start: Vector2, end: Vector2, p_color: Color) -> None
-# Draw line within an image (Vector version)
-def image_draw_pixel(dst: Ptr[Image], pos_x: int, pos_y: int, p_color: Color) -> None
-# Draw pixel within an image
-def image_draw_pixel_v(dst: Ptr[Image], position: Vector2, p_color: Color) -> None
-# Draw pixel within an image (Vector version)
-def image_draw_rectangle(dst: Ptr[Image], pos_x: int, pos_y: int, width: int, height: int, p_color: Color) -> None
-# Draw rectangle within an image
-def image_draw_rectangle_lines(dst: Ptr[Image], rec: Rectangle, thick: int, p_color: Color) -> None
-# Draw rectangle lines within an image
-def image_draw_rectangle_rec(dst: Ptr[Image], rec: Rectangle, p_color: Color) -> None
-# Draw rectangle within an image
-def image_draw_rectangle_v(dst: Ptr[Image], position: Vector2, size: Vector2, p_color: Color) -> None
-# Draw rectangle within an image (Vector version)
-def image_draw_text(dst: Ptr[Image], text: str, pos_x: int, pos_y: int, font_size: int, p_color: Color) -> None
-# Draw text (using default font) within an image (destination)
-def image_draw_text_ex(dst: Ptr[Image], p_font: Font, text: str, position: Vector2, font_size: float, spacing: float, tint: Color) -> None
-# Draw text (custom sprite font) within an image (destination)
-def image_flip_horizontal(p_image: Ptr[Image]) -> None
-# Flip image horizontally
-def image_flip_vertical(p_image: Ptr[Image]) -> None
-# Flip image vertically
-def image_format(p_image: Ptr[Image], new_format: int) -> None
-# Convert image data to desired format
-def image_from_image(p_image: Image, rec: Rectangle) -> Image
-# Create an image from another image piece
-def image_mipmaps(p_image: Ptr[Image]) -> None
-# Compute all mipmap levels for a provided image
-def image_resize(p_image: Ptr[Image], new_width: int, new_height: int) -> None
-# Resize image (Bicubic scaling algorithm)
-def image_resize_canvas(p_image: Ptr[Image], new_width: int, new_height: int, offset_x: int, offset_y: int, fill: Color) -> None
-# Resize canvas and fill with color
-def image_resize_nn(p_image: Ptr[Image], new_width: int, new_height: int) -> None
-# Resize image (Nearest-Neighbor scaling algorithm)
-def image_rotate_ccw(p_image: Ptr[Image]) -> None
-# Rotate image counter-clockwise 90deg
-def image_rotate_cw(p_image: Ptr[Image]) -> None
-# Rotate image clockwise 90deg
-def image_text(text: str, font_size: int, p_color: Color) -> Image
-# Create an image from text (default font)
-def image_text_ex(p_font: Font, text: str, font_size: float, spacing: float, tint: Color) -> Image
-# Create an image from text (custom sprite font)
-def image_to_pot(p_image: Ptr[Image], fill: Color) -> None
-# Convert image to POT (power-of-two)
-def init_audio_device() -> None
-# Initialize audio device and context
-def init_window(width: int, height: int, title: str) -> None
-# Initialize window and OpenGL context
-def is_audio_device_ready() -> bool
-# Check if audio device has been initialized successfully
-def is_audio_stream_playing(stream: AudioStream) -> bool
-# Check if audio stream is playing
-def is_audio_stream_processed(stream: AudioStream) -> bool
-# Check if any audio stream buffers requires refill
-def is_audio_stream_ready(stream: AudioStream) -> bool
-# Checks if an audio stream is ready
-def is_cursor_hidden() -> bool
-# Check if cursor is not visible
-def is_cursor_on_screen() -> bool
-# Check if cursor is on the screen
-def is_file_dropped() -> bool
-# Check if a file has been dropped into window
-def is_file_extension(file_name: str, ext: str) -> bool
-# Check file extension (including point: .png, .wav)
-def is_font_ready(p_font: Font) -> bool
-# Check if a font is ready
-def is_gamepad_available(gamepad: int) -> bool
-# Check if a gamepad is available
-def is_gamepad_button_down(gamepad: int, button: int) -> bool
-# Check if a gamepad button is being pressed
-def is_gamepad_button_pressed(gamepad: int, button: int) -> bool
-# Check if a gamepad button has been pressed once
-def is_gamepad_button_released(gamepad: int, button: int) -> bool
-# Check if a gamepad button has been released once
-def is_gamepad_button_up(gamepad: int, button: int) -> bool
-# Check if a gamepad button is NOT being pressed
-def is_gesture_detected(gesture: int) -> bool
-# Check if a gesture have been detected
-def is_image_ready(p_image: Image) -> bool
-# Check if an image is ready
-def is_key_down(key: int) -> bool
-# Check if a key is being pressed
-def is_key_pressed(key: int) -> bool
-# Check if a key has been pressed once
-def is_key_released(key: int) -> bool
-# Check if a key has been released once
-def is_key_up(key: int) -> bool
-# Check if a key is NOT being pressed
-def is_material_ready(material: Material) -> bool
-# Check if a material is ready
-def is_model_animation_valid(model: Model, anim: ModelAnimation) -> bool
-# Check model animation skeleton match
-def is_model_ready(model: Model) -> bool
-# Check if a model is ready
-def is_mouse_button_down(button: int) -> bool
-# Check if a mouse button is being pressed
-def is_mouse_button_pressed(button: int) -> bool
-# Check if a mouse button has been pressed once
-def is_mouse_button_released(button: int) -> bool
-# Check if a mouse button has been released once
-def is_mouse_button_up(button: int) -> bool
-# Check if a mouse button is NOT being pressed
-def is_music_ready(p_music: Music) -> bool
-# Checks if a music stream is ready
-def is_music_stream_playing(p_music: Music) -> bool
-# Check if music is playing
-def is_path_file(path: str) -> bool
-# Check if a given path is a file or a directory
-def is_render_texture_ready(target: RenderTexture2D) -> bool
-# Check if a render texture is ready
-def is_shader_ready(shader: Shader) -> bool
-# Check if a shader is ready
-def is_sound_playing(p_sound: Sound) -> bool
-# Check if a sound is currently playing
-def is_sound_ready(p_sound: Sound) -> bool
-# Checks if a sound is ready
-def is_texture_ready(p_texture: Texture2D) -> bool
-# Check if a texture is ready
-def is_wave_ready(p_wave: Wave) -> bool
-# Checks if wave data is ready
-def is_window_focused() -> bool
-# Check if window is currently focused (only PLATFORM_DESKTOP)
-def is_window_fullscreen() -> bool
-# Check if window is currently fullscreen
-def is_window_hidden() -> bool
-# Check if window is currently hidden (only PLATFORM_DESKTOP)
-def is_window_maximized() -> bool
-# Check if window is currently maximized (only PLATFORM_DESKTOP)
-def is_window_minimized() -> bool
-# Check if window is currently minimized (only PLATFORM_DESKTOP)
-def is_window_ready() -> bool
-# Check if window has been initialized successfully
-def is_window_resized() -> bool
-# Check if window has been resized last frame
-def is_window_state(flag: u32) -> bool
-# Check if one specific window flag is enabled
-def load_audio_stream(sample_rate: u32, sample_size: u32, channels: u32) -> AudioStream
-# Load audio stream (to stream raw audio pcm data)
-def load_codepoints(text: str, count: Ptr[libs.c.CInt]) -> Ptr[libs.c.CInt]
-# Load all codepoints from a UTF-8 text string, codepoints count returned by parameter
-def load_directory_files(dir_path: str) -> FilePathList
-# Load directory filepaths
-def load_directory_files_ex(base_path: str, filter: str, scan_subdirs: bool) -> FilePathList
-# Load directory filepaths with extension filtering and recursive directory scan
-def load_dropped_files() -> FilePathList
-# Load dropped filepaths
-def load_file_data(file_name: str, bytes_read: Ptr[libs.c.CUInt]) -> Ptr[libs.c.CUChar]
-# Load file data as byte array (read)
-def load_file_text(file_name: str) -> libs.c.CStr
-# Load text data from file (read), returns a '\0' terminated string
-def load_font(file_name: str) -> Font
-# Load font from file into GPU memory (VRAM)
-def load_font_data(file_data: Ptr[Const[libs.c.CUChar]], data_size: int, font_size: int, font_chars: Ptr[libs.c.CInt], glyph_count: int, type: int) -> Ptr[GlyphInfo]
-# Load font data for further use
-def load_font_ex(file_name: str, font_size: int, font_chars: Ptr[libs.c.CInt], glyph_count: int) -> Font
-# Load font from file with extended parameters, use NULL for fontChars and 0 for glyphCount to load the default character set
-def load_font_from_image(p_image: Image, key: Color, first_char: int) -> Font
-# Load font from Image (XNA style)
-def load_font_from_memory(file_type: str, file_data: Ptr[Const[libs.c.CUChar]], data_size: int, font_size: int, font_chars: Ptr[libs.c.CInt], glyph_count: int) -> Font
-# Load font from memory buffer, fileType refers to extension: i.e. '.ttf'
-def load_image(file_name: str) -> Image
-# Load image from file into CPU memory (RAM)
-def load_image_anim(file_name: str, frames: Ptr[libs.c.CInt]) -> Image
-# Load image sequence from file (frames appended to image.data)
-def load_image_colors(p_image: Image) -> Ptr[Color]
-# Load color data from image as a Color array (RGBA - 32bit)
-def load_image_from_memory(file_type: str, file_data: Ptr[Const[libs.c.CUChar]], data_size: int) -> Image
-# Load image from memory buffer, fileType refers to extension: i.e. '.png'
-def load_image_from_screen() -> Image
-# Load image from screen buffer and (screenshot)
-def load_image_from_texture(p_texture: Texture2D) -> Image
-# Load image from GPU texture data
-def load_image_palette(p_image: Image, max_palette_size: int, color_count: Ptr[libs.c.CInt]) -> Ptr[Color]
-# Load colors palette from image as a Color array (RGBA - 32bit)
-def load_image_raw(file_name: str, width: int, height: int, format: int, header_size: int) -> Image
-# Load image from RAW file data
-def load_material_default() -> Material
-# Load default material (Supports: DIFFUSE, SPECULAR, NORMAL maps)
-def load_materials(file_name: str, material_count: Ptr[libs.c.CInt]) -> Ptr[Material]
-# Load materials from model file
-def load_model(file_name: str) -> Model
-# Load model from files (meshes and materials)
-def load_model_animations(file_name: str, anim_count: Ptr[libs.c.CUInt]) -> Ptr[ModelAnimation]
-# Load model animations from file
-def load_model_from_mesh(mesh: Mesh) -> Model
-# Load model from generated mesh (default material)
-def load_music_stream(file_name: str) -> Music
-# Load music stream from file
-def load_music_stream_from_memory(file_type: str, data: Ptr[Const[libs.c.CUChar]], data_size: int) -> Music
-# Load music stream from data
-def load_render_texture(width: int, height: int) -> RenderTexture2D
-# Load texture for rendering (framebuffer)
-def load_shader(vs_file_name: str, fs_file_name: str) -> Shader
-# Load shader from files and bind default locations
-def load_shader_from_memory(vs_code: str, fs_code: str) -> Shader
-# Load shader from code strings and bind default locations
-def load_sound(file_name: str) -> Sound
-# Load sound from file
-def load_sound_from_wave(p_wave: Wave) -> Sound
-# Load sound from wave data
-def load_texture(file_name: str) -> Texture2D
-# Load texture from file into GPU memory (VRAM)
-def load_texture_cubemap(p_image: Image, layout: int) -> TextureCubemap
-# Load cubemap from image, multiple image cubemap layouts supported
-def load_texture_from_image(p_image: Image) -> Texture2D
-# Load texture from image data
-def load_utf8(codepoints: Ptr[Const[libs.c.CInt]], length: int) -> libs.c.CStr
-# Load UTF-8 text encoded from codepoints array
-def load_vr_stereo_config(device: VrDeviceInfo) -> VrStereoConfig
-# Load VR stereo config for VR simulator device parameters
-def load_wave(file_name: str) -> Wave
-# Load wave data from file
-def load_wave_from_memory(file_type: str, file_data: Ptr[Const[libs.c.CUChar]], data_size: int) -> Wave
-# Load wave from memory buffer, fileType refers to extension: i.e. '.wav'
-def load_wave_samples(p_wave: Wave) -> Ptr[libs.c.CFloat]
-# Load samples data from wave as a 32bit float data array
-def material_map(p_texture: Texture2D, p_color: Color, value: float) -> MaterialMap
-# Factory function for: MaterialMap
-def matrix(m0: float, m4: float, m8: float, m12: float, m1: float, m5: float, m9: float, m13: float, m2: float, m6: float, m10: float, m14: float, m3: float, m7: float, m11: float, m15: float) -> Matrix
-# Factory function for: Matrix
-def maximize_window() -> None
-# Set window state: maximized, if resizable (only PLATFORM_DESKTOP)
-def measure_text(text: str, font_size: int) -> int
-# Measure string width for default font
-def measure_text_ex(p_font: Font, text: str, font_size: float, spacing: float) -> Vector2
-# Measure string size for Font
-def mem_alloc(size: u32) -> AnyPtr
-# Internal memory allocator
-def mem_free(ptr: AnyPtr) -> None
-# Internal memory free
-def mem_realloc(ptr: AnyPtr, size: u32) -> AnyPtr
-# Internal memory reallocator
-def minimize_window() -> None
-# Set window state: minimized, if resizable (only PLATFORM_DESKTOP)
-def music(stream: AudioStream, frame_count: u32, looping: bool, ctx_type: int, ctx_data: AnyPtr) -> Music
-# Factory function for: Music
-def n_patch_info(source: Rectangle, left: int, top: int, right: int, bottom: int, layout: int) -> NPatchInfo
-# Factory function for: NPatchInfo
-def open_url(url: str) -> None
-# Open URL with default system browser (if available)
-def pause_audio_stream(stream: AudioStream) -> None
-# Pause audio stream
-def pause_music_stream(p_music: Music) -> None
-# Pause music playing
-def pause_sound(p_sound: Sound) -> None
-# Pause a sound
-def play_audio_stream(stream: AudioStream) -> None
-# Play audio stream
-def play_music_stream(p_music: Music) -> None
-# Start music playing
-def play_sound(p_sound: Sound) -> None
-# Play a sound
-def poll_input_events() -> None
-# Register all input events
-def quaternion(x: float, y: float, z: float, w: float) -> Quaternion
-# Factory function for: Quaternion
-def ray(position: Vector3, direction: Vector3) -> Ray
-# Factory function for: Ray
-def ray_collision(hit: bool, distance: float, point: Vector3, normal: Vector3) -> RayCollision
-# Factory function for: RayCollision
-def rectangle(x: float, y: float, width: float, height: float) -> Rectangle
-# Factory function for: Rectangle
-def render_texture(id: u32, p_texture: Texture, depth: Texture) -> RenderTexture
-# Factory function for: RenderTexture
-def render_texture_2d(id: u32, p_texture: Texture, depth: Texture) -> RenderTexture2D
-# Factory function for: RenderTexture2D
-def restore_window() -> None
-# Set window state: not minimized/maximized (only PLATFORM_DESKTOP)
-def resume_audio_stream(stream: AudioStream) -> None
-# Resume audio stream
-def resume_music_stream(p_music: Music) -> None
-# Resume playing paused music
-def resume_sound(p_sound: Sound) -> None
-# Resume a paused sound
-def save_file_data(file_name: str, data: AnyPtr, bytes_to_write: u32) -> bool
-# Save data to file from byte array (write), returns true on success
-def save_file_text(file_name: str, text: str) -> bool
-# Save text data to file (write), string must be '\0' terminated, returns true on success
-def seek_music_stream(p_music: Music, position: float) -> None
-# Seek music to a position (in seconds)
-def set_audio_stream_buffer_size_default(size: int) -> None
-# Default size for new audio streams
-def set_audio_stream_pan(stream: AudioStream, pan: float) -> None
-# Set pan for audio stream (0.5 is centered)
-def set_audio_stream_pitch(stream: AudioStream, pitch: float) -> None
-# Set pitch for audio stream (1.0 is base level)
-def set_audio_stream_volume(stream: AudioStream, volume: float) -> None
-# Set volume for audio stream (1.0 is max level)
-def set_clipboard_text(text: str) -> None
-# Set clipboard text content
-def set_config_flags(flags: u32) -> None
-# Setup init configuration flags (view FLAGS)
-def set_exit_key(key: int) -> None
-# Set a custom key to exit program (default is ESC)
-def set_gamepad_mappings(mappings: str) -> int
-# Set internal gamepad mappings (SDL_GameControllerDB)
-def set_gestures_enabled(flags: u32) -> None
-# Enable a set of gestures using flags
-def set_master_volume(volume: float) -> None
-# Set master volume (listener)
-def set_material_texture(material: Ptr[Material], map_type: int, p_texture: Texture2D) -> None
-# Set texture for a material map type (MATERIAL_MAP_DIFFUSE, MATERIAL_MAP_SPECULAR...)
-def set_model_mesh_material(model: Ptr[Model], mesh_id: int, material_id: int) -> None
-# Set material for a mesh
-def set_mouse_cursor(cursor: int) -> None
-# Set mouse cursor
-def set_mouse_offset(offset_x: int, offset_y: int) -> None
-# Set mouse offset
-def set_mouse_position(x: int, y: int) -> None
-# Set mouse position XY
-def set_mouse_scale(scale_x: float, scale_y: float) -> None
-# Set mouse scaling
-def set_music_pan(p_music: Music, pan: float) -> None
-# Set pan for a music (0.5 is center)
-def set_music_pitch(p_music: Music, pitch: float) -> None
-# Set pitch for a music (1.0 is base level)
-def set_music_volume(p_music: Music, volume: float) -> None
-# Set volume for music (1.0 is max level)
-def set_pixel_color(dst_ptr: AnyPtr, p_color: Color, format: int) -> None
-# Set color formatted into destination pixel pointer
-def set_random_seed(seed: u32) -> None
-# Set the seed for the random number generator
-def set_shader_value(shader: Shader, loc_index: int, value: AnyPtrToConst, uniform_type: int) -> None
-# Set shader uniform value
-def set_shader_value_matrix(shader: Shader, loc_index: int, mat: Matrix) -> None
-# Set shader uniform value (matrix 4x4)
-def set_shader_value_texture(shader: Shader, loc_index: int, p_texture: Texture2D) -> None
-# Set shader uniform value for texture (sampler2d)
-def set_shader_value_v(shader: Shader, loc_index: int, value: AnyPtrToConst, uniform_type: int, count: int) -> None
-# Set shader uniform value vector
-def set_shapes_texture(p_texture: Texture2D, source: Rectangle) -> None
-# Set texture and rectangle to be used on shapes drawing
-def set_sound_pan(p_sound: Sound, pan: float) -> None
-# Set pan for a sound (0.5 is center)
-def set_sound_pitch(p_sound: Sound, pitch: float) -> None
-# Set pitch for a sound (1.0 is base level)
-def set_sound_volume(p_sound: Sound, volume: float) -> None
-# Set volume for a sound (1.0 is max level)
-def set_target_fps(fps: int) -> None
-# Set target FPS (maximum)
-def set_texture_filter(p_texture: Texture2D, filter: int) -> None
-# Set texture scaling filter mode
-def set_texture_wrap(p_texture: Texture2D, wrap: int) -> None
-# Set texture wrapping mode
-def set_trace_log_level(log_level: int) -> None
-# Set the current threshold (minimum) log level
-def set_window_icon(p_image: Image) -> None
-# Set icon for window (single image, RGBA 32bit, only PLATFORM_DESKTOP)
-def set_window_icons(images: Ptr[Image], count: int) -> None
-# Set icon for window (multiple images, RGBA 32bit, only PLATFORM_DESKTOP)
-def set_window_min_size(width: int, height: int) -> None
-# Set window minimum dimensions (for FLAG_WINDOW_RESIZABLE)
-def set_window_monitor(monitor: int) -> None
-# Set monitor for the current window (fullscreen mode)
-def set_window_opacity(opacity: float) -> None
-# Set window opacity [0.0f..1.0f] (only PLATFORM_DESKTOP)
-def set_window_position(x: int, y: int) -> None
-# Set window position on screen (only PLATFORM_DESKTOP)
-def set_window_size(width: int, height: int) -> None
-# Set window dimensions
-def set_window_state(flags: u32) -> None
-# Set window configuration state using flags (only PLATFORM_DESKTOP)
-def set_window_title(title: str) -> None
-# Set title for window (only PLATFORM_DESKTOP)
-def show_cursor() -> None
-# Shows cursor
-def sound(stream: AudioStream, frame_count: u32) -> Sound
-# Factory function for: Sound
-def stop_audio_stream(stream: AudioStream) -> None
-# Stop audio stream
-def stop_music_stream(p_music: Music) -> None
-# Stop music playing
-def stop_sound(p_sound: Sound) -> None
-# Stop playing a sound
-def swap_screen_buffer() -> None
-# Swap back buffer with front buffer (screen drawing)
-def take_screenshot(file_name: str) -> None
-# Takes a screenshot of current screen (filename extension defines format)
-def text_append(text: str, append: str, position: Ptr[libs.c.CInt]) -> None
-# Append text at specific position and move cursor!
-def text_copy(dst: str, src: str) -> int
-# Copy one string to another, returns bytes copied
-def text_find_index(text: str, find: str) -> int
-# Find first text occurrence within a string
-def text_insert(text: str, insert: str, position: int) -> libs.c.CStr
-# Insert text in a position (WARNING: memory must be freed!)
-def text_is_equal(text1: str, text2: str) -> bool
-# Check if two text string are equal
-def text_join(text_list: Ptr[Ptr[Const[libs.c.CChar]]], count: int, delimiter: str) -> Ptr[Const[libs.c.CChar]]
-# Join text strings with delimiter
-def text_length(text: str) -> u32
-# Get text length, checks for '\0' ending
-def text_replace(text: str, replace: str, by: str) -> libs.c.CStr
-# Replace text string (WARNING: memory must be freed!)
-def text_split(text: str, delimiter: int, count: Ptr[libs.c.CInt]) -> Ptr[Ptr[Const[libs.c.CChar]]]
-# Split text into multiple strings
-def text_subtext(text: str, position: int, length: int) -> Ptr[Const[libs.c.CChar]]
-# Get a piece of a text string
-def text_to_integer(text: str) -> int
-# Get integer value from text (negative values not supported)
-def text_to_lower(text: str) -> Ptr[Const[libs.c.CChar]]
-# Get lower case version of provided string
-def text_to_pascal(text: str) -> Ptr[Const[libs.c.CChar]]
-# Get Pascal case notation version of provided string
-def text_to_upper(text: str) -> Ptr[Const[libs.c.CChar]]
-# Get upper case version of provided string
-def texture(id: u32, width: int, height: int, mipmaps: int, format: int) -> Texture
-# Factory function for: Texture
-def texture_2d(id: u32, width: int, height: int, mipmaps: int, format: int) -> Texture2D
-# Factory function for: Texture2D
-def texture_cubemap(id: u32, width: int, height: int, mipmaps: int, format: int) -> TextureCubemap
-# Factory function for: TextureCubemap
-def toggle_fullscreen() -> None
-# Toggle window state: fullscreen/windowed (only PLATFORM_DESKTOP)
-def transform(translation: Vector3, rotation: Quaternion, scale: Vector3) -> Transform
-# Factory function for: Transform
-def unload_audio_stream(stream: AudioStream) -> None
-# Unload audio stream and free memory
-def unload_codepoints(codepoints: Ptr[libs.c.CInt]) -> None
-# Unload codepoints data from memory
-def unload_directory_files(files: FilePathList) -> None
-# Unload filepaths
-def unload_dropped_files(files: FilePathList) -> None
-# Unload dropped filepaths
-def unload_file_data(data: Ptr[libs.c.CUChar]) -> None
-# Unload file data allocated by LoadFileData()
-def unload_file_text(text: str) -> None
-# Unload file text data allocated by LoadFileText()
-def unload_font(p_font: Font) -> None
-# Unload font from GPU memory (VRAM)
-def unload_font_data(chars: Ptr[GlyphInfo], glyph_count: int) -> None
-# Unload font chars info data (RAM)
-def unload_image(p_image: Image) -> None
-# Unload image from CPU memory (RAM)
-def unload_image_colors(colors: Ptr[Color]) -> None
-# Unload color data loaded with LoadImageColors()
-def unload_image_palette(colors: Ptr[Color]) -> None
-# Unload colors palette loaded with LoadImagePalette()
-def unload_material(material: Material) -> None
-# Unload material from GPU memory (VRAM)
-def unload_mesh(mesh: Mesh) -> None
-# Unload mesh data from CPU and GPU
-def unload_model(model: Model) -> None
-# Unload model (including meshes) from memory (RAM and/or VRAM)
-def unload_model_animation(anim: ModelAnimation) -> None
-# Unload animation data
-def unload_model_animations(animations: Ptr[ModelAnimation], count: u32) -> None
-# Unload animation array data
-def unload_music_stream(p_music: Music) -> None
-# Unload music stream
-def unload_render_texture(target: RenderTexture2D) -> None
-# Unload render texture from GPU memory (VRAM)
-def unload_shader(shader: Shader) -> None
-# Unload shader from GPU memory (VRAM)
-def unload_sound(p_sound: Sound) -> None
-# Unload sound
-def unload_texture(p_texture: Texture2D) -> None
-# Unload texture from GPU memory (VRAM)
-def unload_utf8(text: str) -> None
-# Unload UTF-8 text encoded from codepoints array
-def unload_vr_stereo_config(config: VrStereoConfig) -> None
-# Unload VR stereo config
-def unload_wave(p_wave: Wave) -> None
-# Unload wave data
-def unload_wave_samples(samples: Ptr[libs.c.CFloat]) -> None
-# Unload samples data loaded with LoadWaveSamples()
-def update_audio_stream(stream: AudioStream, data: AnyPtrToConst, frame_count: int) -> None
-# Update audio stream buffers with data
-def update_camera(p_camera: Ptr[Camera], mode: int) -> None
-# Update camera position for selected mode
-def update_camera_pro(p_camera: Ptr[Camera], movement: Vector3, rotation: Vector3, zoom: float) -> None
-# Update camera movement/rotation
-def update_mesh_buffer(mesh: Mesh, index: int, data: AnyPtrToConst, data_size: int, offset: int) -> None
-# Update mesh vertex data in GPU for a specific buffer index
-def update_model_animation(model: Model, anim: ModelAnimation, frame: int) -> None
-# Update model animation pose
-def update_music_stream(p_music: Music) -> None
-# Updates buffers for music streaming
-def update_sound(p_sound: Sound, data: AnyPtrToConst, sample_count: int) -> None
-# Update sound buffer with new data
-def update_texture(p_texture: Texture2D, pixels: AnyPtrToConst) -> None
-# Update GPU texture with new data
-def update_texture_rec(p_texture: Texture2D, rec: Rectangle, pixels: AnyPtrToConst) -> None
-# Update GPU texture rectangle with new data
-def upload_mesh(mesh: Ptr[Mesh], dynamic: bool) -> None
-# Upload mesh vertex data in GPU and provide VAO/VBO ids
-def vector2(x: float, y: float) -> Vector2
-# Factory function for: Vector2
-def vector3(x: float, y: float, z: float) -> Vector3
-# Factory function for: Vector3
-def vector4(x: float, y: float, z: float, w: float) -> Vector4
-# Factory function for: Vector4
-def wait_time(seconds: f64) -> None
-# Wait for some time (halt program execution)
-def wave(frame_count: u32, sample_rate: u32, sample_size: u32, channels: u32, data: AnyPtr) -> Wave
-# Factory function for: Wave
-def wave_copy(p_wave: Wave) -> Wave
-# Copy a wave to a new wave
-def wave_crop(p_wave: Ptr[Wave], init_sample: int, final_sample: int) -> None
-# Crop a wave to defined samples range
-def wave_format(p_wave: Ptr[Wave], sample_rate: int, sample_size: int, channels: int) -> None
-# Convert wave data to desired format
-def window_should_close() -> bool
-# Check if KEY_ESCAPE pressed or Close icon pressed
-

2.2 raylib.gl

RL_ATTACHMENT_COLOR_CHANNEL0: Const[int]
-# Framebuffer attachment type: color 0
-RL_ATTACHMENT_COLOR_CHANNEL1: Const[int]
-# Framebuffer attachment type: color 1
-RL_ATTACHMENT_COLOR_CHANNEL2: Const[int]
-# Framebuffer attachment type: color 2
-RL_ATTACHMENT_COLOR_CHANNEL3: Const[int]
-# Framebuffer attachment type: color 3
-RL_ATTACHMENT_COLOR_CHANNEL4: Const[int]
-# Framebuffer attachment type: color 4
-RL_ATTACHMENT_COLOR_CHANNEL5: Const[int]
-# Framebuffer attachment type: color 5
-RL_ATTACHMENT_COLOR_CHANNEL6: Const[int]
-# Framebuffer attachment type: color 6
-RL_ATTACHMENT_COLOR_CHANNEL7: Const[int]
-# Framebuffer attachment type: color 7
-RL_ATTACHMENT_CUBEMAP_NEGATIVE_X: Const[int]
-# Framebuffer texture attachment type: cubemap, -X side
-RL_ATTACHMENT_CUBEMAP_NEGATIVE_Y: Const[int]
-# Framebuffer texture attachment type: cubemap, -Y side
-RL_ATTACHMENT_CUBEMAP_NEGATIVE_Z: Const[int]
-# Framebuffer texture attachment type: cubemap, -Z side
-RL_ATTACHMENT_CUBEMAP_POSITIVE_X: Const[int]
-# Framebuffer texture attachment type: cubemap, +X side
-RL_ATTACHMENT_CUBEMAP_POSITIVE_Y: Const[int]
-# Framebuffer texture attachment type: cubemap, +Y side
-RL_ATTACHMENT_CUBEMAP_POSITIVE_Z: Const[int]
-# Framebuffer texture attachment type: cubemap, +Z side
-RL_ATTACHMENT_DEPTH: Const[int]
-# Framebuffer attachment type: depth
-RL_ATTACHMENT_RENDERBUFFER: Const[int]
-# Framebuffer texture attachment type: renderbuffer
-RL_ATTACHMENT_STENCIL: Const[int]
-# Framebuffer attachment type: stencil
-RL_ATTACHMENT_TEXTURE2D: Const[int]
-# Framebuffer texture attachment type: texture2d
-RL_BLEND_ADDITIVE: Const[int]
-# Blend textures adding colors
-RL_BLEND_ADD_COLORS: Const[int]
-# Blend textures adding colors (alternative)
-RL_BLEND_ALPHA: Const[int]
-# Blend textures considering alpha (default)
-RL_BLEND_ALPHA_PREMULTIPLY: Const[int]
-# Blend premultiplied textures considering alpha
-RL_BLEND_CUSTOM: Const[int]
-# Blend textures using custom src/dst factors (use rlSetBlendFactors())
-RL_BLEND_CUSTOM_SEPARATE: Const[int]
-# Blend textures using custom src/dst factors (use rlSetBlendFactorsSeparate())
-RL_BLEND_MULTIPLIED: Const[int]
-# Blend textures multiplying colors
-RL_BLEND_SUBTRACT_COLORS: Const[int]
-# Blend textures subtracting colors (alternative)
-RL_CULL_FACE_BACK: Const[int]
-RL_CULL_FACE_FRONT: Const[int]
-RL_LOG_ALL: Const[int]
-# Display all logs
-RL_LOG_DEBUG: Const[int]
-# Debug logging, used for internal debugging, it should be disabled on release builds
-RL_LOG_ERROR: Const[int]
-# Error logging, used on unrecoverable failures
-RL_LOG_FATAL: Const[int]
-# Fatal logging, used to abort program: exit(EXIT_FAILURE)
-RL_LOG_INFO: Const[int]
-# Info logging, used for program execution info
-RL_LOG_NONE: Const[int]
-# Disable logging
-RL_LOG_TRACE: Const[int]
-# Trace logging, intended for internal use only
-RL_LOG_WARNING: Const[int]
-# Warning logging, used on recoverable failures
-RL_OPENGL_11: Const[int]
-# OpenGL 1.1
-RL_OPENGL_21: Const[int]
-# OpenGL 2.1 (GLSL 120)
-RL_OPENGL_33: Const[int]
-# OpenGL 3.3 (GLSL 330)
-RL_OPENGL_43: Const[int]
-# OpenGL 4.3 (using GLSL 330)
-RL_OPENGL_ES_20: Const[int]
-# OpenGL ES 2.0 (GLSL 100)
-RL_PIXELFORMAT_COMPRESSED_ASTC_4x4_RGBA: Const[int]
-# 8 bpp
-RL_PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA: Const[int]
-# 2 bpp
-RL_PIXELFORMAT_COMPRESSED_DXT1_RGB: Const[int]
-# 4 bpp (no alpha)
-RL_PIXELFORMAT_COMPRESSED_DXT1_RGBA: Const[int]
-# 4 bpp (1 bit alpha)
-RL_PIXELFORMAT_COMPRESSED_DXT3_RGBA: Const[int]
-# 8 bpp
-RL_PIXELFORMAT_COMPRESSED_DXT5_RGBA: Const[int]
-# 8 bpp
-RL_PIXELFORMAT_COMPRESSED_ETC1_RGB: Const[int]
-# 4 bpp
-RL_PIXELFORMAT_COMPRESSED_ETC2_EAC_RGBA: Const[int]
-# 8 bpp
-RL_PIXELFORMAT_COMPRESSED_ETC2_RGB: Const[int]
-# 4 bpp
-RL_PIXELFORMAT_COMPRESSED_PVRT_RGB: Const[int]
-# 4 bpp
-RL_PIXELFORMAT_COMPRESSED_PVRT_RGBA: Const[int]
-# 4 bpp
-RL_PIXELFORMAT_UNCOMPRESSED_GRAYSCALE: Const[int]
-# 8 bit per pixel (no alpha)
-RL_PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA: Const[int]
-# 8*2 bpp (2 channels)
-RL_PIXELFORMAT_UNCOMPRESSED_R32: Const[int]
-# 32 bpp (1 channel - float)
-RL_PIXELFORMAT_UNCOMPRESSED_R32G32B32: Const[int]
-# 32*3 bpp (3 channels - float)
-RL_PIXELFORMAT_UNCOMPRESSED_R32G32B32A32: Const[int]
-# 32*4 bpp (4 channels - float)
-RL_PIXELFORMAT_UNCOMPRESSED_R4G4B4A4: Const[int]
-# 16 bpp (4 bit alpha)
-RL_PIXELFORMAT_UNCOMPRESSED_R5G5B5A1: Const[int]
-# 16 bpp (1 bit alpha)
-RL_PIXELFORMAT_UNCOMPRESSED_R5G6B5: Const[int]
-# 16 bpp
-RL_PIXELFORMAT_UNCOMPRESSED_R8G8B8: Const[int]
-# 24 bpp
-RL_PIXELFORMAT_UNCOMPRESSED_R8G8B8A8: Const[int]
-# 32 bpp
-RL_SHADER_ATTRIB_FLOAT: Const[int]
-# Shader attribute type: float
-RL_SHADER_ATTRIB_VEC2: Const[int]
-# Shader attribute type: vec2 (2 float)
-RL_SHADER_ATTRIB_VEC3: Const[int]
-# Shader attribute type: vec3 (3 float)
-RL_SHADER_ATTRIB_VEC4: Const[int]
-# Shader attribute type: vec4 (4 float)
-RL_SHADER_LOC_COLOR_AMBIENT: Const[int]
-# Shader location: vector uniform: ambient color
-RL_SHADER_LOC_COLOR_DIFFUSE: Const[int]
-# Shader location: vector uniform: diffuse color
-RL_SHADER_LOC_COLOR_SPECULAR: Const[int]
-# Shader location: vector uniform: specular color
-RL_SHADER_LOC_MAP_ALBEDO: Const[int]
-# Shader location: sampler2d texture: albedo (same as: RL_SHADER_LOC_MAP_DIFFUSE)
-RL_SHADER_LOC_MAP_BRDF: Const[int]
-# Shader location: sampler2d texture: brdf
-RL_SHADER_LOC_MAP_CUBEMAP: Const[int]
-# Shader location: samplerCube texture: cubemap
-RL_SHADER_LOC_MAP_EMISSION: Const[int]
-# Shader location: sampler2d texture: emission
-RL_SHADER_LOC_MAP_HEIGHT: Const[int]
-# Shader location: sampler2d texture: height
-RL_SHADER_LOC_MAP_IRRADIANCE: Const[int]
-# Shader location: samplerCube texture: irradiance
-RL_SHADER_LOC_MAP_METALNESS: Const[int]
-# Shader location: sampler2d texture: metalness (same as: RL_SHADER_LOC_MAP_SPECULAR)
-RL_SHADER_LOC_MAP_NORMAL: Const[int]
-# Shader location: sampler2d texture: normal
-RL_SHADER_LOC_MAP_OCCLUSION: Const[int]
-# Shader location: sampler2d texture: occlusion
-RL_SHADER_LOC_MAP_PREFILTER: Const[int]
-# Shader location: samplerCube texture: prefilter
-RL_SHADER_LOC_MAP_ROUGHNESS: Const[int]
-# Shader location: sampler2d texture: roughness
-RL_SHADER_LOC_MATRIX_MODEL: Const[int]
-# Shader location: matrix uniform: model (transform)
-RL_SHADER_LOC_MATRIX_MVP: Const[int]
-# Shader location: matrix uniform: model-view-projection
-RL_SHADER_LOC_MATRIX_NORMAL: Const[int]
-# Shader location: matrix uniform: normal
-RL_SHADER_LOC_MATRIX_PROJECTION: Const[int]
-# Shader location: matrix uniform: projection
-RL_SHADER_LOC_MATRIX_VIEW: Const[int]
-# Shader location: matrix uniform: view (camera transform)
-RL_SHADER_LOC_VECTOR_VIEW: Const[int]
-# Shader location: vector uniform: view
-RL_SHADER_LOC_VERTEX_COLOR: Const[int]
-# Shader location: vertex attribute: color
-RL_SHADER_LOC_VERTEX_NORMAL: Const[int]
-# Shader location: vertex attribute: normal
-RL_SHADER_LOC_VERTEX_POSITION: Const[int]
-# Shader location: vertex attribute: position
-RL_SHADER_LOC_VERTEX_TANGENT: Const[int]
-# Shader location: vertex attribute: tangent
-RL_SHADER_LOC_VERTEX_TEXCOORD01: Const[int]
-# Shader location: vertex attribute: texcoord01
-RL_SHADER_LOC_VERTEX_TEXCOORD02: Const[int]
-# Shader location: vertex attribute: texcoord02
-RL_SHADER_UNIFORM_FLOAT: Const[int]
-# Shader uniform type: float
-RL_SHADER_UNIFORM_INT: Const[int]
-# Shader uniform type: int
-RL_SHADER_UNIFORM_IVEC2: Const[int]
-# Shader uniform type: ivec2 (2 int)
-RL_SHADER_UNIFORM_IVEC3: Const[int]
-# Shader uniform type: ivec3 (3 int)
-RL_SHADER_UNIFORM_IVEC4: Const[int]
-# Shader uniform type: ivec4 (4 int)
-RL_SHADER_UNIFORM_SAMPLER2D: Const[int]
-# Shader uniform type: sampler2d
-RL_SHADER_UNIFORM_VEC2: Const[int]
-# Shader uniform type: vec2 (2 float)
-RL_SHADER_UNIFORM_VEC3: Const[int]
-# Shader uniform type: vec3 (3 float)
-RL_SHADER_UNIFORM_VEC4: Const[int]
-# Shader uniform type: vec4 (4 float)
-RL_TEXTURE_FILTER_ANISOTROPIC_16X: Const[int]
-# Anisotropic filtering 16x
-RL_TEXTURE_FILTER_ANISOTROPIC_4X: Const[int]
-# Anisotropic filtering 4x
-RL_TEXTURE_FILTER_ANISOTROPIC_8X: Const[int]
-# Anisotropic filtering 8x
-RL_TEXTURE_FILTER_BILINEAR: Const[int]
-# Linear filtering
-RL_TEXTURE_FILTER_POINT: Const[int]
-# No filter, just pixel approximation
-RL_TEXTURE_FILTER_TRILINEAR: Const[int]
-# Trilinear filtering (linear with mipmaps)
-class rlDrawCall
-# of those state-change happens (this is done in core module):
-    mode: libs.c.CInt
-    vertexCount: libs.c.CInt
-    vertexAlignment: libs.c.CInt
-    textureId: libs.c.CUInt
-class rlRenderBatch
-# rlRenderBatch type:
-    bufferCount: libs.c.CInt
-    currentBuffer: libs.c.CInt
-    vertexBuffer: Ptr[raylib.rlVertexBuffer]
-    draws: Ptr[raylib.rlDrawCall]
-    drawCounter: libs.c.CInt
-    currentDepth: float
-class rlVertexBuffer
-# Dynamic vertex buffers (position + texcoords + colors + indices arrays)
-class rlglData
-def rl_active_draw_buffers(count: int) -> None
-# Activate multiple draw color buffers
-def rl_active_texture_slot(slot: int) -> None
-# Select and active a texture slot
-def rl_begin(mode: int) -> None
-# Initialize drawing mode (how to organize vertex)
-def rl_bind_image_texture(id: u32, index: u32, format: int, readonly: bool) -> None
-# Bind image texture
-def rl_bind_shader_buffer(id: u32, index: u32) -> None
-# Bind SSBO buffer
-def rl_check_errors() -> None
-# Check and log OpenGL error codes
-def rl_check_render_batch_limit(v_count: int) -> bool
-# Check internal buffer overflow for a given number of vertex
-def rl_clear_color(r: int, g: int, b: int, a: int) -> None
-# Clear color buffer with color
-def rl_clear_screen_buffers() -> None
-# Clear used screen buffers (color and depth)
-def rl_color3f(x: float, y: float, z: float) -> None
-# Define one vertex (color) - 3 float
-def rl_color4f(x: float, y: float, z: float, w: float) -> None
-# Define one vertex (color) - 4 float
-def rl_color4ub(r: int, g: int, b: int, a: int) -> None
-# Define one vertex (color) - 4 byte
-def rl_compile_shader(shader_code: str, type: int) -> u32
-# Compile custom shader and return shader id (type: RL_VERTEX_SHADER, RL_FRAGMENT_SHADER, RL_COMPUTE_SHADER)
-def rl_compute_shader_dispatch(group_x: u32, group_y: u32, group_z: u32) -> None
-# Dispatch compute shader (equivalent to *draw* for graphics pipeline)
-def rl_copy_shader_buffer(dest_id: u32, src_id: u32, dest_offset: u32, src_offset: u32, count: u32) -> None
-# Copy SSBO data between buffers
-def rl_cubemap_parameters(id: u32, param: int, value: int) -> None
-# Set cubemap parameters (filter, wrap)
-def rl_disable_backface_culling() -> None
-# Disable backface culling
-def rl_disable_color_blend() -> None
-# Disable color blending
-def rl_disable_depth_mask() -> None
-# Disable depth write
-def rl_disable_depth_test() -> None
-# Disable depth test
-def rl_disable_framebuffer() -> None
-# Disable render texture (fbo), return to default framebuffer
-def rl_disable_scissor_test() -> None
-# Disable scissor test
-def rl_disable_shader() -> None
-# Disable shader program
-def rl_disable_smooth_lines() -> None
-# Disable line aliasing
-def rl_disable_state_pointer(vertex_attrib_type: int) -> None
-# Disable attribute state pointer
-def rl_disable_stereo_render() -> None
-# Disable stereo rendering
-def rl_disable_texture() -> None
-# Disable texture
-def rl_disable_texture_cubemap() -> None
-# Disable texture cubemap
-def rl_disable_vertex_array() -> None
-# Disable vertex array (VAO, if supported)
-def rl_disable_vertex_attribute(index: u32) -> None
-# Disable vertex attribute index
-def rl_disable_vertex_buffer() -> None
-# Disable vertex buffer (VBO)
-def rl_disable_vertex_buffer_element() -> None
-# Disable vertex buffer element (VBO element)
-def rl_disable_wire_mode() -> None
-# Disable wire mode
-def rl_draw_call(mode: int, vertex_count: int, vertex_alignment: int, texture_id: u32) -> rlDrawCall
-# Factory function for: rlDrawCall
-def rl_draw_render_batch(batch: Ptr[raylib.rlRenderBatch]) -> None
-# Draw render batch data (Update->Draw->Reset)
-def rl_draw_render_batch_active() -> None
-# Update and draw internal render batch
-def rl_draw_vertex_array(offset: int, count: int) -> None
-def rl_draw_vertex_array_elements(offset: int, count: int, buffer: AnyPtrToConst) -> None
-def rl_draw_vertex_array_elements_instanced(offset: int, count: int, buffer: AnyPtrToConst, instances: int) -> None
-def rl_draw_vertex_array_instanced(offset: int, count: int, instances: int) -> None
-def rl_enable_backface_culling() -> None
-# Enable backface culling
-def rl_enable_color_blend() -> None
-# Enable color blending
-def rl_enable_depth_mask() -> None
-# Enable depth write
-def rl_enable_depth_test() -> None
-# Enable depth test
-def rl_enable_framebuffer(id: u32) -> None
-# Enable render texture (fbo)
-def rl_enable_scissor_test() -> None
-# Enable scissor test
-def rl_enable_shader(id: u32) -> None
-# Enable shader program
-def rl_enable_smooth_lines() -> None
-# Enable line aliasing
-def rl_enable_state_pointer(vertex_attrib_type: int, buffer: AnyPtr) -> None
-# Enable attribute state pointer
-def rl_enable_stereo_render() -> None
-# Enable stereo rendering
-def rl_enable_texture(id: u32) -> None
-# Enable texture
-def rl_enable_texture_cubemap(id: u32) -> None
-# Enable texture cubemap
-def rl_enable_vertex_array(vao_id: u32) -> bool
-# Enable vertex array (VAO, if supported)
-def rl_enable_vertex_attribute(index: u32) -> None
-# Enable vertex attribute index
-def rl_enable_vertex_buffer(id: u32) -> None
-# Enable vertex buffer (VBO)
-def rl_enable_vertex_buffer_element(id: u32) -> None
-# Enable vertex buffer element (VBO element)
-def rl_enable_wire_mode() -> None
-# Enable wire mode
-def rl_end() -> None
-# Finish vertex providing
-def rl_framebuffer_attach(fbo_id: u32, tex_id: u32, attach_type: int, tex_type: int, mip_level: int) -> None
-# Attach texture/renderbuffer to a framebuffer
-def rl_framebuffer_complete(id: u32) -> bool
-# Verify framebuffer is complete
-def rl_frustum(left: f64, right: f64, bottom: f64, top: f64, znear: f64, zfar: f64) -> None
-def rl_gen_texture_mipmaps(id: u32, width: int, height: int, format: int, mipmaps: Ptr[libs.c.CInt]) -> None
-# Generate mipmap data for selected texture
-def rl_get_framebuffer_height() -> int
-# Get default framebuffer height
-def rl_get_framebuffer_width() -> int
-# Get default framebuffer width
-def rl_get_gl_texture_formats(format: int, gl_internal_format: Ptr[libs.c.CUInt], gl_format: Ptr[libs.c.CUInt], gl_type: Ptr[libs.c.CUInt]) -> None
-# Get OpenGL internal formats
-def rl_get_line_width() -> float
-# Get the line drawing width
-def rl_get_location_attrib(shader_id: u32, attrib_name: str) -> int
-# Get shader location attribute
-def rl_get_location_uniform(shader_id: u32, uniform_name: str) -> int
-# Get shader location uniform
-def rl_get_matrix_modelview() -> raylib.Matrix
-# Get internal modelview matrix
-def rl_get_matrix_projection() -> raylib.Matrix
-# Get internal projection matrix
-def rl_get_matrix_projection_stereo(eye: int) -> raylib.Matrix
-# Get internal projection matrix for stereo render (selected eye)
-def rl_get_matrix_transform() -> raylib.Matrix
-# Get internal accumulated transform matrix
-def rl_get_matrix_view_offset_stereo(eye: int) -> raylib.Matrix
-# Get internal view offset matrix for stereo render (selected eye)
-def rl_get_pixel_format_name(format: u32) -> Ptr[Const[libs.c.CChar]]
-# Get name string for pixel format
-def rl_get_shader_buffer_size(id: u32) -> u32
-# Get SSBO buffer size
-def rl_get_shader_id_default() -> u32
-# Get default shader id
-def rl_get_shader_locs_default() -> Ptr[libs.c.CInt]
-# Get default shader locations
-def rl_get_texture_id_default() -> u32
-# Get default texture id
-def rl_get_version() -> int
-# Get current OpenGL version
-def rl_is_stereo_render_enabled() -> bool
-# Check if stereo render is enabled
-def rl_load_compute_shader_program(shader_id: u32) -> u32
-# Load compute shader program
-def rl_load_draw_cube() -> None
-# Load and draw a cube
-def rl_load_draw_quad() -> None
-# Load and draw a quad
-def rl_load_extensions(loader: AnyPtr) -> None
-# Load OpenGL extensions (loader function required)
-def rl_load_framebuffer(width: int, height: int) -> u32
-# Load an empty framebuffer
-def rl_load_identity() -> None
-# Reset current matrix to identity matrix
-def rl_load_render_batch(num_buffers: int, buffer_elements: int) -> raylib.rlRenderBatch
-# Load a render batch system
-def rl_load_shader_buffer(size: u32, data: AnyPtrToConst, usage_hint: int) -> u32
-# Load shader storage buffer object (SSBO)
-def rl_load_shader_code(vs_code: str, fs_code: str) -> u32
-# Load shader from code strings
-def rl_load_shader_program(v_shader_id: u32, f_shader_id: u32) -> u32
-# Load custom shader program
-def rl_load_texture(data: AnyPtrToConst, width: int, height: int, format: int, mipmap_count: int) -> u32
-# Load texture in GPU
-def rl_load_texture_cubemap(data: AnyPtrToConst, size: int, format: int) -> u32
-# Load texture cubemap
-def rl_load_texture_depth(width: int, height: int, use_render_buffer: bool) -> u32
-# Load depth texture/renderbuffer (to be attached to fbo)
-def rl_load_vertex_array() -> u32
-# Load vertex array (vao) if supported
-def rl_load_vertex_buffer(buffer: AnyPtrToConst, size: int, dynamic: bool) -> u32
-# Load a vertex buffer attribute
-def rl_load_vertex_buffer_element(buffer: AnyPtrToConst, size: int, dynamic: bool) -> u32
-# Load a new attributes element buffer
-def rl_matrix_mode(mode: int) -> None
-# Choose the current matrix to be transformed
-def rl_normal3f(x: float, y: float, z: float) -> None
-# Define one vertex (normal) - 3 float
-def rl_ortho(left: f64, right: f64, bottom: f64, top: f64, znear: f64, zfar: f64) -> None
-def rl_pop_matrix() -> None
-# Pop latest inserted matrix from stack
-def rl_push_matrix() -> None
-# Push the current matrix to stack
-def rl_read_screen_pixels(width: int, height: int) -> Ptr[libs.c.CUChar]
-# Read screen pixel data (color buffer)
-def rl_read_shader_buffer(id: u32, dest: AnyPtr, count: u32, offset: u32) -> None
-# Read SSBO buffer data (GPU->CPU)
-def rl_read_texture_pixels(id: u32, width: int, height: int, format: int) -> AnyPtr
-# Read texture pixel data
-def rl_render_batch(buffer_count: int, current_buffer: int, vertex_buffer: Ptr[raylib.rlVertexBuffer], draws: Ptr[raylib.rlDrawCall], draw_counter: int, current_depth: float) -> rlRenderBatch
-# Factory function for: rlRenderBatch
-def rl_rotatef(angle: float, x: float, y: float, z: float) -> None
-# Multiply the current matrix by a rotation matrix
-def rl_scalef(x: float, y: float, z: float) -> None
-# Multiply the current matrix by a scaling matrix
-def rl_scissor(x: int, y: int, width: int, height: int) -> None
-# Scissor test
-def rl_set_blend_factors(gl_src_factor: int, gl_dst_factor: int, gl_equation: int) -> None
-# Set blending mode factor and equation (using OpenGL factors)
-def rl_set_blend_factors_separate(gl_src_rgb: int, gl_dst_rgb: int, gl_src_alpha: int, gl_dst_alpha: int, gl_eq_rgb: int, gl_eq_alpha: int) -> None
-# Set blending mode factors and equations separately (using OpenGL factors)
-def rl_set_blend_mode(mode: int) -> None
-# Set blending mode
-def rl_set_cull_face(mode: int) -> None
-# Set face culling mode
-def rl_set_framebuffer_height(height: int) -> None
-# Set current framebuffer height
-def rl_set_framebuffer_width(width: int) -> None
-# Set current framebuffer width
-def rl_set_line_width(width: float) -> None
-# Set the line drawing width
-def rl_set_matrix_modelview(view: raylib.Matrix) -> None
-# Set a custom modelview matrix (replaces internal modelview matrix)
-def rl_set_matrix_projection(proj: raylib.Matrix) -> None
-# Set a custom projection matrix (replaces internal projection matrix)
-def rl_set_matrix_projection_stereo(right: raylib.Matrix, left: raylib.Matrix) -> None
-# Set eyes projection matrices for stereo rendering
-def rl_set_matrix_view_offset_stereo(right: raylib.Matrix, left: raylib.Matrix) -> None
-# Set eyes view offsets matrices for stereo rendering
-def rl_set_render_batch_active(batch: Ptr[raylib.rlRenderBatch]) -> None
-# Set the active render batch for rlgl (NULL for default internal)
-def rl_set_shader(id: u32, locs: Ptr[libs.c.CInt]) -> None
-# Set shader currently active (id and locations)
-def rl_set_texture(id: u32) -> None
-# Set current texture for render batch and check buffers limits
-def rl_set_uniform(loc_index: int, value: AnyPtrToConst, uniform_type: int, count: int) -> None
-# Set shader value uniform
-def rl_set_uniform_matrix(loc_index: int, mat: raylib.Matrix) -> None
-# Set shader value matrix
-def rl_set_uniform_sampler(loc_index: int, texture_id: u32) -> None
-# Set shader value sampler
-def rl_set_vertex_attribute(index: u32, comp_size: int, type: int, normalized: bool, stride: int, pointer: AnyPtrToConst) -> None
-def rl_set_vertex_attribute_default(loc_index: int, value: AnyPtrToConst, attrib_type: int, count: int) -> None
-# Set vertex attribute default value
-def rl_set_vertex_attribute_divisor(index: u32, divisor: int) -> None
-def rl_tex_coord2f(x: float, y: float) -> None
-# Define one vertex (texture coordinate) - 2 float
-def rl_texture_parameters(id: u32, param: int, value: int) -> None
-# Set texture parameters (filter, wrap)
-def rl_translatef(x: float, y: float, z: float) -> None
-# Multiply the current matrix by a translation matrix
-def rl_unload_framebuffer(id: u32) -> None
-# Delete framebuffer from GPU
-def rl_unload_render_batch(batch: raylib.rlRenderBatch) -> None
-# Unload render batch system
-def rl_unload_shader_buffer(ssbo_id: u32) -> None
-# Unload shader storage buffer object (SSBO)
-def rl_unload_shader_program(id: u32) -> None
-# Unload shader program
-def rl_unload_texture(id: u32) -> None
-# Unload texture from GPU memory
-def rl_unload_vertex_array(vao_id: u32) -> None
-def rl_unload_vertex_buffer(vbo_id: u32) -> None
-def rl_update_shader_buffer(id: u32, data: AnyPtrToConst, data_size: u32, offset: u32) -> None
-# Update SSBO buffer data
-def rl_update_texture(id: u32, offset_x: int, offset_y: int, width: int, height: int, format: int, data: AnyPtrToConst) -> None
-# Update GPU texture with new data
-def rl_update_vertex_buffer(buffer_id: u32, data: AnyPtrToConst, data_size: int, offset: int) -> None
-# Update GPU buffer with new data
-def rl_update_vertex_buffer_elements(id: u32, data: AnyPtrToConst, data_size: int, offset: int) -> None
-# Update vertex buffer elements with new data
-def rl_vertex2f(x: float, y: float) -> None
-# Define one vertex (position) - 2 float
-def rl_vertex2i(x: int, y: int) -> None
-# Define one vertex (position) - 2 int
-def rl_vertex3f(x: float, y: float, z: float) -> None
-# Define one vertex (position) - 3 float
-def rl_viewport(x: int, y: int, width: int, height: int) -> None
-# Set the viewport area
-def rlgl_close() -> None
-# De-initialize rlgl (buffers, shaders, textures)
-def rlgl_init(width: int, height: int) -> None
-# Initialize rlgl (buffers, shaders, textures, states)
-

2.3 raylib.gui

ARROWS_SIZE: Const[int]
-ARROWS_VISIBLE: Const[int]
-ARROW_PADDING: Const[int]
-# DropdownBox arrow separation from border and items
-BACKGROUND_COLOR: Const[int]
-# Background color
-BASE_COLOR_DISABLED: Const[int]
-BASE_COLOR_FOCUSED: Const[int]
-BASE_COLOR_NORMAL: Const[int]
-BASE_COLOR_PRESSED: Const[int]
-BORDER_COLOR_DISABLED: Const[int]
-BORDER_COLOR_FOCUSED: Const[int]
-BORDER_COLOR_NORMAL: Const[int]
-BORDER_COLOR_PRESSED: Const[int]
-BORDER_WIDTH: Const[int]
-BUTTON: Const[int]
-CHECKBOX: Const[int]
-CHECK_PADDING: Const[int]
-# CheckBox internal check padding
-COLORPICKER: Const[int]
-COLOR_SELECTOR_SIZE: Const[int]
-COMBOBOX: Const[int]
-COMBO_BUTTON_SPACING: Const[int]
-# ComboBox button separation
-COMBO_BUTTON_WIDTH: Const[int]
-# ComboBox right button width
-DEFAULT: Const[int]
-DROPDOWNBOX: Const[int]
-DROPDOWN_ITEMS_SPACING: Const[int]
-# DropdownBox items separation
-GROUP_PADDING: Const[int]
-# ToggleGroup separation between toggles
-HUEBAR_PADDING: Const[int]
-# ColorPicker right hue bar separation from panel
-HUEBAR_SELECTOR_HEIGHT: Const[int]
-# ColorPicker right hue bar selector height
-HUEBAR_SELECTOR_OVERFLOW: Const[int]
-# ColorPicker right hue bar selector overflow
-HUEBAR_WIDTH: Const[int]
-# ColorPicker right hue bar width
-ICON_1UP: Const[int]
-ICON_219: Const[int]
-ICON_220: Const[int]
-ICON_221: Const[int]
-ICON_222: Const[int]
-ICON_223: Const[int]
-ICON_224: Const[int]
-ICON_225: Const[int]
-ICON_226: Const[int]
-ICON_227: Const[int]
-ICON_228: Const[int]
-ICON_229: Const[int]
-ICON_230: Const[int]
-ICON_231: Const[int]
-ICON_232: Const[int]
-ICON_233: Const[int]
-ICON_234: Const[int]
-ICON_235: Const[int]
-ICON_236: Const[int]
-ICON_237: Const[int]
-ICON_238: Const[int]
-ICON_239: Const[int]
-ICON_240: Const[int]
-ICON_241: Const[int]
-ICON_242: Const[int]
-ICON_243: Const[int]
-ICON_244: Const[int]
-ICON_245: Const[int]
-ICON_246: Const[int]
-ICON_247: Const[int]
-ICON_248: Const[int]
-ICON_249: Const[int]
-ICON_250: Const[int]
-ICON_251: Const[int]
-ICON_252: Const[int]
-ICON_253: Const[int]
-ICON_254: Const[int]
-ICON_255: Const[int]
-ICON_ALARM: Const[int]
-ICON_ALPHA_CLEAR: Const[int]
-ICON_ALPHA_MULTIPLY: Const[int]
-ICON_ARROW_DOWN: Const[int]
-ICON_ARROW_DOWN_FILL: Const[int]
-ICON_ARROW_LEFT: Const[int]
-ICON_ARROW_LEFT_FILL: Const[int]
-ICON_ARROW_RIGHT: Const[int]
-ICON_ARROW_RIGHT_FILL: Const[int]
-ICON_ARROW_UP: Const[int]
-ICON_ARROW_UP_FILL: Const[int]
-ICON_AUDIO: Const[int]
-ICON_BIN: Const[int]
-ICON_BOX: Const[int]
-ICON_BOX_BOTTOM: Const[int]
-ICON_BOX_BOTTOM_LEFT: Const[int]
-ICON_BOX_BOTTOM_RIGHT: Const[int]
-ICON_BOX_CENTER: Const[int]
-ICON_BOX_CIRCLE_MASK: Const[int]
-ICON_BOX_CONCENTRIC: Const[int]
-ICON_BOX_CORNERS_BIG: Const[int]
-ICON_BOX_CORNERS_SMALL: Const[int]
-ICON_BOX_DOTS_BIG: Const[int]
-ICON_BOX_DOTS_SMALL: Const[int]
-ICON_BOX_GRID: Const[int]
-ICON_BOX_GRID_BIG: Const[int]
-ICON_BOX_LEFT: Const[int]
-ICON_BOX_MULTISIZE: Const[int]
-ICON_BOX_RIGHT: Const[int]
-ICON_BOX_TOP: Const[int]
-ICON_BOX_TOP_LEFT: Const[int]
-ICON_BOX_TOP_RIGHT: Const[int]
-ICON_BREAKPOINT_OFF: Const[int]
-ICON_BREAKPOINT_ON: Const[int]
-ICON_BRUSH_CLASSIC: Const[int]
-ICON_BRUSH_PAINTER: Const[int]
-ICON_BURGER_MENU: Const[int]
-ICON_CAMERA: Const[int]
-ICON_CASE_SENSITIVE: Const[int]
-ICON_CLOCK: Const[int]
-ICON_COIN: Const[int]
-ICON_COLOR_BUCKET: Const[int]
-ICON_COLOR_PICKER: Const[int]
-ICON_CORNER: Const[int]
-ICON_CPU: Const[int]
-ICON_CRACK: Const[int]
-ICON_CRACK_POINTS: Const[int]
-ICON_CROP: Const[int]
-ICON_CROP_ALPHA: Const[int]
-ICON_CROSS: Const[int]
-ICON_CROSSLINE: Const[int]
-ICON_CROSS_SMALL: Const[int]
-ICON_CUBE: Const[int]
-ICON_CUBE_FACE_BACK: Const[int]
-ICON_CUBE_FACE_BOTTOM: Const[int]
-ICON_CUBE_FACE_FRONT: Const[int]
-ICON_CUBE_FACE_LEFT: Const[int]
-ICON_CUBE_FACE_RIGHT: Const[int]
-ICON_CUBE_FACE_TOP: Const[int]
-ICON_CURSOR_CLASSIC: Const[int]
-ICON_CURSOR_HAND: Const[int]
-ICON_CURSOR_MOVE: Const[int]
-ICON_CURSOR_MOVE_FILL: Const[int]
-ICON_CURSOR_POINTER: Const[int]
-ICON_CURSOR_SCALE: Const[int]
-ICON_CURSOR_SCALE_FILL: Const[int]
-ICON_CURSOR_SCALE_LEFT: Const[int]
-ICON_CURSOR_SCALE_LEFT_FILL: Const[int]
-ICON_CURSOR_SCALE_RIGHT: Const[int]
-ICON_CURSOR_SCALE_RIGHT_FILL: Const[int]
-ICON_DEMON: Const[int]
-ICON_DITHERING: Const[int]
-ICON_DOOR: Const[int]
-ICON_EMPTYBOX: Const[int]
-ICON_EMPTYBOX_SMALL: Const[int]
-ICON_EXIT: Const[int]
-ICON_EXPLOSION: Const[int]
-ICON_EYE_OFF: Const[int]
-ICON_EYE_ON: Const[int]
-ICON_FILE: Const[int]
-ICON_FILETYPE_ALPHA: Const[int]
-ICON_FILETYPE_AUDIO: Const[int]
-ICON_FILETYPE_BINARY: Const[int]
-ICON_FILETYPE_HOME: Const[int]
-ICON_FILETYPE_IMAGE: Const[int]
-ICON_FILETYPE_INFO: Const[int]
-ICON_FILETYPE_PLAY: Const[int]
-ICON_FILETYPE_TEXT: Const[int]
-ICON_FILETYPE_VIDEO: Const[int]
-ICON_FILE_ADD: Const[int]
-ICON_FILE_COPY: Const[int]
-ICON_FILE_CUT: Const[int]
-ICON_FILE_DELETE: Const[int]
-ICON_FILE_EXPORT: Const[int]
-ICON_FILE_NEW: Const[int]
-ICON_FILE_OPEN: Const[int]
-ICON_FILE_PASTE: Const[int]
-ICON_FILE_SAVE: Const[int]
-ICON_FILE_SAVE_CLASSIC: Const[int]
-ICON_FILTER: Const[int]
-ICON_FILTER_BILINEAR: Const[int]
-ICON_FILTER_POINT: Const[int]
-ICON_FILTER_TOP: Const[int]
-ICON_FOLDER: Const[int]
-ICON_FOLDER_ADD: Const[int]
-ICON_FOLDER_FILE_OPEN: Const[int]
-ICON_FOLDER_OPEN: Const[int]
-ICON_FOLDER_SAVE: Const[int]
-ICON_FOUR_BOXES: Const[int]
-ICON_FX: Const[int]
-ICON_GEAR: Const[int]
-ICON_GEAR_BIG: Const[int]
-ICON_GEAR_EX: Const[int]
-ICON_GRID: Const[int]
-ICON_GRID_FILL: Const[int]
-ICON_HAND_POINTER: Const[int]
-ICON_HEART: Const[int]
-ICON_HELP: Const[int]
-ICON_HEX: Const[int]
-ICON_HIDPI: Const[int]
-ICON_HOUSE: Const[int]
-ICON_INFO: Const[int]
-ICON_KEY: Const[int]
-ICON_LASER: Const[int]
-ICON_LAYERS: Const[int]
-ICON_LAYERS_VISIBLE: Const[int]
-ICON_LENS: Const[int]
-ICON_LENS_BIG: Const[int]
-ICON_LIFE_BARS: Const[int]
-ICON_LINK: Const[int]
-ICON_LINK_BOXES: Const[int]
-ICON_LINK_BROKE: Const[int]
-ICON_LINK_MULTI: Const[int]
-ICON_LINK_NET: Const[int]
-ICON_LOCK_CLOSE: Const[int]
-ICON_LOCK_OPEN: Const[int]
-ICON_MAGNET: Const[int]
-ICON_MAILBOX: Const[int]
-ICON_MIPMAPS: Const[int]
-ICON_MODE_2D: Const[int]
-ICON_MODE_3D: Const[int]
-ICON_MONITOR: Const[int]
-ICON_MUTATE: Const[int]
-ICON_MUTATE_FILL: Const[int]
-ICON_NONE: Const[int]
-ICON_NOTEBOOK: Const[int]
-ICON_OK_TICK: Const[int]
-ICON_PENCIL: Const[int]
-ICON_PENCIL_BIG: Const[int]
-ICON_PHOTO_CAMERA: Const[int]
-ICON_PHOTO_CAMERA_FLASH: Const[int]
-ICON_PLAYER: Const[int]
-ICON_PLAYER_JUMP: Const[int]
-ICON_PLAYER_NEXT: Const[int]
-ICON_PLAYER_PAUSE: Const[int]
-ICON_PLAYER_PLAY: Const[int]
-ICON_PLAYER_PLAY_BACK: Const[int]
-ICON_PLAYER_PREVIOUS: Const[int]
-ICON_PLAYER_RECORD: Const[int]
-ICON_PLAYER_STOP: Const[int]
-ICON_POT: Const[int]
-ICON_PRINTER: Const[int]
-ICON_REDO: Const[int]
-ICON_REDO_FILL: Const[int]
-ICON_REG_EXP: Const[int]
-ICON_REPEAT: Const[int]
-ICON_REPEAT_FILL: Const[int]
-ICON_REREDO: Const[int]
-ICON_REREDO_FILL: Const[int]
-ICON_RESIZE: Const[int]
-ICON_RESTART: Const[int]
-ICON_ROM: Const[int]
-ICON_ROTATE: Const[int]
-ICON_ROTATE_FILL: Const[int]
-ICON_RUBBER: Const[int]
-ICON_SCALE: Const[int]
-ICON_SHIELD: Const[int]
-ICON_SHUFFLE: Const[int]
-ICON_SHUFFLE_FILL: Const[int]
-ICON_SPECIAL: Const[int]
-ICON_SQUARE_TOGGLE: Const[int]
-ICON_STAR: Const[int]
-ICON_STEP_INTO: Const[int]
-ICON_STEP_OUT: Const[int]
-ICON_STEP_OVER: Const[int]
-ICON_SUITCASE: Const[int]
-ICON_SUITCASE_ZIP: Const[int]
-ICON_SYMMETRY: Const[int]
-ICON_SYMMETRY_HORIZONTAL: Const[int]
-ICON_SYMMETRY_VERTICAL: Const[int]
-ICON_TARGET: Const[int]
-ICON_TARGET_BIG: Const[int]
-ICON_TARGET_BIG_FILL: Const[int]
-ICON_TARGET_MOVE: Const[int]
-ICON_TARGET_MOVE_FILL: Const[int]
-ICON_TARGET_POINT: Const[int]
-ICON_TARGET_SMALL: Const[int]
-ICON_TARGET_SMALL_FILL: Const[int]
-ICON_TEXT_A: Const[int]
-ICON_TEXT_NOTES: Const[int]
-ICON_TEXT_POPUP: Const[int]
-ICON_TEXT_T: Const[int]
-ICON_TOOLS: Const[int]
-ICON_UNDO: Const[int]
-ICON_UNDO_FILL: Const[int]
-ICON_VERTICAL_BARS: Const[int]
-ICON_VERTICAL_BARS_FILL: Const[int]
-ICON_WATER_DROP: Const[int]
-ICON_WAVE: Const[int]
-ICON_WAVE_SINUS: Const[int]
-ICON_WAVE_SQUARE: Const[int]
-ICON_WAVE_TRIANGULAR: Const[int]
-ICON_WINDOW: Const[int]
-ICON_ZOOM_ALL: Const[int]
-ICON_ZOOM_BIG: Const[int]
-ICON_ZOOM_CENTER: Const[int]
-ICON_ZOOM_MEDIUM: Const[int]
-ICON_ZOOM_SMALL: Const[int]
-LABEL: Const[int]
-# Used also for: LABELBUTTON
-LINE_COLOR: Const[int]
-# Line control color
-LISTVIEW: Const[int]
-LIST_ITEMS_HEIGHT: Const[int]
-# ListView items height
-LIST_ITEMS_SPACING: Const[int]
-# ListView items separation
-PROGRESSBAR: Const[int]
-PROGRESS_PADDING: Const[int]
-# ProgressBar internal padding
-RESERVED: Const[int]
-SCROLLBAR: Const[int]
-SCROLLBAR_SIDE: Const[int]
-# ListView scrollbar side (0-left, 1-right)
-SCROLLBAR_WIDTH: Const[int]
-# ListView scrollbar size (usually width)
-SCROLL_PADDING: Const[int]
-SCROLL_SLIDER_PADDING: Const[int]
-# (SLIDERBAR, SLIDER_PADDING)
-SCROLL_SLIDER_SIZE: Const[int]
-SCROLL_SPEED: Const[int]
-SLIDER: Const[int]
-# Used also for: SLIDERBAR
-SLIDER_PADDING: Const[int]
-# Slider/SliderBar internal bar padding
-SLIDER_WIDTH: Const[int]
-# Slider size of internal bar
-SPINNER: Const[int]
-# Uses: BUTTON, VALUEBOX
-SPIN_BUTTON_SPACING: Const[int]
-# Spinner buttons separation
-SPIN_BUTTON_WIDTH: Const[int]
-# Spinner left/right buttons width
-STATE_DISABLED: Const[int]
-STATE_FOCUSED: Const[int]
-STATE_NORMAL: Const[int]
-STATE_PRESSED: Const[int]
-STATUSBAR: Const[int]
-TEXTBOX: Const[int]
-# Used also for: TEXTBOXMULTI
-TEXT_ALIGNMENT: Const[int]
-TEXT_ALIGN_CENTER: Const[int]
-TEXT_ALIGN_LEFT: Const[int]
-TEXT_ALIGN_RIGHT: Const[int]
-TEXT_COLOR_DISABLED: Const[int]
-TEXT_COLOR_FOCUSED: Const[int]
-TEXT_COLOR_NORMAL: Const[int]
-TEXT_COLOR_PRESSED: Const[int]
-TEXT_INNER_PADDING: Const[int]
-# TextBox/TextBoxMulti/ValueBox/Spinner inner text padding
-TEXT_LINES_SPACING: Const[int]
-# TextBoxMulti lines separation
-TEXT_PADDING: Const[int]
-TEXT_SIZE: Const[int]
-# Text size (glyphs max height)
-TEXT_SPACING: Const[int]
-# Text spacing between glyphs
-TOGGLE: Const[int]
-# Used also for: TOGGLEGROUP
-VALUEBOX: Const[int]
-class GuiStyleProp
-# Style property:
-    controlId: libs.c.CUShort
-    propertyId: libs.c.CUShort
-    propertyValue: libs.c.CUInt
-def gui_button(bounds: raylib.Rectangle, text: str) -> bool
-# Button control, returns true when clicked
-def gui_check_box(bounds: raylib.Rectangle, text: str, checked: bool) -> bool
-# Check Box control, returns true when active
-def gui_color_bar_alpha(bounds: raylib.Rectangle, text: str, alpha: float) -> float
-# Color Bar Alpha control
-def gui_color_bar_hue(bounds: raylib.Rectangle, text: str, value: float) -> float
-# Color Bar Hue control
-def gui_color_panel(bounds: raylib.Rectangle, text: str, p_color: raylib.Color) -> raylib.Color
-# Color Panel control
-def gui_color_picker(bounds: raylib.Rectangle, text: str, p_color: raylib.Color) -> raylib.Color
-# Color Picker control (multiple color controls)
-def gui_combo_box(bounds: raylib.Rectangle, text: str, active: int) -> int
-# Combo Box control, returns selected item index
-def gui_disable() -> None
-# Disable gui controls (global state)
-def gui_disable_tooltip() -> None
-# Disable gui tooltips (global state)
-def gui_draw_icon(icon_id: int, pos_x: int, pos_y: int, pixel_size: int, p_color: raylib.Color) -> None
-def gui_dropdown_box(bounds: raylib.Rectangle, text: str, active: Ptr[libs.c.CInt], edit_mode: bool) -> bool
-# Dropdown Box control, returns selected item
-def gui_dummy_rec(bounds: raylib.Rectangle, text: str) -> None
-# Dummy control for placeholders
-def gui_enable() -> None
-# Enable gui controls (global state)
-def gui_enable_tooltip() -> None
-# Enable gui tooltips (global state)
-def gui_fade(alpha: float) -> None
-# Set gui controls alpha (global state), alpha goes from 0.0f to 1.0f
-def gui_get_font() -> raylib.Font
-# Get gui custom font (global state)
-def gui_get_icons() -> Ptr[libs.c.CUInt]
-# Get raygui icons data pointer
-def gui_get_state() -> int
-# Get gui state (global state)
-def gui_get_style(control: int, property: int) -> int
-# Get one style property
-def gui_grid(bounds: raylib.Rectangle, text: str, spacing: float, subdivs: int) -> raylib.Vector2
-# Grid control, returns mouse cell position
-def gui_group_box(bounds: raylib.Rectangle, text: str) -> None
-# Group Box control with text name
-def gui_icon_text(icon_id: int, text: str) -> Ptr[Const[libs.c.CChar]]
-# Get text with icon id prepended (if supported)
-def gui_is_locked() -> bool
-# Check if gui is locked (global state)
-def gui_label(bounds: raylib.Rectangle, text: str) -> None
-# Label control, shows text
-def gui_label_button(bounds: raylib.Rectangle, text: str) -> bool
-# Label button control, show true when clicked
-def gui_line(bounds: raylib.Rectangle, text: str) -> None
-# Line separator control, could contain text
-def gui_list_view(bounds: raylib.Rectangle, text: str, scroll_index: Ptr[libs.c.CInt], active: int) -> int
-# List View control, returns selected list item index
-def gui_list_view_ex(bounds: raylib.Rectangle, text: Ptr[Ptr[Const[libs.c.CChar]]], count: int, focus: Ptr[libs.c.CInt], scroll_index: Ptr[libs.c.CInt], active: int) -> int
-# List View with extended parameters
-def gui_load_icons(file_name: str, load_icons_name: bool) -> Ptr[Ptr[libs.c.CChar]]
-# Load raygui icons file (.rgi) into internal icons data
-def gui_load_style(file_name: str) -> None
-# Load style file over global style variable (.rgs)
-def gui_load_style_default() -> None
-# Load style default over global style
-def gui_lock() -> None
-# Lock gui controls (global state)
-def gui_message_box(bounds: raylib.Rectangle, title: str, message: str, buttons: str) -> int
-# Message Box control, displays a message
-def gui_panel(bounds: raylib.Rectangle, text: str) -> None
-# Panel control, useful to group controls
-def gui_progress_bar(bounds: raylib.Rectangle, text_left: str, text_right: str, value: float, min_value: float, max_value: float) -> float
-# Progress Bar control, shows current progress value
-def gui_scroll_panel(bounds: raylib.Rectangle, text: str, content: raylib.Rectangle, scroll: Ptr[raylib.Vector2]) -> raylib.Rectangle
-# Scroll Panel control
-def gui_set_font(p_font: raylib.Font) -> None
-# Set gui custom font (global state)
-def gui_set_icon_scale(scale: int) -> None
-# Set icon drawing size
-def gui_set_state(state: int) -> None
-# Set gui state (global state)
-def gui_set_style(control: int, property: int, value: int) -> None
-# Set one style property
-def gui_set_tooltip(tooltip: str) -> None
-# Set tooltip string
-def gui_slider(bounds: raylib.Rectangle, text_left: str, text_right: str, value: float, min_value: float, max_value: float) -> float
-# Slider control, returns selected value
-def gui_slider_bar(bounds: raylib.Rectangle, text_left: str, text_right: str, value: float, min_value: float, max_value: float) -> float
-# Slider Bar control, returns selected value
-def gui_spinner(bounds: raylib.Rectangle, text: str, value: Ptr[libs.c.CInt], min_value: int, max_value: int, edit_mode: bool) -> bool
-# Spinner control, returns selected value
-def gui_status_bar(bounds: raylib.Rectangle, text: str) -> None
-# Status Bar control, shows info text
-def gui_style_prop(control_id: int, property_id: int, property_value: u32) -> GuiStyleProp
-# Factory function for: GuiStyleProp
-def gui_tab_bar(bounds: raylib.Rectangle, text: Ptr[Ptr[Const[libs.c.CChar]]], count: int, active: Ptr[libs.c.CInt]) -> int
-# Tab Bar control, returns TAB to be closed or -1
-def gui_text_box(bounds: raylib.Rectangle, text: str, text_size: int, edit_mode: bool) -> bool
-# Text Box control, updates input text
-def gui_text_box_multi(bounds: raylib.Rectangle, text: str, text_size: int, edit_mode: bool) -> bool
-# Text Box control with multiple lines
-def gui_text_input_box(bounds: raylib.Rectangle, title: str, message: str, buttons: str, text: str, text_max_size: int, secret_view_active: Ptr[libs.c.CInt]) -> int
-# Text Input Box control, ask for text, supports secret
-def gui_toggle(bounds: raylib.Rectangle, text: str, active: bool) -> bool
-# Toggle Button control, returns true when active
-def gui_toggle_group(bounds: raylib.Rectangle, text: str, active: int) -> int
-# Toggle Group control, returns active toggle index
-def gui_unlock() -> None
-# Unlock gui controls (global state)
-def gui_value_box(bounds: raylib.Rectangle, text: str, value: Ptr[libs.c.CInt], min_value: int, max_value: int, edit_mode: bool) -> bool
-# Value Box control, updates input text with numbers
-def gui_window_box(bounds: raylib.Rectangle, title: str) -> bool
-# Window Box control, shows a window that can be closed
-

2.4 raylib.math

class float16
-class float3
-# NOTE: Helper types to be used instead of array return types for *ToFloat functions
-def clamp(value: float, min: float, max: float) -> float
-def float_equals(x: float, y: float) -> int
-def lerp(start: float, end: float, amount: float) -> float
-def matrix_add(left: raylib.Matrix, right: raylib.Matrix) -> raylib.Matrix
-def matrix_determinant(mat: raylib.Matrix) -> float
-def matrix_frustum(left: f64, right: f64, bottom: f64, top: f64, near: f64, far: f64) -> raylib.Matrix
-def matrix_identity() -> raylib.Matrix
-def matrix_invert(mat: raylib.Matrix) -> raylib.Matrix
-def matrix_look_at(eye: raylib.Vector3, target: raylib.Vector3, up: raylib.Vector3) -> raylib.Matrix
-def matrix_multiply(left: raylib.Matrix, right: raylib.Matrix) -> raylib.Matrix
-def matrix_ortho(left: f64, right: f64, bottom: f64, top: f64, near: f64, far: f64) -> raylib.Matrix
-def matrix_perspective(fovy: f64, aspect: f64, near: f64, far: f64) -> raylib.Matrix
-def matrix_rotate(axis: raylib.Vector3, angle: float) -> raylib.Matrix
-def matrix_rotate_x(angle: float) -> raylib.Matrix
-def matrix_rotate_xyz(angle: raylib.Vector3) -> raylib.Matrix
-def matrix_rotate_y(angle: float) -> raylib.Matrix
-def matrix_rotate_z(angle: float) -> raylib.Matrix
-def matrix_rotate_zyx(angle: raylib.Vector3) -> raylib.Matrix
-def matrix_scale(x: float, y: float, z: float) -> raylib.Matrix
-def matrix_subtract(left: raylib.Matrix, right: raylib.Matrix) -> raylib.Matrix
-def matrix_to_float_v(mat: raylib.Matrix) -> raylib.float16
-def matrix_trace(mat: raylib.Matrix) -> float
-def matrix_translate(x: float, y: float, z: float) -> raylib.Matrix
-def matrix_transpose(mat: raylib.Matrix) -> raylib.Matrix
-def normalize(value: float, start: float, end: float) -> float
-def quaternion_add(q1: raylib.Quaternion, q2: raylib.Quaternion) -> raylib.Quaternion
-def quaternion_add_value(q: raylib.Quaternion, add: float) -> raylib.Quaternion
-def quaternion_divide(q1: raylib.Quaternion, q2: raylib.Quaternion) -> raylib.Quaternion
-def quaternion_equals(p: raylib.Quaternion, q: raylib.Quaternion) -> int
-def quaternion_from_axis_angle(axis: raylib.Vector3, angle: float) -> raylib.Quaternion
-def quaternion_from_euler(pitch: float, yaw: float, roll: float) -> raylib.Quaternion
-def quaternion_from_matrix(mat: raylib.Matrix) -> raylib.Quaternion
-def quaternion_from_vector3_to_vector3(p_from: raylib.Vector3, to: raylib.Vector3) -> raylib.Quaternion
-def quaternion_identity() -> raylib.Quaternion
-def quaternion_invert(q: raylib.Quaternion) -> raylib.Quaternion
-def quaternion_length(q: raylib.Quaternion) -> float
-def quaternion_lerp(q1: raylib.Quaternion, q2: raylib.Quaternion, amount: float) -> raylib.Quaternion
-def quaternion_multiply(q1: raylib.Quaternion, q2: raylib.Quaternion) -> raylib.Quaternion
-def quaternion_nlerp(q1: raylib.Quaternion, q2: raylib.Quaternion, amount: float) -> raylib.Quaternion
-def quaternion_normalize(q: raylib.Quaternion) -> raylib.Quaternion
-def quaternion_scale(q: raylib.Quaternion, mul: float) -> raylib.Quaternion
-def quaternion_slerp(q1: raylib.Quaternion, q2: raylib.Quaternion, amount: float) -> raylib.Quaternion
-def quaternion_subtract(q1: raylib.Quaternion, q2: raylib.Quaternion) -> raylib.Quaternion
-def quaternion_subtract_value(q: raylib.Quaternion, sub: float) -> raylib.Quaternion
-def quaternion_to_axis_angle(q: raylib.Quaternion, out_axis: Ptr[raylib.Vector3], out_angle: Ptr[libs.c.CFloat]) -> None
-def quaternion_to_euler(q: raylib.Quaternion) -> raylib.Vector3
-def quaternion_to_matrix(q: raylib.Quaternion) -> raylib.Matrix
-def quaternion_transform(q: raylib.Quaternion, mat: raylib.Matrix) -> raylib.Quaternion
-def remap(value: float, input_start: float, input_end: float, output_start: float, output_end: float) -> float
-def vector2_add(v1: raylib.Vector2, v2: raylib.Vector2) -> raylib.Vector2
-def vector2_add_value(v: raylib.Vector2, add: float) -> raylib.Vector2
-def vector2_angle(v1: raylib.Vector2, v2: raylib.Vector2) -> float
-def vector2_clamp(v: raylib.Vector2, min: raylib.Vector2, max: raylib.Vector2) -> raylib.Vector2
-def vector2_clamp_value(v: raylib.Vector2, min: float, max: float) -> raylib.Vector2
-def vector2_distance(v1: raylib.Vector2, v2: raylib.Vector2) -> float
-def vector2_distance_sqr(v1: raylib.Vector2, v2: raylib.Vector2) -> float
-def vector2_divide(v1: raylib.Vector2, v2: raylib.Vector2) -> raylib.Vector2
-def vector2_dot_product(v1: raylib.Vector2, v2: raylib.Vector2) -> float
-def vector2_equals(p: raylib.Vector2, q: raylib.Vector2) -> int
-def vector2_invert(v: raylib.Vector2) -> raylib.Vector2
-def vector2_length(v: raylib.Vector2) -> float
-def vector2_length_sqr(v: raylib.Vector2) -> float
-def vector2_lerp(v1: raylib.Vector2, v2: raylib.Vector2, amount: float) -> raylib.Vector2
-def vector2_line_angle(start: raylib.Vector2, end: raylib.Vector2) -> float
-def vector2_move_towards(v: raylib.Vector2, target: raylib.Vector2, max_distance: float) -> raylib.Vector2
-def vector2_multiply(v1: raylib.Vector2, v2: raylib.Vector2) -> raylib.Vector2
-def vector2_negate(v: raylib.Vector2) -> raylib.Vector2
-def vector2_normalize(v: raylib.Vector2) -> raylib.Vector2
-def vector2_one() -> raylib.Vector2
-def vector2_reflect(v: raylib.Vector2, normal: raylib.Vector2) -> raylib.Vector2
-def vector2_rotate(v: raylib.Vector2, angle: float) -> raylib.Vector2
-def vector2_scale(v: raylib.Vector2, scale: float) -> raylib.Vector2
-def vector2_subtract(v1: raylib.Vector2, v2: raylib.Vector2) -> raylib.Vector2
-def vector2_subtract_value(v: raylib.Vector2, sub: float) -> raylib.Vector2
-def vector2_transform(v: raylib.Vector2, mat: raylib.Matrix) -> raylib.Vector2
-def vector2_zero() -> raylib.Vector2
-def vector3_add(v1: raylib.Vector3, v2: raylib.Vector3) -> raylib.Vector3
-def vector3_add_value(v: raylib.Vector3, add: float) -> raylib.Vector3
-def vector3_angle(v1: raylib.Vector3, v2: raylib.Vector3) -> float
-def vector3_barycenter(p: raylib.Vector3, a: raylib.Vector3, b: raylib.Vector3, c: raylib.Vector3) -> raylib.Vector3
-def vector3_clamp(v: raylib.Vector3, min: raylib.Vector3, max: raylib.Vector3) -> raylib.Vector3
-def vector3_clamp_value(v: raylib.Vector3, min: float, max: float) -> raylib.Vector3
-def vector3_cross_product(v1: raylib.Vector3, v2: raylib.Vector3) -> raylib.Vector3
-def vector3_distance(v1: raylib.Vector3, v2: raylib.Vector3) -> float
-def vector3_distance_sqr(v1: raylib.Vector3, v2: raylib.Vector3) -> float
-def vector3_divide(v1: raylib.Vector3, v2: raylib.Vector3) -> raylib.Vector3
-def vector3_dot_product(v1: raylib.Vector3, v2: raylib.Vector3) -> float
-def vector3_equals(p: raylib.Vector3, q: raylib.Vector3) -> int
-def vector3_invert(v: raylib.Vector3) -> raylib.Vector3
-def vector3_length(v: Const[raylib.Vector3]) -> float
-def vector3_length_sqr(v: Const[raylib.Vector3]) -> float
-def vector3_lerp(v1: raylib.Vector3, v2: raylib.Vector3, amount: float) -> raylib.Vector3
-def vector3_max(v1: raylib.Vector3, v2: raylib.Vector3) -> raylib.Vector3
-def vector3_min(v1: raylib.Vector3, v2: raylib.Vector3) -> raylib.Vector3
-def vector3_multiply(v1: raylib.Vector3, v2: raylib.Vector3) -> raylib.Vector3
-def vector3_negate(v: raylib.Vector3) -> raylib.Vector3
-def vector3_normalize(v: raylib.Vector3) -> raylib.Vector3
-def vector3_one() -> raylib.Vector3
-def vector3_ortho_normalize(v1: Ptr[raylib.Vector3], v2: Ptr[raylib.Vector3]) -> None
-def vector3_perpendicular(v: raylib.Vector3) -> raylib.Vector3
-def vector3_reflect(v: raylib.Vector3, normal: raylib.Vector3) -> raylib.Vector3
-def vector3_refract(v: raylib.Vector3, n: raylib.Vector3, r: float) -> raylib.Vector3
-def vector3_rotate_by_axis_angle(v: raylib.Vector3, axis: raylib.Vector3, angle: float) -> raylib.Vector3
-def vector3_rotate_by_quaternion(v: raylib.Vector3, q: raylib.Quaternion) -> raylib.Vector3
-def vector3_scale(v: raylib.Vector3, scalar: float) -> raylib.Vector3
-def vector3_subtract(v1: raylib.Vector3, v2: raylib.Vector3) -> raylib.Vector3
-def vector3_subtract_value(v: raylib.Vector3, sub: float) -> raylib.Vector3
-def vector3_to_float_v(v: raylib.Vector3) -> raylib.float3
-def vector3_transform(v: raylib.Vector3, mat: raylib.Matrix) -> raylib.Vector3
-def vector3_unproject(source: raylib.Vector3, projection: raylib.Matrix, view: raylib.Matrix) -> raylib.Vector3
-def vector3_zero() -> raylib.Vector3
-def wrap(value: float, min: float, max: float) -> float
-

2.5 raylib.utils

class Data
-# Arbitary data (void*)
-def clear() -> None
-# Clear background with RAYWHITE colour
-def cos_deg(x: float) -> float
-def is_desktop() -> bool
-# Are we running in raylib in desktop?
-def is_hot_reload() -> bool
-# Are we running in raylib with hot reload?
-def is_web() -> bool
-# Are we running in raylib WASM/Web?
-def lerp_color(a: raylib.Color, b: raylib.Color, fraction: float) -> raylib.Color
-def pi() -> float
-# Get approximate PI value
-def remap(x: float, a: float, b: float, c: float, d: float) -> float
-# Map x to be from 'a to b' range to 'c to d' range
-def run_game_loop(fps: int, data: Data) -> int
-# Run def game_step(d: utils.Data) in a loop
-# Warning! this assumes you have def game_step(d: utils.Data) present in code
-# Warning! game_step def must be present in same file as main()
-# See wind_tree_gs.yaka for a sample of how to use this.
-# Use only if you run into slowness with standard while loop
-def sin_deg(x: float) -> float
-def tan_deg(x: float) -> float
-def todeg(radians: float) -> float
-def torad(degrees: float) -> float
-


3 WASM4 Support Library

Created 2022-10-21, Last Updated 2023-03-19

Support for WASM4 fantasy console.

Additionally following function in libs work.

  • libs.random.random_u64

  • libs.random.set_seed

wasm4 is created by Bruno Garcia and contributors.

Yaksha wraps wasm4.h

3.1 w4

BLIT_1BPP: Const[u32]
-BLIT_2BPP: Const[u32]
-BLIT_FLIP_X: Const[u32]
-BLIT_FLIP_Y: Const[u32]
-BLIT_ROTATE: Const[u32]
-BUTTON_1: Const[u8]
-BUTTON_2: Const[u8]
-BUTTON_DOWN: Const[u8]
-BUTTON_LEFT: Const[u8]
-BUTTON_RIGHT: Const[u8]
-BUTTON_UP: Const[u8]
-MOUSE_LEFT: Const[u8]
-MOUSE_MIDDLE: Const[u8]
-MOUSE_RIGHT: Const[u8]
-SCREEN_SIZE: Const[int]
-# Screen size of wasm4 console
-SYSTEM_HIDE_GAMEPAD_OVERLAY: Const[u8]
-SYSTEM_PRESERVE_FRAMEBUFFER: Const[u8]
-TONE_MODE1: Const[u32]
-TONE_MODE2: Const[u32]
-TONE_MODE3: Const[u32]
-TONE_MODE4: Const[u32]
-TONE_NOISE: Const[u32]
-TONE_PAN_LEFT: Const[u32]
-TONE_PAN_RIGHT: Const[u32]
-TONE_PULSE1: Const[u32]
-TONE_PULSE2: Const[u32]
-TONE_TRIANGLE: Const[u32]
-def blit(data: Ptr[Const[u8]], x: int, y: int, width: u32, height: u32, flags: u32) -> None
-# Copies pixels to the framebuffer
-def blit_sub(data: Ptr[Const[u8]], x: int, y: int, width: u32, height: u32, src_x: u32, src_y: u32, stride: u32, flags: u32) -> None
-# Copies a subregion within a larger sprite atlas to the framebuffer
-def diskr(dest: AnyPtr, size: u32) -> u32
-# Reads up to `size` bytes from persistent storage into the pointer `dest`
-def diskw(src: AnyPtrToConst, size: u32) -> u32
-# Writes up to `size` bytes from the pointer `src` into persistent storage
-def draw_colors() -> u16
-# Read draw colors
-def framebuffer() -> Ptr[u8]
-# Access pointer to framebuffer
-def gamepad1() -> u8
-# Read gamepad 1 value
-def gamepad2() -> u8
-# Read gamepad 2 value
-def gamepad3() -> u8
-# Read gamepad 3 value
-def gamepad4() -> u8
-# Read gamepad 4 value
-def hline(x: int, y: int, length: u32) -> None
-# Draws a horizontal line
-def line(x1: int, y1: int, x2: int, y2: int) -> None
-# Draws a line between two points
-def mouse_buttons() -> u8
-# Read mouse buttons
-def mouse_x() -> i16
-# Read mouse x
-def mouse_y() -> i16
-# Read mouse y
-def netplay() -> int
-def oval(x: int, y: int, width: u32, height: u32) -> None
-# Draws an oval (or circle)
-def palette() -> Ptr[u32]
-# Get a pointer to pallet
-def rect(x: int, y: int, width: u32, height: u32) -> None
-# Draws a rectangle
-def set_draw_colors(value: u16) -> None
-# Set draw colors
-def set_game_state(data: AnyPtr) -> None
-# Set a state value to be passed to game_step() function
-def set_palette(c1: u32, c2: u32, c3: u32, c4: u32) -> None
-# Set palette
-def set_system_flags(value: u8) -> None
-# Set system flags
-def system_flags() -> u8
-# Read system flags
-def text(text_data: str, x: int, y: int) -> None
-# Draws text using the built-in system font
-def text_u8(text_data: Ptr[Const[u8]], x: int, y: int) -> None
-# Draws text from given binarydata("text") (or manually created u8 Ptr) (no string allocation)
-def tone(frequency: u32, duration: u32, volume: u32, flags: u32) -> None
-# Plays a sound tone
-def trace(text_data: str) -> None
-# Prints a message to the debug console
-def trace_u8(text_data: Ptr[Const[u8]]) -> None
-# Prints a message to the debug console from given binarydata("text") (or manually created u8 Ptr) (no string allocation)
-def vline(x: int, y: int, length: u32) -> None
-# Draws a vertical line
-
\ No newline at end of file diff --git a/docs/safari-pinned-tab.svg b/docs/safari-pinned-tab.svg deleted file mode 100644 index fc524c9..0000000 --- a/docs/safari-pinned-tab.svg +++ /dev/null @@ -1,49 +0,0 @@ - - - - -Created by potrace 1.14, written by Peter Selinger 2001-2017 - - - - - - - - diff --git a/docs/site.webmanifest b/docs/site.webmanifest deleted file mode 100644 index a1553eb..0000000 --- a/docs/site.webmanifest +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "", - "short_name": "", - "icons": [ - { - "src": "/android-chrome-192x192.png", - "sizes": "192x192", - "type": "image/png" - }, - { - "src": "/android-chrome-384x384.png", - "sizes": "384x384", - "type": "image/png" - } - ], - "theme_color": "#ffffff", - "background_color": "#ffffff", - "display": "standalone" -} diff --git a/docs/static_demos/space_blast/space_blast.js b/docs/static_demos/space_blast/space_blast.js deleted file mode 100644 index d5e708e..0000000 --- a/docs/static_demos/space_blast/space_blast.js +++ /dev/null @@ -1 +0,0 @@ -var Module=typeof Module!="undefined"?Module:{};if(!Module.expectedDataFileDownloads){Module.expectedDataFileDownloads=0}Module.expectedDataFileDownloads++;(function(){if(Module["ENVIRONMENT_IS_PTHREAD"])return;var loadPackage=function(metadata){var PACKAGE_PATH="";if(typeof window==="object"){PACKAGE_PATH=window["encodeURIComponent"](window.location.pathname.toString().substring(0,window.location.pathname.toString().lastIndexOf("/"))+"/")}else if(typeof process==="undefined"&&typeof location!=="undefined"){PACKAGE_PATH=encodeURIComponent(location.pathname.toString().substring(0,location.pathname.toString().lastIndexOf("/"))+"/")}var PACKAGE_NAME="/home/jadoggx86/Projects/Yaksha/yakshalang.github.io/docs/static_demos/space_blast/space_blast.data";var REMOTE_PACKAGE_BASE="space_blast.data";if(typeof Module["locateFilePackage"]==="function"&&!Module["locateFile"]){Module["locateFile"]=Module["locateFilePackage"];err("warning: you defined Module.locateFilePackage, that has been renamed to Module.locateFile (using your locateFilePackage for now)")}var REMOTE_PACKAGE_NAME=Module["locateFile"]?Module["locateFile"](REMOTE_PACKAGE_BASE,""):REMOTE_PACKAGE_BASE;var REMOTE_PACKAGE_SIZE=metadata["remote_package_size"];function fetchRemotePackage(packageName,packageSize,callback,errback){if(typeof process==="object"&&typeof process.versions==="object"&&typeof process.versions.node==="string"){require("fs").readFile(packageName,function(err,contents){if(err){errback(err)}else{callback(contents.buffer)}});return}var xhr=new XMLHttpRequest;xhr.open("GET",packageName,true);xhr.responseType="arraybuffer";xhr.onprogress=function(event){var url=packageName;var size=packageSize;if(event.total)size=event.total;if(event.loaded){if(!xhr.addedTotal){xhr.addedTotal=true;if(!Module.dataFileDownloads)Module.dataFileDownloads={};Module.dataFileDownloads[url]={loaded:event.loaded,total:size}}else{Module.dataFileDownloads[url].loaded=event.loaded}var total=0;var loaded=0;var num=0;for(var download in Module.dataFileDownloads){var data=Module.dataFileDownloads[download];total+=data.total;loaded+=data.loaded;num++}total=Math.ceil(total*Module.expectedDataFileDownloads/num);if(Module["setStatus"])Module["setStatus"]("Downloading data... ("+loaded+"/"+total+")")}else if(!Module.dataFileDownloads){if(Module["setStatus"])Module["setStatus"]("Downloading data...")}};xhr.onerror=function(event){throw new Error("NetworkError for: "+packageName)};xhr.onload=function(event){if(xhr.status==200||xhr.status==304||xhr.status==206||xhr.status==0&&xhr.response){var packageData=xhr.response;callback(packageData)}else{throw new Error(xhr.statusText+" : "+xhr.responseURL)}};xhr.send(null)}function handleError(error){console.error("package error:",error)}var fetchedCallback=null;var fetched=Module["getPreloadedPackage"]?Module["getPreloadedPackage"](REMOTE_PACKAGE_NAME,REMOTE_PACKAGE_SIZE):null;if(!fetched)fetchRemotePackage(REMOTE_PACKAGE_NAME,REMOTE_PACKAGE_SIZE,function(data){if(fetchedCallback){fetchedCallback(data);fetchedCallback=null}else{fetched=data}},handleError);function runWithFS(){function assert(check,msg){if(!check)throw msg+(new Error).stack}Module["FS_createPath"]("/","assets",true,true);Module["FS_createPath"]("/assets","audio",true,true);Module["FS_createPath"]("/assets","img",true,true);function DataRequest(start,end,audio){this.start=start;this.end=end;this.audio=audio}DataRequest.prototype={requests:{},open:function(mode,name){this.name=name;this.requests[name]=this;Module["addRunDependency"]("fp "+this.name)},send:function(){},onload:function(){var byteArray=this.byteArray.subarray(this.start,this.end);this.finish(byteArray)},finish:function(byteArray){var that=this;Module["FS_createDataFile"](this.name,null,byteArray,true,true,true);Module["removeRunDependency"]("fp "+that.name);this.requests[this.name]=null}};var files=metadata["files"];for(var i=0;i{throw toThrow};var ENVIRONMENT_IS_WEB=typeof window=="object";var ENVIRONMENT_IS_WORKER=typeof importScripts=="function";var ENVIRONMENT_IS_NODE=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string";var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory)}return scriptDirectory+path}var read_,readAsync,readBinary,setWindowTitle;function logExceptionOnExit(e){if(e instanceof ExitStatus)return;let toLog=e;err("exiting due to exception: "+toLog)}if(ENVIRONMENT_IS_NODE){if(ENVIRONMENT_IS_WORKER){scriptDirectory=require("path").dirname(scriptDirectory)+"/"}else{scriptDirectory=__dirname+"/"}var fs,nodePath;if(typeof require==="function"){fs=require("fs");nodePath=require("path")}read_=(filename,binary)=>{filename=nodePath["normalize"](filename);return fs.readFileSync(filename,binary?undefined:"utf8")};readBinary=filename=>{var ret=read_(filename,true);if(!ret.buffer){ret=new Uint8Array(ret)}return ret};readAsync=(filename,onload,onerror)=>{filename=nodePath["normalize"](filename);fs.readFile(filename,function(err,data){if(err)onerror(err);else onload(data.buffer)})};if(process["argv"].length>1){thisProgram=process["argv"][1].replace(/\\/g,"/")}arguments_=process["argv"].slice(2);if(typeof module!="undefined"){module["exports"]=Module}process["on"]("uncaughtException",function(ex){if(!(ex instanceof ExitStatus)){throw ex}});process["on"]("unhandledRejection",function(reason){throw reason});quit_=(status,toThrow)=>{if(keepRuntimeAlive()){process["exitCode"]=status;throw toThrow}logExceptionOnExit(toThrow);process["exit"](status)};Module["inspect"]=function(){return"[Emscripten Module object]"}}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){if(ENVIRONMENT_IS_WORKER){scriptDirectory=self.location.href}else if(typeof document!="undefined"&&document.currentScript){scriptDirectory=document.currentScript.src}if(scriptDirectory.indexOf("blob:")!==0){scriptDirectory=scriptDirectory.substr(0,scriptDirectory.replace(/[?#].*/,"").lastIndexOf("/")+1)}else{scriptDirectory=""}{read_=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.send(null);return xhr.responseText};if(ENVIRONMENT_IS_WORKER){readBinary=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return new Uint8Array(xhr.response)}}readAsync=(url,onload,onerror)=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=()=>{if(xhr.status==200||xhr.status==0&&xhr.response){onload(xhr.response);return}onerror()};xhr.onerror=onerror;xhr.send(null)}}setWindowTitle=title=>document.title=title}else{}var out=Module["print"]||console.log.bind(console);var err=Module["printErr"]||console.warn.bind(console);Object.assign(Module,moduleOverrides);moduleOverrides=null;if(Module["arguments"])arguments_=Module["arguments"];if(Module["thisProgram"])thisProgram=Module["thisProgram"];if(Module["quit"])quit_=Module["quit"];var wasmBinary;if(Module["wasmBinary"])wasmBinary=Module["wasmBinary"];var noExitRuntime=Module["noExitRuntime"]||true;if(typeof WebAssembly!="object"){abort("no native wasm support detected")}var wasmMemory;var ABORT=false;var EXITSTATUS;function assert(condition,text){if(!condition){abort(text)}}var UTF8Decoder=typeof TextDecoder!="undefined"?new TextDecoder("utf8"):undefined;function UTF8ArrayToString(heapOrArray,idx,maxBytesToRead){var endIdx=idx+maxBytesToRead;var endPtr=idx;while(heapOrArray[endPtr]&&!(endPtr>=endIdx))++endPtr;if(endPtr-idx>16&&heapOrArray.buffer&&UTF8Decoder){return UTF8Decoder.decode(heapOrArray.subarray(idx,endPtr))}var str="";while(idx>10,56320|ch&1023)}}return str}function UTF8ToString(ptr,maxBytesToRead){return ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead):""}function stringToUTF8Array(str,heap,outIdx,maxBytesToWrite){if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i=55296&&u<=57343){var u1=str.charCodeAt(++i);u=65536+((u&1023)<<10)|u1&1023}if(u<=127){if(outIdx>=endIdx)break;heap[outIdx++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;heap[outIdx++]=192|u>>6;heap[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;heap[outIdx++]=224|u>>12;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}else{if(outIdx+3>=endIdx)break;heap[outIdx++]=240|u>>18;heap[outIdx++]=128|u>>12&63;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}}heap[outIdx]=0;return outIdx-startIdx}function stringToUTF8(str,outPtr,maxBytesToWrite){return stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite)}function lengthBytesUTF8(str){var len=0;for(var i=0;i=55296&&c<=57343){len+=4;++i}else{len+=3}}return len}var buffer,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;function updateGlobalBufferAndViews(buf){buffer=buf;Module["HEAP8"]=HEAP8=new Int8Array(buf);Module["HEAP16"]=HEAP16=new Int16Array(buf);Module["HEAP32"]=HEAP32=new Int32Array(buf);Module["HEAPU8"]=HEAPU8=new Uint8Array(buf);Module["HEAPU16"]=HEAPU16=new Uint16Array(buf);Module["HEAPU32"]=HEAPU32=new Uint32Array(buf);Module["HEAPF32"]=HEAPF32=new Float32Array(buf);Module["HEAPF64"]=HEAPF64=new Float64Array(buf)}var INITIAL_MEMORY=Module["INITIAL_MEMORY"]||16777216;var wasmTable;var __ATPRERUN__=[];var __ATINIT__=[];var __ATMAIN__=[];var __ATEXIT__=[];var __ATPOSTRUN__=[];var runtimeInitialized=false;function keepRuntimeAlive(){return noExitRuntime}function preRun(){if(Module["preRun"]){if(typeof Module["preRun"]=="function")Module["preRun"]=[Module["preRun"]];while(Module["preRun"].length){addOnPreRun(Module["preRun"].shift())}}callRuntimeCallbacks(__ATPRERUN__)}function initRuntime(){runtimeInitialized=true;if(!Module["noFSInit"]&&!FS.init.initialized)FS.init();FS.ignorePermissions=false;TTY.init();callRuntimeCallbacks(__ATINIT__)}function preMain(){callRuntimeCallbacks(__ATMAIN__)}function postRun(){if(Module["postRun"]){if(typeof Module["postRun"]=="function")Module["postRun"]=[Module["postRun"]];while(Module["postRun"].length){addOnPostRun(Module["postRun"].shift())}}callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(cb){__ATPRERUN__.unshift(cb)}function addOnInit(cb){__ATINIT__.unshift(cb)}function addOnPostRun(cb){__ATPOSTRUN__.unshift(cb)}var runDependencies=0;var runDependencyWatcher=null;var dependenciesFulfilled=null;function getUniqueRunDependency(id){return id}function addRunDependency(id){runDependencies++;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}}function removeRunDependency(id){runDependencies--;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}if(runDependencies==0){if(runDependencyWatcher!==null){clearInterval(runDependencyWatcher);runDependencyWatcher=null}if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback()}}}function abort(what){{if(Module["onAbort"]){Module["onAbort"](what)}}what="Aborted("+what+")";err(what);ABORT=true;EXITSTATUS=1;what+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(what);throw e}var dataURIPrefix="data:application/octet-stream;base64,";function isDataURI(filename){return filename.startsWith(dataURIPrefix)}function isFileURI(filename){return filename.startsWith("file://")}var wasmBinaryFile;wasmBinaryFile="space_blast.wasm";if(!isDataURI(wasmBinaryFile)){wasmBinaryFile=locateFile(wasmBinaryFile)}function getBinary(file){try{if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary)}if(readBinary){return readBinary(file)}throw"both async and sync fetching of the wasm failed"}catch(err){abort(err)}}function getBinaryPromise(){if(!wasmBinary&&(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER)){if(typeof fetch=="function"&&!isFileURI(wasmBinaryFile)){return fetch(wasmBinaryFile,{credentials:"same-origin"}).then(function(response){if(!response["ok"]){throw"failed to load wasm binary file at '"+wasmBinaryFile+"'"}return response["arrayBuffer"]()}).catch(function(){return getBinary(wasmBinaryFile)})}else{if(readAsync){return new Promise(function(resolve,reject){readAsync(wasmBinaryFile,function(response){resolve(new Uint8Array(response))},reject)})}}}return Promise.resolve().then(function(){return getBinary(wasmBinaryFile)})}function createWasm(){var info={"a":asmLibraryArg};function receiveInstance(instance,module){var exports=instance.exports;exports=Asyncify.instrumentWasmExports(exports);Module["asm"]=exports;wasmMemory=Module["asm"]["Td"];updateGlobalBufferAndViews(wasmMemory.buffer);wasmTable=Module["asm"]["be"];addOnInit(Module["asm"]["Ud"]);removeRunDependency("wasm-instantiate")}addRunDependency("wasm-instantiate");function receiveInstantiationResult(result){receiveInstance(result["instance"])}function instantiateArrayBuffer(receiver){return getBinaryPromise().then(function(binary){return WebAssembly.instantiate(binary,info)}).then(function(instance){return instance}).then(receiver,function(reason){err("failed to asynchronously prepare wasm: "+reason);abort(reason)})}function instantiateAsync(){if(!wasmBinary&&typeof WebAssembly.instantiateStreaming=="function"&&!isDataURI(wasmBinaryFile)&&!isFileURI(wasmBinaryFile)&&!ENVIRONMENT_IS_NODE&&typeof fetch=="function"){return fetch(wasmBinaryFile,{credentials:"same-origin"}).then(function(response){var result=WebAssembly.instantiateStreaming(response,info);return result.then(receiveInstantiationResult,function(reason){err("wasm streaming compile failed: "+reason);err("falling back to ArrayBuffer instantiation");return instantiateArrayBuffer(receiveInstantiationResult)})})}else{return instantiateArrayBuffer(receiveInstantiationResult)}}if(Module["instantiateWasm"]){try{var exports=Module["instantiateWasm"](info,receiveInstance);exports=Asyncify.instrumentWasmExports(exports);return exports}catch(e){err("Module.instantiateWasm callback failed with error: "+e);return false}}instantiateAsync();return{}}var tempDouble;var tempI64;var ASM_CONSTS={47792:()=>{if(typeof window==="undefined"||(window.AudioContext||window.webkitAudioContext)===undefined){return 0}if(typeof window.miniaudio==="undefined"){window.miniaudio={referenceCount:0};miniaudio.devices=[];miniaudio.track_device=function(device){for(var iDevice=0;iDevice0){if(miniaudio.devices[miniaudio.devices.length-1]==null){miniaudio.devices.pop()}else{break}}};miniaudio.untrack_device=function(device){for(var iDevice=0;iDevice{if(typeof window.miniaudio!=="undefined"){window.miniaudio.referenceCount--;if(window.miniaudio.referenceCount===0){delete window.miniaudio}}},49652:()=>{return navigator.mediaDevices!==undefined&&navigator.mediaDevices.getUserMedia!==undefined},49756:()=>{try{var temp=new(window.AudioContext||window.webkitAudioContext);var sampleRate=temp.sampleRate;temp.close();return sampleRate}catch(e){return 0}},49927:($0,$1,$2,$3,$4,$5)=>{var channels=$0;var sampleRate=$1;var bufferSize=$2;var isCapture=$3;var pDevice=$4;var pAllocationCallbacks=$5;if(typeof window.miniaudio==="undefined"){return-1}var device={};device.webaudio=new(window.AudioContext||window.webkitAudioContext)({sampleRate:sampleRate});device.webaudio.suspend();device.state=1;device.intermediaryBufferSizeInBytes=channels*bufferSize*4;device.intermediaryBuffer=_ma_malloc_emscripten(device.intermediaryBufferSizeInBytes,pAllocationCallbacks);device.intermediaryBufferView=new Float32Array(Module.HEAPF32.buffer,device.intermediaryBuffer,device.intermediaryBufferSizeInBytes);device.scriptNode=device.webaudio.createScriptProcessor(bufferSize,isCapture?channels:0,isCapture?0:channels);if(isCapture){device.scriptNode.onaudioprocess=function(e){if(device.intermediaryBuffer===undefined){return}if(device.intermediaryBufferView.length==0){device.intermediaryBufferView=new Float32Array(Module.HEAPF32.buffer,device.intermediaryBuffer,device.intermediaryBufferSizeInBytes)}for(var iChannel=0;iChanneldevice.intermediaryBufferSizeInBytes/channels/4){framesToProcess=device.intermediaryBufferSizeInBytes/channels/4}if(sendSilence){device.intermediaryBufferView.fill(0)}else{for(var iFrame=0;iFramedevice.intermediaryBufferSizeInBytes/channels/4){framesToProcess=device.intermediaryBufferSizeInBytes/channels/4}_ma_device_process_pcm_frames_playback__webaudio(pDevice,framesToProcess,device.intermediaryBuffer);if(outputSilence){for(var iChannel=0;iChannel{return miniaudio.get_device_by_index($0).webaudio.sampleRate},54343:($0,$1,$2,$3)=>{var device=miniaudio.get_device_by_index($0);var pAllocationCallbacks=$3;if(device.scriptNode!==undefined){device.scriptNode.onaudioprocess=function(e){};device.scriptNode.disconnect();device.scriptNode=undefined}if(device.streamNode!==undefined){device.streamNode.disconnect();device.streamNode=undefined}device.webaudio.close();device.webaudio=undefined;if(device.intermediaryBuffer!==undefined){_ma_free_emscripten(device.intermediaryBuffer,pAllocationCallbacks);device.intermediaryBuffer=undefined;device.intermediaryBufferView=undefined;device.intermediaryBufferSizeInBytes=undefined}miniaudio.untrack_device_by_index($0)},55029:$0=>{var device=miniaudio.get_device_by_index($0);device.webaudio.resume();device.state=2},55125:$0=>{var device=miniaudio.get_device_by_index($0);device.webaudio.resume();device.state=2},55221:$0=>{var device=miniaudio.get_device_by_index($0);device.webaudio.suspend();device.state=1},55318:$0=>{var device=miniaudio.get_device_by_index($0);device.webaudio.suspend();device.state=1}};function ExitStatus(status){this.name="ExitStatus";this.message="Program terminated with exit("+status+")";this.status=status}function callRuntimeCallbacks(callbacks){while(callbacks.length>0){callbacks.shift()(Module)}}function handleException(e){if(e instanceof ExitStatus||e=="unwind"){return EXITSTATUS}quit_(1,e)}function ___assert_fail(condition,filename,line,func){abort("Assertion failed: "+UTF8ToString(condition)+", at: "+[filename?UTF8ToString(filename):"unknown filename",line,func?UTF8ToString(func):"unknown function"])}function setErrNo(value){HEAP32[___errno_location()>>2]=value;return value}var PATH={isAbs:path=>path.charAt(0)==="/",splitPath:filename=>{var splitPathRe=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;return splitPathRe.exec(filename).slice(1)},normalizeArray:(parts,allowAboveRoot)=>{var up=0;for(var i=parts.length-1;i>=0;i--){var last=parts[i];if(last==="."){parts.splice(i,1)}else if(last===".."){parts.splice(i,1);up++}else if(up){parts.splice(i,1);up--}}if(allowAboveRoot){for(;up;up--){parts.unshift("..")}}return parts},normalize:path=>{var isAbsolute=PATH.isAbs(path),trailingSlash=path.substr(-1)==="/";path=PATH.normalizeArray(path.split("/").filter(p=>!!p),!isAbsolute).join("/");if(!path&&!isAbsolute){path="."}if(path&&trailingSlash){path+="/"}return(isAbsolute?"/":"")+path},dirname:path=>{var result=PATH.splitPath(path),root=result[0],dir=result[1];if(!root&&!dir){return"."}if(dir){dir=dir.substr(0,dir.length-1)}return root+dir},basename:path=>{if(path==="/")return"/";path=PATH.normalize(path);path=path.replace(/\/$/,"");var lastSlash=path.lastIndexOf("/");if(lastSlash===-1)return path;return path.substr(lastSlash+1)},join:function(){var paths=Array.prototype.slice.call(arguments);return PATH.normalize(paths.join("/"))},join2:(l,r)=>{return PATH.normalize(l+"/"+r)}};function getRandomDevice(){if(typeof crypto=="object"&&typeof crypto["getRandomValues"]=="function"){var randomBuffer=new Uint8Array(1);return()=>{crypto.getRandomValues(randomBuffer);return randomBuffer[0]}}else if(ENVIRONMENT_IS_NODE){try{var crypto_module=require("crypto");return()=>crypto_module["randomBytes"](1)[0]}catch(e){}}return()=>abort("randomDevice")}var PATH_FS={resolve:function(){var resolvedPath="",resolvedAbsolute=false;for(var i=arguments.length-1;i>=-1&&!resolvedAbsolute;i--){var path=i>=0?arguments[i]:FS.cwd();if(typeof path!="string"){throw new TypeError("Arguments to path.resolve must be strings")}else if(!path){return""}resolvedPath=path+"/"+resolvedPath;resolvedAbsolute=PATH.isAbs(path)}resolvedPath=PATH.normalizeArray(resolvedPath.split("/").filter(p=>!!p),!resolvedAbsolute).join("/");return(resolvedAbsolute?"/":"")+resolvedPath||"."},relative:(from,to)=>{from=PATH_FS.resolve(from).substr(1);to=PATH_FS.resolve(to).substr(1);function trim(arr){var start=0;for(;start=0;end--){if(arr[end]!=="")break}if(start>end)return[];return arr.slice(start,end-start+1)}var fromParts=trim(from.split("/"));var toParts=trim(to.split("/"));var length=Math.min(fromParts.length,toParts.length);var samePartsLength=length;for(var i=0;i0?length:lengthBytesUTF8(stringy)+1;var u8array=new Array(len);var numBytesWritten=stringToUTF8Array(stringy,u8array,0,u8array.length);if(dontAddNull)u8array.length=numBytesWritten;return u8array}var TTY={ttys:[],init:function(){},shutdown:function(){},register:function(dev,ops){TTY.ttys[dev]={input:[],output:[],ops:ops};FS.registerDevice(dev,TTY.stream_ops)},stream_ops:{open:function(stream){var tty=TTY.ttys[stream.node.rdev];if(!tty){throw new FS.ErrnoError(43)}stream.tty=tty;stream.seekable=false},close:function(stream){stream.tty.ops.fsync(stream.tty)},fsync:function(stream){stream.tty.ops.fsync(stream.tty)},read:function(stream,buffer,offset,length,pos){if(!stream.tty||!stream.tty.ops.get_char){throw new FS.ErrnoError(60)}var bytesRead=0;for(var i=0;i0){result=buf.slice(0,bytesRead).toString("utf-8")}else{result=null}}else if(typeof window!="undefined"&&typeof window.prompt=="function"){result=window.prompt("Input: ");if(result!==null){result+="\n"}}else if(typeof readline=="function"){result=readline();if(result!==null){result+="\n"}}if(!result){return null}tty.input=intArrayFromString(result,true)}return tty.input.shift()},put_char:function(tty,val){if(val===null||val===10){out(UTF8ArrayToString(tty.output,0));tty.output=[]}else{if(val!=0)tty.output.push(val)}},fsync:function(tty){if(tty.output&&tty.output.length>0){out(UTF8ArrayToString(tty.output,0));tty.output=[]}}},default_tty1_ops:{put_char:function(tty,val){if(val===null||val===10){err(UTF8ArrayToString(tty.output,0));tty.output=[]}else{if(val!=0)tty.output.push(val)}},fsync:function(tty){if(tty.output&&tty.output.length>0){err(UTF8ArrayToString(tty.output,0));tty.output=[]}}}};function mmapAlloc(size){abort()}var MEMFS={ops_table:null,mount:function(mount){return MEMFS.createNode(null,"/",16384|511,0)},createNode:function(parent,name,mode,dev){if(FS.isBlkdev(mode)||FS.isFIFO(mode)){throw new FS.ErrnoError(63)}if(!MEMFS.ops_table){MEMFS.ops_table={dir:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr,lookup:MEMFS.node_ops.lookup,mknod:MEMFS.node_ops.mknod,rename:MEMFS.node_ops.rename,unlink:MEMFS.node_ops.unlink,rmdir:MEMFS.node_ops.rmdir,readdir:MEMFS.node_ops.readdir,symlink:MEMFS.node_ops.symlink},stream:{llseek:MEMFS.stream_ops.llseek}},file:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr},stream:{llseek:MEMFS.stream_ops.llseek,read:MEMFS.stream_ops.read,write:MEMFS.stream_ops.write,allocate:MEMFS.stream_ops.allocate,mmap:MEMFS.stream_ops.mmap,msync:MEMFS.stream_ops.msync}},link:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr,readlink:MEMFS.node_ops.readlink},stream:{}},chrdev:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr},stream:FS.chrdev_stream_ops}}}var node=FS.createNode(parent,name,mode,dev);if(FS.isDir(node.mode)){node.node_ops=MEMFS.ops_table.dir.node;node.stream_ops=MEMFS.ops_table.dir.stream;node.contents={}}else if(FS.isFile(node.mode)){node.node_ops=MEMFS.ops_table.file.node;node.stream_ops=MEMFS.ops_table.file.stream;node.usedBytes=0;node.contents=null}else if(FS.isLink(node.mode)){node.node_ops=MEMFS.ops_table.link.node;node.stream_ops=MEMFS.ops_table.link.stream}else if(FS.isChrdev(node.mode)){node.node_ops=MEMFS.ops_table.chrdev.node;node.stream_ops=MEMFS.ops_table.chrdev.stream}node.timestamp=Date.now();if(parent){parent.contents[name]=node;parent.timestamp=node.timestamp}return node},getFileDataAsTypedArray:function(node){if(!node.contents)return new Uint8Array(0);if(node.contents.subarray)return node.contents.subarray(0,node.usedBytes);return new Uint8Array(node.contents)},expandFileStorage:function(node,newCapacity){var prevCapacity=node.contents?node.contents.length:0;if(prevCapacity>=newCapacity)return;var CAPACITY_DOUBLING_MAX=1024*1024;newCapacity=Math.max(newCapacity,prevCapacity*(prevCapacity>>0);if(prevCapacity!=0)newCapacity=Math.max(newCapacity,256);var oldContents=node.contents;node.contents=new Uint8Array(newCapacity);if(node.usedBytes>0)node.contents.set(oldContents.subarray(0,node.usedBytes),0)},resizeFileStorage:function(node,newSize){if(node.usedBytes==newSize)return;if(newSize==0){node.contents=null;node.usedBytes=0}else{var oldContents=node.contents;node.contents=new Uint8Array(newSize);if(oldContents){node.contents.set(oldContents.subarray(0,Math.min(newSize,node.usedBytes)))}node.usedBytes=newSize}},node_ops:{getattr:function(node){var attr={};attr.dev=FS.isChrdev(node.mode)?node.id:1;attr.ino=node.id;attr.mode=node.mode;attr.nlink=1;attr.uid=0;attr.gid=0;attr.rdev=node.rdev;if(FS.isDir(node.mode)){attr.size=4096}else if(FS.isFile(node.mode)){attr.size=node.usedBytes}else if(FS.isLink(node.mode)){attr.size=node.link.length}else{attr.size=0}attr.atime=new Date(node.timestamp);attr.mtime=new Date(node.timestamp);attr.ctime=new Date(node.timestamp);attr.blksize=4096;attr.blocks=Math.ceil(attr.size/attr.blksize);return attr},setattr:function(node,attr){if(attr.mode!==undefined){node.mode=attr.mode}if(attr.timestamp!==undefined){node.timestamp=attr.timestamp}if(attr.size!==undefined){MEMFS.resizeFileStorage(node,attr.size)}},lookup:function(parent,name){throw FS.genericErrors[44]},mknod:function(parent,name,mode,dev){return MEMFS.createNode(parent,name,mode,dev)},rename:function(old_node,new_dir,new_name){if(FS.isDir(old_node.mode)){var new_node;try{new_node=FS.lookupNode(new_dir,new_name)}catch(e){}if(new_node){for(var i in new_node.contents){throw new FS.ErrnoError(55)}}}delete old_node.parent.contents[old_node.name];old_node.parent.timestamp=Date.now();old_node.name=new_name;new_dir.contents[new_name]=old_node;new_dir.timestamp=old_node.parent.timestamp;old_node.parent=new_dir},unlink:function(parent,name){delete parent.contents[name];parent.timestamp=Date.now()},rmdir:function(parent,name){var node=FS.lookupNode(parent,name);for(var i in node.contents){throw new FS.ErrnoError(55)}delete parent.contents[name];parent.timestamp=Date.now()},readdir:function(node){var entries=[".",".."];for(var key in node.contents){if(!node.contents.hasOwnProperty(key)){continue}entries.push(key)}return entries},symlink:function(parent,newname,oldpath){var node=MEMFS.createNode(parent,newname,511|40960,0);node.link=oldpath;return node},readlink:function(node){if(!FS.isLink(node.mode)){throw new FS.ErrnoError(28)}return node.link}},stream_ops:{read:function(stream,buffer,offset,length,position){var contents=stream.node.contents;if(position>=stream.node.usedBytes)return 0;var size=Math.min(stream.node.usedBytes-position,length);if(size>8&&contents.subarray){buffer.set(contents.subarray(position,position+size),offset)}else{for(var i=0;i0||position+length{assert(arrayBuffer,'Loading data file "'+url+'" failed (no arrayBuffer).');onload(new Uint8Array(arrayBuffer));if(dep)removeRunDependency(dep)},event=>{if(onerror){onerror()}else{throw'Loading data file "'+url+'" failed.'}});if(dep)addRunDependency(dep)}var FS={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:false,ignorePermissions:true,ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,lookupPath:(path,opts={})=>{path=PATH_FS.resolve(FS.cwd(),path);if(!path)return{path:"",node:null};var defaults={follow_mount:true,recurse_count:0};opts=Object.assign(defaults,opts);if(opts.recurse_count>8){throw new FS.ErrnoError(32)}var parts=PATH.normalizeArray(path.split("/").filter(p=>!!p),false);var current=FS.root;var current_path="/";for(var i=0;i40){throw new FS.ErrnoError(32)}}}}return{path:current_path,node:current}},getPath:node=>{var path;while(true){if(FS.isRoot(node)){var mount=node.mount.mountpoint;if(!path)return mount;return mount[mount.length-1]!=="/"?mount+"/"+path:mount+path}path=path?node.name+"/"+path:node.name;node=node.parent}},hashName:(parentid,name)=>{var hash=0;for(var i=0;i>>0)%FS.nameTable.length},hashAddNode:node=>{var hash=FS.hashName(node.parent.id,node.name);node.name_next=FS.nameTable[hash];FS.nameTable[hash]=node},hashRemoveNode:node=>{var hash=FS.hashName(node.parent.id,node.name);if(FS.nameTable[hash]===node){FS.nameTable[hash]=node.name_next}else{var current=FS.nameTable[hash];while(current){if(current.name_next===node){current.name_next=node.name_next;break}current=current.name_next}}},lookupNode:(parent,name)=>{var errCode=FS.mayLookup(parent);if(errCode){throw new FS.ErrnoError(errCode,parent)}var hash=FS.hashName(parent.id,name);for(var node=FS.nameTable[hash];node;node=node.name_next){var nodeName=node.name;if(node.parent.id===parent.id&&nodeName===name){return node}}return FS.lookup(parent,name)},createNode:(parent,name,mode,rdev)=>{var node=new FS.FSNode(parent,name,mode,rdev);FS.hashAddNode(node);return node},destroyNode:node=>{FS.hashRemoveNode(node)},isRoot:node=>{return node===node.parent},isMountpoint:node=>{return!!node.mounted},isFile:mode=>{return(mode&61440)===32768},isDir:mode=>{return(mode&61440)===16384},isLink:mode=>{return(mode&61440)===40960},isChrdev:mode=>{return(mode&61440)===8192},isBlkdev:mode=>{return(mode&61440)===24576},isFIFO:mode=>{return(mode&61440)===4096},isSocket:mode=>{return(mode&49152)===49152},flagModes:{"r":0,"r+":2,"w":577,"w+":578,"a":1089,"a+":1090},modeStringToFlags:str=>{var flags=FS.flagModes[str];if(typeof flags=="undefined"){throw new Error("Unknown file open mode: "+str)}return flags},flagsToPermissionString:flag=>{var perms=["r","w","rw"][flag&3];if(flag&512){perms+="w"}return perms},nodePermissions:(node,perms)=>{if(FS.ignorePermissions){return 0}if(perms.includes("r")&&!(node.mode&292)){return 2}else if(perms.includes("w")&&!(node.mode&146)){return 2}else if(perms.includes("x")&&!(node.mode&73)){return 2}return 0},mayLookup:dir=>{var errCode=FS.nodePermissions(dir,"x");if(errCode)return errCode;if(!dir.node_ops.lookup)return 2;return 0},mayCreate:(dir,name)=>{try{var node=FS.lookupNode(dir,name);return 20}catch(e){}return FS.nodePermissions(dir,"wx")},mayDelete:(dir,name,isdir)=>{var node;try{node=FS.lookupNode(dir,name)}catch(e){return e.errno}var errCode=FS.nodePermissions(dir,"wx");if(errCode){return errCode}if(isdir){if(!FS.isDir(node.mode)){return 54}if(FS.isRoot(node)||FS.getPath(node)===FS.cwd()){return 10}}else{if(FS.isDir(node.mode)){return 31}}return 0},mayOpen:(node,flags)=>{if(!node){return 44}if(FS.isLink(node.mode)){return 32}else if(FS.isDir(node.mode)){if(FS.flagsToPermissionString(flags)!=="r"||flags&512){return 31}}return FS.nodePermissions(node,FS.flagsToPermissionString(flags))},MAX_OPEN_FDS:4096,nextfd:(fd_start=0,fd_end=FS.MAX_OPEN_FDS)=>{for(var fd=fd_start;fd<=fd_end;fd++){if(!FS.streams[fd]){return fd}}throw new FS.ErrnoError(33)},getStream:fd=>FS.streams[fd],createStream:(stream,fd_start,fd_end)=>{if(!FS.FSStream){FS.FSStream=function(){this.shared={}};FS.FSStream.prototype={};Object.defineProperties(FS.FSStream.prototype,{object:{get:function(){return this.node},set:function(val){this.node=val}},isRead:{get:function(){return(this.flags&2097155)!==1}},isWrite:{get:function(){return(this.flags&2097155)!==0}},isAppend:{get:function(){return this.flags&1024}},flags:{get:function(){return this.shared.flags},set:function(val){this.shared.flags=val}},position:{get:function(){return this.shared.position},set:function(val){this.shared.position=val}}})}stream=Object.assign(new FS.FSStream,stream);var fd=FS.nextfd(fd_start,fd_end);stream.fd=fd;FS.streams[fd]=stream;return stream},closeStream:fd=>{FS.streams[fd]=null},chrdev_stream_ops:{open:stream=>{var device=FS.getDevice(stream.node.rdev);stream.stream_ops=device.stream_ops;if(stream.stream_ops.open){stream.stream_ops.open(stream)}},llseek:()=>{throw new FS.ErrnoError(70)}},major:dev=>dev>>8,minor:dev=>dev&255,makedev:(ma,mi)=>ma<<8|mi,registerDevice:(dev,ops)=>{FS.devices[dev]={stream_ops:ops}},getDevice:dev=>FS.devices[dev],getMounts:mount=>{var mounts=[];var check=[mount];while(check.length){var m=check.pop();mounts.push(m);check.push.apply(check,m.mounts)}return mounts},syncfs:(populate,callback)=>{if(typeof populate=="function"){callback=populate;populate=false}FS.syncFSRequests++;if(FS.syncFSRequests>1){err("warning: "+FS.syncFSRequests+" FS.syncfs operations in flight at once, probably just doing extra work")}var mounts=FS.getMounts(FS.root.mount);var completed=0;function doCallback(errCode){FS.syncFSRequests--;return callback(errCode)}function done(errCode){if(errCode){if(!done.errored){done.errored=true;return doCallback(errCode)}return}if(++completed>=mounts.length){doCallback(null)}}mounts.forEach(mount=>{if(!mount.type.syncfs){return done(null)}mount.type.syncfs(mount,populate,done)})},mount:(type,opts,mountpoint)=>{var root=mountpoint==="/";var pseudo=!mountpoint;var node;if(root&&FS.root){throw new FS.ErrnoError(10)}else if(!root&&!pseudo){var lookup=FS.lookupPath(mountpoint,{follow_mount:false});mountpoint=lookup.path;node=lookup.node;if(FS.isMountpoint(node)){throw new FS.ErrnoError(10)}if(!FS.isDir(node.mode)){throw new FS.ErrnoError(54)}}var mount={type:type,opts:opts,mountpoint:mountpoint,mounts:[]};var mountRoot=type.mount(mount);mountRoot.mount=mount;mount.root=mountRoot;if(root){FS.root=mountRoot}else if(node){node.mounted=mount;if(node.mount){node.mount.mounts.push(mount)}}return mountRoot},unmount:mountpoint=>{var lookup=FS.lookupPath(mountpoint,{follow_mount:false});if(!FS.isMountpoint(lookup.node)){throw new FS.ErrnoError(28)}var node=lookup.node;var mount=node.mounted;var mounts=FS.getMounts(mount);Object.keys(FS.nameTable).forEach(hash=>{var current=FS.nameTable[hash];while(current){var next=current.name_next;if(mounts.includes(current.mount)){FS.destroyNode(current)}current=next}});node.mounted=null;var idx=node.mount.mounts.indexOf(mount);node.mount.mounts.splice(idx,1)},lookup:(parent,name)=>{return parent.node_ops.lookup(parent,name)},mknod:(path,mode,dev)=>{var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;var name=PATH.basename(path);if(!name||name==="."||name===".."){throw new FS.ErrnoError(28)}var errCode=FS.mayCreate(parent,name);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.mknod){throw new FS.ErrnoError(63)}return parent.node_ops.mknod(parent,name,mode,dev)},create:(path,mode)=>{mode=mode!==undefined?mode:438;mode&=4095;mode|=32768;return FS.mknod(path,mode,0)},mkdir:(path,mode)=>{mode=mode!==undefined?mode:511;mode&=511|512;mode|=16384;return FS.mknod(path,mode,0)},mkdirTree:(path,mode)=>{var dirs=path.split("/");var d="";for(var i=0;i{if(typeof dev=="undefined"){dev=mode;mode=438}mode|=8192;return FS.mknod(path,mode,dev)},symlink:(oldpath,newpath)=>{if(!PATH_FS.resolve(oldpath)){throw new FS.ErrnoError(44)}var lookup=FS.lookupPath(newpath,{parent:true});var parent=lookup.node;if(!parent){throw new FS.ErrnoError(44)}var newname=PATH.basename(newpath);var errCode=FS.mayCreate(parent,newname);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.symlink){throw new FS.ErrnoError(63)}return parent.node_ops.symlink(parent,newname,oldpath)},rename:(old_path,new_path)=>{var old_dirname=PATH.dirname(old_path);var new_dirname=PATH.dirname(new_path);var old_name=PATH.basename(old_path);var new_name=PATH.basename(new_path);var lookup,old_dir,new_dir;lookup=FS.lookupPath(old_path,{parent:true});old_dir=lookup.node;lookup=FS.lookupPath(new_path,{parent:true});new_dir=lookup.node;if(!old_dir||!new_dir)throw new FS.ErrnoError(44);if(old_dir.mount!==new_dir.mount){throw new FS.ErrnoError(75)}var old_node=FS.lookupNode(old_dir,old_name);var relative=PATH_FS.relative(old_path,new_dirname);if(relative.charAt(0)!=="."){throw new FS.ErrnoError(28)}relative=PATH_FS.relative(new_path,old_dirname);if(relative.charAt(0)!=="."){throw new FS.ErrnoError(55)}var new_node;try{new_node=FS.lookupNode(new_dir,new_name)}catch(e){}if(old_node===new_node){return}var isdir=FS.isDir(old_node.mode);var errCode=FS.mayDelete(old_dir,old_name,isdir);if(errCode){throw new FS.ErrnoError(errCode)}errCode=new_node?FS.mayDelete(new_dir,new_name,isdir):FS.mayCreate(new_dir,new_name);if(errCode){throw new FS.ErrnoError(errCode)}if(!old_dir.node_ops.rename){throw new FS.ErrnoError(63)}if(FS.isMountpoint(old_node)||new_node&&FS.isMountpoint(new_node)){throw new FS.ErrnoError(10)}if(new_dir!==old_dir){errCode=FS.nodePermissions(old_dir,"w");if(errCode){throw new FS.ErrnoError(errCode)}}FS.hashRemoveNode(old_node);try{old_dir.node_ops.rename(old_node,new_dir,new_name)}catch(e){throw e}finally{FS.hashAddNode(old_node)}},rmdir:path=>{var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;var name=PATH.basename(path);var node=FS.lookupNode(parent,name);var errCode=FS.mayDelete(parent,name,true);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.rmdir){throw new FS.ErrnoError(63)}if(FS.isMountpoint(node)){throw new FS.ErrnoError(10)}parent.node_ops.rmdir(parent,name);FS.destroyNode(node)},readdir:path=>{var lookup=FS.lookupPath(path,{follow:true});var node=lookup.node;if(!node.node_ops.readdir){throw new FS.ErrnoError(54)}return node.node_ops.readdir(node)},unlink:path=>{var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;if(!parent){throw new FS.ErrnoError(44)}var name=PATH.basename(path);var node=FS.lookupNode(parent,name);var errCode=FS.mayDelete(parent,name,false);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.unlink){throw new FS.ErrnoError(63)}if(FS.isMountpoint(node)){throw new FS.ErrnoError(10)}parent.node_ops.unlink(parent,name);FS.destroyNode(node)},readlink:path=>{var lookup=FS.lookupPath(path);var link=lookup.node;if(!link){throw new FS.ErrnoError(44)}if(!link.node_ops.readlink){throw new FS.ErrnoError(28)}return PATH_FS.resolve(FS.getPath(link.parent),link.node_ops.readlink(link))},stat:(path,dontFollow)=>{var lookup=FS.lookupPath(path,{follow:!dontFollow});var node=lookup.node;if(!node){throw new FS.ErrnoError(44)}if(!node.node_ops.getattr){throw new FS.ErrnoError(63)}return node.node_ops.getattr(node)},lstat:path=>{return FS.stat(path,true)},chmod:(path,mode,dontFollow)=>{var node;if(typeof path=="string"){var lookup=FS.lookupPath(path,{follow:!dontFollow});node=lookup.node}else{node=path}if(!node.node_ops.setattr){throw new FS.ErrnoError(63)}node.node_ops.setattr(node,{mode:mode&4095|node.mode&~4095,timestamp:Date.now()})},lchmod:(path,mode)=>{FS.chmod(path,mode,true)},fchmod:(fd,mode)=>{var stream=FS.getStream(fd);if(!stream){throw new FS.ErrnoError(8)}FS.chmod(stream.node,mode)},chown:(path,uid,gid,dontFollow)=>{var node;if(typeof path=="string"){var lookup=FS.lookupPath(path,{follow:!dontFollow});node=lookup.node}else{node=path}if(!node.node_ops.setattr){throw new FS.ErrnoError(63)}node.node_ops.setattr(node,{timestamp:Date.now()})},lchown:(path,uid,gid)=>{FS.chown(path,uid,gid,true)},fchown:(fd,uid,gid)=>{var stream=FS.getStream(fd);if(!stream){throw new FS.ErrnoError(8)}FS.chown(stream.node,uid,gid)},truncate:(path,len)=>{if(len<0){throw new FS.ErrnoError(28)}var node;if(typeof path=="string"){var lookup=FS.lookupPath(path,{follow:true});node=lookup.node}else{node=path}if(!node.node_ops.setattr){throw new FS.ErrnoError(63)}if(FS.isDir(node.mode)){throw new FS.ErrnoError(31)}if(!FS.isFile(node.mode)){throw new FS.ErrnoError(28)}var errCode=FS.nodePermissions(node,"w");if(errCode){throw new FS.ErrnoError(errCode)}node.node_ops.setattr(node,{size:len,timestamp:Date.now()})},ftruncate:(fd,len)=>{var stream=FS.getStream(fd);if(!stream){throw new FS.ErrnoError(8)}if((stream.flags&2097155)===0){throw new FS.ErrnoError(28)}FS.truncate(stream.node,len)},utime:(path,atime,mtime)=>{var lookup=FS.lookupPath(path,{follow:true});var node=lookup.node;node.node_ops.setattr(node,{timestamp:Math.max(atime,mtime)})},open:(path,flags,mode)=>{if(path===""){throw new FS.ErrnoError(44)}flags=typeof flags=="string"?FS.modeStringToFlags(flags):flags;mode=typeof mode=="undefined"?438:mode;if(flags&64){mode=mode&4095|32768}else{mode=0}var node;if(typeof path=="object"){node=path}else{path=PATH.normalize(path);try{var lookup=FS.lookupPath(path,{follow:!(flags&131072)});node=lookup.node}catch(e){}}var created=false;if(flags&64){if(node){if(flags&128){throw new FS.ErrnoError(20)}}else{node=FS.mknod(path,mode,0);created=true}}if(!node){throw new FS.ErrnoError(44)}if(FS.isChrdev(node.mode)){flags&=~512}if(flags&65536&&!FS.isDir(node.mode)){throw new FS.ErrnoError(54)}if(!created){var errCode=FS.mayOpen(node,flags);if(errCode){throw new FS.ErrnoError(errCode)}}if(flags&512&&!created){FS.truncate(node,0)}flags&=~(128|512|131072);var stream=FS.createStream({node:node,path:FS.getPath(node),flags:flags,seekable:true,position:0,stream_ops:node.stream_ops,ungotten:[],error:false});if(stream.stream_ops.open){stream.stream_ops.open(stream)}if(Module["logReadFiles"]&&!(flags&1)){if(!FS.readFiles)FS.readFiles={};if(!(path in FS.readFiles)){FS.readFiles[path]=1}}return stream},close:stream=>{if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if(stream.getdents)stream.getdents=null;try{if(stream.stream_ops.close){stream.stream_ops.close(stream)}}catch(e){throw e}finally{FS.closeStream(stream.fd)}stream.fd=null},isClosed:stream=>{return stream.fd===null},llseek:(stream,offset,whence)=>{if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if(!stream.seekable||!stream.stream_ops.llseek){throw new FS.ErrnoError(70)}if(whence!=0&&whence!=1&&whence!=2){throw new FS.ErrnoError(28)}stream.position=stream.stream_ops.llseek(stream,offset,whence);stream.ungotten=[];return stream.position},read:(stream,buffer,offset,length,position)=>{if(length<0||position<0){throw new FS.ErrnoError(28)}if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if((stream.flags&2097155)===1){throw new FS.ErrnoError(8)}if(FS.isDir(stream.node.mode)){throw new FS.ErrnoError(31)}if(!stream.stream_ops.read){throw new FS.ErrnoError(28)}var seeking=typeof position!="undefined";if(!seeking){position=stream.position}else if(!stream.seekable){throw new FS.ErrnoError(70)}var bytesRead=stream.stream_ops.read(stream,buffer,offset,length,position);if(!seeking)stream.position+=bytesRead;return bytesRead},write:(stream,buffer,offset,length,position,canOwn)=>{if(length<0||position<0){throw new FS.ErrnoError(28)}if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if((stream.flags&2097155)===0){throw new FS.ErrnoError(8)}if(FS.isDir(stream.node.mode)){throw new FS.ErrnoError(31)}if(!stream.stream_ops.write){throw new FS.ErrnoError(28)}if(stream.seekable&&stream.flags&1024){FS.llseek(stream,0,2)}var seeking=typeof position!="undefined";if(!seeking){position=stream.position}else if(!stream.seekable){throw new FS.ErrnoError(70)}var bytesWritten=stream.stream_ops.write(stream,buffer,offset,length,position,canOwn);if(!seeking)stream.position+=bytesWritten;return bytesWritten},allocate:(stream,offset,length)=>{if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if(offset<0||length<=0){throw new FS.ErrnoError(28)}if((stream.flags&2097155)===0){throw new FS.ErrnoError(8)}if(!FS.isFile(stream.node.mode)&&!FS.isDir(stream.node.mode)){throw new FS.ErrnoError(43)}if(!stream.stream_ops.allocate){throw new FS.ErrnoError(138)}stream.stream_ops.allocate(stream,offset,length)},mmap:(stream,length,position,prot,flags)=>{if((prot&2)!==0&&(flags&2)===0&&(stream.flags&2097155)!==2){throw new FS.ErrnoError(2)}if((stream.flags&2097155)===1){throw new FS.ErrnoError(2)}if(!stream.stream_ops.mmap){throw new FS.ErrnoError(43)}return stream.stream_ops.mmap(stream,length,position,prot,flags)},msync:(stream,buffer,offset,length,mmapFlags)=>{if(!stream.stream_ops.msync){return 0}return stream.stream_ops.msync(stream,buffer,offset,length,mmapFlags)},munmap:stream=>0,ioctl:(stream,cmd,arg)=>{if(!stream.stream_ops.ioctl){throw new FS.ErrnoError(59)}return stream.stream_ops.ioctl(stream,cmd,arg)},readFile:(path,opts={})=>{opts.flags=opts.flags||0;opts.encoding=opts.encoding||"binary";if(opts.encoding!=="utf8"&&opts.encoding!=="binary"){throw new Error('Invalid encoding type "'+opts.encoding+'"')}var ret;var stream=FS.open(path,opts.flags);var stat=FS.stat(path);var length=stat.size;var buf=new Uint8Array(length);FS.read(stream,buf,0,length,0);if(opts.encoding==="utf8"){ret=UTF8ArrayToString(buf,0)}else if(opts.encoding==="binary"){ret=buf}FS.close(stream);return ret},writeFile:(path,data,opts={})=>{opts.flags=opts.flags||577;var stream=FS.open(path,opts.flags,opts.mode);if(typeof data=="string"){var buf=new Uint8Array(lengthBytesUTF8(data)+1);var actualNumBytes=stringToUTF8Array(data,buf,0,buf.length);FS.write(stream,buf,0,actualNumBytes,undefined,opts.canOwn)}else if(ArrayBuffer.isView(data)){FS.write(stream,data,0,data.byteLength,undefined,opts.canOwn)}else{throw new Error("Unsupported data type")}FS.close(stream)},cwd:()=>FS.currentPath,chdir:path=>{var lookup=FS.lookupPath(path,{follow:true});if(lookup.node===null){throw new FS.ErrnoError(44)}if(!FS.isDir(lookup.node.mode)){throw new FS.ErrnoError(54)}var errCode=FS.nodePermissions(lookup.node,"x");if(errCode){throw new FS.ErrnoError(errCode)}FS.currentPath=lookup.path},createDefaultDirectories:()=>{FS.mkdir("/tmp");FS.mkdir("/home");FS.mkdir("/home/web_user")},createDefaultDevices:()=>{FS.mkdir("/dev");FS.registerDevice(FS.makedev(1,3),{read:()=>0,write:(stream,buffer,offset,length,pos)=>length});FS.mkdev("/dev/null",FS.makedev(1,3));TTY.register(FS.makedev(5,0),TTY.default_tty_ops);TTY.register(FS.makedev(6,0),TTY.default_tty1_ops);FS.mkdev("/dev/tty",FS.makedev(5,0));FS.mkdev("/dev/tty1",FS.makedev(6,0));var random_device=getRandomDevice();FS.createDevice("/dev","random",random_device);FS.createDevice("/dev","urandom",random_device);FS.mkdir("/dev/shm");FS.mkdir("/dev/shm/tmp")},createSpecialDirectories:()=>{FS.mkdir("/proc");var proc_self=FS.mkdir("/proc/self");FS.mkdir("/proc/self/fd");FS.mount({mount:()=>{var node=FS.createNode(proc_self,"fd",16384|511,73);node.node_ops={lookup:(parent,name)=>{var fd=+name;var stream=FS.getStream(fd);if(!stream)throw new FS.ErrnoError(8);var ret={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>stream.path}};ret.parent=ret;return ret}};return node}},{},"/proc/self/fd")},createStandardStreams:()=>{if(Module["stdin"]){FS.createDevice("/dev","stdin",Module["stdin"])}else{FS.symlink("/dev/tty","/dev/stdin")}if(Module["stdout"]){FS.createDevice("/dev","stdout",null,Module["stdout"])}else{FS.symlink("/dev/tty","/dev/stdout")}if(Module["stderr"]){FS.createDevice("/dev","stderr",null,Module["stderr"])}else{FS.symlink("/dev/tty1","/dev/stderr")}var stdin=FS.open("/dev/stdin",0);var stdout=FS.open("/dev/stdout",1);var stderr=FS.open("/dev/stderr",1)},ensureErrnoError:()=>{if(FS.ErrnoError)return;FS.ErrnoError=function ErrnoError(errno,node){this.node=node;this.setErrno=function(errno){this.errno=errno};this.setErrno(errno);this.message="FS error"};FS.ErrnoError.prototype=new Error;FS.ErrnoError.prototype.constructor=FS.ErrnoError;[44].forEach(code=>{FS.genericErrors[code]=new FS.ErrnoError(code);FS.genericErrors[code].stack=""})},staticInit:()=>{FS.ensureErrnoError();FS.nameTable=new Array(4096);FS.mount(MEMFS,{},"/");FS.createDefaultDirectories();FS.createDefaultDevices();FS.createSpecialDirectories();FS.filesystems={"MEMFS":MEMFS}},init:(input,output,error)=>{FS.init.initialized=true;FS.ensureErrnoError();Module["stdin"]=input||Module["stdin"];Module["stdout"]=output||Module["stdout"];Module["stderr"]=error||Module["stderr"];FS.createStandardStreams()},quit:()=>{FS.init.initialized=false;for(var i=0;i{var mode=0;if(canRead)mode|=292|73;if(canWrite)mode|=146;return mode},findObject:(path,dontResolveLastLink)=>{var ret=FS.analyzePath(path,dontResolveLastLink);if(!ret.exists){return null}return ret.object},analyzePath:(path,dontResolveLastLink)=>{try{var lookup=FS.lookupPath(path,{follow:!dontResolveLastLink});path=lookup.path}catch(e){}var ret={isRoot:false,exists:false,error:0,name:null,path:null,object:null,parentExists:false,parentPath:null,parentObject:null};try{var lookup=FS.lookupPath(path,{parent:true});ret.parentExists=true;ret.parentPath=lookup.path;ret.parentObject=lookup.node;ret.name=PATH.basename(path);lookup=FS.lookupPath(path,{follow:!dontResolveLastLink});ret.exists=true;ret.path=lookup.path;ret.object=lookup.node;ret.name=lookup.node.name;ret.isRoot=lookup.path==="/"}catch(e){ret.error=e.errno}return ret},createPath:(parent,path,canRead,canWrite)=>{parent=typeof parent=="string"?parent:FS.getPath(parent);var parts=path.split("/").reverse();while(parts.length){var part=parts.pop();if(!part)continue;var current=PATH.join2(parent,part);try{FS.mkdir(current)}catch(e){}parent=current}return current},createFile:(parent,name,properties,canRead,canWrite)=>{var path=PATH.join2(typeof parent=="string"?parent:FS.getPath(parent),name);var mode=FS.getMode(canRead,canWrite);return FS.create(path,mode)},createDataFile:(parent,name,data,canRead,canWrite,canOwn)=>{var path=name;if(parent){parent=typeof parent=="string"?parent:FS.getPath(parent);path=name?PATH.join2(parent,name):parent}var mode=FS.getMode(canRead,canWrite);var node=FS.create(path,mode);if(data){if(typeof data=="string"){var arr=new Array(data.length);for(var i=0,len=data.length;i{var path=PATH.join2(typeof parent=="string"?parent:FS.getPath(parent),name);var mode=FS.getMode(!!input,!!output);if(!FS.createDevice.major)FS.createDevice.major=64;var dev=FS.makedev(FS.createDevice.major++,0);FS.registerDevice(dev,{open:stream=>{stream.seekable=false},close:stream=>{if(output&&output.buffer&&output.buffer.length){output(10)}},read:(stream,buffer,offset,length,pos)=>{var bytesRead=0;for(var i=0;i{for(var i=0;i{if(obj.isDevice||obj.isFolder||obj.link||obj.contents)return true;if(typeof XMLHttpRequest!="undefined"){throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.")}else if(read_){try{obj.contents=intArrayFromString(read_(obj.url),true);obj.usedBytes=obj.contents.length}catch(e){throw new FS.ErrnoError(29)}}else{throw new Error("Cannot load without read() or XMLHttpRequest.")}},createLazyFile:(parent,name,url,canRead,canWrite)=>{function LazyUint8Array(){this.lengthKnown=false;this.chunks=[]}LazyUint8Array.prototype.get=function LazyUint8Array_get(idx){if(idx>this.length-1||idx<0){return undefined}var chunkOffset=idx%this.chunkSize;var chunkNum=idx/this.chunkSize|0;return this.getter(chunkNum)[chunkOffset]};LazyUint8Array.prototype.setDataGetter=function LazyUint8Array_setDataGetter(getter){this.getter=getter};LazyUint8Array.prototype.cacheLength=function LazyUint8Array_cacheLength(){var xhr=new XMLHttpRequest;xhr.open("HEAD",url,false);xhr.send(null);if(!(xhr.status>=200&&xhr.status<300||xhr.status===304))throw new Error("Couldn't load "+url+". Status: "+xhr.status);var datalength=Number(xhr.getResponseHeader("Content-length"));var header;var hasByteServing=(header=xhr.getResponseHeader("Accept-Ranges"))&&header==="bytes";var usesGzip=(header=xhr.getResponseHeader("Content-Encoding"))&&header==="gzip";var chunkSize=1024*1024;if(!hasByteServing)chunkSize=datalength;var doXHR=(from,to)=>{if(from>to)throw new Error("invalid range ("+from+", "+to+") or no bytes requested!");if(to>datalength-1)throw new Error("only "+datalength+" bytes available! programmer error!");var xhr=new XMLHttpRequest;xhr.open("GET",url,false);if(datalength!==chunkSize)xhr.setRequestHeader("Range","bytes="+from+"-"+to);xhr.responseType="arraybuffer";if(xhr.overrideMimeType){xhr.overrideMimeType("text/plain; charset=x-user-defined")}xhr.send(null);if(!(xhr.status>=200&&xhr.status<300||xhr.status===304))throw new Error("Couldn't load "+url+". Status: "+xhr.status);if(xhr.response!==undefined){return new Uint8Array(xhr.response||[])}return intArrayFromString(xhr.responseText||"",true)};var lazyArray=this;lazyArray.setDataGetter(chunkNum=>{var start=chunkNum*chunkSize;var end=(chunkNum+1)*chunkSize-1;end=Math.min(end,datalength-1);if(typeof lazyArray.chunks[chunkNum]=="undefined"){lazyArray.chunks[chunkNum]=doXHR(start,end)}if(typeof lazyArray.chunks[chunkNum]=="undefined")throw new Error("doXHR failed!");return lazyArray.chunks[chunkNum]});if(usesGzip||!datalength){chunkSize=datalength=1;datalength=this.getter(0).length;chunkSize=datalength;out("LazyFiles on gzip forces download of the whole file when length is accessed")}this._length=datalength;this._chunkSize=chunkSize;this.lengthKnown=true};if(typeof XMLHttpRequest!="undefined"){if(!ENVIRONMENT_IS_WORKER)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var lazyArray=new LazyUint8Array;Object.defineProperties(lazyArray,{length:{get:function(){if(!this.lengthKnown){this.cacheLength()}return this._length}},chunkSize:{get:function(){if(!this.lengthKnown){this.cacheLength()}return this._chunkSize}}});var properties={isDevice:false,contents:lazyArray}}else{var properties={isDevice:false,url:url}}var node=FS.createFile(parent,name,properties,canRead,canWrite);if(properties.contents){node.contents=properties.contents}else if(properties.url){node.contents=null;node.url=properties.url}Object.defineProperties(node,{usedBytes:{get:function(){return this.contents.length}}});var stream_ops={};var keys=Object.keys(node.stream_ops);keys.forEach(key=>{var fn=node.stream_ops[key];stream_ops[key]=function forceLoadLazyFile(){FS.forceLoadFile(node);return fn.apply(null,arguments)}});function writeChunks(stream,buffer,offset,length,position){var contents=stream.node.contents;if(position>=contents.length)return 0;var size=Math.min(contents.length-position,length);if(contents.slice){for(var i=0;i{FS.forceLoadFile(node);return writeChunks(stream,buffer,offset,length,position)};stream_ops.mmap=(stream,length,position,prot,flags)=>{FS.forceLoadFile(node);var ptr=mmapAlloc(length);if(!ptr){throw new FS.ErrnoError(48)}writeChunks(stream,HEAP8,ptr,length,position);return{ptr:ptr,allocated:true}};node.stream_ops=stream_ops;return node},createPreloadedFile:(parent,name,url,canRead,canWrite,onload,onerror,dontCreateFile,canOwn,preFinish)=>{var fullname=name?PATH_FS.resolve(PATH.join2(parent,name)):parent;var dep=getUniqueRunDependency("cp "+fullname);function processData(byteArray){function finish(byteArray){if(preFinish)preFinish();if(!dontCreateFile){FS.createDataFile(parent,name,byteArray,canRead,canWrite,canOwn)}if(onload)onload();removeRunDependency(dep)}if(Browser.handledByPreloadPlugin(byteArray,fullname,finish,()=>{if(onerror)onerror();removeRunDependency(dep)})){return}finish(byteArray)}addRunDependency(dep);if(typeof url=="string"){asyncLoad(url,byteArray=>processData(byteArray),onerror)}else{processData(url)}},indexedDB:()=>{return window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB},DB_NAME:()=>{return"EM_FS_"+window.location.pathname},DB_VERSION:20,DB_STORE_NAME:"FILE_DATA",saveFilesToDB:(paths,onload,onerror)=>{onload=onload||(()=>{});onerror=onerror||(()=>{});var indexedDB=FS.indexedDB();try{var openRequest=indexedDB.open(FS.DB_NAME(),FS.DB_VERSION)}catch(e){return onerror(e)}openRequest.onupgradeneeded=()=>{out("creating db");var db=openRequest.result;db.createObjectStore(FS.DB_STORE_NAME)};openRequest.onsuccess=()=>{var db=openRequest.result;var transaction=db.transaction([FS.DB_STORE_NAME],"readwrite");var files=transaction.objectStore(FS.DB_STORE_NAME);var ok=0,fail=0,total=paths.length;function finish(){if(fail==0)onload();else onerror()}paths.forEach(path=>{var putRequest=files.put(FS.analyzePath(path).object.contents,path);putRequest.onsuccess=()=>{ok++;if(ok+fail==total)finish()};putRequest.onerror=()=>{fail++;if(ok+fail==total)finish()}});transaction.onerror=onerror};openRequest.onerror=onerror},loadFilesFromDB:(paths,onload,onerror)=>{onload=onload||(()=>{});onerror=onerror||(()=>{});var indexedDB=FS.indexedDB();try{var openRequest=indexedDB.open(FS.DB_NAME(),FS.DB_VERSION)}catch(e){return onerror(e)}openRequest.onupgradeneeded=onerror;openRequest.onsuccess=()=>{var db=openRequest.result;try{var transaction=db.transaction([FS.DB_STORE_NAME],"readonly")}catch(e){onerror(e);return}var files=transaction.objectStore(FS.DB_STORE_NAME);var ok=0,fail=0,total=paths.length;function finish(){if(fail==0)onload();else onerror()}paths.forEach(path=>{var getRequest=files.get(path);getRequest.onsuccess=()=>{if(FS.analyzePath(path).exists){FS.unlink(path)}FS.createDataFile(PATH.dirname(path),PATH.basename(path),getRequest.result,true,true,true);ok++;if(ok+fail==total)finish()};getRequest.onerror=()=>{fail++;if(ok+fail==total)finish()}});transaction.onerror=onerror};openRequest.onerror=onerror}};var SYSCALLS={DEFAULT_POLLMASK:5,calculateAt:function(dirfd,path,allowEmpty){if(PATH.isAbs(path)){return path}var dir;if(dirfd===-100){dir=FS.cwd()}else{var dirstream=SYSCALLS.getStreamFromFD(dirfd);dir=dirstream.path}if(path.length==0){if(!allowEmpty){throw new FS.ErrnoError(44)}return dir}return PATH.join2(dir,path)},doStat:function(func,path,buf){try{var stat=func(path)}catch(e){if(e&&e.node&&PATH.normalize(path)!==PATH.normalize(FS.getPath(e.node))){return-54}throw e}HEAP32[buf>>2]=stat.dev;HEAP32[buf+8>>2]=stat.ino;HEAP32[buf+12>>2]=stat.mode;HEAPU32[buf+16>>2]=stat.nlink;HEAP32[buf+20>>2]=stat.uid;HEAP32[buf+24>>2]=stat.gid;HEAP32[buf+28>>2]=stat.rdev;tempI64=[stat.size>>>0,(tempDouble=stat.size,+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+40>>2]=tempI64[0],HEAP32[buf+44>>2]=tempI64[1];HEAP32[buf+48>>2]=4096;HEAP32[buf+52>>2]=stat.blocks;tempI64=[Math.floor(stat.atime.getTime()/1e3)>>>0,(tempDouble=Math.floor(stat.atime.getTime()/1e3),+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+56>>2]=tempI64[0],HEAP32[buf+60>>2]=tempI64[1];HEAPU32[buf+64>>2]=0;tempI64=[Math.floor(stat.mtime.getTime()/1e3)>>>0,(tempDouble=Math.floor(stat.mtime.getTime()/1e3),+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+72>>2]=tempI64[0],HEAP32[buf+76>>2]=tempI64[1];HEAPU32[buf+80>>2]=0;tempI64=[Math.floor(stat.ctime.getTime()/1e3)>>>0,(tempDouble=Math.floor(stat.ctime.getTime()/1e3),+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+88>>2]=tempI64[0],HEAP32[buf+92>>2]=tempI64[1];HEAPU32[buf+96>>2]=0;tempI64=[stat.ino>>>0,(tempDouble=stat.ino,+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+104>>2]=tempI64[0],HEAP32[buf+108>>2]=tempI64[1];return 0},doMsync:function(addr,stream,len,flags,offset){if(!FS.isFile(stream.node.mode)){throw new FS.ErrnoError(43)}if(flags&2){return 0}var buffer=HEAPU8.slice(addr,addr+len);FS.msync(stream,buffer,offset,len,flags)},varargs:undefined,get:function(){SYSCALLS.varargs+=4;var ret=HEAP32[SYSCALLS.varargs-4>>2];return ret},getStr:function(ptr){var ret=UTF8ToString(ptr);return ret},getStreamFromFD:function(fd){var stream=FS.getStream(fd);if(!stream)throw new FS.ErrnoError(8);return stream}};function ___syscall_fcntl64(fd,cmd,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(fd);switch(cmd){case 0:{var arg=SYSCALLS.get();if(arg<0){return-28}var newStream;newStream=FS.createStream(stream,arg);return newStream.fd}case 1:case 2:return 0;case 3:return stream.flags;case 4:{var arg=SYSCALLS.get();stream.flags|=arg;return 0}case 5:{var arg=SYSCALLS.get();var offset=0;HEAP16[arg+offset>>1]=2;return 0}case 6:case 7:return 0;case 16:case 8:return-28;case 9:setErrNo(28);return-1;default:{return-28}}}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_getcwd(buf,size){try{if(size===0)return-28;var cwd=FS.cwd();var cwdLengthInBytes=lengthBytesUTF8(cwd)+1;if(size>2]=0;return 0}case 21520:{if(!stream.tty)return-59;return-28}case 21531:{var argp=SYSCALLS.get();return FS.ioctl(stream,op,argp)}case 21523:{if(!stream.tty)return-59;return 0}case 21524:{if(!stream.tty)return-59;return 0}default:return-28}}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_openat(dirfd,path,flags,varargs){SYSCALLS.varargs=varargs;try{path=SYSCALLS.getStr(path);path=SYSCALLS.calculateAt(dirfd,path);var mode=varargs?SYSCALLS.get():0;return FS.open(path,flags,mode).fd}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}var readAsmConstArgsArray=[];function readAsmConstArgs(sigPtr,buf){readAsmConstArgsArray.length=0;var ch;buf>>=2;while(ch=HEAPU8[sigPtr++]){buf+=ch!=105&buf;readAsmConstArgsArray.push(ch==105?HEAP32[buf]:HEAPF64[buf++>>1]);++buf}return readAsmConstArgsArray}function _emscripten_asm_const_int(code,sigPtr,argbuf){var args=readAsmConstArgs(sigPtr,argbuf);return ASM_CONSTS[code].apply(null,args)}function _emscripten_date_now(){return Date.now()}var JSEvents={inEventHandler:0,removeAllEventListeners:function(){for(var i=JSEvents.eventHandlers.length-1;i>=0;--i){JSEvents._removeHandler(i)}JSEvents.eventHandlers=[];JSEvents.deferredCalls=[]},registerRemoveEventListeners:function(){if(!JSEvents.removeEventListenersRegistered){__ATEXIT__.push(JSEvents.removeAllEventListeners);JSEvents.removeEventListenersRegistered=true}},deferredCalls:[],deferCall:function(targetFunction,precedence,argsList){function arraysHaveEqualContent(arrA,arrB){if(arrA.length!=arrB.length)return false;for(var i in arrA){if(arrA[i]!=arrB[i])return false}return true}for(var i in JSEvents.deferredCalls){var call=JSEvents.deferredCalls[i];if(call.targetFunction==targetFunction&&arraysHaveEqualContent(call.argsList,argsList)){return}}JSEvents.deferredCalls.push({targetFunction:targetFunction,precedence:precedence,argsList:argsList});JSEvents.deferredCalls.sort(function(x,y){return x.precedence2?UTF8ToString(cString):cString}var specialHTMLTargets=[0,typeof document!="undefined"?document:0,typeof window!="undefined"?window:0];function findEventTarget(target){target=maybeCStringToJsString(target);var domElement=specialHTMLTargets[target]||(typeof document!="undefined"?document.querySelector(target):undefined);return domElement}function getBoundingClientRect(e){return specialHTMLTargets.indexOf(e)<0?e.getBoundingClientRect():{"left":0,"top":0}}function _emscripten_get_element_css_size(target,width,height){target=findEventTarget(target);if(!target)return-4;var rect=getBoundingClientRect(target);HEAPF64[width>>3]=rect.width;HEAPF64[height>>3]=rect.height;return 0}function fillGamepadEventData(eventStruct,e){HEAPF64[eventStruct>>3]=e.timestamp;for(var i=0;i>3]=e.axes[i]}for(var i=0;i>3]=e.buttons[i].value}else{HEAPF64[eventStruct+i*8+528>>3]=e.buttons[i]}}for(var i=0;i>2]=e.buttons[i].pressed}else{HEAP32[eventStruct+i*4+1040>>2]=e.buttons[i]==1}}HEAP32[eventStruct+1296>>2]=e.connected;HEAP32[eventStruct+1300>>2]=e.index;HEAP32[eventStruct+8>>2]=e.axes.length;HEAP32[eventStruct+12>>2]=e.buttons.length;stringToUTF8(e.id,eventStruct+1304,64);stringToUTF8(e.mapping,eventStruct+1368,64)}function _emscripten_get_gamepad_status(index,gamepadState){if(index<0||index>=JSEvents.lastGamepadState.length)return-5;if(!JSEvents.lastGamepadState[index])return-7;fillGamepadEventData(gamepadState,JSEvents.lastGamepadState[index]);return 0}var _emscripten_get_now;if(ENVIRONMENT_IS_NODE){_emscripten_get_now=()=>{var t=process["hrtime"]();return t[0]*1e3+t[1]/1e6}}else _emscripten_get_now=()=>performance.now();function _emscripten_get_num_gamepads(){return JSEvents.lastGamepadState.length}function __webgl_enable_ANGLE_instanced_arrays(ctx){var ext=ctx.getExtension("ANGLE_instanced_arrays");if(ext){ctx["vertexAttribDivisor"]=function(index,divisor){ext["vertexAttribDivisorANGLE"](index,divisor)};ctx["drawArraysInstanced"]=function(mode,first,count,primcount){ext["drawArraysInstancedANGLE"](mode,first,count,primcount)};ctx["drawElementsInstanced"]=function(mode,count,type,indices,primcount){ext["drawElementsInstancedANGLE"](mode,count,type,indices,primcount)};return 1}}function __webgl_enable_OES_vertex_array_object(ctx){var ext=ctx.getExtension("OES_vertex_array_object");if(ext){ctx["createVertexArray"]=function(){return ext["createVertexArrayOES"]()};ctx["deleteVertexArray"]=function(vao){ext["deleteVertexArrayOES"](vao)};ctx["bindVertexArray"]=function(vao){ext["bindVertexArrayOES"](vao)};ctx["isVertexArray"]=function(vao){return ext["isVertexArrayOES"](vao)};return 1}}function __webgl_enable_WEBGL_draw_buffers(ctx){var ext=ctx.getExtension("WEBGL_draw_buffers");if(ext){ctx["drawBuffers"]=function(n,bufs){ext["drawBuffersWEBGL"](n,bufs)};return 1}}function __webgl_enable_WEBGL_multi_draw(ctx){return!!(ctx.multiDrawWebgl=ctx.getExtension("WEBGL_multi_draw"))}var GL={counter:1,buffers:[],programs:[],framebuffers:[],renderbuffers:[],textures:[],shaders:[],vaos:[],contexts:[],offscreenCanvases:{},queries:[],stringCache:{},unpackAlignment:4,recordError:function recordError(errorCode){if(!GL.lastError){GL.lastError=errorCode}},getNewId:function(table){var ret=GL.counter++;for(var i=table.length;i>2]:-1;source+=UTF8ToString(HEAP32[string+i*4>>2],len<0?undefined:len)}return source},createContext:function(canvas,webGLContextAttributes){if(!canvas.getContextSafariWebGL2Fixed){canvas.getContextSafariWebGL2Fixed=canvas.getContext;function fixedGetContext(ver,attrs){var gl=canvas.getContextSafariWebGL2Fixed(ver,attrs);return ver=="webgl"==gl instanceof WebGLRenderingContext?gl:null}canvas.getContext=fixedGetContext}var ctx=canvas.getContext("webgl",webGLContextAttributes);if(!ctx)return 0;var handle=GL.registerContext(ctx,webGLContextAttributes);return handle},registerContext:function(ctx,webGLContextAttributes){var handle=GL.getNewId(GL.contexts);var context={handle:handle,attributes:webGLContextAttributes,version:webGLContextAttributes.majorVersion,GLctx:ctx};if(ctx.canvas)ctx.canvas.GLctxObject=context;GL.contexts[handle]=context;if(typeof webGLContextAttributes.enableExtensionsByDefault=="undefined"||webGLContextAttributes.enableExtensionsByDefault){GL.initExtensions(context)}return handle},makeContextCurrent:function(contextHandle){GL.currentContext=GL.contexts[contextHandle];Module.ctx=GLctx=GL.currentContext&&GL.currentContext.GLctx;return!(contextHandle&&!GLctx)},getContext:function(contextHandle){return GL.contexts[contextHandle]},deleteContext:function(contextHandle){if(GL.currentContext===GL.contexts[contextHandle])GL.currentContext=null;if(typeof JSEvents=="object")JSEvents.removeAllHandlersOnTarget(GL.contexts[contextHandle].GLctx.canvas);if(GL.contexts[contextHandle]&&GL.contexts[contextHandle].GLctx.canvas)GL.contexts[contextHandle].GLctx.canvas.GLctxObject=undefined;GL.contexts[contextHandle]=null},initExtensions:function(context){if(!context)context=GL.currentContext;if(context.initExtensionsDone)return;context.initExtensionsDone=true;var GLctx=context.GLctx;__webgl_enable_ANGLE_instanced_arrays(GLctx);__webgl_enable_OES_vertex_array_object(GLctx);__webgl_enable_WEBGL_draw_buffers(GLctx);{GLctx.disjointTimerQueryExt=GLctx.getExtension("EXT_disjoint_timer_query")}__webgl_enable_WEBGL_multi_draw(GLctx);var exts=GLctx.getSupportedExtensions()||[];exts.forEach(function(ext){if(!ext.includes("lose_context")&&!ext.includes("debug")){GLctx.getExtension(ext)}})}};function _emscripten_glActiveTexture(x0){GLctx["activeTexture"](x0)}function _emscripten_glAttachShader(program,shader){GLctx.attachShader(GL.programs[program],GL.shaders[shader])}function _emscripten_glBeginQueryEXT(target,id){GLctx.disjointTimerQueryExt["beginQueryEXT"](target,GL.queries[id])}function _emscripten_glBindAttribLocation(program,index,name){GLctx.bindAttribLocation(GL.programs[program],index,UTF8ToString(name))}function _emscripten_glBindBuffer(target,buffer){GLctx.bindBuffer(target,GL.buffers[buffer])}function _emscripten_glBindFramebuffer(target,framebuffer){GLctx.bindFramebuffer(target,GL.framebuffers[framebuffer])}function _emscripten_glBindRenderbuffer(target,renderbuffer){GLctx.bindRenderbuffer(target,GL.renderbuffers[renderbuffer])}function _emscripten_glBindTexture(target,texture){GLctx.bindTexture(target,GL.textures[texture])}function _emscripten_glBindVertexArrayOES(vao){GLctx["bindVertexArray"](GL.vaos[vao])}function _emscripten_glBlendColor(x0,x1,x2,x3){GLctx["blendColor"](x0,x1,x2,x3)}function _emscripten_glBlendEquation(x0){GLctx["blendEquation"](x0)}function _emscripten_glBlendEquationSeparate(x0,x1){GLctx["blendEquationSeparate"](x0,x1)}function _emscripten_glBlendFunc(x0,x1){GLctx["blendFunc"](x0,x1)}function _emscripten_glBlendFuncSeparate(x0,x1,x2,x3){GLctx["blendFuncSeparate"](x0,x1,x2,x3)}function _emscripten_glBufferData(target,size,data,usage){GLctx.bufferData(target,data?HEAPU8.subarray(data,data+size):size,usage)}function _emscripten_glBufferSubData(target,offset,size,data){GLctx.bufferSubData(target,offset,HEAPU8.subarray(data,data+size))}function _emscripten_glCheckFramebufferStatus(x0){return GLctx["checkFramebufferStatus"](x0)}function _emscripten_glClear(x0){GLctx["clear"](x0)}function _emscripten_glClearColor(x0,x1,x2,x3){GLctx["clearColor"](x0,x1,x2,x3)}function _emscripten_glClearDepthf(x0){GLctx["clearDepth"](x0)}function _emscripten_glClearStencil(x0){GLctx["clearStencil"](x0)}function _emscripten_glColorMask(red,green,blue,alpha){GLctx.colorMask(!!red,!!green,!!blue,!!alpha)}function _emscripten_glCompileShader(shader){GLctx.compileShader(GL.shaders[shader])}function _emscripten_glCompressedTexImage2D(target,level,internalFormat,width,height,border,imageSize,data){GLctx["compressedTexImage2D"](target,level,internalFormat,width,height,border,data?HEAPU8.subarray(data,data+imageSize):null)}function _emscripten_glCompressedTexSubImage2D(target,level,xoffset,yoffset,width,height,format,imageSize,data){GLctx["compressedTexSubImage2D"](target,level,xoffset,yoffset,width,height,format,data?HEAPU8.subarray(data,data+imageSize):null)}function _emscripten_glCopyTexImage2D(x0,x1,x2,x3,x4,x5,x6,x7){GLctx["copyTexImage2D"](x0,x1,x2,x3,x4,x5,x6,x7)}function _emscripten_glCopyTexSubImage2D(x0,x1,x2,x3,x4,x5,x6,x7){GLctx["copyTexSubImage2D"](x0,x1,x2,x3,x4,x5,x6,x7)}function _emscripten_glCreateProgram(){var id=GL.getNewId(GL.programs);var program=GLctx.createProgram();program.name=id;program.maxUniformLength=program.maxAttributeLength=program.maxUniformBlockNameLength=0;program.uniformIdCounter=1;GL.programs[id]=program;return id}function _emscripten_glCreateShader(shaderType){var id=GL.getNewId(GL.shaders);GL.shaders[id]=GLctx.createShader(shaderType);return id}function _emscripten_glCullFace(x0){GLctx["cullFace"](x0)}function _emscripten_glDeleteBuffers(n,buffers){for(var i=0;i>2];var buffer=GL.buffers[id];if(!buffer)continue;GLctx.deleteBuffer(buffer);buffer.name=0;GL.buffers[id]=null}}function _emscripten_glDeleteFramebuffers(n,framebuffers){for(var i=0;i>2];var framebuffer=GL.framebuffers[id];if(!framebuffer)continue;GLctx.deleteFramebuffer(framebuffer);framebuffer.name=0;GL.framebuffers[id]=null}}function _emscripten_glDeleteProgram(id){if(!id)return;var program=GL.programs[id];if(!program){GL.recordError(1281);return}GLctx.deleteProgram(program);program.name=0;GL.programs[id]=null}function _emscripten_glDeleteQueriesEXT(n,ids){for(var i=0;i>2];var query=GL.queries[id];if(!query)continue;GLctx.disjointTimerQueryExt["deleteQueryEXT"](query);GL.queries[id]=null}}function _emscripten_glDeleteRenderbuffers(n,renderbuffers){for(var i=0;i>2];var renderbuffer=GL.renderbuffers[id];if(!renderbuffer)continue;GLctx.deleteRenderbuffer(renderbuffer);renderbuffer.name=0;GL.renderbuffers[id]=null}}function _emscripten_glDeleteShader(id){if(!id)return;var shader=GL.shaders[id];if(!shader){GL.recordError(1281);return}GLctx.deleteShader(shader);GL.shaders[id]=null}function _emscripten_glDeleteTextures(n,textures){for(var i=0;i>2];var texture=GL.textures[id];if(!texture)continue;GLctx.deleteTexture(texture);texture.name=0;GL.textures[id]=null}}function _emscripten_glDeleteVertexArraysOES(n,vaos){for(var i=0;i>2];GLctx["deleteVertexArray"](GL.vaos[id]);GL.vaos[id]=null}}function _emscripten_glDepthFunc(x0){GLctx["depthFunc"](x0)}function _emscripten_glDepthMask(flag){GLctx.depthMask(!!flag)}function _emscripten_glDepthRangef(x0,x1){GLctx["depthRange"](x0,x1)}function _emscripten_glDetachShader(program,shader){GLctx.detachShader(GL.programs[program],GL.shaders[shader])}function _emscripten_glDisable(x0){GLctx["disable"](x0)}function _emscripten_glDisableVertexAttribArray(index){GLctx.disableVertexAttribArray(index)}function _emscripten_glDrawArrays(mode,first,count){GLctx.drawArrays(mode,first,count)}function _emscripten_glDrawArraysInstancedANGLE(mode,first,count,primcount){GLctx["drawArraysInstanced"](mode,first,count,primcount)}var tempFixedLengthArray=[];function _emscripten_glDrawBuffersWEBGL(n,bufs){var bufArray=tempFixedLengthArray[n];for(var i=0;i>2]}GLctx["drawBuffers"](bufArray)}function _emscripten_glDrawElements(mode,count,type,indices){GLctx.drawElements(mode,count,type,indices)}function _emscripten_glDrawElementsInstancedANGLE(mode,count,type,indices,primcount){GLctx["drawElementsInstanced"](mode,count,type,indices,primcount)}function _emscripten_glEnable(x0){GLctx["enable"](x0)}function _emscripten_glEnableVertexAttribArray(index){GLctx.enableVertexAttribArray(index)}function _emscripten_glEndQueryEXT(target){GLctx.disjointTimerQueryExt["endQueryEXT"](target)}function _emscripten_glFinish(){GLctx["finish"]()}function _emscripten_glFlush(){GLctx["flush"]()}function _emscripten_glFramebufferRenderbuffer(target,attachment,renderbuffertarget,renderbuffer){GLctx.framebufferRenderbuffer(target,attachment,renderbuffertarget,GL.renderbuffers[renderbuffer])}function _emscripten_glFramebufferTexture2D(target,attachment,textarget,texture,level){GLctx.framebufferTexture2D(target,attachment,textarget,GL.textures[texture],level)}function _emscripten_glFrontFace(x0){GLctx["frontFace"](x0)}function __glGenObject(n,buffers,createFunction,objectTable){for(var i=0;i>2]=id}}function _emscripten_glGenBuffers(n,buffers){__glGenObject(n,buffers,"createBuffer",GL.buffers)}function _emscripten_glGenFramebuffers(n,ids){__glGenObject(n,ids,"createFramebuffer",GL.framebuffers)}function _emscripten_glGenQueriesEXT(n,ids){for(var i=0;i>2]=0;return}var id=GL.getNewId(GL.queries);query.name=id;GL.queries[id]=query;HEAP32[ids+i*4>>2]=id}}function _emscripten_glGenRenderbuffers(n,renderbuffers){__glGenObject(n,renderbuffers,"createRenderbuffer",GL.renderbuffers)}function _emscripten_glGenTextures(n,textures){__glGenObject(n,textures,"createTexture",GL.textures)}function _emscripten_glGenVertexArraysOES(n,arrays){__glGenObject(n,arrays,"createVertexArray",GL.vaos)}function _emscripten_glGenerateMipmap(x0){GLctx["generateMipmap"](x0)}function __glGetActiveAttribOrUniform(funcName,program,index,bufSize,length,size,type,name){program=GL.programs[program];var info=GLctx[funcName](program,index);if(info){var numBytesWrittenExclNull=name&&stringToUTF8(info.name,name,bufSize);if(length)HEAP32[length>>2]=numBytesWrittenExclNull;if(size)HEAP32[size>>2]=info.size;if(type)HEAP32[type>>2]=info.type}}function _emscripten_glGetActiveAttrib(program,index,bufSize,length,size,type,name){__glGetActiveAttribOrUniform("getActiveAttrib",program,index,bufSize,length,size,type,name)}function _emscripten_glGetActiveUniform(program,index,bufSize,length,size,type,name){__glGetActiveAttribOrUniform("getActiveUniform",program,index,bufSize,length,size,type,name)}function _emscripten_glGetAttachedShaders(program,maxCount,count,shaders){var result=GLctx.getAttachedShaders(GL.programs[program]);var len=result.length;if(len>maxCount){len=maxCount}HEAP32[count>>2]=len;for(var i=0;i>2]=id}}function _emscripten_glGetAttribLocation(program,name){return GLctx.getAttribLocation(GL.programs[program],UTF8ToString(name))}function writeI53ToI64(ptr,num){HEAPU32[ptr>>2]=num;HEAPU32[ptr+4>>2]=(num-HEAPU32[ptr>>2])/4294967296}function emscriptenWebGLGet(name_,p,type){if(!p){GL.recordError(1281);return}var ret=undefined;switch(name_){case 36346:ret=1;break;case 36344:if(type!=0&&type!=1){GL.recordError(1280)}return;case 36345:ret=0;break;case 34466:var formats=GLctx.getParameter(34467);ret=formats?formats.length:0;break}if(ret===undefined){var result=GLctx.getParameter(name_);switch(typeof result){case"number":ret=result;break;case"boolean":ret=result?1:0;break;case"string":GL.recordError(1280);return;case"object":if(result===null){switch(name_){case 34964:case 35725:case 34965:case 36006:case 36007:case 32873:case 34229:case 34068:{ret=0;break}default:{GL.recordError(1280);return}}}else if(result instanceof Float32Array||result instanceof Uint32Array||result instanceof Int32Array||result instanceof Array){for(var i=0;i>2]=result[i];break;case 2:HEAPF32[p+i*4>>2]=result[i];break;case 4:HEAP8[p+i>>0]=result[i]?1:0;break}}return}else{try{ret=result.name|0}catch(e){GL.recordError(1280);err("GL_INVALID_ENUM in glGet"+type+"v: Unknown object returned from WebGL getParameter("+name_+")! (error: "+e+")");return}}break;default:GL.recordError(1280);err("GL_INVALID_ENUM in glGet"+type+"v: Native code calling glGet"+type+"v("+name_+") and it returns "+result+" of type "+typeof result+"!");return}}switch(type){case 1:writeI53ToI64(p,ret);break;case 0:HEAP32[p>>2]=ret;break;case 2:HEAPF32[p>>2]=ret;break;case 4:HEAP8[p>>0]=ret?1:0;break}}function _emscripten_glGetBooleanv(name_,p){emscriptenWebGLGet(name_,p,4)}function _emscripten_glGetBufferParameteriv(target,value,data){if(!data){GL.recordError(1281);return}HEAP32[data>>2]=GLctx.getBufferParameter(target,value)}function _emscripten_glGetError(){var error=GLctx.getError()||GL.lastError;GL.lastError=0;return error}function _emscripten_glGetFloatv(name_,p){emscriptenWebGLGet(name_,p,2)}function _emscripten_glGetFramebufferAttachmentParameteriv(target,attachment,pname,params){var result=GLctx.getFramebufferAttachmentParameter(target,attachment,pname);if(result instanceof WebGLRenderbuffer||result instanceof WebGLTexture){result=result.name|0}HEAP32[params>>2]=result}function _emscripten_glGetIntegerv(name_,p){emscriptenWebGLGet(name_,p,0)}function _emscripten_glGetProgramInfoLog(program,maxLength,length,infoLog){var log=GLctx.getProgramInfoLog(GL.programs[program]);if(log===null)log="(unknown error)";var numBytesWrittenExclNull=maxLength>0&&infoLog?stringToUTF8(log,infoLog,maxLength):0;if(length)HEAP32[length>>2]=numBytesWrittenExclNull}function _emscripten_glGetProgramiv(program,pname,p){if(!p){GL.recordError(1281);return}if(program>=GL.counter){GL.recordError(1281);return}program=GL.programs[program];if(pname==35716){var log=GLctx.getProgramInfoLog(program);if(log===null)log="(unknown error)";HEAP32[p>>2]=log.length+1}else if(pname==35719){if(!program.maxUniformLength){for(var i=0;i>2]=program.maxUniformLength}else if(pname==35722){if(!program.maxAttributeLength){for(var i=0;i>2]=program.maxAttributeLength}else if(pname==35381){if(!program.maxUniformBlockNameLength){for(var i=0;i>2]=program.maxUniformBlockNameLength}else{HEAP32[p>>2]=GLctx.getProgramParameter(program,pname)}}function _emscripten_glGetQueryObjecti64vEXT(id,pname,params){if(!params){GL.recordError(1281);return}var query=GL.queries[id];var param;{param=GLctx.disjointTimerQueryExt["getQueryObjectEXT"](query,pname)}var ret;if(typeof param=="boolean"){ret=param?1:0}else{ret=param}writeI53ToI64(params,ret)}function _emscripten_glGetQueryObjectivEXT(id,pname,params){if(!params){GL.recordError(1281);return}var query=GL.queries[id];var param=GLctx.disjointTimerQueryExt["getQueryObjectEXT"](query,pname);var ret;if(typeof param=="boolean"){ret=param?1:0}else{ret=param}HEAP32[params>>2]=ret}function _emscripten_glGetQueryObjectui64vEXT(id,pname,params){if(!params){GL.recordError(1281);return}var query=GL.queries[id];var param;{param=GLctx.disjointTimerQueryExt["getQueryObjectEXT"](query,pname)}var ret;if(typeof param=="boolean"){ret=param?1:0}else{ret=param}writeI53ToI64(params,ret)}function _emscripten_glGetQueryObjectuivEXT(id,pname,params){if(!params){GL.recordError(1281);return}var query=GL.queries[id];var param=GLctx.disjointTimerQueryExt["getQueryObjectEXT"](query,pname);var ret;if(typeof param=="boolean"){ret=param?1:0}else{ret=param}HEAP32[params>>2]=ret}function _emscripten_glGetQueryivEXT(target,pname,params){if(!params){GL.recordError(1281);return}HEAP32[params>>2]=GLctx.disjointTimerQueryExt["getQueryEXT"](target,pname)}function _emscripten_glGetRenderbufferParameteriv(target,pname,params){if(!params){GL.recordError(1281);return}HEAP32[params>>2]=GLctx.getRenderbufferParameter(target,pname)}function _emscripten_glGetShaderInfoLog(shader,maxLength,length,infoLog){var log=GLctx.getShaderInfoLog(GL.shaders[shader]);if(log===null)log="(unknown error)";var numBytesWrittenExclNull=maxLength>0&&infoLog?stringToUTF8(log,infoLog,maxLength):0;if(length)HEAP32[length>>2]=numBytesWrittenExclNull}function _emscripten_glGetShaderPrecisionFormat(shaderType,precisionType,range,precision){var result=GLctx.getShaderPrecisionFormat(shaderType,precisionType);HEAP32[range>>2]=result.rangeMin;HEAP32[range+4>>2]=result.rangeMax;HEAP32[precision>>2]=result.precision}function _emscripten_glGetShaderSource(shader,bufSize,length,source){var result=GLctx.getShaderSource(GL.shaders[shader]);if(!result)return;var numBytesWrittenExclNull=bufSize>0&&source?stringToUTF8(result,source,bufSize):0;if(length)HEAP32[length>>2]=numBytesWrittenExclNull}function _emscripten_glGetShaderiv(shader,pname,p){if(!p){GL.recordError(1281);return}if(pname==35716){var log=GLctx.getShaderInfoLog(GL.shaders[shader]);if(log===null)log="(unknown error)";var logLength=log?log.length+1:0;HEAP32[p>>2]=logLength}else if(pname==35720){var source=GLctx.getShaderSource(GL.shaders[shader]);var sourceLength=source?source.length+1:0;HEAP32[p>>2]=sourceLength}else{HEAP32[p>>2]=GLctx.getShaderParameter(GL.shaders[shader],pname)}}function stringToNewUTF8(jsString){var length=lengthBytesUTF8(jsString)+1;var cString=_malloc(length);stringToUTF8(jsString,cString,length);return cString}function _emscripten_glGetString(name_){var ret=GL.stringCache[name_];if(!ret){switch(name_){case 7939:var exts=GLctx.getSupportedExtensions()||[];exts=exts.concat(exts.map(function(e){return"GL_"+e}));ret=stringToNewUTF8(exts.join(" "));break;case 7936:case 7937:case 37445:case 37446:var s=GLctx.getParameter(name_);if(!s){GL.recordError(1280)}ret=s&&stringToNewUTF8(s);break;case 7938:var glVersion=GLctx.getParameter(7938);{glVersion="OpenGL ES 2.0 ("+glVersion+")"}ret=stringToNewUTF8(glVersion);break;case 35724:var glslVersion=GLctx.getParameter(35724);var ver_re=/^WebGL GLSL ES ([0-9]\.[0-9][0-9]?)(?:$| .*)/;var ver_num=glslVersion.match(ver_re);if(ver_num!==null){if(ver_num[1].length==3)ver_num[1]=ver_num[1]+"0";glslVersion="OpenGL ES GLSL ES "+ver_num[1]+" ("+glslVersion+")"}ret=stringToNewUTF8(glslVersion);break;default:GL.recordError(1280)}GL.stringCache[name_]=ret}return ret}function _emscripten_glGetTexParameterfv(target,pname,params){if(!params){GL.recordError(1281);return}HEAPF32[params>>2]=GLctx.getTexParameter(target,pname)}function _emscripten_glGetTexParameteriv(target,pname,params){if(!params){GL.recordError(1281);return}HEAP32[params>>2]=GLctx.getTexParameter(target,pname)}function jstoi_q(str){return parseInt(str)}function webglGetLeftBracePos(name){return name.slice(-1)=="]"&&name.lastIndexOf("[")}function webglPrepareUniformLocationsBeforeFirstUse(program){var uniformLocsById=program.uniformLocsById,uniformSizeAndIdsByName=program.uniformSizeAndIdsByName,i,j;if(!uniformLocsById){program.uniformLocsById=uniformLocsById={};program.uniformArrayNamesById={};for(i=0;i0?nm.slice(0,lb):nm;var id=program.uniformIdCounter;program.uniformIdCounter+=sz;uniformSizeAndIdsByName[arrayName]=[sz,id];for(j=0;j0){arrayIndex=jstoi_q(name.slice(leftBrace+1))>>>0;uniformBaseName=name.slice(0,leftBrace)}var sizeAndId=program.uniformSizeAndIdsByName[uniformBaseName];if(sizeAndId&&arrayIndex0?"["+webglLoc+"]":""))}return webglLoc}else{GL.recordError(1282)}}function emscriptenWebGLGetUniform(program,location,params,type){if(!params){GL.recordError(1281);return}program=GL.programs[program];webglPrepareUniformLocationsBeforeFirstUse(program);var data=GLctx.getUniform(program,webglGetUniformLocation(location));if(typeof data=="number"||typeof data=="boolean"){switch(type){case 0:HEAP32[params>>2]=data;break;case 2:HEAPF32[params>>2]=data;break}}else{for(var i=0;i>2]=data[i];break;case 2:HEAPF32[params+i*4>>2]=data[i];break}}}}function _emscripten_glGetUniformfv(program,location,params){emscriptenWebGLGetUniform(program,location,params,2)}function _emscripten_glGetUniformiv(program,location,params){emscriptenWebGLGetUniform(program,location,params,0)}function _emscripten_glGetVertexAttribPointerv(index,pname,pointer){if(!pointer){GL.recordError(1281);return}HEAP32[pointer>>2]=GLctx.getVertexAttribOffset(index,pname)}function emscriptenWebGLGetVertexAttrib(index,pname,params,type){if(!params){GL.recordError(1281);return}var data=GLctx.getVertexAttrib(index,pname);if(pname==34975){HEAP32[params>>2]=data&&data["name"]}else if(typeof data=="number"||typeof data=="boolean"){switch(type){case 0:HEAP32[params>>2]=data;break;case 2:HEAPF32[params>>2]=data;break;case 5:HEAP32[params>>2]=Math.fround(data);break}}else{for(var i=0;i>2]=data[i];break;case 2:HEAPF32[params+i*4>>2]=data[i];break;case 5:HEAP32[params+i*4>>2]=Math.fround(data[i]);break}}}}function _emscripten_glGetVertexAttribfv(index,pname,params){emscriptenWebGLGetVertexAttrib(index,pname,params,2)}function _emscripten_glGetVertexAttribiv(index,pname,params){emscriptenWebGLGetVertexAttrib(index,pname,params,5)}function _emscripten_glHint(x0,x1){GLctx["hint"](x0,x1)}function _emscripten_glIsBuffer(buffer){var b=GL.buffers[buffer];if(!b)return 0;return GLctx.isBuffer(b)}function _emscripten_glIsEnabled(x0){return GLctx["isEnabled"](x0)}function _emscripten_glIsFramebuffer(framebuffer){var fb=GL.framebuffers[framebuffer];if(!fb)return 0;return GLctx.isFramebuffer(fb)}function _emscripten_glIsProgram(program){program=GL.programs[program];if(!program)return 0;return GLctx.isProgram(program)}function _emscripten_glIsQueryEXT(id){var query=GL.queries[id];if(!query)return 0;return GLctx.disjointTimerQueryExt["isQueryEXT"](query)}function _emscripten_glIsRenderbuffer(renderbuffer){var rb=GL.renderbuffers[renderbuffer];if(!rb)return 0;return GLctx.isRenderbuffer(rb)}function _emscripten_glIsShader(shader){var s=GL.shaders[shader];if(!s)return 0;return GLctx.isShader(s)}function _emscripten_glIsTexture(id){var texture=GL.textures[id];if(!texture)return 0;return GLctx.isTexture(texture)}function _emscripten_glIsVertexArrayOES(array){var vao=GL.vaos[array];if(!vao)return 0;return GLctx["isVertexArray"](vao)}function _emscripten_glLineWidth(x0){GLctx["lineWidth"](x0)}function _emscripten_glLinkProgram(program){program=GL.programs[program];GLctx.linkProgram(program);program.uniformLocsById=0;program.uniformSizeAndIdsByName={}}function _emscripten_glPixelStorei(pname,param){if(pname==3317){GL.unpackAlignment=param}GLctx.pixelStorei(pname,param)}function _emscripten_glPolygonOffset(x0,x1){GLctx["polygonOffset"](x0,x1)}function _emscripten_glQueryCounterEXT(id,target){GLctx.disjointTimerQueryExt["queryCounterEXT"](GL.queries[id],target)}function computeUnpackAlignedImageSize(width,height,sizePerPixel,alignment){function roundedToNextMultipleOf(x,y){return x+y-1&-y}var plainRowSize=width*sizePerPixel;var alignedRowSize=roundedToNextMultipleOf(plainRowSize,alignment);return height*alignedRowSize}function __colorChannelsInGlTextureFormat(format){var colorChannels={5:3,6:4,8:2,29502:3,29504:4};return colorChannels[format-6402]||1}function heapObjectForWebGLType(type){type-=5120;if(type==1)return HEAPU8;if(type==4)return HEAP32;if(type==6)return HEAPF32;if(type==5||type==28922)return HEAPU32;return HEAPU16}function heapAccessShiftForWebGLHeap(heap){return 31-Math.clz32(heap.BYTES_PER_ELEMENT)}function emscriptenWebGLGetTexPixelData(type,format,width,height,pixels,internalFormat){var heap=heapObjectForWebGLType(type);var shift=heapAccessShiftForWebGLHeap(heap);var byteSize=1<>shift,pixels+bytes>>shift)}function _emscripten_glReadPixels(x,y,width,height,format,type,pixels){var pixelData=emscriptenWebGLGetTexPixelData(type,format,width,height,pixels,format);if(!pixelData){GL.recordError(1280);return}GLctx.readPixels(x,y,width,height,format,type,pixelData)}function _emscripten_glReleaseShaderCompiler(){}function _emscripten_glRenderbufferStorage(x0,x1,x2,x3){GLctx["renderbufferStorage"](x0,x1,x2,x3)}function _emscripten_glSampleCoverage(value,invert){GLctx.sampleCoverage(value,!!invert)}function _emscripten_glScissor(x0,x1,x2,x3){GLctx["scissor"](x0,x1,x2,x3)}function _emscripten_glShaderBinary(){GL.recordError(1280)}function _emscripten_glShaderSource(shader,count,string,length){var source=GL.getSource(shader,count,string,length);GLctx.shaderSource(GL.shaders[shader],source)}function _emscripten_glStencilFunc(x0,x1,x2){GLctx["stencilFunc"](x0,x1,x2)}function _emscripten_glStencilFuncSeparate(x0,x1,x2,x3){GLctx["stencilFuncSeparate"](x0,x1,x2,x3)}function _emscripten_glStencilMask(x0){GLctx["stencilMask"](x0)}function _emscripten_glStencilMaskSeparate(x0,x1){GLctx["stencilMaskSeparate"](x0,x1)}function _emscripten_glStencilOp(x0,x1,x2){GLctx["stencilOp"](x0,x1,x2)}function _emscripten_glStencilOpSeparate(x0,x1,x2,x3){GLctx["stencilOpSeparate"](x0,x1,x2,x3)}function _emscripten_glTexImage2D(target,level,internalFormat,width,height,border,format,type,pixels){GLctx.texImage2D(target,level,internalFormat,width,height,border,format,type,pixels?emscriptenWebGLGetTexPixelData(type,format,width,height,pixels,internalFormat):null)}function _emscripten_glTexParameterf(x0,x1,x2){GLctx["texParameterf"](x0,x1,x2)}function _emscripten_glTexParameterfv(target,pname,params){var param=HEAPF32[params>>2];GLctx.texParameterf(target,pname,param)}function _emscripten_glTexParameteri(x0,x1,x2){GLctx["texParameteri"](x0,x1,x2)}function _emscripten_glTexParameteriv(target,pname,params){var param=HEAP32[params>>2];GLctx.texParameteri(target,pname,param)}function _emscripten_glTexSubImage2D(target,level,xoffset,yoffset,width,height,format,type,pixels){var pixelData=null;if(pixels)pixelData=emscriptenWebGLGetTexPixelData(type,format,width,height,pixels,0);GLctx.texSubImage2D(target,level,xoffset,yoffset,width,height,format,type,pixelData)}function _emscripten_glUniform1f(location,v0){GLctx.uniform1f(webglGetUniformLocation(location),v0)}var miniTempWebGLFloatBuffers=[];function _emscripten_glUniform1fv(location,count,value){if(count<=288){var view=miniTempWebGLFloatBuffers[count-1];for(var i=0;i>2]}}else{var view=HEAPF32.subarray(value>>2,value+count*4>>2)}GLctx.uniform1fv(webglGetUniformLocation(location),view)}function _emscripten_glUniform1i(location,v0){GLctx.uniform1i(webglGetUniformLocation(location),v0)}var __miniTempWebGLIntBuffers=[];function _emscripten_glUniform1iv(location,count,value){if(count<=288){var view=__miniTempWebGLIntBuffers[count-1];for(var i=0;i>2]}}else{var view=HEAP32.subarray(value>>2,value+count*4>>2)}GLctx.uniform1iv(webglGetUniformLocation(location),view)}function _emscripten_glUniform2f(location,v0,v1){GLctx.uniform2f(webglGetUniformLocation(location),v0,v1)}function _emscripten_glUniform2fv(location,count,value){if(count<=144){var view=miniTempWebGLFloatBuffers[2*count-1];for(var i=0;i<2*count;i+=2){view[i]=HEAPF32[value+4*i>>2];view[i+1]=HEAPF32[value+(4*i+4)>>2]}}else{var view=HEAPF32.subarray(value>>2,value+count*8>>2)}GLctx.uniform2fv(webglGetUniformLocation(location),view)}function _emscripten_glUniform2i(location,v0,v1){GLctx.uniform2i(webglGetUniformLocation(location),v0,v1)}function _emscripten_glUniform2iv(location,count,value){if(count<=144){var view=__miniTempWebGLIntBuffers[2*count-1];for(var i=0;i<2*count;i+=2){view[i]=HEAP32[value+4*i>>2];view[i+1]=HEAP32[value+(4*i+4)>>2]}}else{var view=HEAP32.subarray(value>>2,value+count*8>>2)}GLctx.uniform2iv(webglGetUniformLocation(location),view)}function _emscripten_glUniform3f(location,v0,v1,v2){GLctx.uniform3f(webglGetUniformLocation(location),v0,v1,v2)}function _emscripten_glUniform3fv(location,count,value){if(count<=96){var view=miniTempWebGLFloatBuffers[3*count-1];for(var i=0;i<3*count;i+=3){view[i]=HEAPF32[value+4*i>>2];view[i+1]=HEAPF32[value+(4*i+4)>>2];view[i+2]=HEAPF32[value+(4*i+8)>>2]}}else{var view=HEAPF32.subarray(value>>2,value+count*12>>2)}GLctx.uniform3fv(webglGetUniformLocation(location),view)}function _emscripten_glUniform3i(location,v0,v1,v2){GLctx.uniform3i(webglGetUniformLocation(location),v0,v1,v2)}function _emscripten_glUniform3iv(location,count,value){if(count<=96){var view=__miniTempWebGLIntBuffers[3*count-1];for(var i=0;i<3*count;i+=3){view[i]=HEAP32[value+4*i>>2];view[i+1]=HEAP32[value+(4*i+4)>>2];view[i+2]=HEAP32[value+(4*i+8)>>2]}}else{var view=HEAP32.subarray(value>>2,value+count*12>>2)}GLctx.uniform3iv(webglGetUniformLocation(location),view)}function _emscripten_glUniform4f(location,v0,v1,v2,v3){GLctx.uniform4f(webglGetUniformLocation(location),v0,v1,v2,v3)}function _emscripten_glUniform4fv(location,count,value){if(count<=72){var view=miniTempWebGLFloatBuffers[4*count-1];var heap=HEAPF32;value>>=2;for(var i=0;i<4*count;i+=4){var dst=value+i;view[i]=heap[dst];view[i+1]=heap[dst+1];view[i+2]=heap[dst+2];view[i+3]=heap[dst+3]}}else{var view=HEAPF32.subarray(value>>2,value+count*16>>2)}GLctx.uniform4fv(webglGetUniformLocation(location),view)}function _emscripten_glUniform4i(location,v0,v1,v2,v3){GLctx.uniform4i(webglGetUniformLocation(location),v0,v1,v2,v3)}function _emscripten_glUniform4iv(location,count,value){if(count<=72){var view=__miniTempWebGLIntBuffers[4*count-1];for(var i=0;i<4*count;i+=4){view[i]=HEAP32[value+4*i>>2];view[i+1]=HEAP32[value+(4*i+4)>>2];view[i+2]=HEAP32[value+(4*i+8)>>2];view[i+3]=HEAP32[value+(4*i+12)>>2]}}else{var view=HEAP32.subarray(value>>2,value+count*16>>2)}GLctx.uniform4iv(webglGetUniformLocation(location),view)}function _emscripten_glUniformMatrix2fv(location,count,transpose,value){if(count<=72){var view=miniTempWebGLFloatBuffers[4*count-1];for(var i=0;i<4*count;i+=4){view[i]=HEAPF32[value+4*i>>2];view[i+1]=HEAPF32[value+(4*i+4)>>2];view[i+2]=HEAPF32[value+(4*i+8)>>2];view[i+3]=HEAPF32[value+(4*i+12)>>2]}}else{var view=HEAPF32.subarray(value>>2,value+count*16>>2)}GLctx.uniformMatrix2fv(webglGetUniformLocation(location),!!transpose,view)}function _emscripten_glUniformMatrix3fv(location,count,transpose,value){if(count<=32){var view=miniTempWebGLFloatBuffers[9*count-1];for(var i=0;i<9*count;i+=9){view[i]=HEAPF32[value+4*i>>2];view[i+1]=HEAPF32[value+(4*i+4)>>2];view[i+2]=HEAPF32[value+(4*i+8)>>2];view[i+3]=HEAPF32[value+(4*i+12)>>2];view[i+4]=HEAPF32[value+(4*i+16)>>2];view[i+5]=HEAPF32[value+(4*i+20)>>2];view[i+6]=HEAPF32[value+(4*i+24)>>2];view[i+7]=HEAPF32[value+(4*i+28)>>2];view[i+8]=HEAPF32[value+(4*i+32)>>2]}}else{var view=HEAPF32.subarray(value>>2,value+count*36>>2)}GLctx.uniformMatrix3fv(webglGetUniformLocation(location),!!transpose,view)}function _emscripten_glUniformMatrix4fv(location,count,transpose,value){if(count<=18){var view=miniTempWebGLFloatBuffers[16*count-1];var heap=HEAPF32;value>>=2;for(var i=0;i<16*count;i+=16){var dst=value+i;view[i]=heap[dst];view[i+1]=heap[dst+1];view[i+2]=heap[dst+2];view[i+3]=heap[dst+3];view[i+4]=heap[dst+4];view[i+5]=heap[dst+5];view[i+6]=heap[dst+6];view[i+7]=heap[dst+7];view[i+8]=heap[dst+8];view[i+9]=heap[dst+9];view[i+10]=heap[dst+10];view[i+11]=heap[dst+11];view[i+12]=heap[dst+12];view[i+13]=heap[dst+13];view[i+14]=heap[dst+14];view[i+15]=heap[dst+15]}}else{var view=HEAPF32.subarray(value>>2,value+count*64>>2)}GLctx.uniformMatrix4fv(webglGetUniformLocation(location),!!transpose,view)}function _emscripten_glUseProgram(program){program=GL.programs[program];GLctx.useProgram(program);GLctx.currentProgram=program}function _emscripten_glValidateProgram(program){GLctx.validateProgram(GL.programs[program])}function _emscripten_glVertexAttrib1f(x0,x1){GLctx["vertexAttrib1f"](x0,x1)}function _emscripten_glVertexAttrib1fv(index,v){GLctx.vertexAttrib1f(index,HEAPF32[v>>2])}function _emscripten_glVertexAttrib2f(x0,x1,x2){GLctx["vertexAttrib2f"](x0,x1,x2)}function _emscripten_glVertexAttrib2fv(index,v){GLctx.vertexAttrib2f(index,HEAPF32[v>>2],HEAPF32[v+4>>2])}function _emscripten_glVertexAttrib3f(x0,x1,x2,x3){GLctx["vertexAttrib3f"](x0,x1,x2,x3)}function _emscripten_glVertexAttrib3fv(index,v){GLctx.vertexAttrib3f(index,HEAPF32[v>>2],HEAPF32[v+4>>2],HEAPF32[v+8>>2])}function _emscripten_glVertexAttrib4f(x0,x1,x2,x3,x4){GLctx["vertexAttrib4f"](x0,x1,x2,x3,x4)}function _emscripten_glVertexAttrib4fv(index,v){GLctx.vertexAttrib4f(index,HEAPF32[v>>2],HEAPF32[v+4>>2],HEAPF32[v+8>>2],HEAPF32[v+12>>2])}function _emscripten_glVertexAttribDivisorANGLE(index,divisor){GLctx["vertexAttribDivisor"](index,divisor)}function _emscripten_glVertexAttribPointer(index,size,type,normalized,stride,ptr){GLctx.vertexAttribPointer(index,size,type,!!normalized,stride,ptr)}function _emscripten_glViewport(x0,x1,x2,x3){GLctx["viewport"](x0,x1,x2,x3)}function abortOnCannotGrowMemory(requestedSize){abort("OOM")}function _emscripten_resize_heap(requestedSize){var oldSize=HEAPU8.length;requestedSize=requestedSize>>>0;abortOnCannotGrowMemory(requestedSize)}function _emscripten_run_script(ptr){eval(UTF8ToString(ptr))}function _emscripten_sample_gamepad_data(){return(JSEvents.lastGamepadState=navigator.getGamepads?navigator.getGamepads():navigator.webkitGetGamepads?navigator.webkitGetGamepads():null)?0:-1}function fillMouseEventData(eventStruct,e,target){HEAPF64[eventStruct>>3]=e.timeStamp;var idx=eventStruct>>2;HEAP32[idx+2]=e.screenX;HEAP32[idx+3]=e.screenY;HEAP32[idx+4]=e.clientX;HEAP32[idx+5]=e.clientY;HEAP32[idx+6]=e.ctrlKey;HEAP32[idx+7]=e.shiftKey;HEAP32[idx+8]=e.altKey;HEAP32[idx+9]=e.metaKey;HEAP16[idx*2+20]=e.button;HEAP16[idx*2+21]=e.buttons;HEAP32[idx+11]=e["movementX"];HEAP32[idx+12]=e["movementY"];var rect=getBoundingClientRect(target);HEAP32[idx+13]=e.clientX-rect.left;HEAP32[idx+14]=e.clientY-rect.top}function registerMouseEventCallback(target,userData,useCapture,callbackfunc,eventTypeId,eventTypeString,targetThread){if(!JSEvents.mouseEvent)JSEvents.mouseEvent=_malloc(72);target=findEventTarget(target);var mouseEventHandlerFunc=function(ev){var e=ev||event;fillMouseEventData(JSEvents.mouseEvent,e,target);if(function(a1,a2,a3){return dynCall_iiii.apply(null,[callbackfunc,a1,a2,a3])}(eventTypeId,JSEvents.mouseEvent,userData))e.preventDefault()};var eventHandler={target:target,allowsDeferredCalls:eventTypeString!="mousemove"&&eventTypeString!="mouseenter"&&eventTypeString!="mouseleave",eventTypeString:eventTypeString,callbackfunc:callbackfunc,handlerFunc:mouseEventHandlerFunc,useCapture:useCapture};JSEvents.registerOrRemoveHandler(eventHandler)}function _emscripten_set_click_callback_on_thread(target,userData,useCapture,callbackfunc,targetThread){registerMouseEventCallback(target,userData,useCapture,callbackfunc,4,"click",targetThread);return 0}function fillFullscreenChangeEventData(eventStruct){var fullscreenElement=document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement;var isFullscreen=!!fullscreenElement;HEAP32[eventStruct>>2]=isFullscreen;HEAP32[eventStruct+4>>2]=JSEvents.fullscreenEnabled();var reportedElement=isFullscreen?fullscreenElement:JSEvents.previousFullscreenElement;var nodeName=JSEvents.getNodeNameForTarget(reportedElement);var id=reportedElement&&reportedElement.id?reportedElement.id:"";stringToUTF8(nodeName,eventStruct+8,128);stringToUTF8(id,eventStruct+136,128);HEAP32[eventStruct+264>>2]=reportedElement?reportedElement.clientWidth:0;HEAP32[eventStruct+268>>2]=reportedElement?reportedElement.clientHeight:0;HEAP32[eventStruct+272>>2]=screen.width;HEAP32[eventStruct+276>>2]=screen.height;if(isFullscreen){JSEvents.previousFullscreenElement=fullscreenElement}}function registerFullscreenChangeEventCallback(target,userData,useCapture,callbackfunc,eventTypeId,eventTypeString,targetThread){if(!JSEvents.fullscreenChangeEvent)JSEvents.fullscreenChangeEvent=_malloc(280);var fullscreenChangeEventhandlerFunc=function(ev){var e=ev||event;var fullscreenChangeEvent=JSEvents.fullscreenChangeEvent;fillFullscreenChangeEventData(fullscreenChangeEvent);if(function(a1,a2,a3){return dynCall_iiii.apply(null,[callbackfunc,a1,a2,a3])}(eventTypeId,fullscreenChangeEvent,userData))e.preventDefault()};var eventHandler={target:target,eventTypeString:eventTypeString,callbackfunc:callbackfunc,handlerFunc:fullscreenChangeEventhandlerFunc,useCapture:useCapture};JSEvents.registerOrRemoveHandler(eventHandler)}function _emscripten_set_fullscreenchange_callback_on_thread(target,userData,useCapture,callbackfunc,targetThread){if(!JSEvents.fullscreenEnabled())return-1;target=findEventTarget(target);if(!target)return-4;registerFullscreenChangeEventCallback(target,userData,useCapture,callbackfunc,19,"fullscreenchange",targetThread);registerFullscreenChangeEventCallback(target,userData,useCapture,callbackfunc,19,"webkitfullscreenchange",targetThread);return 0}function registerGamepadEventCallback(target,userData,useCapture,callbackfunc,eventTypeId,eventTypeString,targetThread){if(!JSEvents.gamepadEvent)JSEvents.gamepadEvent=_malloc(1432);var gamepadEventHandlerFunc=function(ev){var e=ev||event;var gamepadEvent=JSEvents.gamepadEvent;fillGamepadEventData(gamepadEvent,e["gamepad"]);if(function(a1,a2,a3){return dynCall_iiii.apply(null,[callbackfunc,a1,a2,a3])}(eventTypeId,gamepadEvent,userData))e.preventDefault()};var eventHandler={target:findEventTarget(target),allowsDeferredCalls:true,eventTypeString:eventTypeString,callbackfunc:callbackfunc,handlerFunc:gamepadEventHandlerFunc,useCapture:useCapture};JSEvents.registerOrRemoveHandler(eventHandler)}function _emscripten_set_gamepadconnected_callback_on_thread(userData,useCapture,callbackfunc,targetThread){if(!navigator.getGamepads&&!navigator.webkitGetGamepads)return-1;registerGamepadEventCallback(2,userData,useCapture,callbackfunc,26,"gamepadconnected",targetThread);return 0}function _emscripten_set_gamepaddisconnected_callback_on_thread(userData,useCapture,callbackfunc,targetThread){if(!navigator.getGamepads&&!navigator.webkitGetGamepads)return-1;registerGamepadEventCallback(2,userData,useCapture,callbackfunc,27,"gamepaddisconnected",targetThread);return 0}function registerTouchEventCallback(target,userData,useCapture,callbackfunc,eventTypeId,eventTypeString,targetThread){if(!JSEvents.touchEvent)JSEvents.touchEvent=_malloc(1696);target=findEventTarget(target);var touchEventHandlerFunc=function(e){var t,touches={},et=e.touches;for(var i=0;i>3]=e.timeStamp;var idx=touchEvent>>2;HEAP32[idx+3]=e.ctrlKey;HEAP32[idx+4]=e.shiftKey;HEAP32[idx+5]=e.altKey;HEAP32[idx+6]=e.metaKey;idx+=7;var targetRect=getBoundingClientRect(target);var numTouches=0;for(var i in touches){t=touches[i];HEAP32[idx+0]=t.identifier;HEAP32[idx+1]=t.screenX;HEAP32[idx+2]=t.screenY;HEAP32[idx+3]=t.clientX;HEAP32[idx+4]=t.clientY;HEAP32[idx+5]=t.pageX;HEAP32[idx+6]=t.pageY;HEAP32[idx+7]=t.isChanged;HEAP32[idx+8]=t.onTarget;HEAP32[idx+9]=t.clientX-targetRect.left;HEAP32[idx+10]=t.clientY-targetRect.top;idx+=13;if(++numTouches>31){break}}HEAP32[touchEvent+8>>2]=numTouches;if(function(a1,a2,a3){return dynCall_iiii.apply(null,[callbackfunc,a1,a2,a3])}(eventTypeId,touchEvent,userData))e.preventDefault()};var eventHandler={target:target,allowsDeferredCalls:eventTypeString=="touchstart"||eventTypeString=="touchend",eventTypeString:eventTypeString,callbackfunc:callbackfunc,handlerFunc:touchEventHandlerFunc,useCapture:useCapture};JSEvents.registerOrRemoveHandler(eventHandler)}function _emscripten_set_touchcancel_callback_on_thread(target,userData,useCapture,callbackfunc,targetThread){registerTouchEventCallback(target,userData,useCapture,callbackfunc,25,"touchcancel",targetThread);return 0}function _emscripten_set_touchend_callback_on_thread(target,userData,useCapture,callbackfunc,targetThread){registerTouchEventCallback(target,userData,useCapture,callbackfunc,23,"touchend",targetThread);return 0}function _emscripten_set_touchmove_callback_on_thread(target,userData,useCapture,callbackfunc,targetThread){registerTouchEventCallback(target,userData,useCapture,callbackfunc,24,"touchmove",targetThread);return 0}function _emscripten_set_touchstart_callback_on_thread(target,userData,useCapture,callbackfunc,targetThread){registerTouchEventCallback(target,userData,useCapture,callbackfunc,22,"touchstart",targetThread);return 0}function callUserCallback(func){if(ABORT){return}try{func()}catch(e){handleException(e)}}function safeSetTimeout(func,timeout){return setTimeout(function(){callUserCallback(func)},timeout)}function _emscripten_sleep(ms){return Asyncify.handleSleep(wakeUp=>safeSetTimeout(wakeUp,ms))}var ENV={};function getExecutableName(){return thisProgram||"./this.program"}function getEnvStrings(){if(!getEnvStrings.strings){var lang=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8";var env={"USER":"web_user","LOGNAME":"web_user","PATH":"/","PWD":"/","HOME":"/home/web_user","LANG":lang,"_":getExecutableName()};for(var x in ENV){if(ENV[x]===undefined)delete env[x];else env[x]=ENV[x]}var strings=[];for(var x in env){strings.push(x+"="+env[x])}getEnvStrings.strings=strings}return getEnvStrings.strings}function writeAsciiToMemory(str,buffer,dontAddNull){for(var i=0;i>0]=str.charCodeAt(i)}if(!dontAddNull)HEAP8[buffer>>0]=0}function _environ_get(__environ,environ_buf){var bufSize=0;getEnvStrings().forEach(function(string,i){var ptr=environ_buf+bufSize;HEAPU32[__environ+i*4>>2]=ptr;writeAsciiToMemory(string,ptr);bufSize+=string.length+1});return 0}function _environ_sizes_get(penviron_count,penviron_buf_size){var strings=getEnvStrings();HEAPU32[penviron_count>>2]=strings.length;var bufSize=0;strings.forEach(function(string){bufSize+=string.length+1});HEAPU32[penviron_buf_size>>2]=bufSize;return 0}function _proc_exit(code){EXITSTATUS=code;if(!keepRuntimeAlive()){if(Module["onExit"])Module["onExit"](code);ABORT=true}quit_(code,new ExitStatus(code))}function exitJS(status,implicit){EXITSTATUS=status;_proc_exit(status)}var _exit=exitJS;function _fd_close(fd){try{var stream=SYSCALLS.getStreamFromFD(fd);FS.close(stream);return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return e.errno}}function doReadv(stream,iov,iovcnt,offset){var ret=0;for(var i=0;i>2];var len=HEAPU32[iov+4>>2];iov+=8;var curr=FS.read(stream,HEAP8,ptr,len,offset);if(curr<0)return-1;ret+=curr;if(curr>2]=num;return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return e.errno}}function convertI32PairToI53Checked(lo,hi){return hi+2097152>>>0<4194305-!!lo?(lo>>>0)+hi*4294967296:NaN}function _fd_seek(fd,offset_low,offset_high,whence,newOffset){try{var offset=convertI32PairToI53Checked(offset_low,offset_high);if(isNaN(offset))return 61;var stream=SYSCALLS.getStreamFromFD(fd);FS.llseek(stream,offset,whence);tempI64=[stream.position>>>0,(tempDouble=stream.position,+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[newOffset>>2]=tempI64[0],HEAP32[newOffset+4>>2]=tempI64[1];if(stream.getdents&&offset===0&&whence===0)stream.getdents=null;return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return e.errno}}function doWritev(stream,iov,iovcnt,offset){var ret=0;for(var i=0;i>2];var len=HEAPU32[iov+4>>2];iov+=8;var curr=FS.write(stream,HEAP8,ptr,len,offset);if(curr<0)return-1;ret+=curr}return ret}function _fd_write(fd,iov,iovcnt,pnum){try{var stream=SYSCALLS.getStreamFromFD(fd);var num=doWritev(stream,iov,iovcnt);HEAPU32[pnum>>2]=num;return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return e.errno}}function _glActiveTexture(x0){GLctx["activeTexture"](x0)}function _glAttachShader(program,shader){GLctx.attachShader(GL.programs[program],GL.shaders[shader])}function _glBindAttribLocation(program,index,name){GLctx.bindAttribLocation(GL.programs[program],index,UTF8ToString(name))}function _glBindBuffer(target,buffer){GLctx.bindBuffer(target,GL.buffers[buffer])}function _glBindTexture(target,texture){GLctx.bindTexture(target,GL.textures[texture])}function _glBlendFunc(x0,x1){GLctx["blendFunc"](x0,x1)}function _glBufferData(target,size,data,usage){GLctx.bufferData(target,data?HEAPU8.subarray(data,data+size):size,usage)}function _glBufferSubData(target,offset,size,data){GLctx.bufferSubData(target,offset,HEAPU8.subarray(data,data+size))}function _glClear(x0){GLctx["clear"](x0)}function _glClearColor(x0,x1,x2,x3){GLctx["clearColor"](x0,x1,x2,x3)}function _glClearDepthf(x0){GLctx["clearDepth"](x0)}function _glCompileShader(shader){GLctx.compileShader(GL.shaders[shader])}function _glCompressedTexImage2D(target,level,internalFormat,width,height,border,imageSize,data){GLctx["compressedTexImage2D"](target,level,internalFormat,width,height,border,data?HEAPU8.subarray(data,data+imageSize):null)}function _glCreateProgram(){var id=GL.getNewId(GL.programs);var program=GLctx.createProgram();program.name=id;program.maxUniformLength=program.maxAttributeLength=program.maxUniformBlockNameLength=0;program.uniformIdCounter=1;GL.programs[id]=program;return id}function _glCreateShader(shaderType){var id=GL.getNewId(GL.shaders);GL.shaders[id]=GLctx.createShader(shaderType);return id}function _glCullFace(x0){GLctx["cullFace"](x0)}function _glDeleteProgram(id){if(!id)return;var program=GL.programs[id];if(!program){GL.recordError(1281);return}GLctx.deleteProgram(program);program.name=0;GL.programs[id]=null}function _glDepthFunc(x0){GLctx["depthFunc"](x0)}function _glDisable(x0){GLctx["disable"](x0)}function _glDrawArrays(mode,first,count){GLctx.drawArrays(mode,first,count)}function _glDrawElements(mode,count,type,indices){GLctx.drawElements(mode,count,type,indices)}function _glEnable(x0){GLctx["enable"](x0)}function _glEnableVertexAttribArray(index){GLctx.enableVertexAttribArray(index)}function _glFrontFace(x0){GLctx["frontFace"](x0)}function _glGenBuffers(n,buffers){__glGenObject(n,buffers,"createBuffer",GL.buffers)}function _glGenTextures(n,textures){__glGenObject(n,textures,"createTexture",GL.textures)}function _glGetAttribLocation(program,name){return GLctx.getAttribLocation(GL.programs[program],UTF8ToString(name))}function _glGetFloatv(name_,p){emscriptenWebGLGet(name_,p,2)}function _glGetProgramInfoLog(program,maxLength,length,infoLog){var log=GLctx.getProgramInfoLog(GL.programs[program]);if(log===null)log="(unknown error)";var numBytesWrittenExclNull=maxLength>0&&infoLog?stringToUTF8(log,infoLog,maxLength):0;if(length)HEAP32[length>>2]=numBytesWrittenExclNull}function _glGetProgramiv(program,pname,p){if(!p){GL.recordError(1281);return}if(program>=GL.counter){GL.recordError(1281);return}program=GL.programs[program];if(pname==35716){var log=GLctx.getProgramInfoLog(program);if(log===null)log="(unknown error)";HEAP32[p>>2]=log.length+1}else if(pname==35719){if(!program.maxUniformLength){for(var i=0;i>2]=program.maxUniformLength}else if(pname==35722){if(!program.maxAttributeLength){for(var i=0;i>2]=program.maxAttributeLength}else if(pname==35381){if(!program.maxUniformBlockNameLength){for(var i=0;i>2]=program.maxUniformBlockNameLength}else{HEAP32[p>>2]=GLctx.getProgramParameter(program,pname)}}function _glGetShaderInfoLog(shader,maxLength,length,infoLog){var log=GLctx.getShaderInfoLog(GL.shaders[shader]);if(log===null)log="(unknown error)";var numBytesWrittenExclNull=maxLength>0&&infoLog?stringToUTF8(log,infoLog,maxLength):0;if(length)HEAP32[length>>2]=numBytesWrittenExclNull}function _glGetShaderiv(shader,pname,p){if(!p){GL.recordError(1281);return}if(pname==35716){var log=GLctx.getShaderInfoLog(GL.shaders[shader]);if(log===null)log="(unknown error)";var logLength=log?log.length+1:0;HEAP32[p>>2]=logLength}else if(pname==35720){var source=GLctx.getShaderSource(GL.shaders[shader]);var sourceLength=source?source.length+1:0;HEAP32[p>>2]=sourceLength}else{HEAP32[p>>2]=GLctx.getShaderParameter(GL.shaders[shader],pname)}}function _glGetString(name_){var ret=GL.stringCache[name_];if(!ret){switch(name_){case 7939:var exts=GLctx.getSupportedExtensions()||[];exts=exts.concat(exts.map(function(e){return"GL_"+e}));ret=stringToNewUTF8(exts.join(" "));break;case 7936:case 7937:case 37445:case 37446:var s=GLctx.getParameter(name_);if(!s){GL.recordError(1280)}ret=s&&stringToNewUTF8(s);break;case 7938:var glVersion=GLctx.getParameter(7938);{glVersion="OpenGL ES 2.0 ("+glVersion+")"}ret=stringToNewUTF8(glVersion);break;case 35724:var glslVersion=GLctx.getParameter(35724);var ver_re=/^WebGL GLSL ES ([0-9]\.[0-9][0-9]?)(?:$| .*)/;var ver_num=glslVersion.match(ver_re);if(ver_num!==null){if(ver_num[1].length==3)ver_num[1]=ver_num[1]+"0";glslVersion="OpenGL ES GLSL ES "+ver_num[1]+" ("+glslVersion+")"}ret=stringToNewUTF8(glslVersion);break;default:GL.recordError(1280)}GL.stringCache[name_]=ret}return ret}function _glGetUniformLocation(program,name){name=UTF8ToString(name);if(program=GL.programs[program]){webglPrepareUniformLocationsBeforeFirstUse(program);var uniformLocsById=program.uniformLocsById;var arrayIndex=0;var uniformBaseName=name;var leftBrace=webglGetLeftBracePos(name);if(leftBrace>0){arrayIndex=jstoi_q(name.slice(leftBrace+1))>>>0;uniformBaseName=name.slice(0,leftBrace)}var sizeAndId=program.uniformSizeAndIdsByName[uniformBaseName];if(sizeAndId&&arrayIndex>=2;for(var i=0;i<16*count;i+=16){var dst=value+i;view[i]=heap[dst];view[i+1]=heap[dst+1];view[i+2]=heap[dst+2];view[i+3]=heap[dst+3];view[i+4]=heap[dst+4];view[i+5]=heap[dst+5];view[i+6]=heap[dst+6];view[i+7]=heap[dst+7];view[i+8]=heap[dst+8];view[i+9]=heap[dst+9];view[i+10]=heap[dst+10];view[i+11]=heap[dst+11];view[i+12]=heap[dst+12];view[i+13]=heap[dst+13];view[i+14]=heap[dst+14];view[i+15]=heap[dst+15]}}else{var view=HEAPF32.subarray(value>>2,value+count*64>>2)}GLctx.uniformMatrix4fv(webglGetUniformLocation(location),!!transpose,view)}function _glUseProgram(program){program=GL.programs[program];GLctx.useProgram(program);GLctx.currentProgram=program}function _glVertexAttribPointer(index,size,type,normalized,stride,ptr){GLctx.vertexAttribPointer(index,size,type,!!normalized,stride,ptr)}function _glViewport(x0,x1,x2,x3){GLctx["viewport"](x0,x1,x2,x3)}function _emscripten_set_main_loop_timing(mode,value){Browser.mainLoop.timingMode=mode;Browser.mainLoop.timingValue=value;if(!Browser.mainLoop.func){return 1}if(!Browser.mainLoop.running){Browser.mainLoop.running=true}if(mode==0){Browser.mainLoop.scheduler=function Browser_mainLoop_scheduler_setTimeout(){var timeUntilNextTick=Math.max(0,Browser.mainLoop.tickStartTime+value-_emscripten_get_now())|0;setTimeout(Browser.mainLoop.runner,timeUntilNextTick)};Browser.mainLoop.method="timeout"}else if(mode==1){Browser.mainLoop.scheduler=function Browser_mainLoop_scheduler_rAF(){Browser.requestAnimationFrame(Browser.mainLoop.runner)};Browser.mainLoop.method="rAF"}else if(mode==2){if(typeof setImmediate=="undefined"){var setImmediates=[];var emscriptenMainLoopMessageId="setimmediate";var Browser_setImmediate_messageHandler=event=>{if(event.data===emscriptenMainLoopMessageId||event.data.target===emscriptenMainLoopMessageId){event.stopPropagation();setImmediates.shift()()}};addEventListener("message",Browser_setImmediate_messageHandler,true);setImmediate=function Browser_emulated_setImmediate(func){setImmediates.push(func);if(ENVIRONMENT_IS_WORKER){if(Module["setImmediates"]===undefined)Module["setImmediates"]=[];Module["setImmediates"].push(func);postMessage({target:emscriptenMainLoopMessageId})}else postMessage(emscriptenMainLoopMessageId,"*")}}Browser.mainLoop.scheduler=function Browser_mainLoop_scheduler_setImmediate(){setImmediate(Browser.mainLoop.runner)};Browser.mainLoop.method="immediate"}return 0}function maybeExit(){}function setMainLoop(browserIterationFunc,fps,simulateInfiniteLoop,arg,noSetTiming){assert(!Browser.mainLoop.func,"emscripten_set_main_loop: there can only be one main loop function at once: call emscripten_cancel_main_loop to cancel the previous one before setting a new one with different parameters.");Browser.mainLoop.func=browserIterationFunc;Browser.mainLoop.arg=arg;var thisMainLoopId=Browser.mainLoop.currentlyRunningMainloop;function checkIsRunning(){if(thisMainLoopId0){var start=Date.now();var blocker=Browser.mainLoop.queue.shift();blocker.func(blocker.arg);if(Browser.mainLoop.remainingBlockers){var remaining=Browser.mainLoop.remainingBlockers;var next=remaining%1==0?remaining-1:Math.floor(remaining);if(blocker.counted){Browser.mainLoop.remainingBlockers=next}else{next=next+.5;Browser.mainLoop.remainingBlockers=(8*remaining+next)/9}}out('main loop blocker "'+blocker.name+'" took '+(Date.now()-start)+" ms");Browser.mainLoop.updateStatus();if(!checkIsRunning())return;setTimeout(Browser.mainLoop.runner,0);return}if(!checkIsRunning())return;Browser.mainLoop.currentFrameNumber=Browser.mainLoop.currentFrameNumber+1|0;if(Browser.mainLoop.timingMode==1&&Browser.mainLoop.timingValue>1&&Browser.mainLoop.currentFrameNumber%Browser.mainLoop.timingValue!=0){Browser.mainLoop.scheduler();return}else if(Browser.mainLoop.timingMode==0){Browser.mainLoop.tickStartTime=_emscripten_get_now()}Browser.mainLoop.runIter(browserIterationFunc);if(!checkIsRunning())return;if(typeof SDL=="object"&&SDL.audio&&SDL.audio.queueNewAudioData)SDL.audio.queueNewAudioData();Browser.mainLoop.scheduler()};if(!noSetTiming){if(fps&&fps>0)_emscripten_set_main_loop_timing(0,1e3/fps);else _emscripten_set_main_loop_timing(1,1);Browser.mainLoop.scheduler()}if(simulateInfiniteLoop){throw"unwind"}}function warnOnce(text){if(!warnOnce.shown)warnOnce.shown={};if(!warnOnce.shown[text]){warnOnce.shown[text]=1;if(ENVIRONMENT_IS_NODE)text="warning: "+text;err(text)}}var Browser={mainLoop:{running:false,scheduler:null,method:"",currentlyRunningMainloop:0,func:null,arg:0,timingMode:0,timingValue:0,currentFrameNumber:0,queue:[],pause:function(){Browser.mainLoop.scheduler=null;Browser.mainLoop.currentlyRunningMainloop++},resume:function(){Browser.mainLoop.currentlyRunningMainloop++;var timingMode=Browser.mainLoop.timingMode;var timingValue=Browser.mainLoop.timingValue;var func=Browser.mainLoop.func;Browser.mainLoop.func=null;setMainLoop(func,0,false,Browser.mainLoop.arg,true);_emscripten_set_main_loop_timing(timingMode,timingValue);Browser.mainLoop.scheduler()},updateStatus:function(){if(Module["setStatus"]){var message=Module["statusMessage"]||"Please wait...";var remaining=Browser.mainLoop.remainingBlockers;var expected=Browser.mainLoop.expectedBlockers;if(remaining){if(remaining{assert(img.complete,"Image "+name+" could not be decoded");var canvas=document.createElement("canvas");canvas.width=img.width;canvas.height=img.height;var ctx=canvas.getContext("2d");ctx.drawImage(img,0,0);preloadedImages[name]=canvas;Browser.URLObject.revokeObjectURL(url);if(onload)onload(byteArray)};img.onerror=event=>{out("Image "+url+" could not be decoded");if(onerror)onerror()};img.src=url};Module["preloadPlugins"].push(imagePlugin);var audioPlugin={};audioPlugin["canHandle"]=function audioPlugin_canHandle(name){return!Module.noAudioDecoding&&name.substr(-4)in{".ogg":1,".wav":1,".mp3":1}};audioPlugin["handle"]=function audioPlugin_handle(byteArray,name,onload,onerror){var done=false;function finish(audio){if(done)return;done=true;preloadedAudios[name]=audio;if(onload)onload(byteArray)}function fail(){if(done)return;done=true;preloadedAudios[name]=new Audio;if(onerror)onerror()}if(Browser.hasBlobConstructor){try{var b=new Blob([byteArray],{type:Browser.getMimetype(name)})}catch(e){return fail()}var url=Browser.URLObject.createObjectURL(b);var audio=new Audio;audio.addEventListener("canplaythrough",()=>finish(audio),false);audio.onerror=function audio_onerror(event){if(done)return;err("warning: browser could not fully decode audio "+name+", trying slower base64 approach");function encode64(data){var BASE="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";var PAD="=";var ret="";var leftchar=0;var leftbits=0;for(var i=0;i=6){var curr=leftchar>>leftbits-6&63;leftbits-=6;ret+=BASE[curr]}}if(leftbits==2){ret+=BASE[(leftchar&3)<<4];ret+=PAD+PAD}else if(leftbits==4){ret+=BASE[(leftchar&15)<<2];ret+=PAD}return ret}audio.src="data:audio/x-"+name.substr(-3)+";base64,"+encode64(byteArray);finish(audio)};audio.src=url;safeSetTimeout(function(){finish(audio)},1e4)}else{return fail()}};Module["preloadPlugins"].push(audioPlugin);function pointerLockChange(){Browser.pointerLock=document["pointerLockElement"]===Module["canvas"]||document["mozPointerLockElement"]===Module["canvas"]||document["webkitPointerLockElement"]===Module["canvas"]||document["msPointerLockElement"]===Module["canvas"]}var canvas=Module["canvas"];if(canvas){canvas.requestPointerLock=canvas["requestPointerLock"]||canvas["mozRequestPointerLock"]||canvas["webkitRequestPointerLock"]||canvas["msRequestPointerLock"]||(()=>{});canvas.exitPointerLock=document["exitPointerLock"]||document["mozExitPointerLock"]||document["webkitExitPointerLock"]||document["msExitPointerLock"]||(()=>{});canvas.exitPointerLock=canvas.exitPointerLock.bind(document);document.addEventListener("pointerlockchange",pointerLockChange,false);document.addEventListener("mozpointerlockchange",pointerLockChange,false);document.addEventListener("webkitpointerlockchange",pointerLockChange,false);document.addEventListener("mspointerlockchange",pointerLockChange,false);if(Module["elementPointerLock"]){canvas.addEventListener("click",ev=>{if(!Browser.pointerLock&&Module["canvas"].requestPointerLock){Module["canvas"].requestPointerLock();ev.preventDefault()}},false)}}},handledByPreloadPlugin:function(byteArray,fullname,finish,onerror){Browser.init();var handled=false;Module["preloadPlugins"].forEach(function(plugin){if(handled)return;if(plugin["canHandle"](fullname)){plugin["handle"](byteArray,fullname,finish,onerror);handled=true}});return handled},createContext:function(canvas,useWebGL,setInModule,webGLContextAttributes){if(useWebGL&&Module.ctx&&canvas==Module.canvas)return Module.ctx;var ctx;var contextHandle;if(useWebGL){var contextAttributes={antialias:false,alpha:false,majorVersion:1};if(webGLContextAttributes){for(var attribute in webGLContextAttributes){contextAttributes[attribute]=webGLContextAttributes[attribute]}}if(typeof GL!="undefined"){contextHandle=GL.createContext(canvas,contextAttributes);if(contextHandle){ctx=GL.getContext(contextHandle).GLctx}}}else{ctx=canvas.getContext("2d")}if(!ctx)return null;if(setInModule){if(!useWebGL)assert(typeof GLctx=="undefined","cannot set in module if GLctx is used, but we are a non-GL context that would replace it");Module.ctx=ctx;if(useWebGL)GL.makeContextCurrent(contextHandle);Module.useWebGL=useWebGL;Browser.moduleContextCreatedCallbacks.forEach(function(callback){callback()});Browser.init()}return ctx},destroyContext:function(canvas,useWebGL,setInModule){},fullscreenHandlersInstalled:false,lockPointer:undefined,resizeCanvas:undefined,requestFullscreen:function(lockPointer,resizeCanvas){Browser.lockPointer=lockPointer;Browser.resizeCanvas=resizeCanvas;if(typeof Browser.lockPointer=="undefined")Browser.lockPointer=true;if(typeof Browser.resizeCanvas=="undefined")Browser.resizeCanvas=false;var canvas=Module["canvas"];function fullscreenChange(){Browser.isFullscreen=false;var canvasContainer=canvas.parentNode;if((document["fullscreenElement"]||document["mozFullScreenElement"]||document["msFullscreenElement"]||document["webkitFullscreenElement"]||document["webkitCurrentFullScreenElement"])===canvasContainer){canvas.exitFullscreen=Browser.exitFullscreen;if(Browser.lockPointer)canvas.requestPointerLock();Browser.isFullscreen=true;if(Browser.resizeCanvas){Browser.setFullscreenCanvasSize()}else{Browser.updateCanvasDimensions(canvas)}}else{canvasContainer.parentNode.insertBefore(canvas,canvasContainer);canvasContainer.parentNode.removeChild(canvasContainer);if(Browser.resizeCanvas){Browser.setWindowedCanvasSize()}else{Browser.updateCanvasDimensions(canvas)}}if(Module["onFullScreen"])Module["onFullScreen"](Browser.isFullscreen);if(Module["onFullscreen"])Module["onFullscreen"](Browser.isFullscreen)}if(!Browser.fullscreenHandlersInstalled){Browser.fullscreenHandlersInstalled=true;document.addEventListener("fullscreenchange",fullscreenChange,false);document.addEventListener("mozfullscreenchange",fullscreenChange,false);document.addEventListener("webkitfullscreenchange",fullscreenChange,false);document.addEventListener("MSFullscreenChange",fullscreenChange,false)}var canvasContainer=document.createElement("div");canvas.parentNode.insertBefore(canvasContainer,canvas);canvasContainer.appendChild(canvas);canvasContainer.requestFullscreen=canvasContainer["requestFullscreen"]||canvasContainer["mozRequestFullScreen"]||canvasContainer["msRequestFullscreen"]||(canvasContainer["webkitRequestFullscreen"]?()=>canvasContainer["webkitRequestFullscreen"](Element["ALLOW_KEYBOARD_INPUT"]):null)||(canvasContainer["webkitRequestFullScreen"]?()=>canvasContainer["webkitRequestFullScreen"](Element["ALLOW_KEYBOARD_INPUT"]):null);canvasContainer.requestFullscreen()},exitFullscreen:function(){if(!Browser.isFullscreen){return false}var CFS=document["exitFullscreen"]||document["cancelFullScreen"]||document["mozCancelFullScreen"]||document["msExitFullscreen"]||document["webkitCancelFullScreen"]||function(){};CFS.apply(document,[]);return true},nextRAF:0,fakeRequestAnimationFrame:function(func){var now=Date.now();if(Browser.nextRAF===0){Browser.nextRAF=now+1e3/60}else{while(now+2>=Browser.nextRAF){Browser.nextRAF+=1e3/60}}var delay=Math.max(Browser.nextRAF-now,0);setTimeout(func,delay)},requestAnimationFrame:function(func){if(typeof requestAnimationFrame=="function"){requestAnimationFrame(func);return}var RAF=Browser.fakeRequestAnimationFrame;RAF(func)},safeSetTimeout:function(func){return safeSetTimeout(func)},safeRequestAnimationFrame:function(func){return Browser.requestAnimationFrame(function(){callUserCallback(func)})},getMimetype:function(name){return{"jpg":"image/jpeg","jpeg":"image/jpeg","png":"image/png","bmp":"image/bmp","ogg":"audio/ogg","wav":"audio/wav","mp3":"audio/mpeg"}[name.substr(name.lastIndexOf(".")+1)]},getUserMedia:function(func){if(!window.getUserMedia){window.getUserMedia=navigator["getUserMedia"]||navigator["mozGetUserMedia"]}window.getUserMedia(func)},getMovementX:function(event){return event["movementX"]||event["mozMovementX"]||event["webkitMovementX"]||0},getMovementY:function(event){return event["movementY"]||event["mozMovementY"]||event["webkitMovementY"]||0},getMouseWheelDelta:function(event){var delta=0;switch(event.type){case"DOMMouseScroll":delta=event.detail/3;break;case"mousewheel":delta=event.wheelDelta/120;break;case"wheel":delta=event.deltaY;switch(event.deltaMode){case 0:delta/=100;break;case 1:delta/=3;break;case 2:delta*=80;break;default:throw"unrecognized mouse wheel delta mode: "+event.deltaMode}break;default:throw"unrecognized mouse wheel event: "+event.type}return delta},mouseX:0,mouseY:0,mouseMovementX:0,mouseMovementY:0,touches:{},lastTouches:{},calculateMouseEvent:function(event){if(Browser.pointerLock){if(event.type!="mousemove"&&"mozMovementX"in event){Browser.mouseMovementX=Browser.mouseMovementY=0}else{Browser.mouseMovementX=Browser.getMovementX(event);Browser.mouseMovementY=Browser.getMovementY(event)}if(typeof SDL!="undefined"){Browser.mouseX=SDL.mouseX+Browser.mouseMovementX;Browser.mouseY=SDL.mouseY+Browser.mouseMovementY}else{Browser.mouseX+=Browser.mouseMovementX;Browser.mouseY+=Browser.mouseMovementY}}else{var rect=Module["canvas"].getBoundingClientRect();var cw=Module["canvas"].width;var ch=Module["canvas"].height;var scrollX=typeof window.scrollX!="undefined"?window.scrollX:window.pageXOffset;var scrollY=typeof window.scrollY!="undefined"?window.scrollY:window.pageYOffset;if(event.type==="touchstart"||event.type==="touchend"||event.type==="touchmove"){var touch=event.touch;if(touch===undefined){return}var adjustedX=touch.pageX-(scrollX+rect.left);var adjustedY=touch.pageY-(scrollY+rect.top);adjustedX=adjustedX*(cw/rect.width);adjustedY=adjustedY*(ch/rect.height);var coords={x:adjustedX,y:adjustedY};if(event.type==="touchstart"){Browser.lastTouches[touch.identifier]=coords;Browser.touches[touch.identifier]=coords}else if(event.type==="touchend"||event.type==="touchmove"){var last=Browser.touches[touch.identifier];if(!last)last=coords;Browser.lastTouches[touch.identifier]=last;Browser.touches[touch.identifier]=coords}return}var x=event.pageX-(scrollX+rect.left);var y=event.pageY-(scrollY+rect.top);x=x*(cw/rect.width);y=y*(ch/rect.height);Browser.mouseMovementX=x-Browser.mouseX;Browser.mouseMovementY=y-Browser.mouseY;Browser.mouseX=x;Browser.mouseY=y}},resizeListeners:[],updateResizeListeners:function(){var canvas=Module["canvas"];Browser.resizeListeners.forEach(function(listener){listener(canvas.width,canvas.height)})},setCanvasSize:function(width,height,noUpdates){var canvas=Module["canvas"];Browser.updateCanvasDimensions(canvas,width,height);if(!noUpdates)Browser.updateResizeListeners()},windowedWidth:0,windowedHeight:0,setFullscreenCanvasSize:function(){if(typeof SDL!="undefined"){var flags=HEAPU32[SDL.screen>>2];flags=flags|8388608;HEAP32[SDL.screen>>2]=flags}Browser.updateCanvasDimensions(Module["canvas"]);Browser.updateResizeListeners()},setWindowedCanvasSize:function(){if(typeof SDL!="undefined"){var flags=HEAPU32[SDL.screen>>2];flags=flags&~8388608;HEAP32[SDL.screen>>2]=flags}Browser.updateCanvasDimensions(Module["canvas"]);Browser.updateResizeListeners()},updateCanvasDimensions:function(canvas,wNative,hNative){if(wNative&&hNative){canvas.widthNative=wNative;canvas.heightNative=hNative}else{wNative=canvas.widthNative;hNative=canvas.heightNative}var w=wNative;var h=hNative;if(Module["forcedAspectRatio"]&&Module["forcedAspectRatio"]>0){if(w/h=0&&charCode<=31)return;(function(a1,a2){dynCall_vii.apply(null,[GLFW.active.charFunc,a1,a2])})(GLFW.active.id,charCode)},onKeyChanged:function(keyCode,status){if(!GLFW.active)return;var key=GLFW.DOMToGLFWKeyCode(keyCode);if(key==-1)return;var repeat=status&&GLFW.active.keys[key];GLFW.active.keys[key]=status;GLFW.active.domKeys[keyCode]=status;if(!GLFW.active.keyFunc)return;if(repeat)status=2;(function(a1,a2,a3,a4,a5){dynCall_viiiii.apply(null,[GLFW.active.keyFunc,a1,a2,a3,a4,a5])})(GLFW.active.id,key,keyCode,status,GLFW.getModBits(GLFW.active))},onGamepadConnected:function(event){GLFW.refreshJoysticks()},onGamepadDisconnected:function(event){GLFW.refreshJoysticks()},onKeydown:function(event){GLFW.onKeyChanged(event.keyCode,1);if(event.keyCode===8||event.keyCode===9){event.preventDefault()}},onKeyup:function(event){GLFW.onKeyChanged(event.keyCode,0)},onBlur:function(event){if(!GLFW.active)return;for(var i=0;i0){if(eventButton==1){eventButton=2}else{eventButton=1}}return eventButton},onMouseenter:function(event){if(!GLFW.active)return;if(event.target!=Module["canvas"]||!GLFW.active.cursorEnterFunc)return;(function(a1,a2){dynCall_vii.apply(null,[GLFW.active.cursorEnterFunc,a1,a2])})(GLFW.active.id,1)},onMouseleave:function(event){if(!GLFW.active)return;if(event.target!=Module["canvas"]||!GLFW.active.cursorEnterFunc)return;(function(a1,a2){dynCall_vii.apply(null,[GLFW.active.cursorEnterFunc,a1,a2])})(GLFW.active.id,0)},onMouseButtonChanged:function(event,status){if(!GLFW.active)return;Browser.calculateMouseEvent(event);if(event.target!=Module["canvas"])return;var eventButton=GLFW.DOMToGLFWMouseButton(event);if(status==1){GLFW.active.buttons|=1<0?Math.max(delta,1):Math.min(delta,-1);GLFW.wheelPos+=delta;if(!GLFW.active||!GLFW.active.scrollFunc||event.target!=Module["canvas"])return;var sx=0;var sy=delta;if(event.type=="mousewheel"){sx=event.wheelDeltaX}else{sx=event.deltaX}(function(a1,a2,a3){dynCall_vidd.apply(null,[GLFW.active.scrollFunc,a1,a2,a3])})(GLFW.active.id,sx,sy);event.preventDefault()},onCanvasResize:function(width,height){if(!GLFW.active)return;var resizeNeeded=true;if(document["fullscreen"]||document["fullScreen"]||document["mozFullScreen"]||document["webkitIsFullScreen"]){GLFW.active.storedX=GLFW.active.x;GLFW.active.storedY=GLFW.active.y;GLFW.active.storedWidth=GLFW.active.width;GLFW.active.storedHeight=GLFW.active.height;GLFW.active.x=GLFW.active.y=0;GLFW.active.width=screen.width;GLFW.active.height=screen.height;GLFW.active.fullscreen=true}else if(GLFW.active.fullscreen==true){GLFW.active.x=GLFW.active.storedX;GLFW.active.y=GLFW.active.storedY;GLFW.active.width=GLFW.active.storedWidth;GLFW.active.height=GLFW.active.storedHeight;GLFW.active.fullscreen=false}else if(GLFW.active.width!=width||GLFW.active.height!=height){GLFW.active.width=width;GLFW.active.height=height}else{resizeNeeded=false}if(resizeNeeded){Browser.setCanvasSize(GLFW.active.width,GLFW.active.height,true);GLFW.onWindowSizeChanged();GLFW.onFramebufferSizeChanged()}},onWindowSizeChanged:function(){if(!GLFW.active)return;if(!GLFW.active.windowSizeFunc)return;(function(a1,a2,a3){dynCall_viii.apply(null,[GLFW.active.windowSizeFunc,a1,a2,a3])})(GLFW.active.id,GLFW.active.width,GLFW.active.height)},onFramebufferSizeChanged:function(){if(!GLFW.active)return;if(!GLFW.active.framebufferSizeFunc)return;(function(a1,a2,a3){dynCall_viii.apply(null,[GLFW.active.framebufferSizeFunc,a1,a2,a3])})(GLFW.active.id,GLFW.active.width,GLFW.active.height)},getTime:function(){return _emscripten_get_now()/1e3},setWindowTitle:function(winid,title){var win=GLFW.WindowFromId(winid);if(!win)return;win.title=UTF8ToString(title);if(GLFW.active.id==win.id){document.title=win.title}},setJoystickCallback:function(cbfun){GLFW.joystickFunc=cbfun;GLFW.refreshJoysticks()},joys:{},lastGamepadState:[],lastGamepadStateFrame:null,refreshJoysticks:function(){if(Browser.mainLoop.currentFrameNumber!==GLFW.lastGamepadStateFrame||!Browser.mainLoop.currentFrameNumber){GLFW.lastGamepadState=navigator.getGamepads?navigator.getGamepads():navigator.webkitGetGamepads?navigator.webkitGetGamepads:[];GLFW.lastGamepadStateFrame=Browser.mainLoop.currentFrameNumber;for(var joy=0;joy>0]=gamepad.buttons[i].pressed}for(var i=0;i>2]=gamepad.axes[i]}}else{if(GLFW.joys[joy]){out("glfw joystick disconnected",joy);if(GLFW.joystickFunc){(function(a1,a2){dynCall_vii.apply(null,[GLFW.joystickFunc,a1,a2])})(joy,262146)}_free(GLFW.joys[joy].id);_free(GLFW.joys[joy].buttons);_free(GLFW.joys[joy].axes);delete GLFW.joys[joy]}}}}},setKeyCallback:function(winid,cbfun){var win=GLFW.WindowFromId(winid);if(!win)return null;var prevcbfun=win.keyFunc;win.keyFunc=cbfun;return prevcbfun},setCharCallback:function(winid,cbfun){var win=GLFW.WindowFromId(winid);if(!win)return null;var prevcbfun=win.charFunc;win.charFunc=cbfun;return prevcbfun},setMouseButtonCallback:function(winid,cbfun){var win=GLFW.WindowFromId(winid);if(!win)return null;var prevcbfun=win.mouseButtonFunc;win.mouseButtonFunc=cbfun;return prevcbfun},setCursorPosCallback:function(winid,cbfun){var win=GLFW.WindowFromId(winid);if(!win)return null;var prevcbfun=win.cursorPosFunc;win.cursorPosFunc=cbfun;return prevcbfun},setScrollCallback:function(winid,cbfun){var win=GLFW.WindowFromId(winid);if(!win)return null;var prevcbfun=win.scrollFunc;win.scrollFunc=cbfun;return prevcbfun},setDropCallback:function(winid,cbfun){var win=GLFW.WindowFromId(winid);if(!win)return null;var prevcbfun=win.dropFunc;win.dropFunc=cbfun;return prevcbfun},onDrop:function(event){if(!GLFW.active||!GLFW.active.dropFunc)return;if(!event.dataTransfer||!event.dataTransfer.files||event.dataTransfer.files.length==0)return;event.preventDefault();var filenames=_malloc(event.dataTransfer.files.length*4);var filenamesArray=[];var count=event.dataTransfer.files.length;var written=0;var drop_dir=".glfw_dropped_files";FS.createPath("/",drop_dir);function save(file){var path="/"+drop_dir+"/"+file.name.replace(/\//g,"_");var reader=new FileReader;reader.onloadend=e=>{if(reader.readyState!=2){++written;out("failed to read dropped file: "+file.name+": "+reader.error);return}var data=e.target.result;FS.writeFile(path,new Uint8Array(data));if(++written===count){(function(a1,a2,a3){dynCall_viii.apply(null,[GLFW.active.dropFunc,a1,a2,a3])})(GLFW.active.id,count,filenames);for(var i=0;i>2]=filename}for(var i=0;i0},getCursorPos:function(winid,x,y){HEAPF64[x>>3]=Browser.mouseX;HEAPF64[y>>3]=Browser.mouseY},getMousePos:function(winid,x,y){HEAP32[x>>2]=Browser.mouseX;HEAP32[y>>2]=Browser.mouseY},setCursorPos:function(winid,x,y){},getWindowPos:function(winid,x,y){var wx=0;var wy=0;var win=GLFW.WindowFromId(winid);if(win){wx=win.x;wy=win.y}if(x){HEAP32[x>>2]=wx}if(y){HEAP32[y>>2]=wy}},setWindowPos:function(winid,x,y){var win=GLFW.WindowFromId(winid);if(!win)return;win.x=x;win.y=y},getWindowSize:function(winid,width,height){var ww=0;var wh=0;var win=GLFW.WindowFromId(winid);if(win){ww=win.width;wh=win.height}if(width){HEAP32[width>>2]=ww}if(height){HEAP32[height>>2]=wh}},setWindowSize:function(winid,width,height){var win=GLFW.WindowFromId(winid);if(!win)return;if(GLFW.active.id==win.id){if(width==screen.width&&height==screen.height){Browser.requestFullscreen()}else{Browser.exitFullscreen();Browser.setCanvasSize(width,height);win.width=width;win.height=height}}if(!win.windowSizeFunc)return;(function(a1,a2,a3){dynCall_viii.apply(null,[win.windowSizeFunc,a1,a2,a3])})(win.id,width,height)},createWindow:function(width,height,title,monitor,share){var i,id;for(i=0;i0)throw"glfwCreateWindow only supports one window at time currently";id=i+1;if(width<=0||height<=0)return 0;if(monitor){Browser.requestFullscreen()}else{Browser.setCanvasSize(width,height)}for(i=0;i0;if(i==GLFW.windows.length){if(useWebGL){var contextAttributes={antialias:GLFW.hints[135181]>1,depth:GLFW.hints[135173]>0,stencil:GLFW.hints[135174]>0,alpha:GLFW.hints[135172]>0};Module.ctx=Browser.createContext(Module["canvas"],true,true,contextAttributes)}else{Browser.init()}}if(!Module.ctx&&useWebGL)return 0;var win=new GLFW_Window(id,width,height,title,monitor,share);if(id-1==GLFW.windows.length){GLFW.windows.push(win)}else{GLFW.windows[id-1]=win}GLFW.active=win;return win.id},destroyWindow:function(winid){var win=GLFW.WindowFromId(winid);if(!win)return;if(win.windowCloseFunc)(function(a1){dynCall_vi.apply(null,[win.windowCloseFunc,a1])})(win.id);GLFW.windows[win.id-1]=null;if(GLFW.active.id==win.id)GLFW.active=null;for(var i=0;i>2]=0;return 0}function _glfwInit(){if(GLFW.windows)return 1;GLFW.initialTime=GLFW.getTime();GLFW.hints=GLFW.defaultHints;GLFW.windows=new Array;GLFW.active=null;window.addEventListener("gamepadconnected",GLFW.onGamepadConnected,true);window.addEventListener("gamepaddisconnected",GLFW.onGamepadDisconnected,true);window.addEventListener("keydown",GLFW.onKeydown,true);window.addEventListener("keypress",GLFW.onKeyPress,true);window.addEventListener("keyup",GLFW.onKeyup,true);window.addEventListener("blur",GLFW.onBlur,true);Module["canvas"].addEventListener("touchmove",GLFW.onMousemove,true);Module["canvas"].addEventListener("touchstart",GLFW.onMouseButtonDown,true);Module["canvas"].addEventListener("touchcancel",GLFW.onMouseButtonUp,true);Module["canvas"].addEventListener("touchend",GLFW.onMouseButtonUp,true);Module["canvas"].addEventListener("mousemove",GLFW.onMousemove,true);Module["canvas"].addEventListener("mousedown",GLFW.onMouseButtonDown,true);Module["canvas"].addEventListener("mouseup",GLFW.onMouseButtonUp,true);Module["canvas"].addEventListener("wheel",GLFW.onMouseWheel,true);Module["canvas"].addEventListener("mousewheel",GLFW.onMouseWheel,true);Module["canvas"].addEventListener("mouseenter",GLFW.onMouseenter,true);Module["canvas"].addEventListener("mouseleave",GLFW.onMouseleave,true);Module["canvas"].addEventListener("drop",GLFW.onDrop,true);Module["canvas"].addEventListener("dragover",GLFW.onDragover,true);Browser.resizeListeners.push((width,height)=>{GLFW.onCanvasResize(width,height)});return 1}function _glfwMakeContextCurrent(winid){}function _glfwSetCharCallback(winid,cbfun){return GLFW.setCharCallback(winid,cbfun)}function _glfwSetCursorEnterCallback(winid,cbfun){var win=GLFW.WindowFromId(winid);if(!win)return null;var prevcbfun=win.cursorEnterFunc;win.cursorEnterFunc=cbfun;return prevcbfun}function _glfwSetCursorPosCallback(winid,cbfun){return GLFW.setCursorPosCallback(winid,cbfun)}function _glfwSetDropCallback(winid,cbfun){return GLFW.setDropCallback(winid,cbfun)}function _glfwSetErrorCallback(cbfun){var prevcbfun=GLFW.errorFunc;GLFW.errorFunc=cbfun;return prevcbfun}function _glfwSetKeyCallback(winid,cbfun){return GLFW.setKeyCallback(winid,cbfun)}function _glfwSetMouseButtonCallback(winid,cbfun){return GLFW.setMouseButtonCallback(winid,cbfun)}function _glfwSetScrollCallback(winid,cbfun){return GLFW.setScrollCallback(winid,cbfun)}function _glfwSetWindowFocusCallback(winid,cbfun){var win=GLFW.WindowFromId(winid);if(!win)return null;var prevcbfun=win.windowFocusFunc;win.windowFocusFunc=cbfun;return prevcbfun}function _glfwSetWindowIconifyCallback(winid,cbfun){var win=GLFW.WindowFromId(winid);if(!win)return null;var prevcbfun=win.windowIconifyFunc;win.windowIconifyFunc=cbfun;return prevcbfun}function _glfwSetWindowShouldClose(winid,value){var win=GLFW.WindowFromId(winid);if(!win)return;win.shouldClose=value}function _glfwSetWindowSizeCallback(winid,cbfun){return GLFW.setWindowSizeCallback(winid,cbfun)}function _glfwSwapBuffers(winid){GLFW.swapBuffers(winid)}function _glfwSwapInterval(interval){interval=Math.abs(interval);if(interval==0)_emscripten_set_main_loop_timing(0,0);else _emscripten_set_main_loop_timing(1,interval)}function _glfwTerminate(){window.removeEventListener("gamepadconnected",GLFW.onGamepadConnected,true);window.removeEventListener("gamepaddisconnected",GLFW.onGamepadDisconnected,true);window.removeEventListener("keydown",GLFW.onKeydown,true);window.removeEventListener("keypress",GLFW.onKeyPress,true);window.removeEventListener("keyup",GLFW.onKeyup,true);window.removeEventListener("blur",GLFW.onBlur,true);Module["canvas"].removeEventListener("touchmove",GLFW.onMousemove,true);Module["canvas"].removeEventListener("touchstart",GLFW.onMouseButtonDown,true);Module["canvas"].removeEventListener("touchcancel",GLFW.onMouseButtonUp,true);Module["canvas"].removeEventListener("touchend",GLFW.onMouseButtonUp,true);Module["canvas"].removeEventListener("mousemove",GLFW.onMousemove,true);Module["canvas"].removeEventListener("mousedown",GLFW.onMouseButtonDown,true);Module["canvas"].removeEventListener("mouseup",GLFW.onMouseButtonUp,true);Module["canvas"].removeEventListener("wheel",GLFW.onMouseWheel,true);Module["canvas"].removeEventListener("mousewheel",GLFW.onMouseWheel,true);Module["canvas"].removeEventListener("mouseenter",GLFW.onMouseenter,true);Module["canvas"].removeEventListener("mouseleave",GLFW.onMouseleave,true);Module["canvas"].removeEventListener("drop",GLFW.onDrop,true);Module["canvas"].removeEventListener("dragover",GLFW.onDragover,true);Module["canvas"].width=Module["canvas"].height=1;GLFW.windows=null;GLFW.active=null}function _glfwWindowHint(target,hint){GLFW.hints[target]=hint}function allocateUTF8OnStack(str){var size=lengthBytesUTF8(str)+1;var ret=stackAlloc(size);stringToUTF8Array(str,HEAP8,ret,size);return ret}function runAndAbortIfError(func){try{return func()}catch(e){abort(e)}}var Asyncify={State:{Normal:0,Unwinding:1,Rewinding:2,Disabled:3},state:0,StackSize:4096,currData:null,handleSleepReturnValue:0,exportCallStack:[],callStackNameToId:{},callStackIdToName:{},callStackId:0,asyncPromiseHandlers:null,sleepCallbacks:[],getCallStackId:function(funcName){var id=Asyncify.callStackNameToId[funcName];if(id===undefined){id=Asyncify.callStackId++;Asyncify.callStackNameToId[funcName]=id;Asyncify.callStackIdToName[id]=funcName}return id},instrumentWasmImports:function(imports){var ASYNCIFY_IMPORTS=["env.invoke_*","env.emscripten_sleep","env.emscripten_wget","env.emscripten_wget_data","env.emscripten_idb_load","env.emscripten_idb_store","env.emscripten_idb_delete","env.emscripten_idb_exists","env.emscripten_idb_load_blob","env.emscripten_idb_store_blob","env.SDL_Delay","env.emscripten_scan_registers","env.emscripten_lazy_load_code","env.emscripten_fiber_swap","wasi_snapshot_preview1.fd_sync","env.__wasi_fd_sync","env._emval_await","env._dlopen_js","env.__asyncjs__*"].map(x=>x.split(".")[1]);for(var x in imports){(function(x){var original=imports[x];var sig=original.sig;if(typeof original=="function"){var isAsyncifyImport=ASYNCIFY_IMPORTS.indexOf(x)>=0||x.startsWith("__asyncjs__")}})(x)}},instrumentWasmExports:function(exports){var ret={};for(var x in exports){(function(x){var original=exports[x];if(typeof original=="function"){ret[x]=function(){Asyncify.exportCallStack.push(x);try{return original.apply(null,arguments)}finally{if(!ABORT){var y=Asyncify.exportCallStack.pop();assert(y===x);Asyncify.maybeStopUnwind()}}}}else{ret[x]=original}})(x)}return ret},maybeStopUnwind:function(){if(Asyncify.currData&&Asyncify.state===Asyncify.State.Unwinding&&Asyncify.exportCallStack.length===0){Asyncify.state=Asyncify.State.Normal;runAndAbortIfError(_asyncify_stop_unwind);if(typeof Fibers!="undefined"){Fibers.trampoline()}}},whenDone:function(){return new Promise((resolve,reject)=>{Asyncify.asyncPromiseHandlers={resolve:resolve,reject:reject}})},allocateData:function(){var ptr=_malloc(12+Asyncify.StackSize);Asyncify.setDataHeader(ptr,ptr+12,Asyncify.StackSize);Asyncify.setDataRewindFunc(ptr);return ptr},setDataHeader:function(ptr,stack,stackSize){HEAP32[ptr>>2]=stack;HEAP32[ptr+4>>2]=stack+stackSize},setDataRewindFunc:function(ptr){var bottomOfCallStack=Asyncify.exportCallStack[0];var rewindId=Asyncify.getCallStackId(bottomOfCallStack);HEAP32[ptr+8>>2]=rewindId},getDataRewindFunc:function(ptr){var id=HEAP32[ptr+8>>2];var name=Asyncify.callStackIdToName[id];var func=Module["asm"][name];return func},doRewind:function(ptr){var start=Asyncify.getDataRewindFunc(ptr);return start()},handleSleep:function(startAsync){if(ABORT)return;if(Asyncify.state===Asyncify.State.Normal){var reachedCallback=false;var reachedAfterCallback=false;startAsync(handleSleepReturnValue=>{if(ABORT)return;Asyncify.handleSleepReturnValue=handleSleepReturnValue||0;reachedCallback=true;if(!reachedAfterCallback){return}Asyncify.state=Asyncify.State.Rewinding;runAndAbortIfError(()=>_asyncify_start_rewind(Asyncify.currData));if(typeof Browser!="undefined"&&Browser.mainLoop.func){Browser.mainLoop.resume()}var asyncWasmReturnValue,isError=false;try{asyncWasmReturnValue=Asyncify.doRewind(Asyncify.currData)}catch(err){asyncWasmReturnValue=err;isError=true}var handled=false;if(!Asyncify.currData){var asyncPromiseHandlers=Asyncify.asyncPromiseHandlers;if(asyncPromiseHandlers){Asyncify.asyncPromiseHandlers=null;(isError?asyncPromiseHandlers.reject:asyncPromiseHandlers.resolve)(asyncWasmReturnValue);handled=true}}if(isError&&!handled){throw asyncWasmReturnValue}});reachedAfterCallback=true;if(!reachedCallback){Asyncify.state=Asyncify.State.Unwinding;Asyncify.currData=Asyncify.allocateData();if(typeof Browser!="undefined"&&Browser.mainLoop.func){Browser.mainLoop.pause()}runAndAbortIfError(()=>_asyncify_start_unwind(Asyncify.currData))}}else if(Asyncify.state===Asyncify.State.Rewinding){Asyncify.state=Asyncify.State.Normal;runAndAbortIfError(_asyncify_stop_rewind);_free(Asyncify.currData);Asyncify.currData=null;Asyncify.sleepCallbacks.forEach(func=>callUserCallback(func))}else{abort("invalid state: "+Asyncify.state)}return Asyncify.handleSleepReturnValue},handleAsync:function(startAsync){return Asyncify.handleSleep(wakeUp=>{startAsync().then(wakeUp)})}};var FSNode=function(parent,name,mode,rdev){if(!parent){parent=this}this.parent=parent;this.mount=parent.mount;this.mounted=null;this.id=FS.nextInode++;this.name=name;this.mode=mode;this.node_ops={};this.stream_ops={};this.rdev=rdev};var readMode=292|73;var writeMode=146;Object.defineProperties(FSNode.prototype,{read:{get:function(){return(this.mode&readMode)===readMode},set:function(val){val?this.mode|=readMode:this.mode&=~readMode}},write:{get:function(){return(this.mode&writeMode)===writeMode},set:function(val){val?this.mode|=writeMode:this.mode&=~writeMode}},isFolder:{get:function(){return FS.isDir(this.mode)}},isDevice:{get:function(){return FS.isChrdev(this.mode)}}});FS.FSNode=FSNode;FS.staticInit();Module["FS_createPath"]=FS.createPath;Module["FS_createDataFile"]=FS.createDataFile;Module["FS_createPreloadedFile"]=FS.createPreloadedFile;Module["FS_unlink"]=FS.unlink;Module["FS_createLazyFile"]=FS.createLazyFile;Module["FS_createDevice"]=FS.createDevice;var GLctx;for(var i=0;i<32;++i)tempFixedLengthArray.push(new Array(i));var miniTempWebGLFloatBuffersStorage=new Float32Array(288);for(var i=0;i<288;++i){miniTempWebGLFloatBuffers[i]=miniTempWebGLFloatBuffersStorage.subarray(0,i+1)}var __miniTempWebGLIntBuffersStorage=new Int32Array(288);for(var i=0;i<288;++i){__miniTempWebGLIntBuffers[i]=__miniTempWebGLIntBuffersStorage.subarray(0,i+1)}Module["requestFullscreen"]=function Module_requestFullscreen(lockPointer,resizeCanvas){Browser.requestFullscreen(lockPointer,resizeCanvas)};Module["requestAnimationFrame"]=function Module_requestAnimationFrame(func){Browser.requestAnimationFrame(func)};Module["setCanvasSize"]=function Module_setCanvasSize(width,height,noUpdates){Browser.setCanvasSize(width,height,noUpdates)};Module["pauseMainLoop"]=function Module_pauseMainLoop(){Browser.mainLoop.pause()};Module["resumeMainLoop"]=function Module_resumeMainLoop(){Browser.mainLoop.resume()};Module["getUserMedia"]=function Module_getUserMedia(){Browser.getUserMedia()};Module["createContext"]=function Module_createContext(canvas,useWebGL,setInModule,webGLContextAttributes){return Browser.createContext(canvas,useWebGL,setInModule,webGLContextAttributes)};var preloadedImages={};var preloadedAudios={};var asmLibraryArg={"a":___assert_fail,"z":___syscall_fcntl64,"Sa":___syscall_getcwd,"Va":___syscall_ioctl,"Wa":___syscall_openat,"d":_emscripten_asm_const_int,"Xa":_emscripten_date_now,"Z":_emscripten_get_element_css_size,"U":_emscripten_get_gamepad_status,"A":_emscripten_get_now,"V":_emscripten_get_num_gamepads,"Ld":_emscripten_glActiveTexture,"Kd":_emscripten_glAttachShader,"P":_emscripten_glBeginQueryEXT,"Jd":_emscripten_glBindAttribLocation,"Id":_emscripten_glBindBuffer,"Gd":_emscripten_glBindFramebuffer,"Fd":_emscripten_glBindRenderbuffer,"Ed":_emscripten_glBindTexture,"H":_emscripten_glBindVertexArrayOES,"Dd":_emscripten_glBlendColor,"Cd":_emscripten_glBlendEquation,"Bd":_emscripten_glBlendEquationSeparate,"Ad":_emscripten_glBlendFunc,"zd":_emscripten_glBlendFuncSeparate,"yd":_emscripten_glBufferData,"xd":_emscripten_glBufferSubData,"wd":_emscripten_glCheckFramebufferStatus,"vd":_emscripten_glClear,"ud":_emscripten_glClearColor,"td":_emscripten_glClearDepthf,"sd":_emscripten_glClearStencil,"rd":_emscripten_glColorMask,"qd":_emscripten_glCompileShader,"pd":_emscripten_glCompressedTexImage2D,"od":_emscripten_glCompressedTexSubImage2D,"nd":_emscripten_glCopyTexImage2D,"md":_emscripten_glCopyTexSubImage2D,"ld":_emscripten_glCreateProgram,"kd":_emscripten_glCreateShader,"jd":_emscripten_glCullFace,"id":_emscripten_glDeleteBuffers,"hd":_emscripten_glDeleteFramebuffers,"gd":_emscripten_glDeleteProgram,"R":_emscripten_glDeleteQueriesEXT,"fd":_emscripten_glDeleteRenderbuffers,"ed":_emscripten_glDeleteShader,"dd":_emscripten_glDeleteTextures,"G":_emscripten_glDeleteVertexArraysOES,"bd":_emscripten_glDepthFunc,"ad":_emscripten_glDepthMask,"$c":_emscripten_glDepthRangef,"_c":_emscripten_glDetachShader,"Zc":_emscripten_glDisable,"Yc":_emscripten_glDisableVertexAttribArray,"Xc":_emscripten_glDrawArrays,"Od":_emscripten_glDrawArraysInstancedANGLE,"Pd":_emscripten_glDrawBuffersWEBGL,"Wc":_emscripten_glDrawElements,"Nd":_emscripten_glDrawElementsInstancedANGLE,"Vc":_emscripten_glEnable,"Uc":_emscripten_glEnableVertexAttribArray,"O":_emscripten_glEndQueryEXT,"Sc":_emscripten_glFinish,"Rc":_emscripten_glFlush,"Qc":_emscripten_glFramebufferRenderbuffer,"Pc":_emscripten_glFramebufferTexture2D,"Oc":_emscripten_glFrontFace,"Nc":_emscripten_glGenBuffers,"Lc":_emscripten_glGenFramebuffers,"S":_emscripten_glGenQueriesEXT,"Kc":_emscripten_glGenRenderbuffers,"Jc":_emscripten_glGenTextures,"Rd":_emscripten_glGenVertexArraysOES,"Mc":_emscripten_glGenerateMipmap,"Ic":_emscripten_glGetActiveAttrib,"Hc":_emscripten_glGetActiveUniform,"Gc":_emscripten_glGetAttachedShaders,"Fc":_emscripten_glGetAttribLocation,"Ec":_emscripten_glGetBooleanv,"Dc":_emscripten_glGetBufferParameteriv,"Cc":_emscripten_glGetError,"Bc":_emscripten_glGetFloatv,"Ac":_emscripten_glGetFramebufferAttachmentParameteriv,"zc":_emscripten_glGetIntegerv,"xc":_emscripten_glGetProgramInfoLog,"yc":_emscripten_glGetProgramiv,"J":_emscripten_glGetQueryObjecti64vEXT,"L":_emscripten_glGetQueryObjectivEXT,"I":_emscripten_glGetQueryObjectui64vEXT,"K":_emscripten_glGetQueryObjectuivEXT,"M":_emscripten_glGetQueryivEXT,"wc":_emscripten_glGetRenderbufferParameteriv,"uc":_emscripten_glGetShaderInfoLog,"tc":_emscripten_glGetShaderPrecisionFormat,"sc":_emscripten_glGetShaderSource,"vc":_emscripten_glGetShaderiv,"rc":_emscripten_glGetString,"qc":_emscripten_glGetTexParameterfv,"pc":_emscripten_glGetTexParameteriv,"mc":_emscripten_glGetUniformLocation,"oc":_emscripten_glGetUniformfv,"nc":_emscripten_glGetUniformiv,"jc":_emscripten_glGetVertexAttribPointerv,"lc":_emscripten_glGetVertexAttribfv,"kc":_emscripten_glGetVertexAttribiv,"ic":_emscripten_glHint,"hc":_emscripten_glIsBuffer,"gc":_emscripten_glIsEnabled,"fc":_emscripten_glIsFramebuffer,"dc":_emscripten_glIsProgram,"Q":_emscripten_glIsQueryEXT,"cc":_emscripten_glIsRenderbuffer,"bc":_emscripten_glIsShader,"ac":_emscripten_glIsTexture,"Qd":_emscripten_glIsVertexArrayOES,"$b":_emscripten_glLineWidth,"_b":_emscripten_glLinkProgram,"Zb":_emscripten_glPixelStorei,"Yb":_emscripten_glPolygonOffset,"N":_emscripten_glQueryCounterEXT,"Xb":_emscripten_glReadPixels,"Wb":_emscripten_glReleaseShaderCompiler,"Tb":_emscripten_glRenderbufferStorage,"Sb":_emscripten_glSampleCoverage,"Rb":_emscripten_glScissor,"Qb":_emscripten_glShaderBinary,"Pb":_emscripten_glShaderSource,"Ob":_emscripten_glStencilFunc,"Nb":_emscripten_glStencilFuncSeparate,"Mb":_emscripten_glStencilMask,"Lb":_emscripten_glStencilMaskSeparate,"Kb":_emscripten_glStencilOp,"Ib":_emscripten_glStencilOpSeparate,"Hb":_emscripten_glTexImage2D,"Gb":_emscripten_glTexParameterf,"Fb":_emscripten_glTexParameterfv,"Eb":_emscripten_glTexParameteri,"Db":_emscripten_glTexParameteriv,"Cb":_emscripten_glTexSubImage2D,"Bb":_emscripten_glUniform1f,"Ab":_emscripten_glUniform1fv,"zb":_emscripten_glUniform1i,"yb":_emscripten_glUniform1iv,"xb":_emscripten_glUniform2f,"wb":_emscripten_glUniform2fv,"vb":_emscripten_glUniform2i,"ub":_emscripten_glUniform2iv,"tb":_emscripten_glUniform3f,"sb":_emscripten_glUniform3fv,"rb":_emscripten_glUniform3i,"qb":_emscripten_glUniform3iv,"pb":_emscripten_glUniform4f,"ob":_emscripten_glUniform4fv,"nb":_emscripten_glUniform4i,"mb":_emscripten_glUniform4iv,"lb":_emscripten_glUniformMatrix2fv,"kb":_emscripten_glUniformMatrix3fv,"jb":_emscripten_glUniformMatrix4fv,"ib":_emscripten_glUseProgram,"hb":_emscripten_glValidateProgram,"gb":_emscripten_glVertexAttrib1f,"fb":_emscripten_glVertexAttrib1fv,"db":_emscripten_glVertexAttrib2f,"cb":_emscripten_glVertexAttrib2fv,"bb":_emscripten_glVertexAttrib3f,"ab":_emscripten_glVertexAttrib3fv,"$a":_emscripten_glVertexAttrib4f,"_a":_emscripten_glVertexAttrib4fv,"Md":_emscripten_glVertexAttribDivisorANGLE,"Za":_emscripten_glVertexAttribPointer,"Ya":_emscripten_glViewport,"Pa":_emscripten_resize_heap,"s":_emscripten_run_script,"W":_emscripten_sample_gamepad_data,"ea":_emscripten_set_click_callback_on_thread,"fa":_emscripten_set_fullscreenchange_callback_on_thread,"$":_emscripten_set_gamepadconnected_callback_on_thread,"_":_emscripten_set_gamepaddisconnected_callback_on_thread,"aa":_emscripten_set_touchcancel_callback_on_thread,"ca":_emscripten_set_touchend_callback_on_thread,"ba":_emscripten_set_touchmove_callback_on_thread,"da":_emscripten_set_touchstart_callback_on_thread,"Y":_emscripten_sleep,"Qa":_environ_get,"Ra":_environ_sizes_get,"Vb":_exit,"B":_fd_close,"Ua":_fd_read,"Oa":_fd_seek,"Ta":_fd_write,"F":_glActiveTexture,"x":_glAttachShader,"i":_glBindAttribLocation,"c":_glBindBuffer,"f":_glBindTexture,"eb":_glBlendFunc,"l":_glBufferData,"n":_glBufferSubData,"C":_glClear,"D":_glClearColor,"La":_glClearDepthf,"Ca":_glCompileShader,"Ha":_glCompressedTexImage2D,"Aa":_glCreateProgram,"Ea":_glCreateShader,"Ub":_glCullFace,"Ga":_glDeleteProgram,"Na":_glDepthFunc,"ec":_glDisable,"cd":_glDrawArrays,"Tc":_glDrawElements,"E":_glEnable,"g":_glEnableVertexAttribArray,"Ma":_glFrontFace,"m":_glGenBuffers,"Ja":_glGenTextures,"q":_glGetAttribLocation,"Jb":_glGetFloatv,"ya":_glGetProgramInfoLog,"w":_glGetProgramiv,"Ba":_glGetShaderInfoLog,"y":_glGetShaderiv,"k":_glGetString,"p":_glGetUniformLocation,"za":_glLinkProgram,"Ka":_glPixelStorei,"Fa":_glReadPixels,"Da":_glShaderSource,"Ia":_glTexImage2D,"r":_glTexParameterf,"j":_glTexParameteri,"Hd":_glUniform1i,"Sd":_glUniform4f,"ha":_glUniformMatrix4fv,"t":_glUseProgram,"h":_glVertexAttribPointer,"o":_glViewport,"u":_glfwCreateWindow,"va":_glfwDefaultWindowHints,"v":_glfwGetPrimaryMonitor,"b":_glfwGetTime,"ua":_glfwGetVideoModes,"wa":_glfwInit,"ia":_glfwMakeContextCurrent,"na":_glfwSetCharCallback,"ja":_glfwSetCursorEnterCallback,"la":_glfwSetCursorPosCallback,"pa":_glfwSetDropCallback,"xa":_glfwSetErrorCallback,"oa":_glfwSetKeyCallback,"ma":_glfwSetMouseButtonCallback,"ka":_glfwSetScrollCallback,"qa":_glfwSetWindowFocusCallback,"ra":_glfwSetWindowIconifyCallback,"T":_glfwSetWindowShouldClose,"sa":_glfwSetWindowSizeCallback,"X":_glfwSwapBuffers,"ga":_glfwSwapInterval,"ta":_glfwTerminate,"e":_glfwWindowHint};var asm=createWasm();var ___wasm_call_ctors=Module["___wasm_call_ctors"]=function(){return(___wasm_call_ctors=Module["___wasm_call_ctors"]=Module["asm"]["Ud"]).apply(null,arguments)};var _malloc=Module["_malloc"]=function(){return(_malloc=Module["_malloc"]=Module["asm"]["Vd"]).apply(null,arguments)};var _free=Module["_free"]=function(){return(_free=Module["_free"]=Module["asm"]["Wd"]).apply(null,arguments)};var _main=Module["_main"]=function(){return(_main=Module["_main"]=Module["asm"]["Xd"]).apply(null,arguments)};var ___errno_location=Module["___errno_location"]=function(){return(___errno_location=Module["___errno_location"]=Module["asm"]["Yd"]).apply(null,arguments)};var _ma_malloc_emscripten=Module["_ma_malloc_emscripten"]=function(){return(_ma_malloc_emscripten=Module["_ma_malloc_emscripten"]=Module["asm"]["Zd"]).apply(null,arguments)};var _ma_free_emscripten=Module["_ma_free_emscripten"]=function(){return(_ma_free_emscripten=Module["_ma_free_emscripten"]=Module["asm"]["_d"]).apply(null,arguments)};var _ma_device_process_pcm_frames_capture__webaudio=Module["_ma_device_process_pcm_frames_capture__webaudio"]=function(){return(_ma_device_process_pcm_frames_capture__webaudio=Module["_ma_device_process_pcm_frames_capture__webaudio"]=Module["asm"]["$d"]).apply(null,arguments)};var _ma_device_process_pcm_frames_playback__webaudio=Module["_ma_device_process_pcm_frames_playback__webaudio"]=function(){return(_ma_device_process_pcm_frames_playback__webaudio=Module["_ma_device_process_pcm_frames_playback__webaudio"]=Module["asm"]["ae"]).apply(null,arguments)};var stackAlloc=Module["stackAlloc"]=function(){return(stackAlloc=Module["stackAlloc"]=Module["asm"]["ce"]).apply(null,arguments)};var dynCall_vii=Module["dynCall_vii"]=function(){return(dynCall_vii=Module["dynCall_vii"]=Module["asm"]["de"]).apply(null,arguments)};var dynCall_iiii=Module["dynCall_iiii"]=function(){return(dynCall_iiii=Module["dynCall_iiii"]=Module["asm"]["ee"]).apply(null,arguments)};var dynCall_viiii=Module["dynCall_viiii"]=function(){return(dynCall_viiii=Module["dynCall_viiii"]=Module["asm"]["fe"]).apply(null,arguments)};var dynCall_viii=Module["dynCall_viii"]=function(){return(dynCall_viii=Module["dynCall_viii"]=Module["asm"]["ge"]).apply(null,arguments)};var dynCall_viiiii=Module["dynCall_viiiii"]=function(){return(dynCall_viiiii=Module["dynCall_viiiii"]=Module["asm"]["he"]).apply(null,arguments)};var dynCall_vidd=Module["dynCall_vidd"]=function(){return(dynCall_vidd=Module["dynCall_vidd"]=Module["asm"]["ie"]).apply(null,arguments)};var dynCall_vi=Module["dynCall_vi"]=function(){return(dynCall_vi=Module["dynCall_vi"]=Module["asm"]["je"]).apply(null,arguments)};var _asyncify_start_unwind=Module["_asyncify_start_unwind"]=function(){return(_asyncify_start_unwind=Module["_asyncify_start_unwind"]=Module["asm"]["ke"]).apply(null,arguments)};var _asyncify_stop_unwind=Module["_asyncify_stop_unwind"]=function(){return(_asyncify_stop_unwind=Module["_asyncify_stop_unwind"]=Module["asm"]["le"]).apply(null,arguments)};var _asyncify_start_rewind=Module["_asyncify_start_rewind"]=function(){return(_asyncify_start_rewind=Module["_asyncify_start_rewind"]=Module["asm"]["me"]).apply(null,arguments)};var _asyncify_stop_rewind=Module["_asyncify_stop_rewind"]=function(){return(_asyncify_stop_rewind=Module["_asyncify_stop_rewind"]=Module["asm"]["ne"]).apply(null,arguments)};var ___start_em_js=Module["___start_em_js"]=55415;var ___stop_em_js=Module["___stop_em_js"]=55490;Module["addRunDependency"]=addRunDependency;Module["removeRunDependency"]=removeRunDependency;Module["FS_createPath"]=FS.createPath;Module["FS_createDataFile"]=FS.createDataFile;Module["FS_createPreloadedFile"]=FS.createPreloadedFile;Module["FS_createLazyFile"]=FS.createLazyFile;Module["FS_createDevice"]=FS.createDevice;Module["FS_unlink"]=FS.unlink;var calledRun;dependenciesFulfilled=function runCaller(){if(!calledRun)run();if(!calledRun)dependenciesFulfilled=runCaller};function callMain(args){var entryFunction=Module["_main"];args=args||[];args.unshift(thisProgram);var argc=args.length;var argv=stackAlloc((argc+1)*4);var argv_ptr=argv>>2;args.forEach(arg=>{HEAP32[argv_ptr++]=allocateUTF8OnStack(arg)});HEAP32[argv_ptr]=0;try{var ret=entryFunction(argc,argv);exitJS(ret,true);return ret}catch(e){return handleException(e)}}function run(args){args=args||arguments_;if(runDependencies>0){return}preRun();if(runDependencies>0){return}function doRun(){if(calledRun)return;calledRun=true;Module["calledRun"]=true;if(ABORT)return;initRuntime();preMain();if(Module["onRuntimeInitialized"])Module["onRuntimeInitialized"]();if(shouldRunNow)callMain(args);postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(function(){setTimeout(function(){Module["setStatus"]("")},1);doRun()},1)}else{doRun()}}if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].pop()()}}var shouldRunNow=true;if(Module["noInitialRun"])shouldRunNow=false;run(); diff --git a/docs/static_demos/tree/wind_tree.html b/docs/static_demos/tree/wind_tree.html deleted file mode 100644 index 2c2f8df..0000000 --- a/docs/static_demos/tree/wind_tree.html +++ /dev/null @@ -1 +0,0 @@ -Yaksha/raylib web game

\ No newline at end of file diff --git a/docs/tutorials.html b/docs/tutorials.html deleted file mode 100644 index 4fe1233..0000000 --- a/docs/tutorials.html +++ /dev/null @@ -1,118 +0,0 @@ -Yaksha Programming Language


1 Getting started

Created 2023-07-30, Last Updated 2023-09-07
  • Author(s): Bhathiya Perera

1.1 Setting things up

1.1.1 Downloading

  • Head to releases

  • Pick an archive format you like .7z or .zip (both has same content and .7z is almost always likely to be smaller in size)

  • Since this is a new language we recommend you always download latest version. Please expect things to not work.

1.1.2 Installing

  • After download is completed you can extract the archive. Here are few ways:

  • GNU/Linux: use 7za or unzip depending on archive format.
  • Now you can add bin directory to PATH.

  • If you are in GNU/Linux ensure that binaries in the bin directory have +x (executable) permission assigned. chmod +x *

1.1.3 Basics of Yaksha Programming Language

1.1.3.1 Hello World

Steps:

First save below code to a file named "hello.yaka"

def main() -> int:
-    println("Hello World!")
-    return 0
-

In Yaksha we use .yaka extension for source files. Also, we use -> to denote return type of a function.

Additionally entry point of a program is main function. Main function must always return an int value. In this case we return 0 to indicate that program has exited successfully. Additionally we use println builtin function to print a line to standard output.

Now you can compile it using yaksha command.

yaksha build -R hello.yaka
-

Internally yaksha build command will invoke carpntr binary included in the distribution. carpntr is the builder tool for Yaksha. It will compile the source file and generate a binary named hello in the current directory. Additionally it will generate a hello.c file which is the C code generated by the compiler. You can inspect this file to see how the compiler works. -R option for carpntr (or yaksha build) will execute the binary after compilation.

carpntr (or yaksha build) has many options. You can see them by running yaksha build --help or carpntr --help. Under the hood carpntr uses bundled zig compiler (with zig cc) and compile c code to a binary.

1.1.3.2 Comments

Yaksha programming language use # as an indicator for starting a comment.

# This is a comment
-def main() -> int:
-    a = "Hello # This is not a comment"
-    println(a)
-    # We can also omit return here
-    0
-
1.1.3.3 Data types

Yaksha has many data types. Here are few of them:

  • int: 32 bit signed integer (Examples: 1, 100i32)
  • float: 32 bit floating point number (Examples: 1.0f, 100.0f)
  • bool: Boolean value (Examples: True, False)
  • str: partially memory managed string type. (You need to cleanup if you assign to a struct/class or into an array) (Examples: "Hello World!", """Hello World!""")
  • sr: a reference to a string.
  • None: represents NULL value or void

You can find more data types and how to use them in the documentation. Since this is a tutorial we will not cover them here.

About str:

str is a partially memory managed string type. This means that if you just use str without assigning it to struct/class/arrays or any other data structures you don't need to worry about memory management. However, if you do, you need to cleanup. str implementation uses lot of copying and deletions. This is not the most efficient way to do things. However, it is the easiest way to do things.

About None:

None compiles to either NULL or void depending on the context. You can use None to indicate that a function does not return anything. You can also compare heap structures with None to check if they are NULL.

1.1.3.4 Builtin functions

Out of the box Yaksha provides few builtin functions. Builtin functions compile to various things, therefore they cannot be referenced to create Function[...] variables.

Here are few of them:

  • println: prints a line to standard output
  • print: prints to standard output (no line ending)
1.1.3.5 Variables

You can create a variable by simply using a let statement.

Statements such as a = 1 can be either a let statement or an assignment.

def main() -> int:
-    a = 1      # let
-    b: int = 2 # let
-    a += 2
-    a += b
-    b = a      # assignment
-    println(b)
-    return 0
-

When creating a variable, an identifier should be on the left hand side.

a = 10
-

This make above statement valid.

10 = 20
-

However, a statement such as above is invalid.

You will get an error message like test_file.yaka:2:8 at "=" --> Invalid assignment target!

Following will not even parse

10: int = 20
-

This will generate an error such as test_file.yaka:2:7 at ":" --> Expect new line after value for expression.

Ambiguity in assignment vs let.

Parser does not know if a = 10 is an assignment or a let statement. So it is up to the later steps of the compiler to determine if a is already defined or not. And based on the outcome, type of a is inferred and can be promoted to a let statement. However, unlike languages such as Python type of a cannot be changed later on. Once defined it should remain same type.

1.1.3.6 Statements

Yaksha support various statements such as loops (for and while), if statements, break, continue, return, defer, del, def, pass, import and class (or struct) statements.

See below for a sample usage of a while loop.

def main() -> int:
-    while True:
-        println("loop")
-        break
-    return 0
-

In above example we are using a def statement to create our main function. Which will be the entry point of any Yaksha program. while statement will be executed once printing the world loop in your terminal emulator / console. Program will return 0 to indicate success.

1.1.3.7 Defining a function
def add(a: int, b: int) -> int: a + b
-

Above is an example of how we can define a function called add which can add two integers a and b and return a + b. In above function we have omitted return statement as that can be inferred by the compiler.

def function_name(p1: dt1, p2: dt2, ...) -> return_datatype:
-    ...
-    # body of the function
-    ...
-

Standard functions look like above. p1, p2 are parameters and dt1, dt2 are associated data types.

There are two possible ways of passing arguments to a function. by value and by reference. Primitive data types (and str) are always passed by value. (By value means a new copy is created when invoking a function). Additionally Tuple data types and structs are also passed by value. Objects created from classes are passed by reference. Additionally Ptr, Array and AnyPtr will be passed by reference as well. sr works same as a reference.

Now let's try and use our add function.

def add(a: int, b: int) -> a + b
-
-def main() -> int:
-    println(add(1, 2))
-    return 0
-
1.1.3.8 Defining a struct
struct A:
-    a: int
-
-def main() -> int:
-    item: A
-    item.a = 0
-    return 0
-

When a structure is created, values are initialised to be of garbage values. You can also assign values to this immediately.

1.1.3.9 Scopes

Yaksha scopes are created with blocks. Variables created inside the scopes are not leaked outside. If you need any variable to be accessed outside, you need to ensure that the variable is first created outside.

if a == 5:
-    b: int = 5
-else:
-    b: int = 10
-println(b)    # ❌ <----- you cannot access b
-

Correct usage would be

b: int = 10
-if a == 5:
-    b = 5
-println(b)
-

This way you can access b afterwards.

1.1.3.10 Importing libraries

Yaksha comes with builtin libraries. Standard libraries can be accessed under libs namespace. Additionallyraylib for raylib and w4 for wasm4 library.

import libs.console
-
-def factorial(x: int) -> int:
-    if x <= 0:
-        return 1
-    return x * factorial(x - 1)
-
-def main() -> int:
-    a = 0
-    while a < 10:
-        console.cyan("factorial")
-        console.red("(")
-        print(a)
-        console.red(") = ")
-        println(factorial(a))
-        a = a + 1
-    return 0
-

Above code sample calculates factorial in a recursive manner. libs.console allow us to access cross platform console/terminal emulator functionality. You can use functions such as console.cyan(string) to print coloured text.

1.1.3.10.1 How import works

import libs.c -> this will add c as a globally accessible namespace for content of libs.c.

If you use something like import libs.c as clib then globally accessible namespace would be clib

Accessing as libs.console.cyan is invalid. You should use your_alias_here.cyan or console.cyan



2 YakshaLisp and macros in Yaksha

Created 2023-12-14, Last Updated 2023-12-15
  • Author(s): Bhathiya Perera

YakshaLisp is the builtin macro processing system in the Yaksha language. In this tutorial we will go through YakshaLisp basics, some builtin functions and how you can use those.

2.1 What makes YakshaLisp different from Yaksha

From the point of view of Yaksha language. YakshaLisp exist only during the compilation phase. Most of the programming languages consist of a DSL that acts as the meta programming layer. Think YakshaLisp as such DSL that exist to generate code.

2.2 YakshaLisp basics

Before we take a look at how to write macros, we need to understand how YakshaLisp works.

You can execute YakshaLisp REPL by running yaksha lisp command. (This is a very simple REPL)

2.2.1 Defining and setting a value

(def a 1)  # <--- a is initialized to 1
-(setq a 2) # <--- a value is changed to 2
-           # a is now set to 2
-

Shortcut.

(= a 1)   # <--- def or setq
-

2.2.2 S-expressions

(def a 1)  # <--- this is an S-expression
-

2.2.3 Q-expressions

(def a (quote 1 2 3))
-(def b {1 2 3})
-(== a b) # <---- truthy
-

Q-expressions are inspired by the make your own lisp. (However, we also do have special forms).

2.2.3.1 Difference between list, quote and Q-Expressions
(def a (list 1 2 3)) # <--- a is created with `list`
-(def b {1 2 3})      # <--- b created with `{}`
-(def c (quote 1 2 3))# <--- c is created with `quote`
-(== a b)             # <--- ==/!= type mismatch
-(== b c)             # <--- truthy
-(== (map eval b) a)  # <--- truthy
-

Individual elements in Q-expressions are not evaluated. However, if you want to evaluate them, you can use eval function with map function.

(quote ...) is same as {...}. However, quote is a function with a special form.

(map eval {(+ 0 1) (+ 1 1) (+ 1 2)}) # <---- {1 2 3}
-

2.2.4 Builtin values

  • nil - falsey value, it is same as {}

  • true - truthy value, it is same as 1

  • false - falsey value, it is same as 0

  • newline - newline character, either "\r\n" or "\n"

2.2.5 Simple builtins

(def a (+ 1 2)) # <----- a is 3
-(def b (- 2 1)) # <----- b is 1
-(def c (* 2 3)) # <----- c is 6
-(def d (/ 6 2)) # <----- d is 3
-

2.2.6 Comparison builtins

(def a (== 1 1)) # <----- a is true
-(def b (!= 1 1)) # <----- b is false
-(def c (< 1 2))  # <----- c is true
-(def d (> 1 2))  # <----- d is false
-(def e (<= 1 2)) # <----- e is true
-(def f (>= 1 2)) # <----- f is false
-

2.2.7 Logical builtins

(def a (and true true))  # <----- a is true
-(def b (and true false)) # <----- b is false
-(def c (or true false))  # <----- c is true
-(def d (or false false)) # <----- d is false
-(def e (not true))       # <----- e is false
-(def f (not false))      # <----- f is true
-

2.2.8 If builtin

(def a (if true 1 2)) # <----- a is 1
-(def b (if false 1 2))# <----- b is 2
-(def c (if true 1))   # <----- c is 1
-(def d (if false 1))  # <----- d is nil (same as {})
-

2.3 DSL macros

Currently YakshaLisp can be used to write DSL macros. In this tutorial we will go through how to write a simple DSL macro.

macros! {
-    # Get an integer_decimal token 7
-    (defun ymacro_get () (list (ykt_integer_decimal 7)))
-    # create a DSL macro named get! that executes above (defun ymacro_get...) function
-    (yk_register {dsl get ymacro_get})
-}
-
-def main() -> int:
-    e1 = array("int", 4, 5, 6, get!{})
-    for i: int in e1:
-        println(i)
-    del e1
-    return 0
-

This should print 4, 5, 6, 7 in individual lines. yk_register is a builtin function that registers a DSL macro. dsl is the type of the macro. get is the name of the macro. ymacro_get is the YakshaLisp function that executes when the macro is called.

\ No newline at end of file diff --git a/docs/yama.html b/docs/yama.html deleted file mode 100644 index 2d760c1..0000000 --- a/docs/yama.html +++ /dev/null @@ -1,470 +0,0 @@ -Yaksha Programming Language

YAMA 0001 - Exposing C enums/#defines/consts

Created 2023-07-30, Last Updated 2023-12-13
  • Author(s): Bhathiya Perera
  • Status : ✅

Problem

In C we can define enums such as below.

// Simple
-enum something1 {
-  SOMETHING1,
-  ANOTHER1
-};
-
-// Separate typedef
-enum something2 {
-  SOMETHING2,
-  ANOTHER2
-};
-typedef enum something2 something2_t;
-
-// Combined
-typedef enum
-{
-  SOMETHING3,
-  ANOTHER3
-} something3_t;
-

Currently we can use something like

SOMETHING: Const[int] = 0
-ANOTHER: Const[int] = 1
-

This however make it annoying to maintain, as we now have a copy of the enum value.

We can use below as well.

@nativemacro("SOMETHING")
-def something() -> int:
-    pass
-

This does not copy the value, but make it annoying to use the API as now we need to access this as something().

Suggestions

Suggestion 1

# Expose enum value / #define value
-nativexp "SOMETHING" as SOMETHING: Const[int]
-
-# Some simple constant calculations
-nativexp """1 + 1""" as TWO: Const[int]
-
  • Pro:
  • Clearly define that this is a native expression
  • Con:
  • Looks different

Suggestion 2

TWO: Const[int] = ccode """1 + 1"""
-
  • Pro:
  • Consistent syntax
  • Clearly define that this is a native expression (ccode)
  • Con:
  • None

Suggestion 3

TWO: Const[int] <- nativexp """1 + 1"""
-
  • Pro:
  • Clearly define that this is a native expression
  • Con:
  • Looks different

Suggestion 4

nativexp """1 + 1""" -> TWO: Const[int]
-
  • Pro:
  • None
  • Con:
  • Looks different

Suggestion 5

TWO: Const[int] = nativexp """1 + 1"""
-
  • Pro:
  • Consistent syntax
  • Clearly define that this is a native expression (ccode)
  • Con:
  • New keyword is introduced

This would compile to

#define yk__TWO (1 + 1)
-

Conclusion

I'm going with suggestion 2 as it uses already existing keywords and also at the same time looks consistent with current constants.



YAMA 0002 - Adding support for stack allocated structs

Created 2023-07-30, Last Updated 2023-12-13
  • Author(s): Bhathiya Perera
  • Status : ✅

Problem

class Enemy:
-    x: int
-    y: int
-    hit_points: int
-
-def main() -> int:
-    enemies: Array[Enemy] = arrnew("Enemy", 2)
-    enemies[0] = Enemy()
-    enemies[1] = Enemy()
-    return 0
-

Given a structure like above, it makes no sense to allocate individual objects in heap all the time.

We can avoid it by using Tuple however we lose the information about field names then.

Keep in mind that the Tuple's in Yaksha are mutable (Mutable Tuples are what we have at the moment, may or may not change in future).

Suggestions

Suggestion 1

@namedtuple
-class Enemy:
-    x: int
-    y: int
-    hit_points: int
-
  • Pro:
  • Consistent syntax
  • Does not introduce a new keyword
  • Con:
  • No way to tell that this get allocated in stack?

Suggestion 2

@dataclass
-class Enemy:
-    x: int
-    y: int
-    hit_points: int
-
  • Pro:
  • Consistent syntax
  • Does not introduce a new keyword
  • Familiarity
  • Con:
  • No way to tell that this get allocated in stack?
  • Looks like python but different might make it confusing

Suggestion 3

class Enemy:
-    x: int
-    y: int
-    hit_points: int
-Enemy()     # << allocate on stack
-new Enemy() # << allocate on heap
-
  • Pro:
  • Similar to how C++ works.
  • new - del pairing
  • Con:
  • Need to rewrite everything to follow this convention
  • Note⚠️⚠️:
  • Perhaps reconsider this approach at some point

Suggestion 4 ✅

@onstack
-class Enemy:
-    x: int
-    y: int
-    hit_points: int
-# Rename @dotaccess to @onstack
-# And use that for this purpose
-Enemy() # This is disallowed. Just create a variable and you can use it.
-
  • Pro:
  • Defines that this is different from a normal class
  • Clearly visible that this get allocated on stack
  • Con:
  • Require changes to how @dotaccess works currently

Conclusion

I am thinking suggestion 4 is the best approach.

Update

Additionally Yaksha now supports struct keyword. That act as a syntax sugar for @onstack class.



YAMA 0003 - For loop / loop

Created 2023-07-30, Last Updated 2023-12-13
  • Author(s): Bhathiya Perera
  • Status : ✅

Problem

Yaksha programming language does not offer a for syntax sugar. This is annoying for someone coming from Python or other languages that has this feature.

We have foreach builtin and while loop, which can be used at the moment. for can make certain things easy.

Use case 1 - for each element in array ✅

How it works now

items: Array[int] = get_it()
-
-c: int = 0
-length: int = len(items)
-
-while c < length:
-    if items[c] == 2:
-        c += 1
-        continue
-    println(items[c])
-    c += 1
-

Syntax sugar (we will keep compulsory data types for now)

for item: int in get_it(): # get_it should return Array[T]
-    if item == 2:
-        continue
-    println(item)
-

Desugared

yy__1t: Array[int] = get_it()
-yy__2t: int = 0
-yy__3t: int = len(yk__1t)
-
-while yy__2t < yy__3t:
-    ccode """#define yy__item yy__1t[yy__2t]\n// desugar begin"""
-    expose_native item: int      # To expose what we put in above C code
-    if item == 2:
-        yy__2t += 1
-        continue                 # Continue must increase the counter
-    println(item)
-    ccode """#undef yy__item\n// desugar end"""
-    yy__2t += 1               # Increase count at the very end
-

Use case 2 - endless loops ✅

Syntax sugar

for:
-    game_step()
-    log_stuff()
-

Desugared

while True:
-    game_step()
-    log_stuff()
-

Use case 3 - custom iterators / iterables ⚠️(deferred at this step)

Syntax sugar

def next_book(x: Books) -> Book:
-    pass
-
-def has_next_book(x: Books) -> bool:
-    pass
-
-def process() -> None:
-    books: Books = get_it()
-    it: Iterator[Book] = iterator("Book", books, next_book, has_next_book)
-    for element: Book in it:
-        print_book(element)
-

Use case 4 - range for loops ⚠️(not required a we have c-like for loops)

Syntax sugar

# Example 1
-r: Range[int] = range(1, 5, 2)
-for i: int in r:
-    if i == 1: # do not print 1
-       continue
-    println(i)
-
-# Example 2
-for i: int in range(1, 5, 2):
-    if i == 1: # do not print 1
-       continue
-    println(i)
-

Desugared

r: Tuple[int, int, int]
-r[0] = 1
-r[1] = 5
-r[2] = 2
-
-hidden__c = r[0]
-while hidden__c < r[1]:
-    i: int = hidden__c
-    if i == 1:
-        hidden__c += r[2]
-        continue
-    println(i)
-    hidden__c += r[2]
-

Conclusion

Iterators/Ranges are deferred for now. It would be better to come up with a generic Iterator approach for these.

At the moment I think endless loops and simple for-each style loops should be implemented.



YAMA 0004 - Iterators

Created 2023-07-30, Last Updated 2023-12-13
  • Author(s): Bhathiya Perera
  • Status : Draft

Problem

We would like to introduce support for iterators, such that it allows Yaksha to simply iterate arbitrary content.

Use case 1 - custom iterators / iterables

Syntax sugar

def next_book(x: Ptr[Books]) -> Book:
-    pass
-
-def has_next_book(x: Ptr[Books]) -> bool:
-    pass
-
-def process() -> None:
-    books: Books = get_it()
-    # Books is the mutable state that is passed to next_book and has_next_book
-    # Book is the type that is returned from the next_book
-    it: Iterator[Book] = iterator(books, next_book, has_next_book)
-
-    for element: Book in it:
-        print_book(element)
-

Desugared

def next_book(x: Ptr[Books]) -> Book:
-    pass
-
-def has_next_book(x: Ptr[Books]) -> bool:
-    pass
-
-def process() -> None:
-    books: Books = get_it()
-
-    it: Tuple[Books, .., ..]
-    it[0] = books
-    it[1] = next_book
-    it[2] = has_next_book
-
-    while (it[1])(getref(it[0])):
-        element: Book = (it[2])(getref(it[0]))
-        print_book(element)
-

Use case 2 - range for loops

Syntax sugar

# Example 1
-r: Iterator[int] = range(1, 5, 2)
-for i: int in r:
-    if i == 1: # do not print 1
-       continue
-    println(i)
-
-# Example 2 (would desugar similarly)
-for i: int in range(1, 5, 2):
-    if i == 1: # do not print 1
-       continue
-    println(i)
-

Desugared

r: Tuple[Tuple[int, int, int, int], .., ..]
-yy__1t: Tuple[int, int, int, int]
-yy__1t[0] = 1       # start
-yy__1t[1] = 5       # stop *non inclusive
-yy__1t[2] = 2       # step
-yy__1t[3] = yy__1t[0] # current item
-r[0] = yy__1t
-r[1] = yk__next_range
-r[2] = yk__has_range
-
-while (r[1])(getref(r[0])):
-    i: int = (r[2])(getref(r[0]))
-    if i == 1:
-        continue
-    println(i)
-

Conclusion

Iterators make a fine addition to foreach loop.



YAMA 0005 - DSL macros for Yaksha

Created 2023-07-30, Last Updated 2023-12-15
  • Author(s): Bhathiya Perera
  • Status : In Progress

Problem

Macros allow for compile time code generation. Yaksha already supports multiple ways of exposing and defining C macros. However, C macros are not easy to use. Other than for exposing things written in C one should avoid using C macros in Yaksha (@nativexxx).

Proposal

YakshaLisp would be a language of its own. Capable of executing at compile time of Yaksha (and also as a command line interpreter).

WHY?

  • Lisp is a great language for meta programming.

  • Lisp can be used to manipulate lists. (List processing 😄)

  • Token list to token list transformation is a good fit for lisp.

  • Simplest form of syntax to learn.

  • Yak-shaving is fun. (Did you see what I did there? 😄)

  • Feels nicer and user-friendly than C macros and @nativexxx in Yaksha.

Command line interpreter

Use YakshaLisp as its own programming language.

  • yaksha lisp - Run YakshaLisp interpreter REPL (Just YakshaLisp code, no macros!{} required)

  • yaksha lisp <file> - Execute just YakshaLisp code. (Don't use macros!{} here)

DSL macros

DSL macros get a list of tokens and outputs a list of tokens. This allows for more complex logic to be written in YakshaLisp macros.

Any DSL macro inside {} will be also expanded.

Most nested macro invocation will be expanded first. These macros can call other macros as you call a function and support iteration and recursion. These macros will only be expanded once.

Builtin functionality of YakshaLisp
  • Printing to console ✅

  • Reading from console ✅ - Requires enable_print to be called, before calling print and println, console output of yaksha compile maybe altered using this. Therefore, this is disabled by default.

  • Reading/writing text files ✅

  • Strings, decimal Integers ✅

  • List manipulation ✅

  • Maps (string -> value only) ✅

  • Map literals, and manipulation ✅

  • Working with Yaksha tokens ✅

  • Iteration ✅

  • Conditions - if, cond ✅

  • Few functional built ins - map, reduce, range ✅

  • Q-Expressions inspired by Build Your Own Lisp lisp dialect. ✅ (This is somewhat similar to '(+ 1 2 3))

  • Eval and parse ✅

  • Token generation for Yaksha ✅

  • Executing commands 🟡 (Implemented. however, this is enabled all the time)

  • Macros for YakshaLisp ✅

  • Imports ✅

  • Hygienic macros - gensym ✅ / metagensym 🟡

  • Garbage collection ✅

Item 1 - Initial DSL macro support ✅

# ╔═╗┌─┐┌┬┐┌─┐┬┬  ┌─┐  ╔╦╗┬┌┬┐┌─┐
-# ║  │ ││││├─┘││  ├┤    ║ ││││├┤
-# ╚═╝└─┘┴ ┴┴  ┴┴─┘└─┘   ╩ ┴┴ ┴└─┘
-# ╔═╗┬┌─┐┌─┐  ╔╗ ┬ ┬┌─┐┌─┐
-# ╠╣ │┌─┘┌─┘  ╠╩╗│ │┌─┘┌─┘
-# ╚  ┴└─┘└─┘  ╚═╝└─┘└─┘└─┘
-macros!{
-    (defun to_fb (n) (+ (if (== n 1) "" " ") (cond
-        ((== 0 (modulo n 15)) "FizzBuzz")
-        ((== 0 (modulo n 3)) "Fizz")
-        ((== 0 (modulo n 5)) "Buzz")
-        (true (to_string n))
-        )))
-    (defun fizzbuzz () (list (yk_create_token YK_TOKEN_STRING (reduce + (map to_fb (range 1 101))))))
-    (yk_register {dsl fizzbuzz fizzbuzz})
-}
-
-def main() -> int:
-    println(fizzbuzz!{})
-    return 0
-

Item 2 - Hygienic DSL macros using gensym ✅ and metagensym 🟡

  • gensym - This is not a function unlike metagensym, simply return a name such as $a (any valid Yaksha IDENTIFIER prefixed with $) and it will be replaced with a unique symbol. ✅

  • metagensym - Generates a unique symbol to be used in YakshaLisp code.

Item 3 - Macros for YakshaLisp via metamacro

Did you ever think that your meta programming might benefit from meta-meta programming?

Macros get all parameters non-evaluated. The output from macro will be evaluated (in calling scope) and needs to be a list of expressions.

Other than that it is similar to a defun. Metamacros are executed similarly to functions and can also call other metamacros or defuns.

If you consider just YakshaLisp as it's own language, this allows you to meta program in YakshaLisp during runtime of YakshaLisp.

  • (is_callable my_meta) --> false, this is true only for builtins, def, lambda.

macros!{
-    (metamacro twice (x) (+ (list x) (list x)))
-    # since x is an expression (non evaluated), it can be converted to {}
-    # by simply calling list.
-    # x ----> (= value (+ value 1))) # as an expr
-    # (list x) ---> {(= value (+ value 1))}
-    # (+ (list x) (list x)) ---> {
-    #    (= value (+ value 1)) (= value (+ value 1))
-    #    }
-    # now evaluated in calling scope
-    # (eval {...}) --> increase value by 1 twice
-    (= value 1)
-    (twice (= value (+ value 1)))
-    # This would set success
-    (if (== value 3) (= success 1))
-}
-
-def main() -> int:
-    return 0
-
(twice (println "Hello")) ----> (eval {(println "Hello") (println "Hello")})
-

Item 4 - Import macros from other files ✅

import libs.macro as m
-macros!{
-    (enable_print)
-    (m.twice (println "Hello"))
-}
-
-def main() -> int:
-    return 0
-

Item 5 - Execute commands 🟡

Will be disabled by default. Can be enabled by a setting a flag in yaksha.toml or setting an environment variable YAKSHA_SERIOUSLY_ENABLE_SHELL_EXEC to True.

import libs.macro.shell as m
-
-def main() -> int:
-    m.execute!{"echo Hello World"}
-    println(m.readout!{"echo Hello World", "Failed"})
-    return 0
-

Item 6 - Tracing macro expansion and debugging (not started, planned) ❌

Allow Yaksha compiler to output macro expansion steps. This will be useful for debugging macros.

Design TBD.

Some tracing features are supported by YakshaLisp if DEBUG is enabled during compilation of Yaksha, but this does not look nice and only useful for Yaksha/YakshaLisp language development. Perhaps these DEBUG features can be made to output more readable output and enable/disable with a flag instead of #ifdef DEBUG.

Item 7 - Garbage collection ✅

YakshaLisp will have a simple mark and sweep garbage collector. This will be used to manage memory allocated by YakshaLisp.



YAMA 0006 - C 2 C Compiler - Intermediate C99 to C99 optimizing compiler

Created 2023-07-30, Last Updated 2023-12-13
  • Author(s): Bhathiya Perera
  • Status : Draft

Problem

Yaksha uses C as a final compilation target. This is to introduce a way to have an intermediate C as a IR that can then be compiled to C

Naming

  • iC99 - Intermediate C 99

Language

  • Looks like C99.

  • Loops -> for, while, do while

  • structs, constants, unions, #define

  • We have built-ins such as yk__sdsnew, etc.

#define yy__raylib_Music Music
-
-i32 yy__main() {
-  yy__raylib_Music x;
-
-  return 0;
-}
-

Architecture

  • Tokenize

  • Level 1 -> no keyword recognition

  • Recognizes normal operators, identifiers, #?? and comments

  • Discard comments

  • Parse all with pre-processor statements

  • Remove comments

  • Apply #defines -> until there are no changes present

  • AST based

  • Only works with 1 file

  • Entry points yy__main yy__game_step, yy__init_state

Optimizations

Opt 01 - apply all #defines starting with yy__

  • Implement a simple pre-processor, however only capable of applying #defines that start with yy__

  • Opt 01.01 - Support non function like macros

  • Opt 01.02 - Support for function like macros

Opt 02 - data types

  • Opt 02.01 - Push down support of integer data types from Yaksha compiler to iC99.

  • Instead of having extra complexity at the compiler level for i32 ike data types, we push it to iC99.

Opt 03 - clean up

  • Opt 03.01 - Remove any method that cannot be reached from yy__main()

  • Opt 03.02 - Remove any operation in same block after return

Opt 04 - constant folding

  • Opt 04.01 - Apply -

  • Opt 04.02 - Remove excess ( ) parentheses

  • Opt 04.03 - Do basic math

  • Opt 04.04 - Apply basic string built-ins

  • Opt 04.05 - Apply basic array built-ins

  • Opt 04.06 - Dead code elimination

Opt 05 - apply constant function calls

  • Everything is a constant expression?

  • For each function things with simple math, assignments and built ins are considered pure

  • Any of these pure functions can be invoked during compile time and folded

Opt 06 - small function in-lining

  • Inline small functions < 20 lines?

Opt 07 - multiple rounds of previous optimizations

while changed:

  • Opt 03

  • Opt 04

  • Opt 05

  • Opt 06



YAMA 0007 - Additional features for structs

Created 2023-07-30, Last Updated 2023-12-13
  • Author(s): Bhathiya Perera
  • Status : In Progress

Structures are at the moment can be created as follows

@onstack
-class Banana:
-    color: int
-    origin: int
-
-# Orange is a heap allocated class
-class Orange:
-    color: int
-    origin: int
-

Item 1 - Allocate single object on heap

a: Ptr[Banana] = make("Banana")
-
-b: Orange = make("Orange")
-

Item 2 - Create structures or classes ✅

a: Banana = Banana {color: YELLOW, origin: SRI_LANKA}
-
struct Banana a = (struct Banana){.color = YELLOW, .origin = SRI_LANKA};
-
b: Orange = Orange {color: ORANGE, origin: SOUTH_AFRICA}
-
struct Orange* _temp = calloc(1, sizeof(struct Orange));
-_temp->color  = ORANGE;
-_temp->origin = SOUTH_AFRICA;
-
-struct Orange* b = _temp;
-

Item 3 - Introduce struct keyword, desugar to @onstack class

struct Banana:
-    color: int
-    origin: int
-


YAMA 0008 - Sugar methods

Created 2023-07-30, Last Updated 2023-12-13
  • Author(s): Bhathiya Perera
  • Status : Draft

Idea 01 - Arrow

struct Banana:
-    color: int
-    origin: int
-
-def display(b: Ptr[Banana]) -> None:
-    return
-
-def main() -> int:
-    b: Banana = ...
-    b->display()
-    return 0
-

Idea 02 - Dot ✅

@onstack
-class Banana:
-    color: int
-    origin: int
-
-def display(b: Ptr[Banana]) -> None:
-    return
-
-def main() -> int:
-    b: Banana = ...
-    b.display()
-    return 0
-

If @onstack or struct then we need to use Ptr[DataType] otherwise DataType can be used.

Going with . as it is already valid AST. Additionally, we can find the method during type checking and desugar it.

display(getref(b))
-


YAMA 0009 - Strings revisited

Created 2023-08-13, Last Updated 2023-12-13
  • Author(s): Bhathiya Perera
  • Status : Draft

Strings in programming languages are tough to design. You can make things simple by using it like a value type (Copying and deleting it). However, value like strings come at a cost as it does large number of alloc/dealloc resulting in fragmented memory. In WASM4 or embedded (potential future scenario) cases, this kind of alloc/dealloc is not acceptable.

This is an all or nothing proposal. Need to support all scenarios explained below. After this is completed, libs/runtime needs to rewritten to use new sr data type instead of str data type.

There is also an invisible string data type literal that is only available at compile time (a: literal = "hi" is invalid).

This type will be auto-magically converted to sr.

This is considered to avoid wasting time doing - runtime concatenation and runtime comparison of literals.

  • Breaking changes** - a = "hello" results in a's data type to be sr instead of str and sr is now a builtin data type.

Few areas to explore

String reference

  • String reference does not own the underlying heap allocated memory of a string.

  • No need to delete or duplicate.

  • But it is dangerous to store it in a structure as it might be invalid later on.

Static storage strings

  • Immutable static strings that lives in the static storage, lasts for the whole life time of the program.

  • No need to de-allocate.

  • Can store as a reference anywhere you like.

  • Not copied when passing.

String buffers

  • Mutable string that owns memory.

  • Not copied when passing to a function.

  • Can use same underlying yk__sds as data structure.

Semi managed value like strings

  • What str represents in Yaksha.

  • What is semi-managed? you need to manually de-allocate when a copy is added to a container.

String literals

  • This is a "Hello World" like string literal in Yaksha.

  • This is currently automatically converted to str.

  • We can consider string literals to be static storage strings.

  • Length is known at compile time.

Library/runtime use

  • Runtime functionality will not need to de-allocate strings. Once we switch to use of sr data type.

Implementation

Underlying data structure

struct yk__bstr { // Yaksha Base String
-    union {
-        yk__sds h;              // reference to a heap allocated string
-        const char * s;         // reference to a statically allocated string
-        char* c;                // reference to c.CStr that is heap allocated
-    };
-    size_t l;
-    enum yk__bstr_type { yk__bstr_str, yk__bstr_static, yk__bstr_cstr } t;
-};
-

Yaksha

First we assume we have something like below defined, that takes the new data type sr as an argument.

literal is a hidden data type -- this cannot be used by end users directly. (Internally represented as :s:)

Legend
  • ✅ - Completed

  • N - No allocation should happen here (except in Windows due to need to convert to utf16).

  • A - Alloc/Dealloc happens

  • C - Compile time

  • ! - Type-checking / compile error

def do_something(s: sr) -> int: # N
-    print("Printing sr: ")      # N
-    println(s)                  # N
-    return 0
-
-def takes_str(s: str) -> int:   # A (arg is copied here and deleted in the function)
-    print("Printing str: ")     # N
-    println(s)                  # N
-    return 0
-
Create sr data type ✅
  • Have it compile to struct yk__bstr

Passing a literal to sr
def main() -> int:
-    do_something("Oi")           # N
-    return 0
-
Passing an str to sr and creating a str with literal
def main() -> int:
-    s: str = "Oi"                # A
-    s2: str = "Ha"               # A
-    do_something(s)              # N
-    do_something(s2)             # N
-    return 0
-
Passing a literal/sr to str
def main() -> int:
-    do_something("Oi")           # A
-    a: sr = "ha"                 # A
-    takes_str(a)                 # N
-    takes_str("Oi oi")           # N
-    return 0
-
Variable using sr as data type ✅
def main() -> int:
-    oi = "Oi"                    # A
-    do_something(oi)             # A
-    takes_str("Oi oi")           # N
-    return 0
-
Concatenation of strs --> str
def main() -> int:
-    s: str = "Oi"                # N
-    s2: str = " Hello"           # N
-    takes_str(s + s2)            # NN
-    return 0
-
Concatenation of literals --> literal
def main() -> int:
-    do_something("Oi" + " Hello there" + " Another") # NC
-    takes_str("Oi" + " Hello there" + " Another")    # AC
-    return 0
-
Concatenation of 2 or more srs --> str
def main() -> int:               # A
-    a: sr = "Hi"                 # A
-    b: sr = " there"             # A
-    do_something(a + b + a)      # NA
-    takes_str(a + b)             # NN
-    return 0
-
Concatenation of 2 or more of mixed str, sr and literals --> str
def main() -> int:
-    a: str = "Hello"             # N
-    b: sr = " World"             # A
-    c = a + b + " Hehe"          # NNN
-    do_something(c)              # A
-    takes_str(c)                 # N
-    d = "Ha " + b + " " + a      # NNNN
-    takes_str(d)                 # N
-    do_something(d)              # A
-    return 0
-
Comparison of literals ("a" == "a") --> bool
def main() -> int:
-    println("a" == "a")          # AC
-    println("a" == "b")          # AC
-    println("a" != "a")          # AC
-    println("a" != "b")          # AC
-    return 0
-
Comparison of mixed str, sr and literals --> bool
def main() -> int:
-    a: str = "a"                 # N
-    b: sr = "oi"                 # A
-    println(b == b)              # A
-    println(a == a)              # A
-    println((a == b) or (a != b))# AA
-    println("a" == a)            # AA
-    println(b != a)              # AA
-    println(b != "x")            # AA
-    return 0
-
Wrap/Unwrap c.CStr, Const[Ptr[Const[c.Char]]] as sr
  • Create a simple wrapper function in libs.c to wrap c.CStr --> getref_cstr

  • Create a simple wrapper function in libs.c to unwrap c.CStr --> unref_cstr

  • Create a simple wrapper function in libs.c to wrap Const[Ptr[Const[c.Char]]] --> getref_ccstr

  • Create a simple wrapper function in libs.c to unwrap Const[Ptr[Const[c.Char]]] --> unref_ccstr

  • See do_something and take_str

Wrap Array[u8] as sr
  • Create a simple wrapper function in libs.strings to wrap getref_u8a

Wrap Ptr[u8] as sr
  • Create a simple wrapper function in libs.strings to wrap getref_u8p

Compare with None ✅
def main() -> int:
-    a: sr = "a"                  # N
-    b: str = "b"                 # A
-    println(a == None)           # N
-    println(b == None)           # N
-    println("a" != None)         # NC
-    println("a" == None)         # NC
-    println(None != a)           # N
-    println(None != b)           # N
-    println(None == "a")         # NC
-    println(None != "a")         # NC
-    return 0
-

Additional tasks

  • Update documentation explaining sr data type.



YAMA 0010 - Numbers auto casting when widening

Created 2023-08-13, Last Updated 2023-09-07
  • Author(s): Bhathiya Perera
  • Status : ✅

Following casting is suggested for basic binary mathematical operations.

Assignment would follow same casting style, except lhs needs to be wider.

Bitwise operations would require manual casting to same data type.

    .-------------.
-    |    bool     |
-    '.-----------.'
-     |          .V-.
-     |          |i8|
-     |          '.-'
-    .V----------.|
-    |    u8     ||
-    '.---------.'|
-    .V-------. | |
-    |  u16   | | |
-    '.------.' | |
-    .V----. |  | |
-    | u32 | |  | |
-    '.---.' |  | |
-    .V--.|  |  | |
-    |u64||  |  | |
-    '.--'|  |  | |
-.---.|   |  |  | |
-|f64||   |  |  | |
-'^--'|   |  |  | |
-.'---V-. |  |  | |
-| f32  | |  |  | |
-'^-----' |  |  | |
-.'-------V-.|  | |
-|   i64    ||  | |
-'^---------'|  | |
-.'----------V-.| |
-|     i32     || |
-'^------------'| |
-.'-------------V-V-.
-|       i16        |
-'------------------'
-


YAMA 0011 - Add minimal support for a HTTP client in Yaksha

Created 2023-11-12, Last Updated 2023-12-13
  • Author(s): Bhathiya Perera
  • Status : 🟡

Summary

All programming languages provide a way to make HTTP requests. However, this is currently not available to Yaksha. This proposal aims to add minimal support for HTTP requests to Yaksha.

Design

We plan on using mongoose to implement this feature. Mongoose is a lightweight HTTP server written in C. It is easy to integrate. However, it's license is GPL and users of http library will have to be aware of this.

Client

Simple HTTP client will use following structure. This will be placed in a separate module called http/client.yaka.

# Mongoose mgr data structure
-@nativedefine("struct mg_mgr")
-stuct MongooseMgr:
-    pass
-
-# Mongoose connection data structure
-@nativedefine("struct mg_connection")
-struct MongooseCon:
-    pass
-
-# HTTP client data structure using above 2 structs
-struct HttpClient:
-    mgr: MongooseMgr
-    nc: Ptr[MongooseCon]
-    success: bool
-
-def http_client(url: sr) -> HttpClient:
-    pass  # placeholder
-
-def request(method: sr, url: sr, data: sr, callback: Function[..]) -> HttpRequest:
-    pass  # placeholder
-

Usage of the client will be as follows:

import http.client as client
-
-def callback(...): # placeholder
-    pass
-
-def main() -> int:
-    cl = client.http_client("http://localhost:8080")
-    cl.request("GET", "/api/v1/users", "", callback)
-    defer free_http_client(cl)
-    return 0
-

Required changes to Yaksha ecosystem

  • Implement ability to support fixed sized arrays in Yaksha (parser, compiler, etc).

  • Implement ability in YakshaLisp to execute programs and access output.

  • Implement ability in carpntr to use YakshaLisp to build programs. (Either use program execution ability or use make/cmake to build programs)

  • Implement ability in YakshaLisp to detect platform and use appropriate build system.

  • CI - Add ability to build Yaksha release on supported platforms using github actions. (Instead of cross compiling)

  • Remove hammer and just use cmake to build Yaksha.

  • Update build and other scripts accordingly.

Third party libraries to be included

  • mongoose - for making HTTP requests

  • mbedtls - for TLS support

  • reproc - for executing programs



YAMA 0012 - Fixed size arrays

Created 2023-12-19, Last Updated 2023-12-19
  • Author(s): Bhathiya Perera
  • Status : Draft

Fixed size arrays are an important feature in C. Allowing us to create arrays in the stack and pass them around without worrying about memory management. This is a proposal to add static arrays to Yaksha.

Problem with arrays in C is that it decays to pointers. This is a problem when passing arrays to functions. And we need to pass the size of the array as well. Another problem is array size is not considered part of the data type (as it decays, information is lost).

So in Yaksha I would prefer to have a data type that mentions the size of the array as well. FixedArr[u8,10] would be different from FixedArr[u8,20].

def receive_a(item_a: FixedArr[int, 3]) -> int:
-    item_a[0] + item_a[2]
-
-def main() -> int:
-    a = fixedarr(1, 2, 3)
-    b = fixedarr(1, 2, 3, receive_a(a))
-    for (i = 0; i < len(b); i++): # <----------- len(b) simply becomes 4
-        println(b[i])
-    println(a[4]) # <------ this will result in an error
-    0
-

Phase 1 - Initial fixed array support

  • Add support for the data type fixedarr(...) builtin.

  • Add support for setting and getting individual items.

  • Add support for passing to other functions.

  • Add support for compiling len(x) to an integer.

  • Add support for checking if a passed in literal integer is larger than allowed.

  • Note this will not be checked in runtime

  • FixedArr[Const[int]] <--------- elements cannot be updated

Phase 2 - Add support for more builtins

  • Add foreach and other builtins that expect Arrays to work with FixedArr

  • Add to documentation

  • Add support for intellij and other editors

  • Double check this works in structs.

  • Add support for things like float[3] etc in raylib wrapper generator using FixedArr.

\ No newline at end of file diff --git a/downloadable_artifacts/.keep b/downloadable_artifacts/.keep deleted file mode 100644 index 4bd537c..0000000 --- a/downloadable_artifacts/.keep +++ /dev/null @@ -1 +0,0 @@ -Keep this folder \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..8f6b38c --- /dev/null +++ b/package.json @@ -0,0 +1,21 @@ +{ + "name": "site", + "type": "module", + "version": "0.0.1", + "scripts": { + "dev": "astro dev", + "start": "astro dev", + "build": "astro build", + "preview": "astro preview", + "astro": "astro" + }, + "dependencies": { + "@astrojs/mdx": "^2.0.2", + "@astrojs/tailwind": "^5.0.3", + "@tailwindcss/typography": "^0.5.10", + "astro": "^4.0.6", + "daisyui": "^4.4.22", + "node-fetch": "^3.3.2", + "tailwindcss": "^3.4.0" + } +} diff --git a/docs/android-chrome-192x192.png b/public/android-chrome-192x192.png similarity index 100% rename from docs/android-chrome-192x192.png rename to public/android-chrome-192x192.png diff --git a/docs/android-chrome-384x384.png b/public/android-chrome-384x384.png similarity index 100% rename from docs/android-chrome-384x384.png rename to public/android-chrome-384x384.png diff --git a/docs/apple-touch-icon.png b/public/apple-touch-icon.png similarity index 100% rename from docs/apple-touch-icon.png rename to public/apple-touch-icon.png diff --git a/docs/browserconfig.xml b/public/browserconfig.xml similarity index 100% rename from docs/browserconfig.xml rename to public/browserconfig.xml diff --git a/other-sources/Yaksha-Imports.drawio b/public/drawings/Yaksha-Imports.drawio similarity index 100% rename from other-sources/Yaksha-Imports.drawio rename to public/drawings/Yaksha-Imports.drawio diff --git a/other-sources/Yaksha-RT.drawio b/public/drawings/Yaksha-RT.drawio similarity index 100% rename from other-sources/Yaksha-RT.drawio rename to public/drawings/Yaksha-RT.drawio diff --git a/docs/favicon-16x16.png b/public/favicon-16x16.png similarity index 100% rename from docs/favicon-16x16.png rename to public/favicon-16x16.png diff --git a/docs/favicon-32x32.png b/public/favicon-32x32.png similarity index 100% rename from docs/favicon-32x32.png rename to public/favicon-32x32.png diff --git a/docs/favicon.ico b/public/favicon.ico similarity index 100% rename from docs/favicon.ico rename to public/favicon.ico diff --git a/docs/images_home/carpntr_tool_run.gif b/public/imgs/carpntr_tool_run.gif similarity index 100% rename from docs/images_home/carpntr_tool_run.gif rename to public/imgs/carpntr_tool_run.gif diff --git a/docs/images_home/code_scroll_yaksha.gif b/public/imgs/code_scroll_yaksha.gif similarity index 100% rename from docs/images_home/code_scroll_yaksha.gif rename to public/imgs/code_scroll_yaksha.gif diff --git a/docs/images_home/typing_code_yaksha.gif b/public/imgs/typing_code_yaksha.gif similarity index 100% rename from docs/images_home/typing_code_yaksha.gif rename to public/imgs/typing_code_yaksha.gif diff --git a/docs/images_home/wind_tree.gif b/public/imgs/wind_tree.gif similarity index 100% rename from docs/images_home/wind_tree.gif rename to public/imgs/wind_tree.gif diff --git a/docs/images_home/yaksha_logo.png b/public/imgs/yaksha_logo.png similarity index 100% rename from docs/images_home/yaksha_logo.png rename to public/imgs/yaksha_logo.png diff --git a/docs/images_home/yk-banner.png b/public/imgs/yk-banner1.png similarity index 100% rename from docs/images_home/yk-banner.png rename to public/imgs/yk-banner1.png diff --git a/docs/images/yk-banner.png b/public/imgs/yk-banner2.png similarity index 100% rename from docs/images/yk-banner.png rename to public/imgs/yk-banner2.png diff --git a/docs/images/yk-imports.png b/public/imgs/yk-imports.png similarity index 100% rename from docs/images/yk-imports.png rename to public/imgs/yk-imports.png diff --git a/docs/images/yk-rt.png b/public/imgs/yk-rt.png similarity index 100% rename from docs/images/yk-rt.png rename to public/imgs/yk-rt.png diff --git a/docs/images/yk-sample1.png b/public/imgs/yk-sample1.png similarity index 100% rename from docs/images/yk-sample1.png rename to public/imgs/yk-sample1.png diff --git a/docs/images/yk-sample2.gif b/public/imgs/yk-sample2.gif similarity index 100% rename from docs/images/yk-sample2.gif rename to public/imgs/yk-sample2.gif diff --git a/docs/mstile-150x150.png b/public/mstile-150x150.png similarity index 100% rename from docs/mstile-150x150.png rename to public/mstile-150x150.png diff --git a/docs/static_demos/gui/gui_window.html b/public/static_demos/gui/gui_window.html similarity index 100% rename from docs/static_demos/gui/gui_window.html rename to public/static_demos/gui/gui_window.html diff --git a/docs/static_demos/gui/gui_window.js b/public/static_demos/gui/gui_window.js similarity index 100% rename from docs/static_demos/gui/gui_window.js rename to public/static_demos/gui/gui_window.js diff --git a/docs/static_demos/gui/gui_window.wasm b/public/static_demos/gui/gui_window.wasm similarity index 100% rename from docs/static_demos/gui/gui_window.wasm rename to public/static_demos/gui/gui_window.wasm diff --git a/docs/static_demos/gui/gui_window.yaka b/public/static_demos/gui/gui_window.yaka similarity index 100% rename from docs/static_demos/gui/gui_window.yaka rename to public/static_demos/gui/gui_window.yaka diff --git a/docs/static_demos/notes_wasm4/notes.html b/public/static_demos/notes_wasm4/notes.html similarity index 100% rename from docs/static_demos/notes_wasm4/notes.html rename to public/static_demos/notes_wasm4/notes.html diff --git a/docs/static_demos/notes_wasm4/notes.wasm b/public/static_demos/notes_wasm4/notes.wasm similarity index 100% rename from docs/static_demos/notes_wasm4/notes.wasm rename to public/static_demos/notes_wasm4/notes.wasm diff --git a/docs/static_demos/notes_wasm4/notes.yaka b/public/static_demos/notes_wasm4/notes.yaka similarity index 100% rename from docs/static_demos/notes_wasm4/notes.yaka rename to public/static_demos/notes_wasm4/notes.yaka diff --git a/docs/static_demos/snake_wasm4/snake.html b/public/static_demos/snake_wasm4/snake.html similarity index 100% rename from docs/static_demos/snake_wasm4/snake.html rename to public/static_demos/snake_wasm4/snake.html diff --git a/docs/static_demos/snake_wasm4/snake_w4.wasm b/public/static_demos/snake_wasm4/snake_w4.wasm similarity index 100% rename from docs/static_demos/snake_wasm4/snake_w4.wasm rename to public/static_demos/snake_wasm4/snake_w4.wasm diff --git a/docs/static_demos/snake_wasm4/snake_w4.yaka b/public/static_demos/snake_wasm4/snake_w4.yaka similarity index 100% rename from docs/static_demos/snake_wasm4/snake_w4.yaka rename to public/static_demos/snake_wasm4/snake_w4.yaka diff --git a/docs/static_demos/space_blast/space_blast.data b/public/static_demos/space_blast/space_blast.data similarity index 100% rename from docs/static_demos/space_blast/space_blast.data rename to public/static_demos/space_blast/space_blast.data diff --git a/docs/static_demos/space_blast/space_blast.html b/public/static_demos/space_blast/space_blast.html similarity index 100% rename from docs/static_demos/space_blast/space_blast.html rename to public/static_demos/space_blast/space_blast.html diff --git a/public/static_demos/space_blast/space_blast.js b/public/static_demos/space_blast/space_blast.js new file mode 100644 index 0000000..9d45f5b --- /dev/null +++ b/public/static_demos/space_blast/space_blast.js @@ -0,0 +1 @@ +var Module=typeof Module!="undefined"?Module:{};if(!Module.expectedDataFileDownloads){Module.expectedDataFileDownloads=0}Module.expectedDataFileDownloads++;(function(){if(Module["ENVIRONMENT_IS_PTHREAD"])return;var loadPackage=function(metadata){var PACKAGE_PATH="";if(typeof window==="object"){PACKAGE_PATH=window["encodeURIComponent"](window.location.pathname.toString().substring(0,window.location.pathname.toString().lastIndexOf("/"))+"/")}else if(typeof process==="undefined"&&typeof location!=="undefined"){PACKAGE_PATH=encodeURIComponent(location.pathname.toString().substring(0,location.pathname.toString().lastIndexOf("/"))+"/")}var PACKAGE_NAME="/home/jadoggx86/Projects/Yaksha/yakshalang.github.io/docs/static_demos/space_blast/space_blast.data";var REMOTE_PACKAGE_BASE="/static_demos/space_blast/space_blast.data";if(typeof Module["locateFilePackage"]==="function"&&!Module["locateFile"]){Module["locateFile"]=Module["locateFilePackage"];err("warning: you defined Module.locateFilePackage, that has been renamed to Module.locateFile (using your locateFilePackage for now)")}var REMOTE_PACKAGE_NAME=Module["locateFile"]?Module["locateFile"](REMOTE_PACKAGE_BASE,""):REMOTE_PACKAGE_BASE;var REMOTE_PACKAGE_SIZE=metadata["remote_package_size"];function fetchRemotePackage(packageName,packageSize,callback,errback){if(typeof process==="object"&&typeof process.versions==="object"&&typeof process.versions.node==="string"){require("fs").readFile(packageName,function(err,contents){if(err){errback(err)}else{callback(contents.buffer)}});return}var xhr=new XMLHttpRequest;xhr.open("GET",packageName,true);xhr.responseType="arraybuffer";xhr.onprogress=function(event){var url=packageName;var size=packageSize;if(event.total)size=event.total;if(event.loaded){if(!xhr.addedTotal){xhr.addedTotal=true;if(!Module.dataFileDownloads)Module.dataFileDownloads={};Module.dataFileDownloads[url]={loaded:event.loaded,total:size}}else{Module.dataFileDownloads[url].loaded=event.loaded}var total=0;var loaded=0;var num=0;for(var download in Module.dataFileDownloads){var data=Module.dataFileDownloads[download];total+=data.total;loaded+=data.loaded;num++}total=Math.ceil(total*Module.expectedDataFileDownloads/num);if(Module["setStatus"])Module["setStatus"]("Downloading data... ("+loaded+"/"+total+")")}else if(!Module.dataFileDownloads){if(Module["setStatus"])Module["setStatus"]("Downloading data...")}};xhr.onerror=function(event){throw new Error("NetworkError for: "+packageName)};xhr.onload=function(event){if(xhr.status==200||xhr.status==304||xhr.status==206||xhr.status==0&&xhr.response){var packageData=xhr.response;callback(packageData)}else{throw new Error(xhr.statusText+" : "+xhr.responseURL)}};xhr.send(null)}function handleError(error){console.error("package error:",error)}var fetchedCallback=null;var fetched=Module["getPreloadedPackage"]?Module["getPreloadedPackage"](REMOTE_PACKAGE_NAME,REMOTE_PACKAGE_SIZE):null;if(!fetched)fetchRemotePackage(REMOTE_PACKAGE_NAME,REMOTE_PACKAGE_SIZE,function(data){if(fetchedCallback){fetchedCallback(data);fetchedCallback=null}else{fetched=data}},handleError);function runWithFS(){function assert(check,msg){if(!check)throw msg+(new Error).stack}Module["FS_createPath"]("/","assets",true,true);Module["FS_createPath"]("/assets","audio",true,true);Module["FS_createPath"]("/assets","img",true,true);function DataRequest(start,end,audio){this.start=start;this.end=end;this.audio=audio}DataRequest.prototype={requests:{},open:function(mode,name){this.name=name;this.requests[name]=this;Module["addRunDependency"]("fp "+this.name)},send:function(){},onload:function(){var byteArray=this.byteArray.subarray(this.start,this.end);this.finish(byteArray)},finish:function(byteArray){var that=this;Module["FS_createDataFile"](this.name,null,byteArray,true,true,true);Module["removeRunDependency"]("fp "+that.name);this.requests[this.name]=null}};var files=metadata["files"];for(var i=0;i{throw toThrow};var ENVIRONMENT_IS_WEB=typeof window=="object";var ENVIRONMENT_IS_WORKER=typeof importScripts=="function";var ENVIRONMENT_IS_NODE=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string";var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory)}return scriptDirectory+path}var read_,readAsync,readBinary,setWindowTitle;function logExceptionOnExit(e){if(e instanceof ExitStatus)return;let toLog=e;err("exiting due to exception: "+toLog)}if(ENVIRONMENT_IS_NODE){if(ENVIRONMENT_IS_WORKER){scriptDirectory=require("path").dirname(scriptDirectory)+"/"}else{scriptDirectory=__dirname+"/"}var fs,nodePath;if(typeof require==="function"){fs=require("fs");nodePath=require("path")}read_=(filename,binary)=>{filename=nodePath["normalize"](filename);return fs.readFileSync(filename,binary?undefined:"utf8")};readBinary=filename=>{var ret=read_(filename,true);if(!ret.buffer){ret=new Uint8Array(ret)}return ret};readAsync=(filename,onload,onerror)=>{filename=nodePath["normalize"](filename);fs.readFile(filename,function(err,data){if(err)onerror(err);else onload(data.buffer)})};if(process["argv"].length>1){thisProgram=process["argv"][1].replace(/\\/g,"/")}arguments_=process["argv"].slice(2);if(typeof module!="undefined"){module["exports"]=Module}process["on"]("uncaughtException",function(ex){if(!(ex instanceof ExitStatus)){throw ex}});process["on"]("unhandledRejection",function(reason){throw reason});quit_=(status,toThrow)=>{if(keepRuntimeAlive()){process["exitCode"]=status;throw toThrow}logExceptionOnExit(toThrow);process["exit"](status)};Module["inspect"]=function(){return"[Emscripten Module object]"}}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){if(ENVIRONMENT_IS_WORKER){scriptDirectory=self.location.href}else if(typeof document!="undefined"&&document.currentScript){scriptDirectory=document.currentScript.src}if(scriptDirectory.indexOf("blob:")!==0){scriptDirectory=scriptDirectory.substr(0,scriptDirectory.replace(/[?#].*/,"").lastIndexOf("/")+1)}else{scriptDirectory=""}{read_=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.send(null);return xhr.responseText};if(ENVIRONMENT_IS_WORKER){readBinary=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return new Uint8Array(xhr.response)}}readAsync=(url,onload,onerror)=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=()=>{if(xhr.status==200||xhr.status==0&&xhr.response){onload(xhr.response);return}onerror()};xhr.onerror=onerror;xhr.send(null)}}setWindowTitle=title=>document.title=title}else{}var out=Module["print"]||console.log.bind(console);var err=Module["printErr"]||console.warn.bind(console);Object.assign(Module,moduleOverrides);moduleOverrides=null;if(Module["arguments"])arguments_=Module["arguments"];if(Module["thisProgram"])thisProgram=Module["thisProgram"];if(Module["quit"])quit_=Module["quit"];var wasmBinary;if(Module["wasmBinary"])wasmBinary=Module["wasmBinary"];var noExitRuntime=Module["noExitRuntime"]||true;if(typeof WebAssembly!="object"){abort("no native wasm support detected")}var wasmMemory;var ABORT=false;var EXITSTATUS;function assert(condition,text){if(!condition){abort(text)}}var UTF8Decoder=typeof TextDecoder!="undefined"?new TextDecoder("utf8"):undefined;function UTF8ArrayToString(heapOrArray,idx,maxBytesToRead){var endIdx=idx+maxBytesToRead;var endPtr=idx;while(heapOrArray[endPtr]&&!(endPtr>=endIdx))++endPtr;if(endPtr-idx>16&&heapOrArray.buffer&&UTF8Decoder){return UTF8Decoder.decode(heapOrArray.subarray(idx,endPtr))}var str="";while(idx>10,56320|ch&1023)}}return str}function UTF8ToString(ptr,maxBytesToRead){return ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead):""}function stringToUTF8Array(str,heap,outIdx,maxBytesToWrite){if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i=55296&&u<=57343){var u1=str.charCodeAt(++i);u=65536+((u&1023)<<10)|u1&1023}if(u<=127){if(outIdx>=endIdx)break;heap[outIdx++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;heap[outIdx++]=192|u>>6;heap[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;heap[outIdx++]=224|u>>12;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}else{if(outIdx+3>=endIdx)break;heap[outIdx++]=240|u>>18;heap[outIdx++]=128|u>>12&63;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}}heap[outIdx]=0;return outIdx-startIdx}function stringToUTF8(str,outPtr,maxBytesToWrite){return stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite)}function lengthBytesUTF8(str){var len=0;for(var i=0;i=55296&&c<=57343){len+=4;++i}else{len+=3}}return len}var buffer,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;function updateGlobalBufferAndViews(buf){buffer=buf;Module["HEAP8"]=HEAP8=new Int8Array(buf);Module["HEAP16"]=HEAP16=new Int16Array(buf);Module["HEAP32"]=HEAP32=new Int32Array(buf);Module["HEAPU8"]=HEAPU8=new Uint8Array(buf);Module["HEAPU16"]=HEAPU16=new Uint16Array(buf);Module["HEAPU32"]=HEAPU32=new Uint32Array(buf);Module["HEAPF32"]=HEAPF32=new Float32Array(buf);Module["HEAPF64"]=HEAPF64=new Float64Array(buf)}var INITIAL_MEMORY=Module["INITIAL_MEMORY"]||16777216;var wasmTable;var __ATPRERUN__=[];var __ATINIT__=[];var __ATMAIN__=[];var __ATEXIT__=[];var __ATPOSTRUN__=[];var runtimeInitialized=false;function keepRuntimeAlive(){return noExitRuntime}function preRun(){if(Module["preRun"]){if(typeof Module["preRun"]=="function")Module["preRun"]=[Module["preRun"]];while(Module["preRun"].length){addOnPreRun(Module["preRun"].shift())}}callRuntimeCallbacks(__ATPRERUN__)}function initRuntime(){runtimeInitialized=true;if(!Module["noFSInit"]&&!FS.init.initialized)FS.init();FS.ignorePermissions=false;TTY.init();callRuntimeCallbacks(__ATINIT__)}function preMain(){callRuntimeCallbacks(__ATMAIN__)}function postRun(){if(Module["postRun"]){if(typeof Module["postRun"]=="function")Module["postRun"]=[Module["postRun"]];while(Module["postRun"].length){addOnPostRun(Module["postRun"].shift())}}callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(cb){__ATPRERUN__.unshift(cb)}function addOnInit(cb){__ATINIT__.unshift(cb)}function addOnPostRun(cb){__ATPOSTRUN__.unshift(cb)}var runDependencies=0;var runDependencyWatcher=null;var dependenciesFulfilled=null;function getUniqueRunDependency(id){return id}function addRunDependency(id){runDependencies++;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}}function removeRunDependency(id){runDependencies--;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}if(runDependencies==0){if(runDependencyWatcher!==null){clearInterval(runDependencyWatcher);runDependencyWatcher=null}if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback()}}}function abort(what){{if(Module["onAbort"]){Module["onAbort"](what)}}what="Aborted("+what+")";err(what);ABORT=true;EXITSTATUS=1;what+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(what);throw e}var dataURIPrefix="data:application/octet-stream;base64,";function isDataURI(filename){return filename.startsWith(dataURIPrefix)}function isFileURI(filename){return filename.startsWith("file://")}var wasmBinaryFile;wasmBinaryFile="space_blast.wasm";if(!isDataURI(wasmBinaryFile)){wasmBinaryFile=locateFile(wasmBinaryFile)}function getBinary(file){try{if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary)}if(readBinary){return readBinary(file)}throw"both async and sync fetching of the wasm failed"}catch(err){abort(err)}}function getBinaryPromise(){if(!wasmBinary&&(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER)){if(typeof fetch=="function"&&!isFileURI(wasmBinaryFile)){return fetch(wasmBinaryFile,{credentials:"same-origin"}).then(function(response){if(!response["ok"]){throw"failed to load wasm binary file at '"+wasmBinaryFile+"'"}return response["arrayBuffer"]()}).catch(function(){return getBinary(wasmBinaryFile)})}else{if(readAsync){return new Promise(function(resolve,reject){readAsync(wasmBinaryFile,function(response){resolve(new Uint8Array(response))},reject)})}}}return Promise.resolve().then(function(){return getBinary(wasmBinaryFile)})}function createWasm(){var info={"a":asmLibraryArg};function receiveInstance(instance,module){var exports=instance.exports;exports=Asyncify.instrumentWasmExports(exports);Module["asm"]=exports;wasmMemory=Module["asm"]["Td"];updateGlobalBufferAndViews(wasmMemory.buffer);wasmTable=Module["asm"]["be"];addOnInit(Module["asm"]["Ud"]);removeRunDependency("wasm-instantiate")}addRunDependency("wasm-instantiate");function receiveInstantiationResult(result){receiveInstance(result["instance"])}function instantiateArrayBuffer(receiver){return getBinaryPromise().then(function(binary){return WebAssembly.instantiate(binary,info)}).then(function(instance){return instance}).then(receiver,function(reason){err("failed to asynchronously prepare wasm: "+reason);abort(reason)})}function instantiateAsync(){if(!wasmBinary&&typeof WebAssembly.instantiateStreaming=="function"&&!isDataURI(wasmBinaryFile)&&!isFileURI(wasmBinaryFile)&&!ENVIRONMENT_IS_NODE&&typeof fetch=="function"){return fetch(wasmBinaryFile,{credentials:"same-origin"}).then(function(response){var result=WebAssembly.instantiateStreaming(response,info);return result.then(receiveInstantiationResult,function(reason){err("wasm streaming compile failed: "+reason);err("falling back to ArrayBuffer instantiation");return instantiateArrayBuffer(receiveInstantiationResult)})})}else{return instantiateArrayBuffer(receiveInstantiationResult)}}if(Module["instantiateWasm"]){try{var exports=Module["instantiateWasm"](info,receiveInstance);exports=Asyncify.instrumentWasmExports(exports);return exports}catch(e){err("Module.instantiateWasm callback failed with error: "+e);return false}}instantiateAsync();return{}}var tempDouble;var tempI64;var ASM_CONSTS={47792:()=>{if(typeof window==="undefined"||(window.AudioContext||window.webkitAudioContext)===undefined){return 0}if(typeof window.miniaudio==="undefined"){window.miniaudio={referenceCount:0};miniaudio.devices=[];miniaudio.track_device=function(device){for(var iDevice=0;iDevice0){if(miniaudio.devices[miniaudio.devices.length-1]==null){miniaudio.devices.pop()}else{break}}};miniaudio.untrack_device=function(device){for(var iDevice=0;iDevice{if(typeof window.miniaudio!=="undefined"){window.miniaudio.referenceCount--;if(window.miniaudio.referenceCount===0){delete window.miniaudio}}},49652:()=>{return navigator.mediaDevices!==undefined&&navigator.mediaDevices.getUserMedia!==undefined},49756:()=>{try{var temp=new(window.AudioContext||window.webkitAudioContext);var sampleRate=temp.sampleRate;temp.close();return sampleRate}catch(e){return 0}},49927:($0,$1,$2,$3,$4,$5)=>{var channels=$0;var sampleRate=$1;var bufferSize=$2;var isCapture=$3;var pDevice=$4;var pAllocationCallbacks=$5;if(typeof window.miniaudio==="undefined"){return-1}var device={};device.webaudio=new(window.AudioContext||window.webkitAudioContext)({sampleRate:sampleRate});device.webaudio.suspend();device.state=1;device.intermediaryBufferSizeInBytes=channels*bufferSize*4;device.intermediaryBuffer=_ma_malloc_emscripten(device.intermediaryBufferSizeInBytes,pAllocationCallbacks);device.intermediaryBufferView=new Float32Array(Module.HEAPF32.buffer,device.intermediaryBuffer,device.intermediaryBufferSizeInBytes);device.scriptNode=device.webaudio.createScriptProcessor(bufferSize,isCapture?channels:0,isCapture?0:channels);if(isCapture){device.scriptNode.onaudioprocess=function(e){if(device.intermediaryBuffer===undefined){return}if(device.intermediaryBufferView.length==0){device.intermediaryBufferView=new Float32Array(Module.HEAPF32.buffer,device.intermediaryBuffer,device.intermediaryBufferSizeInBytes)}for(var iChannel=0;iChanneldevice.intermediaryBufferSizeInBytes/channels/4){framesToProcess=device.intermediaryBufferSizeInBytes/channels/4}if(sendSilence){device.intermediaryBufferView.fill(0)}else{for(var iFrame=0;iFramedevice.intermediaryBufferSizeInBytes/channels/4){framesToProcess=device.intermediaryBufferSizeInBytes/channels/4}_ma_device_process_pcm_frames_playback__webaudio(pDevice,framesToProcess,device.intermediaryBuffer);if(outputSilence){for(var iChannel=0;iChannel{return miniaudio.get_device_by_index($0).webaudio.sampleRate},54343:($0,$1,$2,$3)=>{var device=miniaudio.get_device_by_index($0);var pAllocationCallbacks=$3;if(device.scriptNode!==undefined){device.scriptNode.onaudioprocess=function(e){};device.scriptNode.disconnect();device.scriptNode=undefined}if(device.streamNode!==undefined){device.streamNode.disconnect();device.streamNode=undefined}device.webaudio.close();device.webaudio=undefined;if(device.intermediaryBuffer!==undefined){_ma_free_emscripten(device.intermediaryBuffer,pAllocationCallbacks);device.intermediaryBuffer=undefined;device.intermediaryBufferView=undefined;device.intermediaryBufferSizeInBytes=undefined}miniaudio.untrack_device_by_index($0)},55029:$0=>{var device=miniaudio.get_device_by_index($0);device.webaudio.resume();device.state=2},55125:$0=>{var device=miniaudio.get_device_by_index($0);device.webaudio.resume();device.state=2},55221:$0=>{var device=miniaudio.get_device_by_index($0);device.webaudio.suspend();device.state=1},55318:$0=>{var device=miniaudio.get_device_by_index($0);device.webaudio.suspend();device.state=1}};function ExitStatus(status){this.name="ExitStatus";this.message="Program terminated with exit("+status+")";this.status=status}function callRuntimeCallbacks(callbacks){while(callbacks.length>0){callbacks.shift()(Module)}}function handleException(e){if(e instanceof ExitStatus||e=="unwind"){return EXITSTATUS}quit_(1,e)}function ___assert_fail(condition,filename,line,func){abort("Assertion failed: "+UTF8ToString(condition)+", at: "+[filename?UTF8ToString(filename):"unknown filename",line,func?UTF8ToString(func):"unknown function"])}function setErrNo(value){HEAP32[___errno_location()>>2]=value;return value}var PATH={isAbs:path=>path.charAt(0)==="/",splitPath:filename=>{var splitPathRe=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;return splitPathRe.exec(filename).slice(1)},normalizeArray:(parts,allowAboveRoot)=>{var up=0;for(var i=parts.length-1;i>=0;i--){var last=parts[i];if(last==="."){parts.splice(i,1)}else if(last===".."){parts.splice(i,1);up++}else if(up){parts.splice(i,1);up--}}if(allowAboveRoot){for(;up;up--){parts.unshift("..")}}return parts},normalize:path=>{var isAbsolute=PATH.isAbs(path),trailingSlash=path.substr(-1)==="/";path=PATH.normalizeArray(path.split("/").filter(p=>!!p),!isAbsolute).join("/");if(!path&&!isAbsolute){path="."}if(path&&trailingSlash){path+="/"}return(isAbsolute?"/":"")+path},dirname:path=>{var result=PATH.splitPath(path),root=result[0],dir=result[1];if(!root&&!dir){return"."}if(dir){dir=dir.substr(0,dir.length-1)}return root+dir},basename:path=>{if(path==="/")return"/";path=PATH.normalize(path);path=path.replace(/\/$/,"");var lastSlash=path.lastIndexOf("/");if(lastSlash===-1)return path;return path.substr(lastSlash+1)},join:function(){var paths=Array.prototype.slice.call(arguments);return PATH.normalize(paths.join("/"))},join2:(l,r)=>{return PATH.normalize(l+"/"+r)}};function getRandomDevice(){if(typeof crypto=="object"&&typeof crypto["getRandomValues"]=="function"){var randomBuffer=new Uint8Array(1);return()=>{crypto.getRandomValues(randomBuffer);return randomBuffer[0]}}else if(ENVIRONMENT_IS_NODE){try{var crypto_module=require("crypto");return()=>crypto_module["randomBytes"](1)[0]}catch(e){}}return()=>abort("randomDevice")}var PATH_FS={resolve:function(){var resolvedPath="",resolvedAbsolute=false;for(var i=arguments.length-1;i>=-1&&!resolvedAbsolute;i--){var path=i>=0?arguments[i]:FS.cwd();if(typeof path!="string"){throw new TypeError("Arguments to path.resolve must be strings")}else if(!path){return""}resolvedPath=path+"/"+resolvedPath;resolvedAbsolute=PATH.isAbs(path)}resolvedPath=PATH.normalizeArray(resolvedPath.split("/").filter(p=>!!p),!resolvedAbsolute).join("/");return(resolvedAbsolute?"/":"")+resolvedPath||"."},relative:(from,to)=>{from=PATH_FS.resolve(from).substr(1);to=PATH_FS.resolve(to).substr(1);function trim(arr){var start=0;for(;start=0;end--){if(arr[end]!=="")break}if(start>end)return[];return arr.slice(start,end-start+1)}var fromParts=trim(from.split("/"));var toParts=trim(to.split("/"));var length=Math.min(fromParts.length,toParts.length);var samePartsLength=length;for(var i=0;i0?length:lengthBytesUTF8(stringy)+1;var u8array=new Array(len);var numBytesWritten=stringToUTF8Array(stringy,u8array,0,u8array.length);if(dontAddNull)u8array.length=numBytesWritten;return u8array}var TTY={ttys:[],init:function(){},shutdown:function(){},register:function(dev,ops){TTY.ttys[dev]={input:[],output:[],ops:ops};FS.registerDevice(dev,TTY.stream_ops)},stream_ops:{open:function(stream){var tty=TTY.ttys[stream.node.rdev];if(!tty){throw new FS.ErrnoError(43)}stream.tty=tty;stream.seekable=false},close:function(stream){stream.tty.ops.fsync(stream.tty)},fsync:function(stream){stream.tty.ops.fsync(stream.tty)},read:function(stream,buffer,offset,length,pos){if(!stream.tty||!stream.tty.ops.get_char){throw new FS.ErrnoError(60)}var bytesRead=0;for(var i=0;i0){result=buf.slice(0,bytesRead).toString("utf-8")}else{result=null}}else if(typeof window!="undefined"&&typeof window.prompt=="function"){result=window.prompt("Input: ");if(result!==null){result+="\n"}}else if(typeof readline=="function"){result=readline();if(result!==null){result+="\n"}}if(!result){return null}tty.input=intArrayFromString(result,true)}return tty.input.shift()},put_char:function(tty,val){if(val===null||val===10){out(UTF8ArrayToString(tty.output,0));tty.output=[]}else{if(val!=0)tty.output.push(val)}},fsync:function(tty){if(tty.output&&tty.output.length>0){out(UTF8ArrayToString(tty.output,0));tty.output=[]}}},default_tty1_ops:{put_char:function(tty,val){if(val===null||val===10){err(UTF8ArrayToString(tty.output,0));tty.output=[]}else{if(val!=0)tty.output.push(val)}},fsync:function(tty){if(tty.output&&tty.output.length>0){err(UTF8ArrayToString(tty.output,0));tty.output=[]}}}};function mmapAlloc(size){abort()}var MEMFS={ops_table:null,mount:function(mount){return MEMFS.createNode(null,"/",16384|511,0)},createNode:function(parent,name,mode,dev){if(FS.isBlkdev(mode)||FS.isFIFO(mode)){throw new FS.ErrnoError(63)}if(!MEMFS.ops_table){MEMFS.ops_table={dir:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr,lookup:MEMFS.node_ops.lookup,mknod:MEMFS.node_ops.mknod,rename:MEMFS.node_ops.rename,unlink:MEMFS.node_ops.unlink,rmdir:MEMFS.node_ops.rmdir,readdir:MEMFS.node_ops.readdir,symlink:MEMFS.node_ops.symlink},stream:{llseek:MEMFS.stream_ops.llseek}},file:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr},stream:{llseek:MEMFS.stream_ops.llseek,read:MEMFS.stream_ops.read,write:MEMFS.stream_ops.write,allocate:MEMFS.stream_ops.allocate,mmap:MEMFS.stream_ops.mmap,msync:MEMFS.stream_ops.msync}},link:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr,readlink:MEMFS.node_ops.readlink},stream:{}},chrdev:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr},stream:FS.chrdev_stream_ops}}}var node=FS.createNode(parent,name,mode,dev);if(FS.isDir(node.mode)){node.node_ops=MEMFS.ops_table.dir.node;node.stream_ops=MEMFS.ops_table.dir.stream;node.contents={}}else if(FS.isFile(node.mode)){node.node_ops=MEMFS.ops_table.file.node;node.stream_ops=MEMFS.ops_table.file.stream;node.usedBytes=0;node.contents=null}else if(FS.isLink(node.mode)){node.node_ops=MEMFS.ops_table.link.node;node.stream_ops=MEMFS.ops_table.link.stream}else if(FS.isChrdev(node.mode)){node.node_ops=MEMFS.ops_table.chrdev.node;node.stream_ops=MEMFS.ops_table.chrdev.stream}node.timestamp=Date.now();if(parent){parent.contents[name]=node;parent.timestamp=node.timestamp}return node},getFileDataAsTypedArray:function(node){if(!node.contents)return new Uint8Array(0);if(node.contents.subarray)return node.contents.subarray(0,node.usedBytes);return new Uint8Array(node.contents)},expandFileStorage:function(node,newCapacity){var prevCapacity=node.contents?node.contents.length:0;if(prevCapacity>=newCapacity)return;var CAPACITY_DOUBLING_MAX=1024*1024;newCapacity=Math.max(newCapacity,prevCapacity*(prevCapacity>>0);if(prevCapacity!=0)newCapacity=Math.max(newCapacity,256);var oldContents=node.contents;node.contents=new Uint8Array(newCapacity);if(node.usedBytes>0)node.contents.set(oldContents.subarray(0,node.usedBytes),0)},resizeFileStorage:function(node,newSize){if(node.usedBytes==newSize)return;if(newSize==0){node.contents=null;node.usedBytes=0}else{var oldContents=node.contents;node.contents=new Uint8Array(newSize);if(oldContents){node.contents.set(oldContents.subarray(0,Math.min(newSize,node.usedBytes)))}node.usedBytes=newSize}},node_ops:{getattr:function(node){var attr={};attr.dev=FS.isChrdev(node.mode)?node.id:1;attr.ino=node.id;attr.mode=node.mode;attr.nlink=1;attr.uid=0;attr.gid=0;attr.rdev=node.rdev;if(FS.isDir(node.mode)){attr.size=4096}else if(FS.isFile(node.mode)){attr.size=node.usedBytes}else if(FS.isLink(node.mode)){attr.size=node.link.length}else{attr.size=0}attr.atime=new Date(node.timestamp);attr.mtime=new Date(node.timestamp);attr.ctime=new Date(node.timestamp);attr.blksize=4096;attr.blocks=Math.ceil(attr.size/attr.blksize);return attr},setattr:function(node,attr){if(attr.mode!==undefined){node.mode=attr.mode}if(attr.timestamp!==undefined){node.timestamp=attr.timestamp}if(attr.size!==undefined){MEMFS.resizeFileStorage(node,attr.size)}},lookup:function(parent,name){throw FS.genericErrors[44]},mknod:function(parent,name,mode,dev){return MEMFS.createNode(parent,name,mode,dev)},rename:function(old_node,new_dir,new_name){if(FS.isDir(old_node.mode)){var new_node;try{new_node=FS.lookupNode(new_dir,new_name)}catch(e){}if(new_node){for(var i in new_node.contents){throw new FS.ErrnoError(55)}}}delete old_node.parent.contents[old_node.name];old_node.parent.timestamp=Date.now();old_node.name=new_name;new_dir.contents[new_name]=old_node;new_dir.timestamp=old_node.parent.timestamp;old_node.parent=new_dir},unlink:function(parent,name){delete parent.contents[name];parent.timestamp=Date.now()},rmdir:function(parent,name){var node=FS.lookupNode(parent,name);for(var i in node.contents){throw new FS.ErrnoError(55)}delete parent.contents[name];parent.timestamp=Date.now()},readdir:function(node){var entries=[".",".."];for(var key in node.contents){if(!node.contents.hasOwnProperty(key)){continue}entries.push(key)}return entries},symlink:function(parent,newname,oldpath){var node=MEMFS.createNode(parent,newname,511|40960,0);node.link=oldpath;return node},readlink:function(node){if(!FS.isLink(node.mode)){throw new FS.ErrnoError(28)}return node.link}},stream_ops:{read:function(stream,buffer,offset,length,position){var contents=stream.node.contents;if(position>=stream.node.usedBytes)return 0;var size=Math.min(stream.node.usedBytes-position,length);if(size>8&&contents.subarray){buffer.set(contents.subarray(position,position+size),offset)}else{for(var i=0;i0||position+length{assert(arrayBuffer,'Loading data file "'+url+'" failed (no arrayBuffer).');onload(new Uint8Array(arrayBuffer));if(dep)removeRunDependency(dep)},event=>{if(onerror){onerror()}else{throw'Loading data file "'+url+'" failed.'}});if(dep)addRunDependency(dep)}var FS={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:false,ignorePermissions:true,ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,lookupPath:(path,opts={})=>{path=PATH_FS.resolve(FS.cwd(),path);if(!path)return{path:"",node:null};var defaults={follow_mount:true,recurse_count:0};opts=Object.assign(defaults,opts);if(opts.recurse_count>8){throw new FS.ErrnoError(32)}var parts=PATH.normalizeArray(path.split("/").filter(p=>!!p),false);var current=FS.root;var current_path="/";for(var i=0;i40){throw new FS.ErrnoError(32)}}}}return{path:current_path,node:current}},getPath:node=>{var path;while(true){if(FS.isRoot(node)){var mount=node.mount.mountpoint;if(!path)return mount;return mount[mount.length-1]!=="/"?mount+"/"+path:mount+path}path=path?node.name+"/"+path:node.name;node=node.parent}},hashName:(parentid,name)=>{var hash=0;for(var i=0;i>>0)%FS.nameTable.length},hashAddNode:node=>{var hash=FS.hashName(node.parent.id,node.name);node.name_next=FS.nameTable[hash];FS.nameTable[hash]=node},hashRemoveNode:node=>{var hash=FS.hashName(node.parent.id,node.name);if(FS.nameTable[hash]===node){FS.nameTable[hash]=node.name_next}else{var current=FS.nameTable[hash];while(current){if(current.name_next===node){current.name_next=node.name_next;break}current=current.name_next}}},lookupNode:(parent,name)=>{var errCode=FS.mayLookup(parent);if(errCode){throw new FS.ErrnoError(errCode,parent)}var hash=FS.hashName(parent.id,name);for(var node=FS.nameTable[hash];node;node=node.name_next){var nodeName=node.name;if(node.parent.id===parent.id&&nodeName===name){return node}}return FS.lookup(parent,name)},createNode:(parent,name,mode,rdev)=>{var node=new FS.FSNode(parent,name,mode,rdev);FS.hashAddNode(node);return node},destroyNode:node=>{FS.hashRemoveNode(node)},isRoot:node=>{return node===node.parent},isMountpoint:node=>{return!!node.mounted},isFile:mode=>{return(mode&61440)===32768},isDir:mode=>{return(mode&61440)===16384},isLink:mode=>{return(mode&61440)===40960},isChrdev:mode=>{return(mode&61440)===8192},isBlkdev:mode=>{return(mode&61440)===24576},isFIFO:mode=>{return(mode&61440)===4096},isSocket:mode=>{return(mode&49152)===49152},flagModes:{"r":0,"r+":2,"w":577,"w+":578,"a":1089,"a+":1090},modeStringToFlags:str=>{var flags=FS.flagModes[str];if(typeof flags=="undefined"){throw new Error("Unknown file open mode: "+str)}return flags},flagsToPermissionString:flag=>{var perms=["r","w","rw"][flag&3];if(flag&512){perms+="w"}return perms},nodePermissions:(node,perms)=>{if(FS.ignorePermissions){return 0}if(perms.includes("r")&&!(node.mode&292)){return 2}else if(perms.includes("w")&&!(node.mode&146)){return 2}else if(perms.includes("x")&&!(node.mode&73)){return 2}return 0},mayLookup:dir=>{var errCode=FS.nodePermissions(dir,"x");if(errCode)return errCode;if(!dir.node_ops.lookup)return 2;return 0},mayCreate:(dir,name)=>{try{var node=FS.lookupNode(dir,name);return 20}catch(e){}return FS.nodePermissions(dir,"wx")},mayDelete:(dir,name,isdir)=>{var node;try{node=FS.lookupNode(dir,name)}catch(e){return e.errno}var errCode=FS.nodePermissions(dir,"wx");if(errCode){return errCode}if(isdir){if(!FS.isDir(node.mode)){return 54}if(FS.isRoot(node)||FS.getPath(node)===FS.cwd()){return 10}}else{if(FS.isDir(node.mode)){return 31}}return 0},mayOpen:(node,flags)=>{if(!node){return 44}if(FS.isLink(node.mode)){return 32}else if(FS.isDir(node.mode)){if(FS.flagsToPermissionString(flags)!=="r"||flags&512){return 31}}return FS.nodePermissions(node,FS.flagsToPermissionString(flags))},MAX_OPEN_FDS:4096,nextfd:(fd_start=0,fd_end=FS.MAX_OPEN_FDS)=>{for(var fd=fd_start;fd<=fd_end;fd++){if(!FS.streams[fd]){return fd}}throw new FS.ErrnoError(33)},getStream:fd=>FS.streams[fd],createStream:(stream,fd_start,fd_end)=>{if(!FS.FSStream){FS.FSStream=function(){this.shared={}};FS.FSStream.prototype={};Object.defineProperties(FS.FSStream.prototype,{object:{get:function(){return this.node},set:function(val){this.node=val}},isRead:{get:function(){return(this.flags&2097155)!==1}},isWrite:{get:function(){return(this.flags&2097155)!==0}},isAppend:{get:function(){return this.flags&1024}},flags:{get:function(){return this.shared.flags},set:function(val){this.shared.flags=val}},position:{get:function(){return this.shared.position},set:function(val){this.shared.position=val}}})}stream=Object.assign(new FS.FSStream,stream);var fd=FS.nextfd(fd_start,fd_end);stream.fd=fd;FS.streams[fd]=stream;return stream},closeStream:fd=>{FS.streams[fd]=null},chrdev_stream_ops:{open:stream=>{var device=FS.getDevice(stream.node.rdev);stream.stream_ops=device.stream_ops;if(stream.stream_ops.open){stream.stream_ops.open(stream)}},llseek:()=>{throw new FS.ErrnoError(70)}},major:dev=>dev>>8,minor:dev=>dev&255,makedev:(ma,mi)=>ma<<8|mi,registerDevice:(dev,ops)=>{FS.devices[dev]={stream_ops:ops}},getDevice:dev=>FS.devices[dev],getMounts:mount=>{var mounts=[];var check=[mount];while(check.length){var m=check.pop();mounts.push(m);check.push.apply(check,m.mounts)}return mounts},syncfs:(populate,callback)=>{if(typeof populate=="function"){callback=populate;populate=false}FS.syncFSRequests++;if(FS.syncFSRequests>1){err("warning: "+FS.syncFSRequests+" FS.syncfs operations in flight at once, probably just doing extra work")}var mounts=FS.getMounts(FS.root.mount);var completed=0;function doCallback(errCode){FS.syncFSRequests--;return callback(errCode)}function done(errCode){if(errCode){if(!done.errored){done.errored=true;return doCallback(errCode)}return}if(++completed>=mounts.length){doCallback(null)}}mounts.forEach(mount=>{if(!mount.type.syncfs){return done(null)}mount.type.syncfs(mount,populate,done)})},mount:(type,opts,mountpoint)=>{var root=mountpoint==="/";var pseudo=!mountpoint;var node;if(root&&FS.root){throw new FS.ErrnoError(10)}else if(!root&&!pseudo){var lookup=FS.lookupPath(mountpoint,{follow_mount:false});mountpoint=lookup.path;node=lookup.node;if(FS.isMountpoint(node)){throw new FS.ErrnoError(10)}if(!FS.isDir(node.mode)){throw new FS.ErrnoError(54)}}var mount={type:type,opts:opts,mountpoint:mountpoint,mounts:[]};var mountRoot=type.mount(mount);mountRoot.mount=mount;mount.root=mountRoot;if(root){FS.root=mountRoot}else if(node){node.mounted=mount;if(node.mount){node.mount.mounts.push(mount)}}return mountRoot},unmount:mountpoint=>{var lookup=FS.lookupPath(mountpoint,{follow_mount:false});if(!FS.isMountpoint(lookup.node)){throw new FS.ErrnoError(28)}var node=lookup.node;var mount=node.mounted;var mounts=FS.getMounts(mount);Object.keys(FS.nameTable).forEach(hash=>{var current=FS.nameTable[hash];while(current){var next=current.name_next;if(mounts.includes(current.mount)){FS.destroyNode(current)}current=next}});node.mounted=null;var idx=node.mount.mounts.indexOf(mount);node.mount.mounts.splice(idx,1)},lookup:(parent,name)=>{return parent.node_ops.lookup(parent,name)},mknod:(path,mode,dev)=>{var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;var name=PATH.basename(path);if(!name||name==="."||name===".."){throw new FS.ErrnoError(28)}var errCode=FS.mayCreate(parent,name);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.mknod){throw new FS.ErrnoError(63)}return parent.node_ops.mknod(parent,name,mode,dev)},create:(path,mode)=>{mode=mode!==undefined?mode:438;mode&=4095;mode|=32768;return FS.mknod(path,mode,0)},mkdir:(path,mode)=>{mode=mode!==undefined?mode:511;mode&=511|512;mode|=16384;return FS.mknod(path,mode,0)},mkdirTree:(path,mode)=>{var dirs=path.split("/");var d="";for(var i=0;i{if(typeof dev=="undefined"){dev=mode;mode=438}mode|=8192;return FS.mknod(path,mode,dev)},symlink:(oldpath,newpath)=>{if(!PATH_FS.resolve(oldpath)){throw new FS.ErrnoError(44)}var lookup=FS.lookupPath(newpath,{parent:true});var parent=lookup.node;if(!parent){throw new FS.ErrnoError(44)}var newname=PATH.basename(newpath);var errCode=FS.mayCreate(parent,newname);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.symlink){throw new FS.ErrnoError(63)}return parent.node_ops.symlink(parent,newname,oldpath)},rename:(old_path,new_path)=>{var old_dirname=PATH.dirname(old_path);var new_dirname=PATH.dirname(new_path);var old_name=PATH.basename(old_path);var new_name=PATH.basename(new_path);var lookup,old_dir,new_dir;lookup=FS.lookupPath(old_path,{parent:true});old_dir=lookup.node;lookup=FS.lookupPath(new_path,{parent:true});new_dir=lookup.node;if(!old_dir||!new_dir)throw new FS.ErrnoError(44);if(old_dir.mount!==new_dir.mount){throw new FS.ErrnoError(75)}var old_node=FS.lookupNode(old_dir,old_name);var relative=PATH_FS.relative(old_path,new_dirname);if(relative.charAt(0)!=="."){throw new FS.ErrnoError(28)}relative=PATH_FS.relative(new_path,old_dirname);if(relative.charAt(0)!=="."){throw new FS.ErrnoError(55)}var new_node;try{new_node=FS.lookupNode(new_dir,new_name)}catch(e){}if(old_node===new_node){return}var isdir=FS.isDir(old_node.mode);var errCode=FS.mayDelete(old_dir,old_name,isdir);if(errCode){throw new FS.ErrnoError(errCode)}errCode=new_node?FS.mayDelete(new_dir,new_name,isdir):FS.mayCreate(new_dir,new_name);if(errCode){throw new FS.ErrnoError(errCode)}if(!old_dir.node_ops.rename){throw new FS.ErrnoError(63)}if(FS.isMountpoint(old_node)||new_node&&FS.isMountpoint(new_node)){throw new FS.ErrnoError(10)}if(new_dir!==old_dir){errCode=FS.nodePermissions(old_dir,"w");if(errCode){throw new FS.ErrnoError(errCode)}}FS.hashRemoveNode(old_node);try{old_dir.node_ops.rename(old_node,new_dir,new_name)}catch(e){throw e}finally{FS.hashAddNode(old_node)}},rmdir:path=>{var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;var name=PATH.basename(path);var node=FS.lookupNode(parent,name);var errCode=FS.mayDelete(parent,name,true);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.rmdir){throw new FS.ErrnoError(63)}if(FS.isMountpoint(node)){throw new FS.ErrnoError(10)}parent.node_ops.rmdir(parent,name);FS.destroyNode(node)},readdir:path=>{var lookup=FS.lookupPath(path,{follow:true});var node=lookup.node;if(!node.node_ops.readdir){throw new FS.ErrnoError(54)}return node.node_ops.readdir(node)},unlink:path=>{var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;if(!parent){throw new FS.ErrnoError(44)}var name=PATH.basename(path);var node=FS.lookupNode(parent,name);var errCode=FS.mayDelete(parent,name,false);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.unlink){throw new FS.ErrnoError(63)}if(FS.isMountpoint(node)){throw new FS.ErrnoError(10)}parent.node_ops.unlink(parent,name);FS.destroyNode(node)},readlink:path=>{var lookup=FS.lookupPath(path);var link=lookup.node;if(!link){throw new FS.ErrnoError(44)}if(!link.node_ops.readlink){throw new FS.ErrnoError(28)}return PATH_FS.resolve(FS.getPath(link.parent),link.node_ops.readlink(link))},stat:(path,dontFollow)=>{var lookup=FS.lookupPath(path,{follow:!dontFollow});var node=lookup.node;if(!node){throw new FS.ErrnoError(44)}if(!node.node_ops.getattr){throw new FS.ErrnoError(63)}return node.node_ops.getattr(node)},lstat:path=>{return FS.stat(path,true)},chmod:(path,mode,dontFollow)=>{var node;if(typeof path=="string"){var lookup=FS.lookupPath(path,{follow:!dontFollow});node=lookup.node}else{node=path}if(!node.node_ops.setattr){throw new FS.ErrnoError(63)}node.node_ops.setattr(node,{mode:mode&4095|node.mode&~4095,timestamp:Date.now()})},lchmod:(path,mode)=>{FS.chmod(path,mode,true)},fchmod:(fd,mode)=>{var stream=FS.getStream(fd);if(!stream){throw new FS.ErrnoError(8)}FS.chmod(stream.node,mode)},chown:(path,uid,gid,dontFollow)=>{var node;if(typeof path=="string"){var lookup=FS.lookupPath(path,{follow:!dontFollow});node=lookup.node}else{node=path}if(!node.node_ops.setattr){throw new FS.ErrnoError(63)}node.node_ops.setattr(node,{timestamp:Date.now()})},lchown:(path,uid,gid)=>{FS.chown(path,uid,gid,true)},fchown:(fd,uid,gid)=>{var stream=FS.getStream(fd);if(!stream){throw new FS.ErrnoError(8)}FS.chown(stream.node,uid,gid)},truncate:(path,len)=>{if(len<0){throw new FS.ErrnoError(28)}var node;if(typeof path=="string"){var lookup=FS.lookupPath(path,{follow:true});node=lookup.node}else{node=path}if(!node.node_ops.setattr){throw new FS.ErrnoError(63)}if(FS.isDir(node.mode)){throw new FS.ErrnoError(31)}if(!FS.isFile(node.mode)){throw new FS.ErrnoError(28)}var errCode=FS.nodePermissions(node,"w");if(errCode){throw new FS.ErrnoError(errCode)}node.node_ops.setattr(node,{size:len,timestamp:Date.now()})},ftruncate:(fd,len)=>{var stream=FS.getStream(fd);if(!stream){throw new FS.ErrnoError(8)}if((stream.flags&2097155)===0){throw new FS.ErrnoError(28)}FS.truncate(stream.node,len)},utime:(path,atime,mtime)=>{var lookup=FS.lookupPath(path,{follow:true});var node=lookup.node;node.node_ops.setattr(node,{timestamp:Math.max(atime,mtime)})},open:(path,flags,mode)=>{if(path===""){throw new FS.ErrnoError(44)}flags=typeof flags=="string"?FS.modeStringToFlags(flags):flags;mode=typeof mode=="undefined"?438:mode;if(flags&64){mode=mode&4095|32768}else{mode=0}var node;if(typeof path=="object"){node=path}else{path=PATH.normalize(path);try{var lookup=FS.lookupPath(path,{follow:!(flags&131072)});node=lookup.node}catch(e){}}var created=false;if(flags&64){if(node){if(flags&128){throw new FS.ErrnoError(20)}}else{node=FS.mknod(path,mode,0);created=true}}if(!node){throw new FS.ErrnoError(44)}if(FS.isChrdev(node.mode)){flags&=~512}if(flags&65536&&!FS.isDir(node.mode)){throw new FS.ErrnoError(54)}if(!created){var errCode=FS.mayOpen(node,flags);if(errCode){throw new FS.ErrnoError(errCode)}}if(flags&512&&!created){FS.truncate(node,0)}flags&=~(128|512|131072);var stream=FS.createStream({node:node,path:FS.getPath(node),flags:flags,seekable:true,position:0,stream_ops:node.stream_ops,ungotten:[],error:false});if(stream.stream_ops.open){stream.stream_ops.open(stream)}if(Module["logReadFiles"]&&!(flags&1)){if(!FS.readFiles)FS.readFiles={};if(!(path in FS.readFiles)){FS.readFiles[path]=1}}return stream},close:stream=>{if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if(stream.getdents)stream.getdents=null;try{if(stream.stream_ops.close){stream.stream_ops.close(stream)}}catch(e){throw e}finally{FS.closeStream(stream.fd)}stream.fd=null},isClosed:stream=>{return stream.fd===null},llseek:(stream,offset,whence)=>{if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if(!stream.seekable||!stream.stream_ops.llseek){throw new FS.ErrnoError(70)}if(whence!=0&&whence!=1&&whence!=2){throw new FS.ErrnoError(28)}stream.position=stream.stream_ops.llseek(stream,offset,whence);stream.ungotten=[];return stream.position},read:(stream,buffer,offset,length,position)=>{if(length<0||position<0){throw new FS.ErrnoError(28)}if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if((stream.flags&2097155)===1){throw new FS.ErrnoError(8)}if(FS.isDir(stream.node.mode)){throw new FS.ErrnoError(31)}if(!stream.stream_ops.read){throw new FS.ErrnoError(28)}var seeking=typeof position!="undefined";if(!seeking){position=stream.position}else if(!stream.seekable){throw new FS.ErrnoError(70)}var bytesRead=stream.stream_ops.read(stream,buffer,offset,length,position);if(!seeking)stream.position+=bytesRead;return bytesRead},write:(stream,buffer,offset,length,position,canOwn)=>{if(length<0||position<0){throw new FS.ErrnoError(28)}if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if((stream.flags&2097155)===0){throw new FS.ErrnoError(8)}if(FS.isDir(stream.node.mode)){throw new FS.ErrnoError(31)}if(!stream.stream_ops.write){throw new FS.ErrnoError(28)}if(stream.seekable&&stream.flags&1024){FS.llseek(stream,0,2)}var seeking=typeof position!="undefined";if(!seeking){position=stream.position}else if(!stream.seekable){throw new FS.ErrnoError(70)}var bytesWritten=stream.stream_ops.write(stream,buffer,offset,length,position,canOwn);if(!seeking)stream.position+=bytesWritten;return bytesWritten},allocate:(stream,offset,length)=>{if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if(offset<0||length<=0){throw new FS.ErrnoError(28)}if((stream.flags&2097155)===0){throw new FS.ErrnoError(8)}if(!FS.isFile(stream.node.mode)&&!FS.isDir(stream.node.mode)){throw new FS.ErrnoError(43)}if(!stream.stream_ops.allocate){throw new FS.ErrnoError(138)}stream.stream_ops.allocate(stream,offset,length)},mmap:(stream,length,position,prot,flags)=>{if((prot&2)!==0&&(flags&2)===0&&(stream.flags&2097155)!==2){throw new FS.ErrnoError(2)}if((stream.flags&2097155)===1){throw new FS.ErrnoError(2)}if(!stream.stream_ops.mmap){throw new FS.ErrnoError(43)}return stream.stream_ops.mmap(stream,length,position,prot,flags)},msync:(stream,buffer,offset,length,mmapFlags)=>{if(!stream.stream_ops.msync){return 0}return stream.stream_ops.msync(stream,buffer,offset,length,mmapFlags)},munmap:stream=>0,ioctl:(stream,cmd,arg)=>{if(!stream.stream_ops.ioctl){throw new FS.ErrnoError(59)}return stream.stream_ops.ioctl(stream,cmd,arg)},readFile:(path,opts={})=>{opts.flags=opts.flags||0;opts.encoding=opts.encoding||"binary";if(opts.encoding!=="utf8"&&opts.encoding!=="binary"){throw new Error('Invalid encoding type "'+opts.encoding+'"')}var ret;var stream=FS.open(path,opts.flags);var stat=FS.stat(path);var length=stat.size;var buf=new Uint8Array(length);FS.read(stream,buf,0,length,0);if(opts.encoding==="utf8"){ret=UTF8ArrayToString(buf,0)}else if(opts.encoding==="binary"){ret=buf}FS.close(stream);return ret},writeFile:(path,data,opts={})=>{opts.flags=opts.flags||577;var stream=FS.open(path,opts.flags,opts.mode);if(typeof data=="string"){var buf=new Uint8Array(lengthBytesUTF8(data)+1);var actualNumBytes=stringToUTF8Array(data,buf,0,buf.length);FS.write(stream,buf,0,actualNumBytes,undefined,opts.canOwn)}else if(ArrayBuffer.isView(data)){FS.write(stream,data,0,data.byteLength,undefined,opts.canOwn)}else{throw new Error("Unsupported data type")}FS.close(stream)},cwd:()=>FS.currentPath,chdir:path=>{var lookup=FS.lookupPath(path,{follow:true});if(lookup.node===null){throw new FS.ErrnoError(44)}if(!FS.isDir(lookup.node.mode)){throw new FS.ErrnoError(54)}var errCode=FS.nodePermissions(lookup.node,"x");if(errCode){throw new FS.ErrnoError(errCode)}FS.currentPath=lookup.path},createDefaultDirectories:()=>{FS.mkdir("/tmp");FS.mkdir("/home");FS.mkdir("/home/web_user")},createDefaultDevices:()=>{FS.mkdir("/dev");FS.registerDevice(FS.makedev(1,3),{read:()=>0,write:(stream,buffer,offset,length,pos)=>length});FS.mkdev("/dev/null",FS.makedev(1,3));TTY.register(FS.makedev(5,0),TTY.default_tty_ops);TTY.register(FS.makedev(6,0),TTY.default_tty1_ops);FS.mkdev("/dev/tty",FS.makedev(5,0));FS.mkdev("/dev/tty1",FS.makedev(6,0));var random_device=getRandomDevice();FS.createDevice("/dev","random",random_device);FS.createDevice("/dev","urandom",random_device);FS.mkdir("/dev/shm");FS.mkdir("/dev/shm/tmp")},createSpecialDirectories:()=>{FS.mkdir("/proc");var proc_self=FS.mkdir("/proc/self");FS.mkdir("/proc/self/fd");FS.mount({mount:()=>{var node=FS.createNode(proc_self,"fd",16384|511,73);node.node_ops={lookup:(parent,name)=>{var fd=+name;var stream=FS.getStream(fd);if(!stream)throw new FS.ErrnoError(8);var ret={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>stream.path}};ret.parent=ret;return ret}};return node}},{},"/proc/self/fd")},createStandardStreams:()=>{if(Module["stdin"]){FS.createDevice("/dev","stdin",Module["stdin"])}else{FS.symlink("/dev/tty","/dev/stdin")}if(Module["stdout"]){FS.createDevice("/dev","stdout",null,Module["stdout"])}else{FS.symlink("/dev/tty","/dev/stdout")}if(Module["stderr"]){FS.createDevice("/dev","stderr",null,Module["stderr"])}else{FS.symlink("/dev/tty1","/dev/stderr")}var stdin=FS.open("/dev/stdin",0);var stdout=FS.open("/dev/stdout",1);var stderr=FS.open("/dev/stderr",1)},ensureErrnoError:()=>{if(FS.ErrnoError)return;FS.ErrnoError=function ErrnoError(errno,node){this.node=node;this.setErrno=function(errno){this.errno=errno};this.setErrno(errno);this.message="FS error"};FS.ErrnoError.prototype=new Error;FS.ErrnoError.prototype.constructor=FS.ErrnoError;[44].forEach(code=>{FS.genericErrors[code]=new FS.ErrnoError(code);FS.genericErrors[code].stack=""})},staticInit:()=>{FS.ensureErrnoError();FS.nameTable=new Array(4096);FS.mount(MEMFS,{},"/");FS.createDefaultDirectories();FS.createDefaultDevices();FS.createSpecialDirectories();FS.filesystems={"MEMFS":MEMFS}},init:(input,output,error)=>{FS.init.initialized=true;FS.ensureErrnoError();Module["stdin"]=input||Module["stdin"];Module["stdout"]=output||Module["stdout"];Module["stderr"]=error||Module["stderr"];FS.createStandardStreams()},quit:()=>{FS.init.initialized=false;for(var i=0;i{var mode=0;if(canRead)mode|=292|73;if(canWrite)mode|=146;return mode},findObject:(path,dontResolveLastLink)=>{var ret=FS.analyzePath(path,dontResolveLastLink);if(!ret.exists){return null}return ret.object},analyzePath:(path,dontResolveLastLink)=>{try{var lookup=FS.lookupPath(path,{follow:!dontResolveLastLink});path=lookup.path}catch(e){}var ret={isRoot:false,exists:false,error:0,name:null,path:null,object:null,parentExists:false,parentPath:null,parentObject:null};try{var lookup=FS.lookupPath(path,{parent:true});ret.parentExists=true;ret.parentPath=lookup.path;ret.parentObject=lookup.node;ret.name=PATH.basename(path);lookup=FS.lookupPath(path,{follow:!dontResolveLastLink});ret.exists=true;ret.path=lookup.path;ret.object=lookup.node;ret.name=lookup.node.name;ret.isRoot=lookup.path==="/"}catch(e){ret.error=e.errno}return ret},createPath:(parent,path,canRead,canWrite)=>{parent=typeof parent=="string"?parent:FS.getPath(parent);var parts=path.split("/").reverse();while(parts.length){var part=parts.pop();if(!part)continue;var current=PATH.join2(parent,part);try{FS.mkdir(current)}catch(e){}parent=current}return current},createFile:(parent,name,properties,canRead,canWrite)=>{var path=PATH.join2(typeof parent=="string"?parent:FS.getPath(parent),name);var mode=FS.getMode(canRead,canWrite);return FS.create(path,mode)},createDataFile:(parent,name,data,canRead,canWrite,canOwn)=>{var path=name;if(parent){parent=typeof parent=="string"?parent:FS.getPath(parent);path=name?PATH.join2(parent,name):parent}var mode=FS.getMode(canRead,canWrite);var node=FS.create(path,mode);if(data){if(typeof data=="string"){var arr=new Array(data.length);for(var i=0,len=data.length;i{var path=PATH.join2(typeof parent=="string"?parent:FS.getPath(parent),name);var mode=FS.getMode(!!input,!!output);if(!FS.createDevice.major)FS.createDevice.major=64;var dev=FS.makedev(FS.createDevice.major++,0);FS.registerDevice(dev,{open:stream=>{stream.seekable=false},close:stream=>{if(output&&output.buffer&&output.buffer.length){output(10)}},read:(stream,buffer,offset,length,pos)=>{var bytesRead=0;for(var i=0;i{for(var i=0;i{if(obj.isDevice||obj.isFolder||obj.link||obj.contents)return true;if(typeof XMLHttpRequest!="undefined"){throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.")}else if(read_){try{obj.contents=intArrayFromString(read_(obj.url),true);obj.usedBytes=obj.contents.length}catch(e){throw new FS.ErrnoError(29)}}else{throw new Error("Cannot load without read() or XMLHttpRequest.")}},createLazyFile:(parent,name,url,canRead,canWrite)=>{function LazyUint8Array(){this.lengthKnown=false;this.chunks=[]}LazyUint8Array.prototype.get=function LazyUint8Array_get(idx){if(idx>this.length-1||idx<0){return undefined}var chunkOffset=idx%this.chunkSize;var chunkNum=idx/this.chunkSize|0;return this.getter(chunkNum)[chunkOffset]};LazyUint8Array.prototype.setDataGetter=function LazyUint8Array_setDataGetter(getter){this.getter=getter};LazyUint8Array.prototype.cacheLength=function LazyUint8Array_cacheLength(){var xhr=new XMLHttpRequest;xhr.open("HEAD",url,false);xhr.send(null);if(!(xhr.status>=200&&xhr.status<300||xhr.status===304))throw new Error("Couldn't load "+url+". Status: "+xhr.status);var datalength=Number(xhr.getResponseHeader("Content-length"));var header;var hasByteServing=(header=xhr.getResponseHeader("Accept-Ranges"))&&header==="bytes";var usesGzip=(header=xhr.getResponseHeader("Content-Encoding"))&&header==="gzip";var chunkSize=1024*1024;if(!hasByteServing)chunkSize=datalength;var doXHR=(from,to)=>{if(from>to)throw new Error("invalid range ("+from+", "+to+") or no bytes requested!");if(to>datalength-1)throw new Error("only "+datalength+" bytes available! programmer error!");var xhr=new XMLHttpRequest;xhr.open("GET",url,false);if(datalength!==chunkSize)xhr.setRequestHeader("Range","bytes="+from+"-"+to);xhr.responseType="arraybuffer";if(xhr.overrideMimeType){xhr.overrideMimeType("text/plain; charset=x-user-defined")}xhr.send(null);if(!(xhr.status>=200&&xhr.status<300||xhr.status===304))throw new Error("Couldn't load "+url+". Status: "+xhr.status);if(xhr.response!==undefined){return new Uint8Array(xhr.response||[])}return intArrayFromString(xhr.responseText||"",true)};var lazyArray=this;lazyArray.setDataGetter(chunkNum=>{var start=chunkNum*chunkSize;var end=(chunkNum+1)*chunkSize-1;end=Math.min(end,datalength-1);if(typeof lazyArray.chunks[chunkNum]=="undefined"){lazyArray.chunks[chunkNum]=doXHR(start,end)}if(typeof lazyArray.chunks[chunkNum]=="undefined")throw new Error("doXHR failed!");return lazyArray.chunks[chunkNum]});if(usesGzip||!datalength){chunkSize=datalength=1;datalength=this.getter(0).length;chunkSize=datalength;out("LazyFiles on gzip forces download of the whole file when length is accessed")}this._length=datalength;this._chunkSize=chunkSize;this.lengthKnown=true};if(typeof XMLHttpRequest!="undefined"){if(!ENVIRONMENT_IS_WORKER)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var lazyArray=new LazyUint8Array;Object.defineProperties(lazyArray,{length:{get:function(){if(!this.lengthKnown){this.cacheLength()}return this._length}},chunkSize:{get:function(){if(!this.lengthKnown){this.cacheLength()}return this._chunkSize}}});var properties={isDevice:false,contents:lazyArray}}else{var properties={isDevice:false,url:url}}var node=FS.createFile(parent,name,properties,canRead,canWrite);if(properties.contents){node.contents=properties.contents}else if(properties.url){node.contents=null;node.url=properties.url}Object.defineProperties(node,{usedBytes:{get:function(){return this.contents.length}}});var stream_ops={};var keys=Object.keys(node.stream_ops);keys.forEach(key=>{var fn=node.stream_ops[key];stream_ops[key]=function forceLoadLazyFile(){FS.forceLoadFile(node);return fn.apply(null,arguments)}});function writeChunks(stream,buffer,offset,length,position){var contents=stream.node.contents;if(position>=contents.length)return 0;var size=Math.min(contents.length-position,length);if(contents.slice){for(var i=0;i{FS.forceLoadFile(node);return writeChunks(stream,buffer,offset,length,position)};stream_ops.mmap=(stream,length,position,prot,flags)=>{FS.forceLoadFile(node);var ptr=mmapAlloc(length);if(!ptr){throw new FS.ErrnoError(48)}writeChunks(stream,HEAP8,ptr,length,position);return{ptr:ptr,allocated:true}};node.stream_ops=stream_ops;return node},createPreloadedFile:(parent,name,url,canRead,canWrite,onload,onerror,dontCreateFile,canOwn,preFinish)=>{var fullname=name?PATH_FS.resolve(PATH.join2(parent,name)):parent;var dep=getUniqueRunDependency("cp "+fullname);function processData(byteArray){function finish(byteArray){if(preFinish)preFinish();if(!dontCreateFile){FS.createDataFile(parent,name,byteArray,canRead,canWrite,canOwn)}if(onload)onload();removeRunDependency(dep)}if(Browser.handledByPreloadPlugin(byteArray,fullname,finish,()=>{if(onerror)onerror();removeRunDependency(dep)})){return}finish(byteArray)}addRunDependency(dep);if(typeof url=="string"){asyncLoad(url,byteArray=>processData(byteArray),onerror)}else{processData(url)}},indexedDB:()=>{return window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB},DB_NAME:()=>{return"EM_FS_"+window.location.pathname},DB_VERSION:20,DB_STORE_NAME:"FILE_DATA",saveFilesToDB:(paths,onload,onerror)=>{onload=onload||(()=>{});onerror=onerror||(()=>{});var indexedDB=FS.indexedDB();try{var openRequest=indexedDB.open(FS.DB_NAME(),FS.DB_VERSION)}catch(e){return onerror(e)}openRequest.onupgradeneeded=()=>{out("creating db");var db=openRequest.result;db.createObjectStore(FS.DB_STORE_NAME)};openRequest.onsuccess=()=>{var db=openRequest.result;var transaction=db.transaction([FS.DB_STORE_NAME],"readwrite");var files=transaction.objectStore(FS.DB_STORE_NAME);var ok=0,fail=0,total=paths.length;function finish(){if(fail==0)onload();else onerror()}paths.forEach(path=>{var putRequest=files.put(FS.analyzePath(path).object.contents,path);putRequest.onsuccess=()=>{ok++;if(ok+fail==total)finish()};putRequest.onerror=()=>{fail++;if(ok+fail==total)finish()}});transaction.onerror=onerror};openRequest.onerror=onerror},loadFilesFromDB:(paths,onload,onerror)=>{onload=onload||(()=>{});onerror=onerror||(()=>{});var indexedDB=FS.indexedDB();try{var openRequest=indexedDB.open(FS.DB_NAME(),FS.DB_VERSION)}catch(e){return onerror(e)}openRequest.onupgradeneeded=onerror;openRequest.onsuccess=()=>{var db=openRequest.result;try{var transaction=db.transaction([FS.DB_STORE_NAME],"readonly")}catch(e){onerror(e);return}var files=transaction.objectStore(FS.DB_STORE_NAME);var ok=0,fail=0,total=paths.length;function finish(){if(fail==0)onload();else onerror()}paths.forEach(path=>{var getRequest=files.get(path);getRequest.onsuccess=()=>{if(FS.analyzePath(path).exists){FS.unlink(path)}FS.createDataFile(PATH.dirname(path),PATH.basename(path),getRequest.result,true,true,true);ok++;if(ok+fail==total)finish()};getRequest.onerror=()=>{fail++;if(ok+fail==total)finish()}});transaction.onerror=onerror};openRequest.onerror=onerror}};var SYSCALLS={DEFAULT_POLLMASK:5,calculateAt:function(dirfd,path,allowEmpty){if(PATH.isAbs(path)){return path}var dir;if(dirfd===-100){dir=FS.cwd()}else{var dirstream=SYSCALLS.getStreamFromFD(dirfd);dir=dirstream.path}if(path.length==0){if(!allowEmpty){throw new FS.ErrnoError(44)}return dir}return PATH.join2(dir,path)},doStat:function(func,path,buf){try{var stat=func(path)}catch(e){if(e&&e.node&&PATH.normalize(path)!==PATH.normalize(FS.getPath(e.node))){return-54}throw e}HEAP32[buf>>2]=stat.dev;HEAP32[buf+8>>2]=stat.ino;HEAP32[buf+12>>2]=stat.mode;HEAPU32[buf+16>>2]=stat.nlink;HEAP32[buf+20>>2]=stat.uid;HEAP32[buf+24>>2]=stat.gid;HEAP32[buf+28>>2]=stat.rdev;tempI64=[stat.size>>>0,(tempDouble=stat.size,+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+40>>2]=tempI64[0],HEAP32[buf+44>>2]=tempI64[1];HEAP32[buf+48>>2]=4096;HEAP32[buf+52>>2]=stat.blocks;tempI64=[Math.floor(stat.atime.getTime()/1e3)>>>0,(tempDouble=Math.floor(stat.atime.getTime()/1e3),+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+56>>2]=tempI64[0],HEAP32[buf+60>>2]=tempI64[1];HEAPU32[buf+64>>2]=0;tempI64=[Math.floor(stat.mtime.getTime()/1e3)>>>0,(tempDouble=Math.floor(stat.mtime.getTime()/1e3),+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+72>>2]=tempI64[0],HEAP32[buf+76>>2]=tempI64[1];HEAPU32[buf+80>>2]=0;tempI64=[Math.floor(stat.ctime.getTime()/1e3)>>>0,(tempDouble=Math.floor(stat.ctime.getTime()/1e3),+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+88>>2]=tempI64[0],HEAP32[buf+92>>2]=tempI64[1];HEAPU32[buf+96>>2]=0;tempI64=[stat.ino>>>0,(tempDouble=stat.ino,+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+104>>2]=tempI64[0],HEAP32[buf+108>>2]=tempI64[1];return 0},doMsync:function(addr,stream,len,flags,offset){if(!FS.isFile(stream.node.mode)){throw new FS.ErrnoError(43)}if(flags&2){return 0}var buffer=HEAPU8.slice(addr,addr+len);FS.msync(stream,buffer,offset,len,flags)},varargs:undefined,get:function(){SYSCALLS.varargs+=4;var ret=HEAP32[SYSCALLS.varargs-4>>2];return ret},getStr:function(ptr){var ret=UTF8ToString(ptr);return ret},getStreamFromFD:function(fd){var stream=FS.getStream(fd);if(!stream)throw new FS.ErrnoError(8);return stream}};function ___syscall_fcntl64(fd,cmd,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(fd);switch(cmd){case 0:{var arg=SYSCALLS.get();if(arg<0){return-28}var newStream;newStream=FS.createStream(stream,arg);return newStream.fd}case 1:case 2:return 0;case 3:return stream.flags;case 4:{var arg=SYSCALLS.get();stream.flags|=arg;return 0}case 5:{var arg=SYSCALLS.get();var offset=0;HEAP16[arg+offset>>1]=2;return 0}case 6:case 7:return 0;case 16:case 8:return-28;case 9:setErrNo(28);return-1;default:{return-28}}}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_getcwd(buf,size){try{if(size===0)return-28;var cwd=FS.cwd();var cwdLengthInBytes=lengthBytesUTF8(cwd)+1;if(size>2]=0;return 0}case 21520:{if(!stream.tty)return-59;return-28}case 21531:{var argp=SYSCALLS.get();return FS.ioctl(stream,op,argp)}case 21523:{if(!stream.tty)return-59;return 0}case 21524:{if(!stream.tty)return-59;return 0}default:return-28}}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_openat(dirfd,path,flags,varargs){SYSCALLS.varargs=varargs;try{path=SYSCALLS.getStr(path);path=SYSCALLS.calculateAt(dirfd,path);var mode=varargs?SYSCALLS.get():0;return FS.open(path,flags,mode).fd}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}var readAsmConstArgsArray=[];function readAsmConstArgs(sigPtr,buf){readAsmConstArgsArray.length=0;var ch;buf>>=2;while(ch=HEAPU8[sigPtr++]){buf+=ch!=105&buf;readAsmConstArgsArray.push(ch==105?HEAP32[buf]:HEAPF64[buf++>>1]);++buf}return readAsmConstArgsArray}function _emscripten_asm_const_int(code,sigPtr,argbuf){var args=readAsmConstArgs(sigPtr,argbuf);return ASM_CONSTS[code].apply(null,args)}function _emscripten_date_now(){return Date.now()}var JSEvents={inEventHandler:0,removeAllEventListeners:function(){for(var i=JSEvents.eventHandlers.length-1;i>=0;--i){JSEvents._removeHandler(i)}JSEvents.eventHandlers=[];JSEvents.deferredCalls=[]},registerRemoveEventListeners:function(){if(!JSEvents.removeEventListenersRegistered){__ATEXIT__.push(JSEvents.removeAllEventListeners);JSEvents.removeEventListenersRegistered=true}},deferredCalls:[],deferCall:function(targetFunction,precedence,argsList){function arraysHaveEqualContent(arrA,arrB){if(arrA.length!=arrB.length)return false;for(var i in arrA){if(arrA[i]!=arrB[i])return false}return true}for(var i in JSEvents.deferredCalls){var call=JSEvents.deferredCalls[i];if(call.targetFunction==targetFunction&&arraysHaveEqualContent(call.argsList,argsList)){return}}JSEvents.deferredCalls.push({targetFunction:targetFunction,precedence:precedence,argsList:argsList});JSEvents.deferredCalls.sort(function(x,y){return x.precedence2?UTF8ToString(cString):cString}var specialHTMLTargets=[0,typeof document!="undefined"?document:0,typeof window!="undefined"?window:0];function findEventTarget(target){target=maybeCStringToJsString(target);var domElement=specialHTMLTargets[target]||(typeof document!="undefined"?document.querySelector(target):undefined);return domElement}function getBoundingClientRect(e){return specialHTMLTargets.indexOf(e)<0?e.getBoundingClientRect():{"left":0,"top":0}}function _emscripten_get_element_css_size(target,width,height){target=findEventTarget(target);if(!target)return-4;var rect=getBoundingClientRect(target);HEAPF64[width>>3]=rect.width;HEAPF64[height>>3]=rect.height;return 0}function fillGamepadEventData(eventStruct,e){HEAPF64[eventStruct>>3]=e.timestamp;for(var i=0;i>3]=e.axes[i]}for(var i=0;i>3]=e.buttons[i].value}else{HEAPF64[eventStruct+i*8+528>>3]=e.buttons[i]}}for(var i=0;i>2]=e.buttons[i].pressed}else{HEAP32[eventStruct+i*4+1040>>2]=e.buttons[i]==1}}HEAP32[eventStruct+1296>>2]=e.connected;HEAP32[eventStruct+1300>>2]=e.index;HEAP32[eventStruct+8>>2]=e.axes.length;HEAP32[eventStruct+12>>2]=e.buttons.length;stringToUTF8(e.id,eventStruct+1304,64);stringToUTF8(e.mapping,eventStruct+1368,64)}function _emscripten_get_gamepad_status(index,gamepadState){if(index<0||index>=JSEvents.lastGamepadState.length)return-5;if(!JSEvents.lastGamepadState[index])return-7;fillGamepadEventData(gamepadState,JSEvents.lastGamepadState[index]);return 0}var _emscripten_get_now;if(ENVIRONMENT_IS_NODE){_emscripten_get_now=()=>{var t=process["hrtime"]();return t[0]*1e3+t[1]/1e6}}else _emscripten_get_now=()=>performance.now();function _emscripten_get_num_gamepads(){return JSEvents.lastGamepadState.length}function __webgl_enable_ANGLE_instanced_arrays(ctx){var ext=ctx.getExtension("ANGLE_instanced_arrays");if(ext){ctx["vertexAttribDivisor"]=function(index,divisor){ext["vertexAttribDivisorANGLE"](index,divisor)};ctx["drawArraysInstanced"]=function(mode,first,count,primcount){ext["drawArraysInstancedANGLE"](mode,first,count,primcount)};ctx["drawElementsInstanced"]=function(mode,count,type,indices,primcount){ext["drawElementsInstancedANGLE"](mode,count,type,indices,primcount)};return 1}}function __webgl_enable_OES_vertex_array_object(ctx){var ext=ctx.getExtension("OES_vertex_array_object");if(ext){ctx["createVertexArray"]=function(){return ext["createVertexArrayOES"]()};ctx["deleteVertexArray"]=function(vao){ext["deleteVertexArrayOES"](vao)};ctx["bindVertexArray"]=function(vao){ext["bindVertexArrayOES"](vao)};ctx["isVertexArray"]=function(vao){return ext["isVertexArrayOES"](vao)};return 1}}function __webgl_enable_WEBGL_draw_buffers(ctx){var ext=ctx.getExtension("WEBGL_draw_buffers");if(ext){ctx["drawBuffers"]=function(n,bufs){ext["drawBuffersWEBGL"](n,bufs)};return 1}}function __webgl_enable_WEBGL_multi_draw(ctx){return!!(ctx.multiDrawWebgl=ctx.getExtension("WEBGL_multi_draw"))}var GL={counter:1,buffers:[],programs:[],framebuffers:[],renderbuffers:[],textures:[],shaders:[],vaos:[],contexts:[],offscreenCanvases:{},queries:[],stringCache:{},unpackAlignment:4,recordError:function recordError(errorCode){if(!GL.lastError){GL.lastError=errorCode}},getNewId:function(table){var ret=GL.counter++;for(var i=table.length;i>2]:-1;source+=UTF8ToString(HEAP32[string+i*4>>2],len<0?undefined:len)}return source},createContext:function(canvas,webGLContextAttributes){if(!canvas.getContextSafariWebGL2Fixed){canvas.getContextSafariWebGL2Fixed=canvas.getContext;function fixedGetContext(ver,attrs){var gl=canvas.getContextSafariWebGL2Fixed(ver,attrs);return ver=="webgl"==gl instanceof WebGLRenderingContext?gl:null}canvas.getContext=fixedGetContext}var ctx=canvas.getContext("webgl",webGLContextAttributes);if(!ctx)return 0;var handle=GL.registerContext(ctx,webGLContextAttributes);return handle},registerContext:function(ctx,webGLContextAttributes){var handle=GL.getNewId(GL.contexts);var context={handle:handle,attributes:webGLContextAttributes,version:webGLContextAttributes.majorVersion,GLctx:ctx};if(ctx.canvas)ctx.canvas.GLctxObject=context;GL.contexts[handle]=context;if(typeof webGLContextAttributes.enableExtensionsByDefault=="undefined"||webGLContextAttributes.enableExtensionsByDefault){GL.initExtensions(context)}return handle},makeContextCurrent:function(contextHandle){GL.currentContext=GL.contexts[contextHandle];Module.ctx=GLctx=GL.currentContext&&GL.currentContext.GLctx;return!(contextHandle&&!GLctx)},getContext:function(contextHandle){return GL.contexts[contextHandle]},deleteContext:function(contextHandle){if(GL.currentContext===GL.contexts[contextHandle])GL.currentContext=null;if(typeof JSEvents=="object")JSEvents.removeAllHandlersOnTarget(GL.contexts[contextHandle].GLctx.canvas);if(GL.contexts[contextHandle]&&GL.contexts[contextHandle].GLctx.canvas)GL.contexts[contextHandle].GLctx.canvas.GLctxObject=undefined;GL.contexts[contextHandle]=null},initExtensions:function(context){if(!context)context=GL.currentContext;if(context.initExtensionsDone)return;context.initExtensionsDone=true;var GLctx=context.GLctx;__webgl_enable_ANGLE_instanced_arrays(GLctx);__webgl_enable_OES_vertex_array_object(GLctx);__webgl_enable_WEBGL_draw_buffers(GLctx);{GLctx.disjointTimerQueryExt=GLctx.getExtension("EXT_disjoint_timer_query")}__webgl_enable_WEBGL_multi_draw(GLctx);var exts=GLctx.getSupportedExtensions()||[];exts.forEach(function(ext){if(!ext.includes("lose_context")&&!ext.includes("debug")){GLctx.getExtension(ext)}})}};function _emscripten_glActiveTexture(x0){GLctx["activeTexture"](x0)}function _emscripten_glAttachShader(program,shader){GLctx.attachShader(GL.programs[program],GL.shaders[shader])}function _emscripten_glBeginQueryEXT(target,id){GLctx.disjointTimerQueryExt["beginQueryEXT"](target,GL.queries[id])}function _emscripten_glBindAttribLocation(program,index,name){GLctx.bindAttribLocation(GL.programs[program],index,UTF8ToString(name))}function _emscripten_glBindBuffer(target,buffer){GLctx.bindBuffer(target,GL.buffers[buffer])}function _emscripten_glBindFramebuffer(target,framebuffer){GLctx.bindFramebuffer(target,GL.framebuffers[framebuffer])}function _emscripten_glBindRenderbuffer(target,renderbuffer){GLctx.bindRenderbuffer(target,GL.renderbuffers[renderbuffer])}function _emscripten_glBindTexture(target,texture){GLctx.bindTexture(target,GL.textures[texture])}function _emscripten_glBindVertexArrayOES(vao){GLctx["bindVertexArray"](GL.vaos[vao])}function _emscripten_glBlendColor(x0,x1,x2,x3){GLctx["blendColor"](x0,x1,x2,x3)}function _emscripten_glBlendEquation(x0){GLctx["blendEquation"](x0)}function _emscripten_glBlendEquationSeparate(x0,x1){GLctx["blendEquationSeparate"](x0,x1)}function _emscripten_glBlendFunc(x0,x1){GLctx["blendFunc"](x0,x1)}function _emscripten_glBlendFuncSeparate(x0,x1,x2,x3){GLctx["blendFuncSeparate"](x0,x1,x2,x3)}function _emscripten_glBufferData(target,size,data,usage){GLctx.bufferData(target,data?HEAPU8.subarray(data,data+size):size,usage)}function _emscripten_glBufferSubData(target,offset,size,data){GLctx.bufferSubData(target,offset,HEAPU8.subarray(data,data+size))}function _emscripten_glCheckFramebufferStatus(x0){return GLctx["checkFramebufferStatus"](x0)}function _emscripten_glClear(x0){GLctx["clear"](x0)}function _emscripten_glClearColor(x0,x1,x2,x3){GLctx["clearColor"](x0,x1,x2,x3)}function _emscripten_glClearDepthf(x0){GLctx["clearDepth"](x0)}function _emscripten_glClearStencil(x0){GLctx["clearStencil"](x0)}function _emscripten_glColorMask(red,green,blue,alpha){GLctx.colorMask(!!red,!!green,!!blue,!!alpha)}function _emscripten_glCompileShader(shader){GLctx.compileShader(GL.shaders[shader])}function _emscripten_glCompressedTexImage2D(target,level,internalFormat,width,height,border,imageSize,data){GLctx["compressedTexImage2D"](target,level,internalFormat,width,height,border,data?HEAPU8.subarray(data,data+imageSize):null)}function _emscripten_glCompressedTexSubImage2D(target,level,xoffset,yoffset,width,height,format,imageSize,data){GLctx["compressedTexSubImage2D"](target,level,xoffset,yoffset,width,height,format,data?HEAPU8.subarray(data,data+imageSize):null)}function _emscripten_glCopyTexImage2D(x0,x1,x2,x3,x4,x5,x6,x7){GLctx["copyTexImage2D"](x0,x1,x2,x3,x4,x5,x6,x7)}function _emscripten_glCopyTexSubImage2D(x0,x1,x2,x3,x4,x5,x6,x7){GLctx["copyTexSubImage2D"](x0,x1,x2,x3,x4,x5,x6,x7)}function _emscripten_glCreateProgram(){var id=GL.getNewId(GL.programs);var program=GLctx.createProgram();program.name=id;program.maxUniformLength=program.maxAttributeLength=program.maxUniformBlockNameLength=0;program.uniformIdCounter=1;GL.programs[id]=program;return id}function _emscripten_glCreateShader(shaderType){var id=GL.getNewId(GL.shaders);GL.shaders[id]=GLctx.createShader(shaderType);return id}function _emscripten_glCullFace(x0){GLctx["cullFace"](x0)}function _emscripten_glDeleteBuffers(n,buffers){for(var i=0;i>2];var buffer=GL.buffers[id];if(!buffer)continue;GLctx.deleteBuffer(buffer);buffer.name=0;GL.buffers[id]=null}}function _emscripten_glDeleteFramebuffers(n,framebuffers){for(var i=0;i>2];var framebuffer=GL.framebuffers[id];if(!framebuffer)continue;GLctx.deleteFramebuffer(framebuffer);framebuffer.name=0;GL.framebuffers[id]=null}}function _emscripten_glDeleteProgram(id){if(!id)return;var program=GL.programs[id];if(!program){GL.recordError(1281);return}GLctx.deleteProgram(program);program.name=0;GL.programs[id]=null}function _emscripten_glDeleteQueriesEXT(n,ids){for(var i=0;i>2];var query=GL.queries[id];if(!query)continue;GLctx.disjointTimerQueryExt["deleteQueryEXT"](query);GL.queries[id]=null}}function _emscripten_glDeleteRenderbuffers(n,renderbuffers){for(var i=0;i>2];var renderbuffer=GL.renderbuffers[id];if(!renderbuffer)continue;GLctx.deleteRenderbuffer(renderbuffer);renderbuffer.name=0;GL.renderbuffers[id]=null}}function _emscripten_glDeleteShader(id){if(!id)return;var shader=GL.shaders[id];if(!shader){GL.recordError(1281);return}GLctx.deleteShader(shader);GL.shaders[id]=null}function _emscripten_glDeleteTextures(n,textures){for(var i=0;i>2];var texture=GL.textures[id];if(!texture)continue;GLctx.deleteTexture(texture);texture.name=0;GL.textures[id]=null}}function _emscripten_glDeleteVertexArraysOES(n,vaos){for(var i=0;i>2];GLctx["deleteVertexArray"](GL.vaos[id]);GL.vaos[id]=null}}function _emscripten_glDepthFunc(x0){GLctx["depthFunc"](x0)}function _emscripten_glDepthMask(flag){GLctx.depthMask(!!flag)}function _emscripten_glDepthRangef(x0,x1){GLctx["depthRange"](x0,x1)}function _emscripten_glDetachShader(program,shader){GLctx.detachShader(GL.programs[program],GL.shaders[shader])}function _emscripten_glDisable(x0){GLctx["disable"](x0)}function _emscripten_glDisableVertexAttribArray(index){GLctx.disableVertexAttribArray(index)}function _emscripten_glDrawArrays(mode,first,count){GLctx.drawArrays(mode,first,count)}function _emscripten_glDrawArraysInstancedANGLE(mode,first,count,primcount){GLctx["drawArraysInstanced"](mode,first,count,primcount)}var tempFixedLengthArray=[];function _emscripten_glDrawBuffersWEBGL(n,bufs){var bufArray=tempFixedLengthArray[n];for(var i=0;i>2]}GLctx["drawBuffers"](bufArray)}function _emscripten_glDrawElements(mode,count,type,indices){GLctx.drawElements(mode,count,type,indices)}function _emscripten_glDrawElementsInstancedANGLE(mode,count,type,indices,primcount){GLctx["drawElementsInstanced"](mode,count,type,indices,primcount)}function _emscripten_glEnable(x0){GLctx["enable"](x0)}function _emscripten_glEnableVertexAttribArray(index){GLctx.enableVertexAttribArray(index)}function _emscripten_glEndQueryEXT(target){GLctx.disjointTimerQueryExt["endQueryEXT"](target)}function _emscripten_glFinish(){GLctx["finish"]()}function _emscripten_glFlush(){GLctx["flush"]()}function _emscripten_glFramebufferRenderbuffer(target,attachment,renderbuffertarget,renderbuffer){GLctx.framebufferRenderbuffer(target,attachment,renderbuffertarget,GL.renderbuffers[renderbuffer])}function _emscripten_glFramebufferTexture2D(target,attachment,textarget,texture,level){GLctx.framebufferTexture2D(target,attachment,textarget,GL.textures[texture],level)}function _emscripten_glFrontFace(x0){GLctx["frontFace"](x0)}function __glGenObject(n,buffers,createFunction,objectTable){for(var i=0;i>2]=id}}function _emscripten_glGenBuffers(n,buffers){__glGenObject(n,buffers,"createBuffer",GL.buffers)}function _emscripten_glGenFramebuffers(n,ids){__glGenObject(n,ids,"createFramebuffer",GL.framebuffers)}function _emscripten_glGenQueriesEXT(n,ids){for(var i=0;i>2]=0;return}var id=GL.getNewId(GL.queries);query.name=id;GL.queries[id]=query;HEAP32[ids+i*4>>2]=id}}function _emscripten_glGenRenderbuffers(n,renderbuffers){__glGenObject(n,renderbuffers,"createRenderbuffer",GL.renderbuffers)}function _emscripten_glGenTextures(n,textures){__glGenObject(n,textures,"createTexture",GL.textures)}function _emscripten_glGenVertexArraysOES(n,arrays){__glGenObject(n,arrays,"createVertexArray",GL.vaos)}function _emscripten_glGenerateMipmap(x0){GLctx["generateMipmap"](x0)}function __glGetActiveAttribOrUniform(funcName,program,index,bufSize,length,size,type,name){program=GL.programs[program];var info=GLctx[funcName](program,index);if(info){var numBytesWrittenExclNull=name&&stringToUTF8(info.name,name,bufSize);if(length)HEAP32[length>>2]=numBytesWrittenExclNull;if(size)HEAP32[size>>2]=info.size;if(type)HEAP32[type>>2]=info.type}}function _emscripten_glGetActiveAttrib(program,index,bufSize,length,size,type,name){__glGetActiveAttribOrUniform("getActiveAttrib",program,index,bufSize,length,size,type,name)}function _emscripten_glGetActiveUniform(program,index,bufSize,length,size,type,name){__glGetActiveAttribOrUniform("getActiveUniform",program,index,bufSize,length,size,type,name)}function _emscripten_glGetAttachedShaders(program,maxCount,count,shaders){var result=GLctx.getAttachedShaders(GL.programs[program]);var len=result.length;if(len>maxCount){len=maxCount}HEAP32[count>>2]=len;for(var i=0;i>2]=id}}function _emscripten_glGetAttribLocation(program,name){return GLctx.getAttribLocation(GL.programs[program],UTF8ToString(name))}function writeI53ToI64(ptr,num){HEAPU32[ptr>>2]=num;HEAPU32[ptr+4>>2]=(num-HEAPU32[ptr>>2])/4294967296}function emscriptenWebGLGet(name_,p,type){if(!p){GL.recordError(1281);return}var ret=undefined;switch(name_){case 36346:ret=1;break;case 36344:if(type!=0&&type!=1){GL.recordError(1280)}return;case 36345:ret=0;break;case 34466:var formats=GLctx.getParameter(34467);ret=formats?formats.length:0;break}if(ret===undefined){var result=GLctx.getParameter(name_);switch(typeof result){case"number":ret=result;break;case"boolean":ret=result?1:0;break;case"string":GL.recordError(1280);return;case"object":if(result===null){switch(name_){case 34964:case 35725:case 34965:case 36006:case 36007:case 32873:case 34229:case 34068:{ret=0;break}default:{GL.recordError(1280);return}}}else if(result instanceof Float32Array||result instanceof Uint32Array||result instanceof Int32Array||result instanceof Array){for(var i=0;i>2]=result[i];break;case 2:HEAPF32[p+i*4>>2]=result[i];break;case 4:HEAP8[p+i>>0]=result[i]?1:0;break}}return}else{try{ret=result.name|0}catch(e){GL.recordError(1280);err("GL_INVALID_ENUM in glGet"+type+"v: Unknown object returned from WebGL getParameter("+name_+")! (error: "+e+")");return}}break;default:GL.recordError(1280);err("GL_INVALID_ENUM in glGet"+type+"v: Native code calling glGet"+type+"v("+name_+") and it returns "+result+" of type "+typeof result+"!");return}}switch(type){case 1:writeI53ToI64(p,ret);break;case 0:HEAP32[p>>2]=ret;break;case 2:HEAPF32[p>>2]=ret;break;case 4:HEAP8[p>>0]=ret?1:0;break}}function _emscripten_glGetBooleanv(name_,p){emscriptenWebGLGet(name_,p,4)}function _emscripten_glGetBufferParameteriv(target,value,data){if(!data){GL.recordError(1281);return}HEAP32[data>>2]=GLctx.getBufferParameter(target,value)}function _emscripten_glGetError(){var error=GLctx.getError()||GL.lastError;GL.lastError=0;return error}function _emscripten_glGetFloatv(name_,p){emscriptenWebGLGet(name_,p,2)}function _emscripten_glGetFramebufferAttachmentParameteriv(target,attachment,pname,params){var result=GLctx.getFramebufferAttachmentParameter(target,attachment,pname);if(result instanceof WebGLRenderbuffer||result instanceof WebGLTexture){result=result.name|0}HEAP32[params>>2]=result}function _emscripten_glGetIntegerv(name_,p){emscriptenWebGLGet(name_,p,0)}function _emscripten_glGetProgramInfoLog(program,maxLength,length,infoLog){var log=GLctx.getProgramInfoLog(GL.programs[program]);if(log===null)log="(unknown error)";var numBytesWrittenExclNull=maxLength>0&&infoLog?stringToUTF8(log,infoLog,maxLength):0;if(length)HEAP32[length>>2]=numBytesWrittenExclNull}function _emscripten_glGetProgramiv(program,pname,p){if(!p){GL.recordError(1281);return}if(program>=GL.counter){GL.recordError(1281);return}program=GL.programs[program];if(pname==35716){var log=GLctx.getProgramInfoLog(program);if(log===null)log="(unknown error)";HEAP32[p>>2]=log.length+1}else if(pname==35719){if(!program.maxUniformLength){for(var i=0;i>2]=program.maxUniformLength}else if(pname==35722){if(!program.maxAttributeLength){for(var i=0;i>2]=program.maxAttributeLength}else if(pname==35381){if(!program.maxUniformBlockNameLength){for(var i=0;i>2]=program.maxUniformBlockNameLength}else{HEAP32[p>>2]=GLctx.getProgramParameter(program,pname)}}function _emscripten_glGetQueryObjecti64vEXT(id,pname,params){if(!params){GL.recordError(1281);return}var query=GL.queries[id];var param;{param=GLctx.disjointTimerQueryExt["getQueryObjectEXT"](query,pname)}var ret;if(typeof param=="boolean"){ret=param?1:0}else{ret=param}writeI53ToI64(params,ret)}function _emscripten_glGetQueryObjectivEXT(id,pname,params){if(!params){GL.recordError(1281);return}var query=GL.queries[id];var param=GLctx.disjointTimerQueryExt["getQueryObjectEXT"](query,pname);var ret;if(typeof param=="boolean"){ret=param?1:0}else{ret=param}HEAP32[params>>2]=ret}function _emscripten_glGetQueryObjectui64vEXT(id,pname,params){if(!params){GL.recordError(1281);return}var query=GL.queries[id];var param;{param=GLctx.disjointTimerQueryExt["getQueryObjectEXT"](query,pname)}var ret;if(typeof param=="boolean"){ret=param?1:0}else{ret=param}writeI53ToI64(params,ret)}function _emscripten_glGetQueryObjectuivEXT(id,pname,params){if(!params){GL.recordError(1281);return}var query=GL.queries[id];var param=GLctx.disjointTimerQueryExt["getQueryObjectEXT"](query,pname);var ret;if(typeof param=="boolean"){ret=param?1:0}else{ret=param}HEAP32[params>>2]=ret}function _emscripten_glGetQueryivEXT(target,pname,params){if(!params){GL.recordError(1281);return}HEAP32[params>>2]=GLctx.disjointTimerQueryExt["getQueryEXT"](target,pname)}function _emscripten_glGetRenderbufferParameteriv(target,pname,params){if(!params){GL.recordError(1281);return}HEAP32[params>>2]=GLctx.getRenderbufferParameter(target,pname)}function _emscripten_glGetShaderInfoLog(shader,maxLength,length,infoLog){var log=GLctx.getShaderInfoLog(GL.shaders[shader]);if(log===null)log="(unknown error)";var numBytesWrittenExclNull=maxLength>0&&infoLog?stringToUTF8(log,infoLog,maxLength):0;if(length)HEAP32[length>>2]=numBytesWrittenExclNull}function _emscripten_glGetShaderPrecisionFormat(shaderType,precisionType,range,precision){var result=GLctx.getShaderPrecisionFormat(shaderType,precisionType);HEAP32[range>>2]=result.rangeMin;HEAP32[range+4>>2]=result.rangeMax;HEAP32[precision>>2]=result.precision}function _emscripten_glGetShaderSource(shader,bufSize,length,source){var result=GLctx.getShaderSource(GL.shaders[shader]);if(!result)return;var numBytesWrittenExclNull=bufSize>0&&source?stringToUTF8(result,source,bufSize):0;if(length)HEAP32[length>>2]=numBytesWrittenExclNull}function _emscripten_glGetShaderiv(shader,pname,p){if(!p){GL.recordError(1281);return}if(pname==35716){var log=GLctx.getShaderInfoLog(GL.shaders[shader]);if(log===null)log="(unknown error)";var logLength=log?log.length+1:0;HEAP32[p>>2]=logLength}else if(pname==35720){var source=GLctx.getShaderSource(GL.shaders[shader]);var sourceLength=source?source.length+1:0;HEAP32[p>>2]=sourceLength}else{HEAP32[p>>2]=GLctx.getShaderParameter(GL.shaders[shader],pname)}}function stringToNewUTF8(jsString){var length=lengthBytesUTF8(jsString)+1;var cString=_malloc(length);stringToUTF8(jsString,cString,length);return cString}function _emscripten_glGetString(name_){var ret=GL.stringCache[name_];if(!ret){switch(name_){case 7939:var exts=GLctx.getSupportedExtensions()||[];exts=exts.concat(exts.map(function(e){return"GL_"+e}));ret=stringToNewUTF8(exts.join(" "));break;case 7936:case 7937:case 37445:case 37446:var s=GLctx.getParameter(name_);if(!s){GL.recordError(1280)}ret=s&&stringToNewUTF8(s);break;case 7938:var glVersion=GLctx.getParameter(7938);{glVersion="OpenGL ES 2.0 ("+glVersion+")"}ret=stringToNewUTF8(glVersion);break;case 35724:var glslVersion=GLctx.getParameter(35724);var ver_re=/^WebGL GLSL ES ([0-9]\.[0-9][0-9]?)(?:$| .*)/;var ver_num=glslVersion.match(ver_re);if(ver_num!==null){if(ver_num[1].length==3)ver_num[1]=ver_num[1]+"0";glslVersion="OpenGL ES GLSL ES "+ver_num[1]+" ("+glslVersion+")"}ret=stringToNewUTF8(glslVersion);break;default:GL.recordError(1280)}GL.stringCache[name_]=ret}return ret}function _emscripten_glGetTexParameterfv(target,pname,params){if(!params){GL.recordError(1281);return}HEAPF32[params>>2]=GLctx.getTexParameter(target,pname)}function _emscripten_glGetTexParameteriv(target,pname,params){if(!params){GL.recordError(1281);return}HEAP32[params>>2]=GLctx.getTexParameter(target,pname)}function jstoi_q(str){return parseInt(str)}function webglGetLeftBracePos(name){return name.slice(-1)=="]"&&name.lastIndexOf("[")}function webglPrepareUniformLocationsBeforeFirstUse(program){var uniformLocsById=program.uniformLocsById,uniformSizeAndIdsByName=program.uniformSizeAndIdsByName,i,j;if(!uniformLocsById){program.uniformLocsById=uniformLocsById={};program.uniformArrayNamesById={};for(i=0;i0?nm.slice(0,lb):nm;var id=program.uniformIdCounter;program.uniformIdCounter+=sz;uniformSizeAndIdsByName[arrayName]=[sz,id];for(j=0;j0){arrayIndex=jstoi_q(name.slice(leftBrace+1))>>>0;uniformBaseName=name.slice(0,leftBrace)}var sizeAndId=program.uniformSizeAndIdsByName[uniformBaseName];if(sizeAndId&&arrayIndex0?"["+webglLoc+"]":""))}return webglLoc}else{GL.recordError(1282)}}function emscriptenWebGLGetUniform(program,location,params,type){if(!params){GL.recordError(1281);return}program=GL.programs[program];webglPrepareUniformLocationsBeforeFirstUse(program);var data=GLctx.getUniform(program,webglGetUniformLocation(location));if(typeof data=="number"||typeof data=="boolean"){switch(type){case 0:HEAP32[params>>2]=data;break;case 2:HEAPF32[params>>2]=data;break}}else{for(var i=0;i>2]=data[i];break;case 2:HEAPF32[params+i*4>>2]=data[i];break}}}}function _emscripten_glGetUniformfv(program,location,params){emscriptenWebGLGetUniform(program,location,params,2)}function _emscripten_glGetUniformiv(program,location,params){emscriptenWebGLGetUniform(program,location,params,0)}function _emscripten_glGetVertexAttribPointerv(index,pname,pointer){if(!pointer){GL.recordError(1281);return}HEAP32[pointer>>2]=GLctx.getVertexAttribOffset(index,pname)}function emscriptenWebGLGetVertexAttrib(index,pname,params,type){if(!params){GL.recordError(1281);return}var data=GLctx.getVertexAttrib(index,pname);if(pname==34975){HEAP32[params>>2]=data&&data["name"]}else if(typeof data=="number"||typeof data=="boolean"){switch(type){case 0:HEAP32[params>>2]=data;break;case 2:HEAPF32[params>>2]=data;break;case 5:HEAP32[params>>2]=Math.fround(data);break}}else{for(var i=0;i>2]=data[i];break;case 2:HEAPF32[params+i*4>>2]=data[i];break;case 5:HEAP32[params+i*4>>2]=Math.fround(data[i]);break}}}}function _emscripten_glGetVertexAttribfv(index,pname,params){emscriptenWebGLGetVertexAttrib(index,pname,params,2)}function _emscripten_glGetVertexAttribiv(index,pname,params){emscriptenWebGLGetVertexAttrib(index,pname,params,5)}function _emscripten_glHint(x0,x1){GLctx["hint"](x0,x1)}function _emscripten_glIsBuffer(buffer){var b=GL.buffers[buffer];if(!b)return 0;return GLctx.isBuffer(b)}function _emscripten_glIsEnabled(x0){return GLctx["isEnabled"](x0)}function _emscripten_glIsFramebuffer(framebuffer){var fb=GL.framebuffers[framebuffer];if(!fb)return 0;return GLctx.isFramebuffer(fb)}function _emscripten_glIsProgram(program){program=GL.programs[program];if(!program)return 0;return GLctx.isProgram(program)}function _emscripten_glIsQueryEXT(id){var query=GL.queries[id];if(!query)return 0;return GLctx.disjointTimerQueryExt["isQueryEXT"](query)}function _emscripten_glIsRenderbuffer(renderbuffer){var rb=GL.renderbuffers[renderbuffer];if(!rb)return 0;return GLctx.isRenderbuffer(rb)}function _emscripten_glIsShader(shader){var s=GL.shaders[shader];if(!s)return 0;return GLctx.isShader(s)}function _emscripten_glIsTexture(id){var texture=GL.textures[id];if(!texture)return 0;return GLctx.isTexture(texture)}function _emscripten_glIsVertexArrayOES(array){var vao=GL.vaos[array];if(!vao)return 0;return GLctx["isVertexArray"](vao)}function _emscripten_glLineWidth(x0){GLctx["lineWidth"](x0)}function _emscripten_glLinkProgram(program){program=GL.programs[program];GLctx.linkProgram(program);program.uniformLocsById=0;program.uniformSizeAndIdsByName={}}function _emscripten_glPixelStorei(pname,param){if(pname==3317){GL.unpackAlignment=param}GLctx.pixelStorei(pname,param)}function _emscripten_glPolygonOffset(x0,x1){GLctx["polygonOffset"](x0,x1)}function _emscripten_glQueryCounterEXT(id,target){GLctx.disjointTimerQueryExt["queryCounterEXT"](GL.queries[id],target)}function computeUnpackAlignedImageSize(width,height,sizePerPixel,alignment){function roundedToNextMultipleOf(x,y){return x+y-1&-y}var plainRowSize=width*sizePerPixel;var alignedRowSize=roundedToNextMultipleOf(plainRowSize,alignment);return height*alignedRowSize}function __colorChannelsInGlTextureFormat(format){var colorChannels={5:3,6:4,8:2,29502:3,29504:4};return colorChannels[format-6402]||1}function heapObjectForWebGLType(type){type-=5120;if(type==1)return HEAPU8;if(type==4)return HEAP32;if(type==6)return HEAPF32;if(type==5||type==28922)return HEAPU32;return HEAPU16}function heapAccessShiftForWebGLHeap(heap){return 31-Math.clz32(heap.BYTES_PER_ELEMENT)}function emscriptenWebGLGetTexPixelData(type,format,width,height,pixels,internalFormat){var heap=heapObjectForWebGLType(type);var shift=heapAccessShiftForWebGLHeap(heap);var byteSize=1<>shift,pixels+bytes>>shift)}function _emscripten_glReadPixels(x,y,width,height,format,type,pixels){var pixelData=emscriptenWebGLGetTexPixelData(type,format,width,height,pixels,format);if(!pixelData){GL.recordError(1280);return}GLctx.readPixels(x,y,width,height,format,type,pixelData)}function _emscripten_glReleaseShaderCompiler(){}function _emscripten_glRenderbufferStorage(x0,x1,x2,x3){GLctx["renderbufferStorage"](x0,x1,x2,x3)}function _emscripten_glSampleCoverage(value,invert){GLctx.sampleCoverage(value,!!invert)}function _emscripten_glScissor(x0,x1,x2,x3){GLctx["scissor"](x0,x1,x2,x3)}function _emscripten_glShaderBinary(){GL.recordError(1280)}function _emscripten_glShaderSource(shader,count,string,length){var source=GL.getSource(shader,count,string,length);GLctx.shaderSource(GL.shaders[shader],source)}function _emscripten_glStencilFunc(x0,x1,x2){GLctx["stencilFunc"](x0,x1,x2)}function _emscripten_glStencilFuncSeparate(x0,x1,x2,x3){GLctx["stencilFuncSeparate"](x0,x1,x2,x3)}function _emscripten_glStencilMask(x0){GLctx["stencilMask"](x0)}function _emscripten_glStencilMaskSeparate(x0,x1){GLctx["stencilMaskSeparate"](x0,x1)}function _emscripten_glStencilOp(x0,x1,x2){GLctx["stencilOp"](x0,x1,x2)}function _emscripten_glStencilOpSeparate(x0,x1,x2,x3){GLctx["stencilOpSeparate"](x0,x1,x2,x3)}function _emscripten_glTexImage2D(target,level,internalFormat,width,height,border,format,type,pixels){GLctx.texImage2D(target,level,internalFormat,width,height,border,format,type,pixels?emscriptenWebGLGetTexPixelData(type,format,width,height,pixels,internalFormat):null)}function _emscripten_glTexParameterf(x0,x1,x2){GLctx["texParameterf"](x0,x1,x2)}function _emscripten_glTexParameterfv(target,pname,params){var param=HEAPF32[params>>2];GLctx.texParameterf(target,pname,param)}function _emscripten_glTexParameteri(x0,x1,x2){GLctx["texParameteri"](x0,x1,x2)}function _emscripten_glTexParameteriv(target,pname,params){var param=HEAP32[params>>2];GLctx.texParameteri(target,pname,param)}function _emscripten_glTexSubImage2D(target,level,xoffset,yoffset,width,height,format,type,pixels){var pixelData=null;if(pixels)pixelData=emscriptenWebGLGetTexPixelData(type,format,width,height,pixels,0);GLctx.texSubImage2D(target,level,xoffset,yoffset,width,height,format,type,pixelData)}function _emscripten_glUniform1f(location,v0){GLctx.uniform1f(webglGetUniformLocation(location),v0)}var miniTempWebGLFloatBuffers=[];function _emscripten_glUniform1fv(location,count,value){if(count<=288){var view=miniTempWebGLFloatBuffers[count-1];for(var i=0;i>2]}}else{var view=HEAPF32.subarray(value>>2,value+count*4>>2)}GLctx.uniform1fv(webglGetUniformLocation(location),view)}function _emscripten_glUniform1i(location,v0){GLctx.uniform1i(webglGetUniformLocation(location),v0)}var __miniTempWebGLIntBuffers=[];function _emscripten_glUniform1iv(location,count,value){if(count<=288){var view=__miniTempWebGLIntBuffers[count-1];for(var i=0;i>2]}}else{var view=HEAP32.subarray(value>>2,value+count*4>>2)}GLctx.uniform1iv(webglGetUniformLocation(location),view)}function _emscripten_glUniform2f(location,v0,v1){GLctx.uniform2f(webglGetUniformLocation(location),v0,v1)}function _emscripten_glUniform2fv(location,count,value){if(count<=144){var view=miniTempWebGLFloatBuffers[2*count-1];for(var i=0;i<2*count;i+=2){view[i]=HEAPF32[value+4*i>>2];view[i+1]=HEAPF32[value+(4*i+4)>>2]}}else{var view=HEAPF32.subarray(value>>2,value+count*8>>2)}GLctx.uniform2fv(webglGetUniformLocation(location),view)}function _emscripten_glUniform2i(location,v0,v1){GLctx.uniform2i(webglGetUniformLocation(location),v0,v1)}function _emscripten_glUniform2iv(location,count,value){if(count<=144){var view=__miniTempWebGLIntBuffers[2*count-1];for(var i=0;i<2*count;i+=2){view[i]=HEAP32[value+4*i>>2];view[i+1]=HEAP32[value+(4*i+4)>>2]}}else{var view=HEAP32.subarray(value>>2,value+count*8>>2)}GLctx.uniform2iv(webglGetUniformLocation(location),view)}function _emscripten_glUniform3f(location,v0,v1,v2){GLctx.uniform3f(webglGetUniformLocation(location),v0,v1,v2)}function _emscripten_glUniform3fv(location,count,value){if(count<=96){var view=miniTempWebGLFloatBuffers[3*count-1];for(var i=0;i<3*count;i+=3){view[i]=HEAPF32[value+4*i>>2];view[i+1]=HEAPF32[value+(4*i+4)>>2];view[i+2]=HEAPF32[value+(4*i+8)>>2]}}else{var view=HEAPF32.subarray(value>>2,value+count*12>>2)}GLctx.uniform3fv(webglGetUniformLocation(location),view)}function _emscripten_glUniform3i(location,v0,v1,v2){GLctx.uniform3i(webglGetUniformLocation(location),v0,v1,v2)}function _emscripten_glUniform3iv(location,count,value){if(count<=96){var view=__miniTempWebGLIntBuffers[3*count-1];for(var i=0;i<3*count;i+=3){view[i]=HEAP32[value+4*i>>2];view[i+1]=HEAP32[value+(4*i+4)>>2];view[i+2]=HEAP32[value+(4*i+8)>>2]}}else{var view=HEAP32.subarray(value>>2,value+count*12>>2)}GLctx.uniform3iv(webglGetUniformLocation(location),view)}function _emscripten_glUniform4f(location,v0,v1,v2,v3){GLctx.uniform4f(webglGetUniformLocation(location),v0,v1,v2,v3)}function _emscripten_glUniform4fv(location,count,value){if(count<=72){var view=miniTempWebGLFloatBuffers[4*count-1];var heap=HEAPF32;value>>=2;for(var i=0;i<4*count;i+=4){var dst=value+i;view[i]=heap[dst];view[i+1]=heap[dst+1];view[i+2]=heap[dst+2];view[i+3]=heap[dst+3]}}else{var view=HEAPF32.subarray(value>>2,value+count*16>>2)}GLctx.uniform4fv(webglGetUniformLocation(location),view)}function _emscripten_glUniform4i(location,v0,v1,v2,v3){GLctx.uniform4i(webglGetUniformLocation(location),v0,v1,v2,v3)}function _emscripten_glUniform4iv(location,count,value){if(count<=72){var view=__miniTempWebGLIntBuffers[4*count-1];for(var i=0;i<4*count;i+=4){view[i]=HEAP32[value+4*i>>2];view[i+1]=HEAP32[value+(4*i+4)>>2];view[i+2]=HEAP32[value+(4*i+8)>>2];view[i+3]=HEAP32[value+(4*i+12)>>2]}}else{var view=HEAP32.subarray(value>>2,value+count*16>>2)}GLctx.uniform4iv(webglGetUniformLocation(location),view)}function _emscripten_glUniformMatrix2fv(location,count,transpose,value){if(count<=72){var view=miniTempWebGLFloatBuffers[4*count-1];for(var i=0;i<4*count;i+=4){view[i]=HEAPF32[value+4*i>>2];view[i+1]=HEAPF32[value+(4*i+4)>>2];view[i+2]=HEAPF32[value+(4*i+8)>>2];view[i+3]=HEAPF32[value+(4*i+12)>>2]}}else{var view=HEAPF32.subarray(value>>2,value+count*16>>2)}GLctx.uniformMatrix2fv(webglGetUniformLocation(location),!!transpose,view)}function _emscripten_glUniformMatrix3fv(location,count,transpose,value){if(count<=32){var view=miniTempWebGLFloatBuffers[9*count-1];for(var i=0;i<9*count;i+=9){view[i]=HEAPF32[value+4*i>>2];view[i+1]=HEAPF32[value+(4*i+4)>>2];view[i+2]=HEAPF32[value+(4*i+8)>>2];view[i+3]=HEAPF32[value+(4*i+12)>>2];view[i+4]=HEAPF32[value+(4*i+16)>>2];view[i+5]=HEAPF32[value+(4*i+20)>>2];view[i+6]=HEAPF32[value+(4*i+24)>>2];view[i+7]=HEAPF32[value+(4*i+28)>>2];view[i+8]=HEAPF32[value+(4*i+32)>>2]}}else{var view=HEAPF32.subarray(value>>2,value+count*36>>2)}GLctx.uniformMatrix3fv(webglGetUniformLocation(location),!!transpose,view)}function _emscripten_glUniformMatrix4fv(location,count,transpose,value){if(count<=18){var view=miniTempWebGLFloatBuffers[16*count-1];var heap=HEAPF32;value>>=2;for(var i=0;i<16*count;i+=16){var dst=value+i;view[i]=heap[dst];view[i+1]=heap[dst+1];view[i+2]=heap[dst+2];view[i+3]=heap[dst+3];view[i+4]=heap[dst+4];view[i+5]=heap[dst+5];view[i+6]=heap[dst+6];view[i+7]=heap[dst+7];view[i+8]=heap[dst+8];view[i+9]=heap[dst+9];view[i+10]=heap[dst+10];view[i+11]=heap[dst+11];view[i+12]=heap[dst+12];view[i+13]=heap[dst+13];view[i+14]=heap[dst+14];view[i+15]=heap[dst+15]}}else{var view=HEAPF32.subarray(value>>2,value+count*64>>2)}GLctx.uniformMatrix4fv(webglGetUniformLocation(location),!!transpose,view)}function _emscripten_glUseProgram(program){program=GL.programs[program];GLctx.useProgram(program);GLctx.currentProgram=program}function _emscripten_glValidateProgram(program){GLctx.validateProgram(GL.programs[program])}function _emscripten_glVertexAttrib1f(x0,x1){GLctx["vertexAttrib1f"](x0,x1)}function _emscripten_glVertexAttrib1fv(index,v){GLctx.vertexAttrib1f(index,HEAPF32[v>>2])}function _emscripten_glVertexAttrib2f(x0,x1,x2){GLctx["vertexAttrib2f"](x0,x1,x2)}function _emscripten_glVertexAttrib2fv(index,v){GLctx.vertexAttrib2f(index,HEAPF32[v>>2],HEAPF32[v+4>>2])}function _emscripten_glVertexAttrib3f(x0,x1,x2,x3){GLctx["vertexAttrib3f"](x0,x1,x2,x3)}function _emscripten_glVertexAttrib3fv(index,v){GLctx.vertexAttrib3f(index,HEAPF32[v>>2],HEAPF32[v+4>>2],HEAPF32[v+8>>2])}function _emscripten_glVertexAttrib4f(x0,x1,x2,x3,x4){GLctx["vertexAttrib4f"](x0,x1,x2,x3,x4)}function _emscripten_glVertexAttrib4fv(index,v){GLctx.vertexAttrib4f(index,HEAPF32[v>>2],HEAPF32[v+4>>2],HEAPF32[v+8>>2],HEAPF32[v+12>>2])}function _emscripten_glVertexAttribDivisorANGLE(index,divisor){GLctx["vertexAttribDivisor"](index,divisor)}function _emscripten_glVertexAttribPointer(index,size,type,normalized,stride,ptr){GLctx.vertexAttribPointer(index,size,type,!!normalized,stride,ptr)}function _emscripten_glViewport(x0,x1,x2,x3){GLctx["viewport"](x0,x1,x2,x3)}function abortOnCannotGrowMemory(requestedSize){abort("OOM")}function _emscripten_resize_heap(requestedSize){var oldSize=HEAPU8.length;requestedSize=requestedSize>>>0;abortOnCannotGrowMemory(requestedSize)}function _emscripten_run_script(ptr){eval(UTF8ToString(ptr))}function _emscripten_sample_gamepad_data(){return(JSEvents.lastGamepadState=navigator.getGamepads?navigator.getGamepads():navigator.webkitGetGamepads?navigator.webkitGetGamepads():null)?0:-1}function fillMouseEventData(eventStruct,e,target){HEAPF64[eventStruct>>3]=e.timeStamp;var idx=eventStruct>>2;HEAP32[idx+2]=e.screenX;HEAP32[idx+3]=e.screenY;HEAP32[idx+4]=e.clientX;HEAP32[idx+5]=e.clientY;HEAP32[idx+6]=e.ctrlKey;HEAP32[idx+7]=e.shiftKey;HEAP32[idx+8]=e.altKey;HEAP32[idx+9]=e.metaKey;HEAP16[idx*2+20]=e.button;HEAP16[idx*2+21]=e.buttons;HEAP32[idx+11]=e["movementX"];HEAP32[idx+12]=e["movementY"];var rect=getBoundingClientRect(target);HEAP32[idx+13]=e.clientX-rect.left;HEAP32[idx+14]=e.clientY-rect.top}function registerMouseEventCallback(target,userData,useCapture,callbackfunc,eventTypeId,eventTypeString,targetThread){if(!JSEvents.mouseEvent)JSEvents.mouseEvent=_malloc(72);target=findEventTarget(target);var mouseEventHandlerFunc=function(ev){var e=ev||event;fillMouseEventData(JSEvents.mouseEvent,e,target);if(function(a1,a2,a3){return dynCall_iiii.apply(null,[callbackfunc,a1,a2,a3])}(eventTypeId,JSEvents.mouseEvent,userData))e.preventDefault()};var eventHandler={target:target,allowsDeferredCalls:eventTypeString!="mousemove"&&eventTypeString!="mouseenter"&&eventTypeString!="mouseleave",eventTypeString:eventTypeString,callbackfunc:callbackfunc,handlerFunc:mouseEventHandlerFunc,useCapture:useCapture};JSEvents.registerOrRemoveHandler(eventHandler)}function _emscripten_set_click_callback_on_thread(target,userData,useCapture,callbackfunc,targetThread){registerMouseEventCallback(target,userData,useCapture,callbackfunc,4,"click",targetThread);return 0}function fillFullscreenChangeEventData(eventStruct){var fullscreenElement=document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement;var isFullscreen=!!fullscreenElement;HEAP32[eventStruct>>2]=isFullscreen;HEAP32[eventStruct+4>>2]=JSEvents.fullscreenEnabled();var reportedElement=isFullscreen?fullscreenElement:JSEvents.previousFullscreenElement;var nodeName=JSEvents.getNodeNameForTarget(reportedElement);var id=reportedElement&&reportedElement.id?reportedElement.id:"";stringToUTF8(nodeName,eventStruct+8,128);stringToUTF8(id,eventStruct+136,128);HEAP32[eventStruct+264>>2]=reportedElement?reportedElement.clientWidth:0;HEAP32[eventStruct+268>>2]=reportedElement?reportedElement.clientHeight:0;HEAP32[eventStruct+272>>2]=screen.width;HEAP32[eventStruct+276>>2]=screen.height;if(isFullscreen){JSEvents.previousFullscreenElement=fullscreenElement}}function registerFullscreenChangeEventCallback(target,userData,useCapture,callbackfunc,eventTypeId,eventTypeString,targetThread){if(!JSEvents.fullscreenChangeEvent)JSEvents.fullscreenChangeEvent=_malloc(280);var fullscreenChangeEventhandlerFunc=function(ev){var e=ev||event;var fullscreenChangeEvent=JSEvents.fullscreenChangeEvent;fillFullscreenChangeEventData(fullscreenChangeEvent);if(function(a1,a2,a3){return dynCall_iiii.apply(null,[callbackfunc,a1,a2,a3])}(eventTypeId,fullscreenChangeEvent,userData))e.preventDefault()};var eventHandler={target:target,eventTypeString:eventTypeString,callbackfunc:callbackfunc,handlerFunc:fullscreenChangeEventhandlerFunc,useCapture:useCapture};JSEvents.registerOrRemoveHandler(eventHandler)}function _emscripten_set_fullscreenchange_callback_on_thread(target,userData,useCapture,callbackfunc,targetThread){if(!JSEvents.fullscreenEnabled())return-1;target=findEventTarget(target);if(!target)return-4;registerFullscreenChangeEventCallback(target,userData,useCapture,callbackfunc,19,"fullscreenchange",targetThread);registerFullscreenChangeEventCallback(target,userData,useCapture,callbackfunc,19,"webkitfullscreenchange",targetThread);return 0}function registerGamepadEventCallback(target,userData,useCapture,callbackfunc,eventTypeId,eventTypeString,targetThread){if(!JSEvents.gamepadEvent)JSEvents.gamepadEvent=_malloc(1432);var gamepadEventHandlerFunc=function(ev){var e=ev||event;var gamepadEvent=JSEvents.gamepadEvent;fillGamepadEventData(gamepadEvent,e["gamepad"]);if(function(a1,a2,a3){return dynCall_iiii.apply(null,[callbackfunc,a1,a2,a3])}(eventTypeId,gamepadEvent,userData))e.preventDefault()};var eventHandler={target:findEventTarget(target),allowsDeferredCalls:true,eventTypeString:eventTypeString,callbackfunc:callbackfunc,handlerFunc:gamepadEventHandlerFunc,useCapture:useCapture};JSEvents.registerOrRemoveHandler(eventHandler)}function _emscripten_set_gamepadconnected_callback_on_thread(userData,useCapture,callbackfunc,targetThread){if(!navigator.getGamepads&&!navigator.webkitGetGamepads)return-1;registerGamepadEventCallback(2,userData,useCapture,callbackfunc,26,"gamepadconnected",targetThread);return 0}function _emscripten_set_gamepaddisconnected_callback_on_thread(userData,useCapture,callbackfunc,targetThread){if(!navigator.getGamepads&&!navigator.webkitGetGamepads)return-1;registerGamepadEventCallback(2,userData,useCapture,callbackfunc,27,"gamepaddisconnected",targetThread);return 0}function registerTouchEventCallback(target,userData,useCapture,callbackfunc,eventTypeId,eventTypeString,targetThread){if(!JSEvents.touchEvent)JSEvents.touchEvent=_malloc(1696);target=findEventTarget(target);var touchEventHandlerFunc=function(e){var t,touches={},et=e.touches;for(var i=0;i>3]=e.timeStamp;var idx=touchEvent>>2;HEAP32[idx+3]=e.ctrlKey;HEAP32[idx+4]=e.shiftKey;HEAP32[idx+5]=e.altKey;HEAP32[idx+6]=e.metaKey;idx+=7;var targetRect=getBoundingClientRect(target);var numTouches=0;for(var i in touches){t=touches[i];HEAP32[idx+0]=t.identifier;HEAP32[idx+1]=t.screenX;HEAP32[idx+2]=t.screenY;HEAP32[idx+3]=t.clientX;HEAP32[idx+4]=t.clientY;HEAP32[idx+5]=t.pageX;HEAP32[idx+6]=t.pageY;HEAP32[idx+7]=t.isChanged;HEAP32[idx+8]=t.onTarget;HEAP32[idx+9]=t.clientX-targetRect.left;HEAP32[idx+10]=t.clientY-targetRect.top;idx+=13;if(++numTouches>31){break}}HEAP32[touchEvent+8>>2]=numTouches;if(function(a1,a2,a3){return dynCall_iiii.apply(null,[callbackfunc,a1,a2,a3])}(eventTypeId,touchEvent,userData))e.preventDefault()};var eventHandler={target:target,allowsDeferredCalls:eventTypeString=="touchstart"||eventTypeString=="touchend",eventTypeString:eventTypeString,callbackfunc:callbackfunc,handlerFunc:touchEventHandlerFunc,useCapture:useCapture};JSEvents.registerOrRemoveHandler(eventHandler)}function _emscripten_set_touchcancel_callback_on_thread(target,userData,useCapture,callbackfunc,targetThread){registerTouchEventCallback(target,userData,useCapture,callbackfunc,25,"touchcancel",targetThread);return 0}function _emscripten_set_touchend_callback_on_thread(target,userData,useCapture,callbackfunc,targetThread){registerTouchEventCallback(target,userData,useCapture,callbackfunc,23,"touchend",targetThread);return 0}function _emscripten_set_touchmove_callback_on_thread(target,userData,useCapture,callbackfunc,targetThread){registerTouchEventCallback(target,userData,useCapture,callbackfunc,24,"touchmove",targetThread);return 0}function _emscripten_set_touchstart_callback_on_thread(target,userData,useCapture,callbackfunc,targetThread){registerTouchEventCallback(target,userData,useCapture,callbackfunc,22,"touchstart",targetThread);return 0}function callUserCallback(func){if(ABORT){return}try{func()}catch(e){handleException(e)}}function safeSetTimeout(func,timeout){return setTimeout(function(){callUserCallback(func)},timeout)}function _emscripten_sleep(ms){return Asyncify.handleSleep(wakeUp=>safeSetTimeout(wakeUp,ms))}var ENV={};function getExecutableName(){return thisProgram||"./this.program"}function getEnvStrings(){if(!getEnvStrings.strings){var lang=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8";var env={"USER":"web_user","LOGNAME":"web_user","PATH":"/","PWD":"/","HOME":"/home/web_user","LANG":lang,"_":getExecutableName()};for(var x in ENV){if(ENV[x]===undefined)delete env[x];else env[x]=ENV[x]}var strings=[];for(var x in env){strings.push(x+"="+env[x])}getEnvStrings.strings=strings}return getEnvStrings.strings}function writeAsciiToMemory(str,buffer,dontAddNull){for(var i=0;i>0]=str.charCodeAt(i)}if(!dontAddNull)HEAP8[buffer>>0]=0}function _environ_get(__environ,environ_buf){var bufSize=0;getEnvStrings().forEach(function(string,i){var ptr=environ_buf+bufSize;HEAPU32[__environ+i*4>>2]=ptr;writeAsciiToMemory(string,ptr);bufSize+=string.length+1});return 0}function _environ_sizes_get(penviron_count,penviron_buf_size){var strings=getEnvStrings();HEAPU32[penviron_count>>2]=strings.length;var bufSize=0;strings.forEach(function(string){bufSize+=string.length+1});HEAPU32[penviron_buf_size>>2]=bufSize;return 0}function _proc_exit(code){EXITSTATUS=code;if(!keepRuntimeAlive()){if(Module["onExit"])Module["onExit"](code);ABORT=true}quit_(code,new ExitStatus(code))}function exitJS(status,implicit){EXITSTATUS=status;_proc_exit(status)}var _exit=exitJS;function _fd_close(fd){try{var stream=SYSCALLS.getStreamFromFD(fd);FS.close(stream);return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return e.errno}}function doReadv(stream,iov,iovcnt,offset){var ret=0;for(var i=0;i>2];var len=HEAPU32[iov+4>>2];iov+=8;var curr=FS.read(stream,HEAP8,ptr,len,offset);if(curr<0)return-1;ret+=curr;if(curr>2]=num;return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return e.errno}}function convertI32PairToI53Checked(lo,hi){return hi+2097152>>>0<4194305-!!lo?(lo>>>0)+hi*4294967296:NaN}function _fd_seek(fd,offset_low,offset_high,whence,newOffset){try{var offset=convertI32PairToI53Checked(offset_low,offset_high);if(isNaN(offset))return 61;var stream=SYSCALLS.getStreamFromFD(fd);FS.llseek(stream,offset,whence);tempI64=[stream.position>>>0,(tempDouble=stream.position,+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[newOffset>>2]=tempI64[0],HEAP32[newOffset+4>>2]=tempI64[1];if(stream.getdents&&offset===0&&whence===0)stream.getdents=null;return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return e.errno}}function doWritev(stream,iov,iovcnt,offset){var ret=0;for(var i=0;i>2];var len=HEAPU32[iov+4>>2];iov+=8;var curr=FS.write(stream,HEAP8,ptr,len,offset);if(curr<0)return-1;ret+=curr}return ret}function _fd_write(fd,iov,iovcnt,pnum){try{var stream=SYSCALLS.getStreamFromFD(fd);var num=doWritev(stream,iov,iovcnt);HEAPU32[pnum>>2]=num;return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return e.errno}}function _glActiveTexture(x0){GLctx["activeTexture"](x0)}function _glAttachShader(program,shader){GLctx.attachShader(GL.programs[program],GL.shaders[shader])}function _glBindAttribLocation(program,index,name){GLctx.bindAttribLocation(GL.programs[program],index,UTF8ToString(name))}function _glBindBuffer(target,buffer){GLctx.bindBuffer(target,GL.buffers[buffer])}function _glBindTexture(target,texture){GLctx.bindTexture(target,GL.textures[texture])}function _glBlendFunc(x0,x1){GLctx["blendFunc"](x0,x1)}function _glBufferData(target,size,data,usage){GLctx.bufferData(target,data?HEAPU8.subarray(data,data+size):size,usage)}function _glBufferSubData(target,offset,size,data){GLctx.bufferSubData(target,offset,HEAPU8.subarray(data,data+size))}function _glClear(x0){GLctx["clear"](x0)}function _glClearColor(x0,x1,x2,x3){GLctx["clearColor"](x0,x1,x2,x3)}function _glClearDepthf(x0){GLctx["clearDepth"](x0)}function _glCompileShader(shader){GLctx.compileShader(GL.shaders[shader])}function _glCompressedTexImage2D(target,level,internalFormat,width,height,border,imageSize,data){GLctx["compressedTexImage2D"](target,level,internalFormat,width,height,border,data?HEAPU8.subarray(data,data+imageSize):null)}function _glCreateProgram(){var id=GL.getNewId(GL.programs);var program=GLctx.createProgram();program.name=id;program.maxUniformLength=program.maxAttributeLength=program.maxUniformBlockNameLength=0;program.uniformIdCounter=1;GL.programs[id]=program;return id}function _glCreateShader(shaderType){var id=GL.getNewId(GL.shaders);GL.shaders[id]=GLctx.createShader(shaderType);return id}function _glCullFace(x0){GLctx["cullFace"](x0)}function _glDeleteProgram(id){if(!id)return;var program=GL.programs[id];if(!program){GL.recordError(1281);return}GLctx.deleteProgram(program);program.name=0;GL.programs[id]=null}function _glDepthFunc(x0){GLctx["depthFunc"](x0)}function _glDisable(x0){GLctx["disable"](x0)}function _glDrawArrays(mode,first,count){GLctx.drawArrays(mode,first,count)}function _glDrawElements(mode,count,type,indices){GLctx.drawElements(mode,count,type,indices)}function _glEnable(x0){GLctx["enable"](x0)}function _glEnableVertexAttribArray(index){GLctx.enableVertexAttribArray(index)}function _glFrontFace(x0){GLctx["frontFace"](x0)}function _glGenBuffers(n,buffers){__glGenObject(n,buffers,"createBuffer",GL.buffers)}function _glGenTextures(n,textures){__glGenObject(n,textures,"createTexture",GL.textures)}function _glGetAttribLocation(program,name){return GLctx.getAttribLocation(GL.programs[program],UTF8ToString(name))}function _glGetFloatv(name_,p){emscriptenWebGLGet(name_,p,2)}function _glGetProgramInfoLog(program,maxLength,length,infoLog){var log=GLctx.getProgramInfoLog(GL.programs[program]);if(log===null)log="(unknown error)";var numBytesWrittenExclNull=maxLength>0&&infoLog?stringToUTF8(log,infoLog,maxLength):0;if(length)HEAP32[length>>2]=numBytesWrittenExclNull}function _glGetProgramiv(program,pname,p){if(!p){GL.recordError(1281);return}if(program>=GL.counter){GL.recordError(1281);return}program=GL.programs[program];if(pname==35716){var log=GLctx.getProgramInfoLog(program);if(log===null)log="(unknown error)";HEAP32[p>>2]=log.length+1}else if(pname==35719){if(!program.maxUniformLength){for(var i=0;i>2]=program.maxUniformLength}else if(pname==35722){if(!program.maxAttributeLength){for(var i=0;i>2]=program.maxAttributeLength}else if(pname==35381){if(!program.maxUniformBlockNameLength){for(var i=0;i>2]=program.maxUniformBlockNameLength}else{HEAP32[p>>2]=GLctx.getProgramParameter(program,pname)}}function _glGetShaderInfoLog(shader,maxLength,length,infoLog){var log=GLctx.getShaderInfoLog(GL.shaders[shader]);if(log===null)log="(unknown error)";var numBytesWrittenExclNull=maxLength>0&&infoLog?stringToUTF8(log,infoLog,maxLength):0;if(length)HEAP32[length>>2]=numBytesWrittenExclNull}function _glGetShaderiv(shader,pname,p){if(!p){GL.recordError(1281);return}if(pname==35716){var log=GLctx.getShaderInfoLog(GL.shaders[shader]);if(log===null)log="(unknown error)";var logLength=log?log.length+1:0;HEAP32[p>>2]=logLength}else if(pname==35720){var source=GLctx.getShaderSource(GL.shaders[shader]);var sourceLength=source?source.length+1:0;HEAP32[p>>2]=sourceLength}else{HEAP32[p>>2]=GLctx.getShaderParameter(GL.shaders[shader],pname)}}function _glGetString(name_){var ret=GL.stringCache[name_];if(!ret){switch(name_){case 7939:var exts=GLctx.getSupportedExtensions()||[];exts=exts.concat(exts.map(function(e){return"GL_"+e}));ret=stringToNewUTF8(exts.join(" "));break;case 7936:case 7937:case 37445:case 37446:var s=GLctx.getParameter(name_);if(!s){GL.recordError(1280)}ret=s&&stringToNewUTF8(s);break;case 7938:var glVersion=GLctx.getParameter(7938);{glVersion="OpenGL ES 2.0 ("+glVersion+")"}ret=stringToNewUTF8(glVersion);break;case 35724:var glslVersion=GLctx.getParameter(35724);var ver_re=/^WebGL GLSL ES ([0-9]\.[0-9][0-9]?)(?:$| .*)/;var ver_num=glslVersion.match(ver_re);if(ver_num!==null){if(ver_num[1].length==3)ver_num[1]=ver_num[1]+"0";glslVersion="OpenGL ES GLSL ES "+ver_num[1]+" ("+glslVersion+")"}ret=stringToNewUTF8(glslVersion);break;default:GL.recordError(1280)}GL.stringCache[name_]=ret}return ret}function _glGetUniformLocation(program,name){name=UTF8ToString(name);if(program=GL.programs[program]){webglPrepareUniformLocationsBeforeFirstUse(program);var uniformLocsById=program.uniformLocsById;var arrayIndex=0;var uniformBaseName=name;var leftBrace=webglGetLeftBracePos(name);if(leftBrace>0){arrayIndex=jstoi_q(name.slice(leftBrace+1))>>>0;uniformBaseName=name.slice(0,leftBrace)}var sizeAndId=program.uniformSizeAndIdsByName[uniformBaseName];if(sizeAndId&&arrayIndex>=2;for(var i=0;i<16*count;i+=16){var dst=value+i;view[i]=heap[dst];view[i+1]=heap[dst+1];view[i+2]=heap[dst+2];view[i+3]=heap[dst+3];view[i+4]=heap[dst+4];view[i+5]=heap[dst+5];view[i+6]=heap[dst+6];view[i+7]=heap[dst+7];view[i+8]=heap[dst+8];view[i+9]=heap[dst+9];view[i+10]=heap[dst+10];view[i+11]=heap[dst+11];view[i+12]=heap[dst+12];view[i+13]=heap[dst+13];view[i+14]=heap[dst+14];view[i+15]=heap[dst+15]}}else{var view=HEAPF32.subarray(value>>2,value+count*64>>2)}GLctx.uniformMatrix4fv(webglGetUniformLocation(location),!!transpose,view)}function _glUseProgram(program){program=GL.programs[program];GLctx.useProgram(program);GLctx.currentProgram=program}function _glVertexAttribPointer(index,size,type,normalized,stride,ptr){GLctx.vertexAttribPointer(index,size,type,!!normalized,stride,ptr)}function _glViewport(x0,x1,x2,x3){GLctx["viewport"](x0,x1,x2,x3)}function _emscripten_set_main_loop_timing(mode,value){Browser.mainLoop.timingMode=mode;Browser.mainLoop.timingValue=value;if(!Browser.mainLoop.func){return 1}if(!Browser.mainLoop.running){Browser.mainLoop.running=true}if(mode==0){Browser.mainLoop.scheduler=function Browser_mainLoop_scheduler_setTimeout(){var timeUntilNextTick=Math.max(0,Browser.mainLoop.tickStartTime+value-_emscripten_get_now())|0;setTimeout(Browser.mainLoop.runner,timeUntilNextTick)};Browser.mainLoop.method="timeout"}else if(mode==1){Browser.mainLoop.scheduler=function Browser_mainLoop_scheduler_rAF(){Browser.requestAnimationFrame(Browser.mainLoop.runner)};Browser.mainLoop.method="rAF"}else if(mode==2){if(typeof setImmediate=="undefined"){var setImmediates=[];var emscriptenMainLoopMessageId="setimmediate";var Browser_setImmediate_messageHandler=event=>{if(event.data===emscriptenMainLoopMessageId||event.data.target===emscriptenMainLoopMessageId){event.stopPropagation();setImmediates.shift()()}};addEventListener("message",Browser_setImmediate_messageHandler,true);setImmediate=function Browser_emulated_setImmediate(func){setImmediates.push(func);if(ENVIRONMENT_IS_WORKER){if(Module["setImmediates"]===undefined)Module["setImmediates"]=[];Module["setImmediates"].push(func);postMessage({target:emscriptenMainLoopMessageId})}else postMessage(emscriptenMainLoopMessageId,"*")}}Browser.mainLoop.scheduler=function Browser_mainLoop_scheduler_setImmediate(){setImmediate(Browser.mainLoop.runner)};Browser.mainLoop.method="immediate"}return 0}function maybeExit(){}function setMainLoop(browserIterationFunc,fps,simulateInfiniteLoop,arg,noSetTiming){assert(!Browser.mainLoop.func,"emscripten_set_main_loop: there can only be one main loop function at once: call emscripten_cancel_main_loop to cancel the previous one before setting a new one with different parameters.");Browser.mainLoop.func=browserIterationFunc;Browser.mainLoop.arg=arg;var thisMainLoopId=Browser.mainLoop.currentlyRunningMainloop;function checkIsRunning(){if(thisMainLoopId0){var start=Date.now();var blocker=Browser.mainLoop.queue.shift();blocker.func(blocker.arg);if(Browser.mainLoop.remainingBlockers){var remaining=Browser.mainLoop.remainingBlockers;var next=remaining%1==0?remaining-1:Math.floor(remaining);if(blocker.counted){Browser.mainLoop.remainingBlockers=next}else{next=next+.5;Browser.mainLoop.remainingBlockers=(8*remaining+next)/9}}out('main loop blocker "'+blocker.name+'" took '+(Date.now()-start)+" ms");Browser.mainLoop.updateStatus();if(!checkIsRunning())return;setTimeout(Browser.mainLoop.runner,0);return}if(!checkIsRunning())return;Browser.mainLoop.currentFrameNumber=Browser.mainLoop.currentFrameNumber+1|0;if(Browser.mainLoop.timingMode==1&&Browser.mainLoop.timingValue>1&&Browser.mainLoop.currentFrameNumber%Browser.mainLoop.timingValue!=0){Browser.mainLoop.scheduler();return}else if(Browser.mainLoop.timingMode==0){Browser.mainLoop.tickStartTime=_emscripten_get_now()}Browser.mainLoop.runIter(browserIterationFunc);if(!checkIsRunning())return;if(typeof SDL=="object"&&SDL.audio&&SDL.audio.queueNewAudioData)SDL.audio.queueNewAudioData();Browser.mainLoop.scheduler()};if(!noSetTiming){if(fps&&fps>0)_emscripten_set_main_loop_timing(0,1e3/fps);else _emscripten_set_main_loop_timing(1,1);Browser.mainLoop.scheduler()}if(simulateInfiniteLoop){throw"unwind"}}function warnOnce(text){if(!warnOnce.shown)warnOnce.shown={};if(!warnOnce.shown[text]){warnOnce.shown[text]=1;if(ENVIRONMENT_IS_NODE)text="warning: "+text;err(text)}}var Browser={mainLoop:{running:false,scheduler:null,method:"",currentlyRunningMainloop:0,func:null,arg:0,timingMode:0,timingValue:0,currentFrameNumber:0,queue:[],pause:function(){Browser.mainLoop.scheduler=null;Browser.mainLoop.currentlyRunningMainloop++},resume:function(){Browser.mainLoop.currentlyRunningMainloop++;var timingMode=Browser.mainLoop.timingMode;var timingValue=Browser.mainLoop.timingValue;var func=Browser.mainLoop.func;Browser.mainLoop.func=null;setMainLoop(func,0,false,Browser.mainLoop.arg,true);_emscripten_set_main_loop_timing(timingMode,timingValue);Browser.mainLoop.scheduler()},updateStatus:function(){if(Module["setStatus"]){var message=Module["statusMessage"]||"Please wait...";var remaining=Browser.mainLoop.remainingBlockers;var expected=Browser.mainLoop.expectedBlockers;if(remaining){if(remaining{assert(img.complete,"Image "+name+" could not be decoded");var canvas=document.createElement("canvas");canvas.width=img.width;canvas.height=img.height;var ctx=canvas.getContext("2d");ctx.drawImage(img,0,0);preloadedImages[name]=canvas;Browser.URLObject.revokeObjectURL(url);if(onload)onload(byteArray)};img.onerror=event=>{out("Image "+url+" could not be decoded");if(onerror)onerror()};img.src=url};Module["preloadPlugins"].push(imagePlugin);var audioPlugin={};audioPlugin["canHandle"]=function audioPlugin_canHandle(name){return!Module.noAudioDecoding&&name.substr(-4)in{".ogg":1,".wav":1,".mp3":1}};audioPlugin["handle"]=function audioPlugin_handle(byteArray,name,onload,onerror){var done=false;function finish(audio){if(done)return;done=true;preloadedAudios[name]=audio;if(onload)onload(byteArray)}function fail(){if(done)return;done=true;preloadedAudios[name]=new Audio;if(onerror)onerror()}if(Browser.hasBlobConstructor){try{var b=new Blob([byteArray],{type:Browser.getMimetype(name)})}catch(e){return fail()}var url=Browser.URLObject.createObjectURL(b);var audio=new Audio;audio.addEventListener("canplaythrough",()=>finish(audio),false);audio.onerror=function audio_onerror(event){if(done)return;err("warning: browser could not fully decode audio "+name+", trying slower base64 approach");function encode64(data){var BASE="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";var PAD="=";var ret="";var leftchar=0;var leftbits=0;for(var i=0;i=6){var curr=leftchar>>leftbits-6&63;leftbits-=6;ret+=BASE[curr]}}if(leftbits==2){ret+=BASE[(leftchar&3)<<4];ret+=PAD+PAD}else if(leftbits==4){ret+=BASE[(leftchar&15)<<2];ret+=PAD}return ret}audio.src="data:audio/x-"+name.substr(-3)+";base64,"+encode64(byteArray);finish(audio)};audio.src=url;safeSetTimeout(function(){finish(audio)},1e4)}else{return fail()}};Module["preloadPlugins"].push(audioPlugin);function pointerLockChange(){Browser.pointerLock=document["pointerLockElement"]===Module["canvas"]||document["mozPointerLockElement"]===Module["canvas"]||document["webkitPointerLockElement"]===Module["canvas"]||document["msPointerLockElement"]===Module["canvas"]}var canvas=Module["canvas"];if(canvas){canvas.requestPointerLock=canvas["requestPointerLock"]||canvas["mozRequestPointerLock"]||canvas["webkitRequestPointerLock"]||canvas["msRequestPointerLock"]||(()=>{});canvas.exitPointerLock=document["exitPointerLock"]||document["mozExitPointerLock"]||document["webkitExitPointerLock"]||document["msExitPointerLock"]||(()=>{});canvas.exitPointerLock=canvas.exitPointerLock.bind(document);document.addEventListener("pointerlockchange",pointerLockChange,false);document.addEventListener("mozpointerlockchange",pointerLockChange,false);document.addEventListener("webkitpointerlockchange",pointerLockChange,false);document.addEventListener("mspointerlockchange",pointerLockChange,false);if(Module["elementPointerLock"]){canvas.addEventListener("click",ev=>{if(!Browser.pointerLock&&Module["canvas"].requestPointerLock){Module["canvas"].requestPointerLock();ev.preventDefault()}},false)}}},handledByPreloadPlugin:function(byteArray,fullname,finish,onerror){Browser.init();var handled=false;Module["preloadPlugins"].forEach(function(plugin){if(handled)return;if(plugin["canHandle"](fullname)){plugin["handle"](byteArray,fullname,finish,onerror);handled=true}});return handled},createContext:function(canvas,useWebGL,setInModule,webGLContextAttributes){if(useWebGL&&Module.ctx&&canvas==Module.canvas)return Module.ctx;var ctx;var contextHandle;if(useWebGL){var contextAttributes={antialias:false,alpha:false,majorVersion:1};if(webGLContextAttributes){for(var attribute in webGLContextAttributes){contextAttributes[attribute]=webGLContextAttributes[attribute]}}if(typeof GL!="undefined"){contextHandle=GL.createContext(canvas,contextAttributes);if(contextHandle){ctx=GL.getContext(contextHandle).GLctx}}}else{ctx=canvas.getContext("2d")}if(!ctx)return null;if(setInModule){if(!useWebGL)assert(typeof GLctx=="undefined","cannot set in module if GLctx is used, but we are a non-GL context that would replace it");Module.ctx=ctx;if(useWebGL)GL.makeContextCurrent(contextHandle);Module.useWebGL=useWebGL;Browser.moduleContextCreatedCallbacks.forEach(function(callback){callback()});Browser.init()}return ctx},destroyContext:function(canvas,useWebGL,setInModule){},fullscreenHandlersInstalled:false,lockPointer:undefined,resizeCanvas:undefined,requestFullscreen:function(lockPointer,resizeCanvas){Browser.lockPointer=lockPointer;Browser.resizeCanvas=resizeCanvas;if(typeof Browser.lockPointer=="undefined")Browser.lockPointer=true;if(typeof Browser.resizeCanvas=="undefined")Browser.resizeCanvas=false;var canvas=Module["canvas"];function fullscreenChange(){Browser.isFullscreen=false;var canvasContainer=canvas.parentNode;if((document["fullscreenElement"]||document["mozFullScreenElement"]||document["msFullscreenElement"]||document["webkitFullscreenElement"]||document["webkitCurrentFullScreenElement"])===canvasContainer){canvas.exitFullscreen=Browser.exitFullscreen;if(Browser.lockPointer)canvas.requestPointerLock();Browser.isFullscreen=true;if(Browser.resizeCanvas){Browser.setFullscreenCanvasSize()}else{Browser.updateCanvasDimensions(canvas)}}else{canvasContainer.parentNode.insertBefore(canvas,canvasContainer);canvasContainer.parentNode.removeChild(canvasContainer);if(Browser.resizeCanvas){Browser.setWindowedCanvasSize()}else{Browser.updateCanvasDimensions(canvas)}}if(Module["onFullScreen"])Module["onFullScreen"](Browser.isFullscreen);if(Module["onFullscreen"])Module["onFullscreen"](Browser.isFullscreen)}if(!Browser.fullscreenHandlersInstalled){Browser.fullscreenHandlersInstalled=true;document.addEventListener("fullscreenchange",fullscreenChange,false);document.addEventListener("mozfullscreenchange",fullscreenChange,false);document.addEventListener("webkitfullscreenchange",fullscreenChange,false);document.addEventListener("MSFullscreenChange",fullscreenChange,false)}var canvasContainer=document.createElement("div");canvas.parentNode.insertBefore(canvasContainer,canvas);canvasContainer.appendChild(canvas);canvasContainer.requestFullscreen=canvasContainer["requestFullscreen"]||canvasContainer["mozRequestFullScreen"]||canvasContainer["msRequestFullscreen"]||(canvasContainer["webkitRequestFullscreen"]?()=>canvasContainer["webkitRequestFullscreen"](Element["ALLOW_KEYBOARD_INPUT"]):null)||(canvasContainer["webkitRequestFullScreen"]?()=>canvasContainer["webkitRequestFullScreen"](Element["ALLOW_KEYBOARD_INPUT"]):null);canvasContainer.requestFullscreen()},exitFullscreen:function(){if(!Browser.isFullscreen){return false}var CFS=document["exitFullscreen"]||document["cancelFullScreen"]||document["mozCancelFullScreen"]||document["msExitFullscreen"]||document["webkitCancelFullScreen"]||function(){};CFS.apply(document,[]);return true},nextRAF:0,fakeRequestAnimationFrame:function(func){var now=Date.now();if(Browser.nextRAF===0){Browser.nextRAF=now+1e3/60}else{while(now+2>=Browser.nextRAF){Browser.nextRAF+=1e3/60}}var delay=Math.max(Browser.nextRAF-now,0);setTimeout(func,delay)},requestAnimationFrame:function(func){if(typeof requestAnimationFrame=="function"){requestAnimationFrame(func);return}var RAF=Browser.fakeRequestAnimationFrame;RAF(func)},safeSetTimeout:function(func){return safeSetTimeout(func)},safeRequestAnimationFrame:function(func){return Browser.requestAnimationFrame(function(){callUserCallback(func)})},getMimetype:function(name){return{"jpg":"image/jpeg","jpeg":"image/jpeg","png":"image/png","bmp":"image/bmp","ogg":"audio/ogg","wav":"audio/wav","mp3":"audio/mpeg"}[name.substr(name.lastIndexOf(".")+1)]},getUserMedia:function(func){if(!window.getUserMedia){window.getUserMedia=navigator["getUserMedia"]||navigator["mozGetUserMedia"]}window.getUserMedia(func)},getMovementX:function(event){return event["movementX"]||event["mozMovementX"]||event["webkitMovementX"]||0},getMovementY:function(event){return event["movementY"]||event["mozMovementY"]||event["webkitMovementY"]||0},getMouseWheelDelta:function(event){var delta=0;switch(event.type){case"DOMMouseScroll":delta=event.detail/3;break;case"mousewheel":delta=event.wheelDelta/120;break;case"wheel":delta=event.deltaY;switch(event.deltaMode){case 0:delta/=100;break;case 1:delta/=3;break;case 2:delta*=80;break;default:throw"unrecognized mouse wheel delta mode: "+event.deltaMode}break;default:throw"unrecognized mouse wheel event: "+event.type}return delta},mouseX:0,mouseY:0,mouseMovementX:0,mouseMovementY:0,touches:{},lastTouches:{},calculateMouseEvent:function(event){if(Browser.pointerLock){if(event.type!="mousemove"&&"mozMovementX"in event){Browser.mouseMovementX=Browser.mouseMovementY=0}else{Browser.mouseMovementX=Browser.getMovementX(event);Browser.mouseMovementY=Browser.getMovementY(event)}if(typeof SDL!="undefined"){Browser.mouseX=SDL.mouseX+Browser.mouseMovementX;Browser.mouseY=SDL.mouseY+Browser.mouseMovementY}else{Browser.mouseX+=Browser.mouseMovementX;Browser.mouseY+=Browser.mouseMovementY}}else{var rect=Module["canvas"].getBoundingClientRect();var cw=Module["canvas"].width;var ch=Module["canvas"].height;var scrollX=typeof window.scrollX!="undefined"?window.scrollX:window.pageXOffset;var scrollY=typeof window.scrollY!="undefined"?window.scrollY:window.pageYOffset;if(event.type==="touchstart"||event.type==="touchend"||event.type==="touchmove"){var touch=event.touch;if(touch===undefined){return}var adjustedX=touch.pageX-(scrollX+rect.left);var adjustedY=touch.pageY-(scrollY+rect.top);adjustedX=adjustedX*(cw/rect.width);adjustedY=adjustedY*(ch/rect.height);var coords={x:adjustedX,y:adjustedY};if(event.type==="touchstart"){Browser.lastTouches[touch.identifier]=coords;Browser.touches[touch.identifier]=coords}else if(event.type==="touchend"||event.type==="touchmove"){var last=Browser.touches[touch.identifier];if(!last)last=coords;Browser.lastTouches[touch.identifier]=last;Browser.touches[touch.identifier]=coords}return}var x=event.pageX-(scrollX+rect.left);var y=event.pageY-(scrollY+rect.top);x=x*(cw/rect.width);y=y*(ch/rect.height);Browser.mouseMovementX=x-Browser.mouseX;Browser.mouseMovementY=y-Browser.mouseY;Browser.mouseX=x;Browser.mouseY=y}},resizeListeners:[],updateResizeListeners:function(){var canvas=Module["canvas"];Browser.resizeListeners.forEach(function(listener){listener(canvas.width,canvas.height)})},setCanvasSize:function(width,height,noUpdates){var canvas=Module["canvas"];Browser.updateCanvasDimensions(canvas,width,height);if(!noUpdates)Browser.updateResizeListeners()},windowedWidth:0,windowedHeight:0,setFullscreenCanvasSize:function(){if(typeof SDL!="undefined"){var flags=HEAPU32[SDL.screen>>2];flags=flags|8388608;HEAP32[SDL.screen>>2]=flags}Browser.updateCanvasDimensions(Module["canvas"]);Browser.updateResizeListeners()},setWindowedCanvasSize:function(){if(typeof SDL!="undefined"){var flags=HEAPU32[SDL.screen>>2];flags=flags&~8388608;HEAP32[SDL.screen>>2]=flags}Browser.updateCanvasDimensions(Module["canvas"]);Browser.updateResizeListeners()},updateCanvasDimensions:function(canvas,wNative,hNative){if(wNative&&hNative){canvas.widthNative=wNative;canvas.heightNative=hNative}else{wNative=canvas.widthNative;hNative=canvas.heightNative}var w=wNative;var h=hNative;if(Module["forcedAspectRatio"]&&Module["forcedAspectRatio"]>0){if(w/h=0&&charCode<=31)return;(function(a1,a2){dynCall_vii.apply(null,[GLFW.active.charFunc,a1,a2])})(GLFW.active.id,charCode)},onKeyChanged:function(keyCode,status){if(!GLFW.active)return;var key=GLFW.DOMToGLFWKeyCode(keyCode);if(key==-1)return;var repeat=status&&GLFW.active.keys[key];GLFW.active.keys[key]=status;GLFW.active.domKeys[keyCode]=status;if(!GLFW.active.keyFunc)return;if(repeat)status=2;(function(a1,a2,a3,a4,a5){dynCall_viiiii.apply(null,[GLFW.active.keyFunc,a1,a2,a3,a4,a5])})(GLFW.active.id,key,keyCode,status,GLFW.getModBits(GLFW.active))},onGamepadConnected:function(event){GLFW.refreshJoysticks()},onGamepadDisconnected:function(event){GLFW.refreshJoysticks()},onKeydown:function(event){GLFW.onKeyChanged(event.keyCode,1);if(event.keyCode===8||event.keyCode===9){event.preventDefault()}},onKeyup:function(event){GLFW.onKeyChanged(event.keyCode,0)},onBlur:function(event){if(!GLFW.active)return;for(var i=0;i0){if(eventButton==1){eventButton=2}else{eventButton=1}}return eventButton},onMouseenter:function(event){if(!GLFW.active)return;if(event.target!=Module["canvas"]||!GLFW.active.cursorEnterFunc)return;(function(a1,a2){dynCall_vii.apply(null,[GLFW.active.cursorEnterFunc,a1,a2])})(GLFW.active.id,1)},onMouseleave:function(event){if(!GLFW.active)return;if(event.target!=Module["canvas"]||!GLFW.active.cursorEnterFunc)return;(function(a1,a2){dynCall_vii.apply(null,[GLFW.active.cursorEnterFunc,a1,a2])})(GLFW.active.id,0)},onMouseButtonChanged:function(event,status){if(!GLFW.active)return;Browser.calculateMouseEvent(event);if(event.target!=Module["canvas"])return;var eventButton=GLFW.DOMToGLFWMouseButton(event);if(status==1){GLFW.active.buttons|=1<0?Math.max(delta,1):Math.min(delta,-1);GLFW.wheelPos+=delta;if(!GLFW.active||!GLFW.active.scrollFunc||event.target!=Module["canvas"])return;var sx=0;var sy=delta;if(event.type=="mousewheel"){sx=event.wheelDeltaX}else{sx=event.deltaX}(function(a1,a2,a3){dynCall_vidd.apply(null,[GLFW.active.scrollFunc,a1,a2,a3])})(GLFW.active.id,sx,sy);event.preventDefault()},onCanvasResize:function(width,height){if(!GLFW.active)return;var resizeNeeded=true;if(document["fullscreen"]||document["fullScreen"]||document["mozFullScreen"]||document["webkitIsFullScreen"]){GLFW.active.storedX=GLFW.active.x;GLFW.active.storedY=GLFW.active.y;GLFW.active.storedWidth=GLFW.active.width;GLFW.active.storedHeight=GLFW.active.height;GLFW.active.x=GLFW.active.y=0;GLFW.active.width=screen.width;GLFW.active.height=screen.height;GLFW.active.fullscreen=true}else if(GLFW.active.fullscreen==true){GLFW.active.x=GLFW.active.storedX;GLFW.active.y=GLFW.active.storedY;GLFW.active.width=GLFW.active.storedWidth;GLFW.active.height=GLFW.active.storedHeight;GLFW.active.fullscreen=false}else if(GLFW.active.width!=width||GLFW.active.height!=height){GLFW.active.width=width;GLFW.active.height=height}else{resizeNeeded=false}if(resizeNeeded){Browser.setCanvasSize(GLFW.active.width,GLFW.active.height,true);GLFW.onWindowSizeChanged();GLFW.onFramebufferSizeChanged()}},onWindowSizeChanged:function(){if(!GLFW.active)return;if(!GLFW.active.windowSizeFunc)return;(function(a1,a2,a3){dynCall_viii.apply(null,[GLFW.active.windowSizeFunc,a1,a2,a3])})(GLFW.active.id,GLFW.active.width,GLFW.active.height)},onFramebufferSizeChanged:function(){if(!GLFW.active)return;if(!GLFW.active.framebufferSizeFunc)return;(function(a1,a2,a3){dynCall_viii.apply(null,[GLFW.active.framebufferSizeFunc,a1,a2,a3])})(GLFW.active.id,GLFW.active.width,GLFW.active.height)},getTime:function(){return _emscripten_get_now()/1e3},setWindowTitle:function(winid,title){var win=GLFW.WindowFromId(winid);if(!win)return;win.title=UTF8ToString(title);if(GLFW.active.id==win.id){document.title=win.title}},setJoystickCallback:function(cbfun){GLFW.joystickFunc=cbfun;GLFW.refreshJoysticks()},joys:{},lastGamepadState:[],lastGamepadStateFrame:null,refreshJoysticks:function(){if(Browser.mainLoop.currentFrameNumber!==GLFW.lastGamepadStateFrame||!Browser.mainLoop.currentFrameNumber){GLFW.lastGamepadState=navigator.getGamepads?navigator.getGamepads():navigator.webkitGetGamepads?navigator.webkitGetGamepads:[];GLFW.lastGamepadStateFrame=Browser.mainLoop.currentFrameNumber;for(var joy=0;joy>0]=gamepad.buttons[i].pressed}for(var i=0;i>2]=gamepad.axes[i]}}else{if(GLFW.joys[joy]){out("glfw joystick disconnected",joy);if(GLFW.joystickFunc){(function(a1,a2){dynCall_vii.apply(null,[GLFW.joystickFunc,a1,a2])})(joy,262146)}_free(GLFW.joys[joy].id);_free(GLFW.joys[joy].buttons);_free(GLFW.joys[joy].axes);delete GLFW.joys[joy]}}}}},setKeyCallback:function(winid,cbfun){var win=GLFW.WindowFromId(winid);if(!win)return null;var prevcbfun=win.keyFunc;win.keyFunc=cbfun;return prevcbfun},setCharCallback:function(winid,cbfun){var win=GLFW.WindowFromId(winid);if(!win)return null;var prevcbfun=win.charFunc;win.charFunc=cbfun;return prevcbfun},setMouseButtonCallback:function(winid,cbfun){var win=GLFW.WindowFromId(winid);if(!win)return null;var prevcbfun=win.mouseButtonFunc;win.mouseButtonFunc=cbfun;return prevcbfun},setCursorPosCallback:function(winid,cbfun){var win=GLFW.WindowFromId(winid);if(!win)return null;var prevcbfun=win.cursorPosFunc;win.cursorPosFunc=cbfun;return prevcbfun},setScrollCallback:function(winid,cbfun){var win=GLFW.WindowFromId(winid);if(!win)return null;var prevcbfun=win.scrollFunc;win.scrollFunc=cbfun;return prevcbfun},setDropCallback:function(winid,cbfun){var win=GLFW.WindowFromId(winid);if(!win)return null;var prevcbfun=win.dropFunc;win.dropFunc=cbfun;return prevcbfun},onDrop:function(event){if(!GLFW.active||!GLFW.active.dropFunc)return;if(!event.dataTransfer||!event.dataTransfer.files||event.dataTransfer.files.length==0)return;event.preventDefault();var filenames=_malloc(event.dataTransfer.files.length*4);var filenamesArray=[];var count=event.dataTransfer.files.length;var written=0;var drop_dir=".glfw_dropped_files";FS.createPath("/",drop_dir);function save(file){var path="/"+drop_dir+"/"+file.name.replace(/\//g,"_");var reader=new FileReader;reader.onloadend=e=>{if(reader.readyState!=2){++written;out("failed to read dropped file: "+file.name+": "+reader.error);return}var data=e.target.result;FS.writeFile(path,new Uint8Array(data));if(++written===count){(function(a1,a2,a3){dynCall_viii.apply(null,[GLFW.active.dropFunc,a1,a2,a3])})(GLFW.active.id,count,filenames);for(var i=0;i>2]=filename}for(var i=0;i0},getCursorPos:function(winid,x,y){HEAPF64[x>>3]=Browser.mouseX;HEAPF64[y>>3]=Browser.mouseY},getMousePos:function(winid,x,y){HEAP32[x>>2]=Browser.mouseX;HEAP32[y>>2]=Browser.mouseY},setCursorPos:function(winid,x,y){},getWindowPos:function(winid,x,y){var wx=0;var wy=0;var win=GLFW.WindowFromId(winid);if(win){wx=win.x;wy=win.y}if(x){HEAP32[x>>2]=wx}if(y){HEAP32[y>>2]=wy}},setWindowPos:function(winid,x,y){var win=GLFW.WindowFromId(winid);if(!win)return;win.x=x;win.y=y},getWindowSize:function(winid,width,height){var ww=0;var wh=0;var win=GLFW.WindowFromId(winid);if(win){ww=win.width;wh=win.height}if(width){HEAP32[width>>2]=ww}if(height){HEAP32[height>>2]=wh}},setWindowSize:function(winid,width,height){var win=GLFW.WindowFromId(winid);if(!win)return;if(GLFW.active.id==win.id){if(width==screen.width&&height==screen.height){Browser.requestFullscreen()}else{Browser.exitFullscreen();Browser.setCanvasSize(width,height);win.width=width;win.height=height}}if(!win.windowSizeFunc)return;(function(a1,a2,a3){dynCall_viii.apply(null,[win.windowSizeFunc,a1,a2,a3])})(win.id,width,height)},createWindow:function(width,height,title,monitor,share){var i,id;for(i=0;i0)throw"glfwCreateWindow only supports one window at time currently";id=i+1;if(width<=0||height<=0)return 0;if(monitor){Browser.requestFullscreen()}else{Browser.setCanvasSize(width,height)}for(i=0;i0;if(i==GLFW.windows.length){if(useWebGL){var contextAttributes={antialias:GLFW.hints[135181]>1,depth:GLFW.hints[135173]>0,stencil:GLFW.hints[135174]>0,alpha:GLFW.hints[135172]>0};Module.ctx=Browser.createContext(Module["canvas"],true,true,contextAttributes)}else{Browser.init()}}if(!Module.ctx&&useWebGL)return 0;var win=new GLFW_Window(id,width,height,title,monitor,share);if(id-1==GLFW.windows.length){GLFW.windows.push(win)}else{GLFW.windows[id-1]=win}GLFW.active=win;return win.id},destroyWindow:function(winid){var win=GLFW.WindowFromId(winid);if(!win)return;if(win.windowCloseFunc)(function(a1){dynCall_vi.apply(null,[win.windowCloseFunc,a1])})(win.id);GLFW.windows[win.id-1]=null;if(GLFW.active.id==win.id)GLFW.active=null;for(var i=0;i>2]=0;return 0}function _glfwInit(){if(GLFW.windows)return 1;GLFW.initialTime=GLFW.getTime();GLFW.hints=GLFW.defaultHints;GLFW.windows=new Array;GLFW.active=null;window.addEventListener("gamepadconnected",GLFW.onGamepadConnected,true);window.addEventListener("gamepaddisconnected",GLFW.onGamepadDisconnected,true);window.addEventListener("keydown",GLFW.onKeydown,true);window.addEventListener("keypress",GLFW.onKeyPress,true);window.addEventListener("keyup",GLFW.onKeyup,true);window.addEventListener("blur",GLFW.onBlur,true);Module["canvas"].addEventListener("touchmove",GLFW.onMousemove,true);Module["canvas"].addEventListener("touchstart",GLFW.onMouseButtonDown,true);Module["canvas"].addEventListener("touchcancel",GLFW.onMouseButtonUp,true);Module["canvas"].addEventListener("touchend",GLFW.onMouseButtonUp,true);Module["canvas"].addEventListener("mousemove",GLFW.onMousemove,true);Module["canvas"].addEventListener("mousedown",GLFW.onMouseButtonDown,true);Module["canvas"].addEventListener("mouseup",GLFW.onMouseButtonUp,true);Module["canvas"].addEventListener("wheel",GLFW.onMouseWheel,true);Module["canvas"].addEventListener("mousewheel",GLFW.onMouseWheel,true);Module["canvas"].addEventListener("mouseenter",GLFW.onMouseenter,true);Module["canvas"].addEventListener("mouseleave",GLFW.onMouseleave,true);Module["canvas"].addEventListener("drop",GLFW.onDrop,true);Module["canvas"].addEventListener("dragover",GLFW.onDragover,true);Browser.resizeListeners.push((width,height)=>{GLFW.onCanvasResize(width,height)});return 1}function _glfwMakeContextCurrent(winid){}function _glfwSetCharCallback(winid,cbfun){return GLFW.setCharCallback(winid,cbfun)}function _glfwSetCursorEnterCallback(winid,cbfun){var win=GLFW.WindowFromId(winid);if(!win)return null;var prevcbfun=win.cursorEnterFunc;win.cursorEnterFunc=cbfun;return prevcbfun}function _glfwSetCursorPosCallback(winid,cbfun){return GLFW.setCursorPosCallback(winid,cbfun)}function _glfwSetDropCallback(winid,cbfun){return GLFW.setDropCallback(winid,cbfun)}function _glfwSetErrorCallback(cbfun){var prevcbfun=GLFW.errorFunc;GLFW.errorFunc=cbfun;return prevcbfun}function _glfwSetKeyCallback(winid,cbfun){return GLFW.setKeyCallback(winid,cbfun)}function _glfwSetMouseButtonCallback(winid,cbfun){return GLFW.setMouseButtonCallback(winid,cbfun)}function _glfwSetScrollCallback(winid,cbfun){return GLFW.setScrollCallback(winid,cbfun)}function _glfwSetWindowFocusCallback(winid,cbfun){var win=GLFW.WindowFromId(winid);if(!win)return null;var prevcbfun=win.windowFocusFunc;win.windowFocusFunc=cbfun;return prevcbfun}function _glfwSetWindowIconifyCallback(winid,cbfun){var win=GLFW.WindowFromId(winid);if(!win)return null;var prevcbfun=win.windowIconifyFunc;win.windowIconifyFunc=cbfun;return prevcbfun}function _glfwSetWindowShouldClose(winid,value){var win=GLFW.WindowFromId(winid);if(!win)return;win.shouldClose=value}function _glfwSetWindowSizeCallback(winid,cbfun){return GLFW.setWindowSizeCallback(winid,cbfun)}function _glfwSwapBuffers(winid){GLFW.swapBuffers(winid)}function _glfwSwapInterval(interval){interval=Math.abs(interval);if(interval==0)_emscripten_set_main_loop_timing(0,0);else _emscripten_set_main_loop_timing(1,interval)}function _glfwTerminate(){window.removeEventListener("gamepadconnected",GLFW.onGamepadConnected,true);window.removeEventListener("gamepaddisconnected",GLFW.onGamepadDisconnected,true);window.removeEventListener("keydown",GLFW.onKeydown,true);window.removeEventListener("keypress",GLFW.onKeyPress,true);window.removeEventListener("keyup",GLFW.onKeyup,true);window.removeEventListener("blur",GLFW.onBlur,true);Module["canvas"].removeEventListener("touchmove",GLFW.onMousemove,true);Module["canvas"].removeEventListener("touchstart",GLFW.onMouseButtonDown,true);Module["canvas"].removeEventListener("touchcancel",GLFW.onMouseButtonUp,true);Module["canvas"].removeEventListener("touchend",GLFW.onMouseButtonUp,true);Module["canvas"].removeEventListener("mousemove",GLFW.onMousemove,true);Module["canvas"].removeEventListener("mousedown",GLFW.onMouseButtonDown,true);Module["canvas"].removeEventListener("mouseup",GLFW.onMouseButtonUp,true);Module["canvas"].removeEventListener("wheel",GLFW.onMouseWheel,true);Module["canvas"].removeEventListener("mousewheel",GLFW.onMouseWheel,true);Module["canvas"].removeEventListener("mouseenter",GLFW.onMouseenter,true);Module["canvas"].removeEventListener("mouseleave",GLFW.onMouseleave,true);Module["canvas"].removeEventListener("drop",GLFW.onDrop,true);Module["canvas"].removeEventListener("dragover",GLFW.onDragover,true);Module["canvas"].width=Module["canvas"].height=1;GLFW.windows=null;GLFW.active=null}function _glfwWindowHint(target,hint){GLFW.hints[target]=hint}function allocateUTF8OnStack(str){var size=lengthBytesUTF8(str)+1;var ret=stackAlloc(size);stringToUTF8Array(str,HEAP8,ret,size);return ret}function runAndAbortIfError(func){try{return func()}catch(e){abort(e)}}var Asyncify={State:{Normal:0,Unwinding:1,Rewinding:2,Disabled:3},state:0,StackSize:4096,currData:null,handleSleepReturnValue:0,exportCallStack:[],callStackNameToId:{},callStackIdToName:{},callStackId:0,asyncPromiseHandlers:null,sleepCallbacks:[],getCallStackId:function(funcName){var id=Asyncify.callStackNameToId[funcName];if(id===undefined){id=Asyncify.callStackId++;Asyncify.callStackNameToId[funcName]=id;Asyncify.callStackIdToName[id]=funcName}return id},instrumentWasmImports:function(imports){var ASYNCIFY_IMPORTS=["env.invoke_*","env.emscripten_sleep","env.emscripten_wget","env.emscripten_wget_data","env.emscripten_idb_load","env.emscripten_idb_store","env.emscripten_idb_delete","env.emscripten_idb_exists","env.emscripten_idb_load_blob","env.emscripten_idb_store_blob","env.SDL_Delay","env.emscripten_scan_registers","env.emscripten_lazy_load_code","env.emscripten_fiber_swap","wasi_snapshot_preview1.fd_sync","env.__wasi_fd_sync","env._emval_await","env._dlopen_js","env.__asyncjs__*"].map(x=>x.split(".")[1]);for(var x in imports){(function(x){var original=imports[x];var sig=original.sig;if(typeof original=="function"){var isAsyncifyImport=ASYNCIFY_IMPORTS.indexOf(x)>=0||x.startsWith("__asyncjs__")}})(x)}},instrumentWasmExports:function(exports){var ret={};for(var x in exports){(function(x){var original=exports[x];if(typeof original=="function"){ret[x]=function(){Asyncify.exportCallStack.push(x);try{return original.apply(null,arguments)}finally{if(!ABORT){var y=Asyncify.exportCallStack.pop();assert(y===x);Asyncify.maybeStopUnwind()}}}}else{ret[x]=original}})(x)}return ret},maybeStopUnwind:function(){if(Asyncify.currData&&Asyncify.state===Asyncify.State.Unwinding&&Asyncify.exportCallStack.length===0){Asyncify.state=Asyncify.State.Normal;runAndAbortIfError(_asyncify_stop_unwind);if(typeof Fibers!="undefined"){Fibers.trampoline()}}},whenDone:function(){return new Promise((resolve,reject)=>{Asyncify.asyncPromiseHandlers={resolve:resolve,reject:reject}})},allocateData:function(){var ptr=_malloc(12+Asyncify.StackSize);Asyncify.setDataHeader(ptr,ptr+12,Asyncify.StackSize);Asyncify.setDataRewindFunc(ptr);return ptr},setDataHeader:function(ptr,stack,stackSize){HEAP32[ptr>>2]=stack;HEAP32[ptr+4>>2]=stack+stackSize},setDataRewindFunc:function(ptr){var bottomOfCallStack=Asyncify.exportCallStack[0];var rewindId=Asyncify.getCallStackId(bottomOfCallStack);HEAP32[ptr+8>>2]=rewindId},getDataRewindFunc:function(ptr){var id=HEAP32[ptr+8>>2];var name=Asyncify.callStackIdToName[id];var func=Module["asm"][name];return func},doRewind:function(ptr){var start=Asyncify.getDataRewindFunc(ptr);return start()},handleSleep:function(startAsync){if(ABORT)return;if(Asyncify.state===Asyncify.State.Normal){var reachedCallback=false;var reachedAfterCallback=false;startAsync(handleSleepReturnValue=>{if(ABORT)return;Asyncify.handleSleepReturnValue=handleSleepReturnValue||0;reachedCallback=true;if(!reachedAfterCallback){return}Asyncify.state=Asyncify.State.Rewinding;runAndAbortIfError(()=>_asyncify_start_rewind(Asyncify.currData));if(typeof Browser!="undefined"&&Browser.mainLoop.func){Browser.mainLoop.resume()}var asyncWasmReturnValue,isError=false;try{asyncWasmReturnValue=Asyncify.doRewind(Asyncify.currData)}catch(err){asyncWasmReturnValue=err;isError=true}var handled=false;if(!Asyncify.currData){var asyncPromiseHandlers=Asyncify.asyncPromiseHandlers;if(asyncPromiseHandlers){Asyncify.asyncPromiseHandlers=null;(isError?asyncPromiseHandlers.reject:asyncPromiseHandlers.resolve)(asyncWasmReturnValue);handled=true}}if(isError&&!handled){throw asyncWasmReturnValue}});reachedAfterCallback=true;if(!reachedCallback){Asyncify.state=Asyncify.State.Unwinding;Asyncify.currData=Asyncify.allocateData();if(typeof Browser!="undefined"&&Browser.mainLoop.func){Browser.mainLoop.pause()}runAndAbortIfError(()=>_asyncify_start_unwind(Asyncify.currData))}}else if(Asyncify.state===Asyncify.State.Rewinding){Asyncify.state=Asyncify.State.Normal;runAndAbortIfError(_asyncify_stop_rewind);_free(Asyncify.currData);Asyncify.currData=null;Asyncify.sleepCallbacks.forEach(func=>callUserCallback(func))}else{abort("invalid state: "+Asyncify.state)}return Asyncify.handleSleepReturnValue},handleAsync:function(startAsync){return Asyncify.handleSleep(wakeUp=>{startAsync().then(wakeUp)})}};var FSNode=function(parent,name,mode,rdev){if(!parent){parent=this}this.parent=parent;this.mount=parent.mount;this.mounted=null;this.id=FS.nextInode++;this.name=name;this.mode=mode;this.node_ops={};this.stream_ops={};this.rdev=rdev};var readMode=292|73;var writeMode=146;Object.defineProperties(FSNode.prototype,{read:{get:function(){return(this.mode&readMode)===readMode},set:function(val){val?this.mode|=readMode:this.mode&=~readMode}},write:{get:function(){return(this.mode&writeMode)===writeMode},set:function(val){val?this.mode|=writeMode:this.mode&=~writeMode}},isFolder:{get:function(){return FS.isDir(this.mode)}},isDevice:{get:function(){return FS.isChrdev(this.mode)}}});FS.FSNode=FSNode;FS.staticInit();Module["FS_createPath"]=FS.createPath;Module["FS_createDataFile"]=FS.createDataFile;Module["FS_createPreloadedFile"]=FS.createPreloadedFile;Module["FS_unlink"]=FS.unlink;Module["FS_createLazyFile"]=FS.createLazyFile;Module["FS_createDevice"]=FS.createDevice;var GLctx;for(var i=0;i<32;++i)tempFixedLengthArray.push(new Array(i));var miniTempWebGLFloatBuffersStorage=new Float32Array(288);for(var i=0;i<288;++i){miniTempWebGLFloatBuffers[i]=miniTempWebGLFloatBuffersStorage.subarray(0,i+1)}var __miniTempWebGLIntBuffersStorage=new Int32Array(288);for(var i=0;i<288;++i){__miniTempWebGLIntBuffers[i]=__miniTempWebGLIntBuffersStorage.subarray(0,i+1)}Module["requestFullscreen"]=function Module_requestFullscreen(lockPointer,resizeCanvas){Browser.requestFullscreen(lockPointer,resizeCanvas)};Module["requestAnimationFrame"]=function Module_requestAnimationFrame(func){Browser.requestAnimationFrame(func)};Module["setCanvasSize"]=function Module_setCanvasSize(width,height,noUpdates){Browser.setCanvasSize(width,height,noUpdates)};Module["pauseMainLoop"]=function Module_pauseMainLoop(){Browser.mainLoop.pause()};Module["resumeMainLoop"]=function Module_resumeMainLoop(){Browser.mainLoop.resume()};Module["getUserMedia"]=function Module_getUserMedia(){Browser.getUserMedia()};Module["createContext"]=function Module_createContext(canvas,useWebGL,setInModule,webGLContextAttributes){return Browser.createContext(canvas,useWebGL,setInModule,webGLContextAttributes)};var preloadedImages={};var preloadedAudios={};var asmLibraryArg={"a":___assert_fail,"z":___syscall_fcntl64,"Sa":___syscall_getcwd,"Va":___syscall_ioctl,"Wa":___syscall_openat,"d":_emscripten_asm_const_int,"Xa":_emscripten_date_now,"Z":_emscripten_get_element_css_size,"U":_emscripten_get_gamepad_status,"A":_emscripten_get_now,"V":_emscripten_get_num_gamepads,"Ld":_emscripten_glActiveTexture,"Kd":_emscripten_glAttachShader,"P":_emscripten_glBeginQueryEXT,"Jd":_emscripten_glBindAttribLocation,"Id":_emscripten_glBindBuffer,"Gd":_emscripten_glBindFramebuffer,"Fd":_emscripten_glBindRenderbuffer,"Ed":_emscripten_glBindTexture,"H":_emscripten_glBindVertexArrayOES,"Dd":_emscripten_glBlendColor,"Cd":_emscripten_glBlendEquation,"Bd":_emscripten_glBlendEquationSeparate,"Ad":_emscripten_glBlendFunc,"zd":_emscripten_glBlendFuncSeparate,"yd":_emscripten_glBufferData,"xd":_emscripten_glBufferSubData,"wd":_emscripten_glCheckFramebufferStatus,"vd":_emscripten_glClear,"ud":_emscripten_glClearColor,"td":_emscripten_glClearDepthf,"sd":_emscripten_glClearStencil,"rd":_emscripten_glColorMask,"qd":_emscripten_glCompileShader,"pd":_emscripten_glCompressedTexImage2D,"od":_emscripten_glCompressedTexSubImage2D,"nd":_emscripten_glCopyTexImage2D,"md":_emscripten_glCopyTexSubImage2D,"ld":_emscripten_glCreateProgram,"kd":_emscripten_glCreateShader,"jd":_emscripten_glCullFace,"id":_emscripten_glDeleteBuffers,"hd":_emscripten_glDeleteFramebuffers,"gd":_emscripten_glDeleteProgram,"R":_emscripten_glDeleteQueriesEXT,"fd":_emscripten_glDeleteRenderbuffers,"ed":_emscripten_glDeleteShader,"dd":_emscripten_glDeleteTextures,"G":_emscripten_glDeleteVertexArraysOES,"bd":_emscripten_glDepthFunc,"ad":_emscripten_glDepthMask,"$c":_emscripten_glDepthRangef,"_c":_emscripten_glDetachShader,"Zc":_emscripten_glDisable,"Yc":_emscripten_glDisableVertexAttribArray,"Xc":_emscripten_glDrawArrays,"Od":_emscripten_glDrawArraysInstancedANGLE,"Pd":_emscripten_glDrawBuffersWEBGL,"Wc":_emscripten_glDrawElements,"Nd":_emscripten_glDrawElementsInstancedANGLE,"Vc":_emscripten_glEnable,"Uc":_emscripten_glEnableVertexAttribArray,"O":_emscripten_glEndQueryEXT,"Sc":_emscripten_glFinish,"Rc":_emscripten_glFlush,"Qc":_emscripten_glFramebufferRenderbuffer,"Pc":_emscripten_glFramebufferTexture2D,"Oc":_emscripten_glFrontFace,"Nc":_emscripten_glGenBuffers,"Lc":_emscripten_glGenFramebuffers,"S":_emscripten_glGenQueriesEXT,"Kc":_emscripten_glGenRenderbuffers,"Jc":_emscripten_glGenTextures,"Rd":_emscripten_glGenVertexArraysOES,"Mc":_emscripten_glGenerateMipmap,"Ic":_emscripten_glGetActiveAttrib,"Hc":_emscripten_glGetActiveUniform,"Gc":_emscripten_glGetAttachedShaders,"Fc":_emscripten_glGetAttribLocation,"Ec":_emscripten_glGetBooleanv,"Dc":_emscripten_glGetBufferParameteriv,"Cc":_emscripten_glGetError,"Bc":_emscripten_glGetFloatv,"Ac":_emscripten_glGetFramebufferAttachmentParameteriv,"zc":_emscripten_glGetIntegerv,"xc":_emscripten_glGetProgramInfoLog,"yc":_emscripten_glGetProgramiv,"J":_emscripten_glGetQueryObjecti64vEXT,"L":_emscripten_glGetQueryObjectivEXT,"I":_emscripten_glGetQueryObjectui64vEXT,"K":_emscripten_glGetQueryObjectuivEXT,"M":_emscripten_glGetQueryivEXT,"wc":_emscripten_glGetRenderbufferParameteriv,"uc":_emscripten_glGetShaderInfoLog,"tc":_emscripten_glGetShaderPrecisionFormat,"sc":_emscripten_glGetShaderSource,"vc":_emscripten_glGetShaderiv,"rc":_emscripten_glGetString,"qc":_emscripten_glGetTexParameterfv,"pc":_emscripten_glGetTexParameteriv,"mc":_emscripten_glGetUniformLocation,"oc":_emscripten_glGetUniformfv,"nc":_emscripten_glGetUniformiv,"jc":_emscripten_glGetVertexAttribPointerv,"lc":_emscripten_glGetVertexAttribfv,"kc":_emscripten_glGetVertexAttribiv,"ic":_emscripten_glHint,"hc":_emscripten_glIsBuffer,"gc":_emscripten_glIsEnabled,"fc":_emscripten_glIsFramebuffer,"dc":_emscripten_glIsProgram,"Q":_emscripten_glIsQueryEXT,"cc":_emscripten_glIsRenderbuffer,"bc":_emscripten_glIsShader,"ac":_emscripten_glIsTexture,"Qd":_emscripten_glIsVertexArrayOES,"$b":_emscripten_glLineWidth,"_b":_emscripten_glLinkProgram,"Zb":_emscripten_glPixelStorei,"Yb":_emscripten_glPolygonOffset,"N":_emscripten_glQueryCounterEXT,"Xb":_emscripten_glReadPixels,"Wb":_emscripten_glReleaseShaderCompiler,"Tb":_emscripten_glRenderbufferStorage,"Sb":_emscripten_glSampleCoverage,"Rb":_emscripten_glScissor,"Qb":_emscripten_glShaderBinary,"Pb":_emscripten_glShaderSource,"Ob":_emscripten_glStencilFunc,"Nb":_emscripten_glStencilFuncSeparate,"Mb":_emscripten_glStencilMask,"Lb":_emscripten_glStencilMaskSeparate,"Kb":_emscripten_glStencilOp,"Ib":_emscripten_glStencilOpSeparate,"Hb":_emscripten_glTexImage2D,"Gb":_emscripten_glTexParameterf,"Fb":_emscripten_glTexParameterfv,"Eb":_emscripten_glTexParameteri,"Db":_emscripten_glTexParameteriv,"Cb":_emscripten_glTexSubImage2D,"Bb":_emscripten_glUniform1f,"Ab":_emscripten_glUniform1fv,"zb":_emscripten_glUniform1i,"yb":_emscripten_glUniform1iv,"xb":_emscripten_glUniform2f,"wb":_emscripten_glUniform2fv,"vb":_emscripten_glUniform2i,"ub":_emscripten_glUniform2iv,"tb":_emscripten_glUniform3f,"sb":_emscripten_glUniform3fv,"rb":_emscripten_glUniform3i,"qb":_emscripten_glUniform3iv,"pb":_emscripten_glUniform4f,"ob":_emscripten_glUniform4fv,"nb":_emscripten_glUniform4i,"mb":_emscripten_glUniform4iv,"lb":_emscripten_glUniformMatrix2fv,"kb":_emscripten_glUniformMatrix3fv,"jb":_emscripten_glUniformMatrix4fv,"ib":_emscripten_glUseProgram,"hb":_emscripten_glValidateProgram,"gb":_emscripten_glVertexAttrib1f,"fb":_emscripten_glVertexAttrib1fv,"db":_emscripten_glVertexAttrib2f,"cb":_emscripten_glVertexAttrib2fv,"bb":_emscripten_glVertexAttrib3f,"ab":_emscripten_glVertexAttrib3fv,"$a":_emscripten_glVertexAttrib4f,"_a":_emscripten_glVertexAttrib4fv,"Md":_emscripten_glVertexAttribDivisorANGLE,"Za":_emscripten_glVertexAttribPointer,"Ya":_emscripten_glViewport,"Pa":_emscripten_resize_heap,"s":_emscripten_run_script,"W":_emscripten_sample_gamepad_data,"ea":_emscripten_set_click_callback_on_thread,"fa":_emscripten_set_fullscreenchange_callback_on_thread,"$":_emscripten_set_gamepadconnected_callback_on_thread,"_":_emscripten_set_gamepaddisconnected_callback_on_thread,"aa":_emscripten_set_touchcancel_callback_on_thread,"ca":_emscripten_set_touchend_callback_on_thread,"ba":_emscripten_set_touchmove_callback_on_thread,"da":_emscripten_set_touchstart_callback_on_thread,"Y":_emscripten_sleep,"Qa":_environ_get,"Ra":_environ_sizes_get,"Vb":_exit,"B":_fd_close,"Ua":_fd_read,"Oa":_fd_seek,"Ta":_fd_write,"F":_glActiveTexture,"x":_glAttachShader,"i":_glBindAttribLocation,"c":_glBindBuffer,"f":_glBindTexture,"eb":_glBlendFunc,"l":_glBufferData,"n":_glBufferSubData,"C":_glClear,"D":_glClearColor,"La":_glClearDepthf,"Ca":_glCompileShader,"Ha":_glCompressedTexImage2D,"Aa":_glCreateProgram,"Ea":_glCreateShader,"Ub":_glCullFace,"Ga":_glDeleteProgram,"Na":_glDepthFunc,"ec":_glDisable,"cd":_glDrawArrays,"Tc":_glDrawElements,"E":_glEnable,"g":_glEnableVertexAttribArray,"Ma":_glFrontFace,"m":_glGenBuffers,"Ja":_glGenTextures,"q":_glGetAttribLocation,"Jb":_glGetFloatv,"ya":_glGetProgramInfoLog,"w":_glGetProgramiv,"Ba":_glGetShaderInfoLog,"y":_glGetShaderiv,"k":_glGetString,"p":_glGetUniformLocation,"za":_glLinkProgram,"Ka":_glPixelStorei,"Fa":_glReadPixels,"Da":_glShaderSource,"Ia":_glTexImage2D,"r":_glTexParameterf,"j":_glTexParameteri,"Hd":_glUniform1i,"Sd":_glUniform4f,"ha":_glUniformMatrix4fv,"t":_glUseProgram,"h":_glVertexAttribPointer,"o":_glViewport,"u":_glfwCreateWindow,"va":_glfwDefaultWindowHints,"v":_glfwGetPrimaryMonitor,"b":_glfwGetTime,"ua":_glfwGetVideoModes,"wa":_glfwInit,"ia":_glfwMakeContextCurrent,"na":_glfwSetCharCallback,"ja":_glfwSetCursorEnterCallback,"la":_glfwSetCursorPosCallback,"pa":_glfwSetDropCallback,"xa":_glfwSetErrorCallback,"oa":_glfwSetKeyCallback,"ma":_glfwSetMouseButtonCallback,"ka":_glfwSetScrollCallback,"qa":_glfwSetWindowFocusCallback,"ra":_glfwSetWindowIconifyCallback,"T":_glfwSetWindowShouldClose,"sa":_glfwSetWindowSizeCallback,"X":_glfwSwapBuffers,"ga":_glfwSwapInterval,"ta":_glfwTerminate,"e":_glfwWindowHint};var asm=createWasm();var ___wasm_call_ctors=Module["___wasm_call_ctors"]=function(){return(___wasm_call_ctors=Module["___wasm_call_ctors"]=Module["asm"]["Ud"]).apply(null,arguments)};var _malloc=Module["_malloc"]=function(){return(_malloc=Module["_malloc"]=Module["asm"]["Vd"]).apply(null,arguments)};var _free=Module["_free"]=function(){return(_free=Module["_free"]=Module["asm"]["Wd"]).apply(null,arguments)};var _main=Module["_main"]=function(){return(_main=Module["_main"]=Module["asm"]["Xd"]).apply(null,arguments)};var ___errno_location=Module["___errno_location"]=function(){return(___errno_location=Module["___errno_location"]=Module["asm"]["Yd"]).apply(null,arguments)};var _ma_malloc_emscripten=Module["_ma_malloc_emscripten"]=function(){return(_ma_malloc_emscripten=Module["_ma_malloc_emscripten"]=Module["asm"]["Zd"]).apply(null,arguments)};var _ma_free_emscripten=Module["_ma_free_emscripten"]=function(){return(_ma_free_emscripten=Module["_ma_free_emscripten"]=Module["asm"]["_d"]).apply(null,arguments)};var _ma_device_process_pcm_frames_capture__webaudio=Module["_ma_device_process_pcm_frames_capture__webaudio"]=function(){return(_ma_device_process_pcm_frames_capture__webaudio=Module["_ma_device_process_pcm_frames_capture__webaudio"]=Module["asm"]["$d"]).apply(null,arguments)};var _ma_device_process_pcm_frames_playback__webaudio=Module["_ma_device_process_pcm_frames_playback__webaudio"]=function(){return(_ma_device_process_pcm_frames_playback__webaudio=Module["_ma_device_process_pcm_frames_playback__webaudio"]=Module["asm"]["ae"]).apply(null,arguments)};var stackAlloc=Module["stackAlloc"]=function(){return(stackAlloc=Module["stackAlloc"]=Module["asm"]["ce"]).apply(null,arguments)};var dynCall_vii=Module["dynCall_vii"]=function(){return(dynCall_vii=Module["dynCall_vii"]=Module["asm"]["de"]).apply(null,arguments)};var dynCall_iiii=Module["dynCall_iiii"]=function(){return(dynCall_iiii=Module["dynCall_iiii"]=Module["asm"]["ee"]).apply(null,arguments)};var dynCall_viiii=Module["dynCall_viiii"]=function(){return(dynCall_viiii=Module["dynCall_viiii"]=Module["asm"]["fe"]).apply(null,arguments)};var dynCall_viii=Module["dynCall_viii"]=function(){return(dynCall_viii=Module["dynCall_viii"]=Module["asm"]["ge"]).apply(null,arguments)};var dynCall_viiiii=Module["dynCall_viiiii"]=function(){return(dynCall_viiiii=Module["dynCall_viiiii"]=Module["asm"]["he"]).apply(null,arguments)};var dynCall_vidd=Module["dynCall_vidd"]=function(){return(dynCall_vidd=Module["dynCall_vidd"]=Module["asm"]["ie"]).apply(null,arguments)};var dynCall_vi=Module["dynCall_vi"]=function(){return(dynCall_vi=Module["dynCall_vi"]=Module["asm"]["je"]).apply(null,arguments)};var _asyncify_start_unwind=Module["_asyncify_start_unwind"]=function(){return(_asyncify_start_unwind=Module["_asyncify_start_unwind"]=Module["asm"]["ke"]).apply(null,arguments)};var _asyncify_stop_unwind=Module["_asyncify_stop_unwind"]=function(){return(_asyncify_stop_unwind=Module["_asyncify_stop_unwind"]=Module["asm"]["le"]).apply(null,arguments)};var _asyncify_start_rewind=Module["_asyncify_start_rewind"]=function(){return(_asyncify_start_rewind=Module["_asyncify_start_rewind"]=Module["asm"]["me"]).apply(null,arguments)};var _asyncify_stop_rewind=Module["_asyncify_stop_rewind"]=function(){return(_asyncify_stop_rewind=Module["_asyncify_stop_rewind"]=Module["asm"]["ne"]).apply(null,arguments)};var ___start_em_js=Module["___start_em_js"]=55415;var ___stop_em_js=Module["___stop_em_js"]=55490;Module["addRunDependency"]=addRunDependency;Module["removeRunDependency"]=removeRunDependency;Module["FS_createPath"]=FS.createPath;Module["FS_createDataFile"]=FS.createDataFile;Module["FS_createPreloadedFile"]=FS.createPreloadedFile;Module["FS_createLazyFile"]=FS.createLazyFile;Module["FS_createDevice"]=FS.createDevice;Module["FS_unlink"]=FS.unlink;var calledRun;dependenciesFulfilled=function runCaller(){if(!calledRun)run();if(!calledRun)dependenciesFulfilled=runCaller};function callMain(args){var entryFunction=Module["_main"];args=args||[];args.unshift(thisProgram);var argc=args.length;var argv=stackAlloc((argc+1)*4);var argv_ptr=argv>>2;args.forEach(arg=>{HEAP32[argv_ptr++]=allocateUTF8OnStack(arg)});HEAP32[argv_ptr]=0;try{var ret=entryFunction(argc,argv);exitJS(ret,true);return ret}catch(e){return handleException(e)}}function run(args){args=args||arguments_;if(runDependencies>0){return}preRun();if(runDependencies>0){return}function doRun(){if(calledRun)return;calledRun=true;Module["calledRun"]=true;if(ABORT)return;initRuntime();preMain();if(Module["onRuntimeInitialized"])Module["onRuntimeInitialized"]();if(shouldRunNow)callMain(args);postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(function(){setTimeout(function(){Module["setStatus"]("")},1);doRun()},1)}else{doRun()}}if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].pop()()}}var shouldRunNow=true;if(Module["noInitialRun"])shouldRunNow=false;run(); diff --git a/docs/static_demos/space_blast/space_blast.wasm b/public/static_demos/space_blast/space_blast.wasm similarity index 100% rename from docs/static_demos/space_blast/space_blast.wasm rename to public/static_demos/space_blast/space_blast.wasm diff --git a/docs/static_demos/space_blast/space_blast.yaka b/public/static_demos/space_blast/space_blast.yaka similarity index 100% rename from docs/static_demos/space_blast/space_blast.yaka rename to public/static_demos/space_blast/space_blast.yaka diff --git a/public/static_demos/tree/wind_tree.html b/public/static_demos/tree/wind_tree.html new file mode 100644 index 0000000..f703b05 --- /dev/null +++ b/public/static_demos/tree/wind_tree.html @@ -0,0 +1,20 @@ + + + Yaksha/raylib web game + + + + + + +

+ + + + \ No newline at end of file diff --git a/docs/static_demos/tree/wind_tree.js b/public/static_demos/tree/wind_tree.js similarity index 100% rename from docs/static_demos/tree/wind_tree.js rename to public/static_demos/tree/wind_tree.js diff --git a/docs/static_demos/tree/wind_tree.wasm b/public/static_demos/tree/wind_tree.wasm similarity index 100% rename from docs/static_demos/tree/wind_tree.wasm rename to public/static_demos/tree/wind_tree.wasm diff --git a/run.sh b/run.sh deleted file mode 100755 index d6f642f..0000000 --- a/run.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash -python build.py -./server.sh diff --git a/server.cmd b/server.cmd deleted file mode 100644 index f719e47..0000000 --- a/server.cmd +++ /dev/null @@ -1 +0,0 @@ -python -m http.server --directory docs --bind 127.0.0.1 5005 diff --git a/server.sh b/server.sh deleted file mode 100755 index 13fb443..0000000 --- a/server.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env bash -python -m http.server --directory docs --bind 127.0.0.1 5005 diff --git a/src/components/Footer.astro b/src/components/Footer.astro new file mode 100644 index 0000000..b2ebadd --- /dev/null +++ b/src/components/Footer.astro @@ -0,0 +1,28 @@ +

+ + +
diff --git a/src/components/LightSwitch.astro b/src/components/LightSwitch.astro new file mode 100644 index 0000000..a4c6b54 --- /dev/null +++ b/src/components/LightSwitch.astro @@ -0,0 +1,21 @@ +--- + + +--- + + + + \ No newline at end of file diff --git a/src/components/NavBar.astro b/src/components/NavBar.astro new file mode 100644 index 0000000..a62cbd8 --- /dev/null +++ b/src/components/NavBar.astro @@ -0,0 +1,54 @@ +--- +import LightSwitch from "./LightSwitch.astro"; + +const pathname = new URL(Astro.request.url).pathname; +const currentPageRegex = /\/([^\/]*)/; + +const matches = currentPageRegex.exec(pathname); +const currentPath = matches ? matches[1] : ""; + +const activePageStyling = (path: string) => path == currentPath ? "text-secondary" : ""; +--- + + \ No newline at end of file diff --git a/src/components/Note.astro b/src/components/Note.astro new file mode 100644 index 0000000..fcb9a6d --- /dev/null +++ b/src/components/Note.astro @@ -0,0 +1,4 @@ +
+ + +
\ No newline at end of file diff --git a/src/components/Status.astro b/src/components/Status.astro new file mode 100644 index 0000000..4665b35 --- /dev/null +++ b/src/components/Status.astro @@ -0,0 +1,22 @@ +--- +interface Props { + status: "done" | "in-progress" | "not-started"; +} + +const { status } = Astro.props; + +let style; + +if (status == "done") { + style = "badge badge-success text-success-content"; +} else if (status == "in-progress") { + style = "badge badge-warning text-warning-content"; +} else if (status == "not-started") { + style = "badge badge-error text-error-content"; +} +--- + +
+ +
{status} +
diff --git a/src/components/Warning.astro b/src/components/Warning.astro new file mode 100644 index 0000000..448b8f3 --- /dev/null +++ b/src/components/Warning.astro @@ -0,0 +1,4 @@ +
+ + +
\ No newline at end of file diff --git a/src/env.d.ts b/src/env.d.ts new file mode 100644 index 0000000..acef35f --- /dev/null +++ b/src/env.d.ts @@ -0,0 +1,2 @@ +/// +/// diff --git a/src/layouts/BlogPostLayout.astro b/src/layouts/BlogPostLayout.astro new file mode 100644 index 0000000..d676bd8 --- /dev/null +++ b/src/layouts/BlogPostLayout.astro @@ -0,0 +1,17 @@ +--- +import Layout from '../layouts/Layout.astro'; + +const {frontmatter} = Astro.props; +--- + +
+

{frontmatter.title}

+

{frontmatter.author}

+ +
+ +
+ +
+
+ \ No newline at end of file diff --git a/src/layouts/DemoLayout.astro b/src/layouts/DemoLayout.astro new file mode 100644 index 0000000..69d4f1c --- /dev/null +++ b/src/layouts/DemoLayout.astro @@ -0,0 +1,35 @@ +--- +import Layout from '../layouts/Layout.astro'; + +const {frontmatter} = Astro.props; +--- + + +
+

{frontmatter.title}

+

{frontmatter.author}

+ +
+ { frontmatter.demoJs != undefined && + <> + + + + diff --git a/src/layouts/Layout.astro b/src/layouts/Layout.astro new file mode 100644 index 0000000..93c448e --- /dev/null +++ b/src/layouts/Layout.astro @@ -0,0 +1,32 @@ +--- +import Footer from '../components/Footer.astro'; +import NavBar from '../components/NavBar.astro'; + +interface Props { + title: string; + description?: string; +} + +const { title, description } = Astro.props; +--- + + + + + + + + + + + + {title} + + + +
+ +
+