Skip to content

Latest commit

 

History

History
51 lines (32 loc) · 1.29 KB

README.md

File metadata and controls

51 lines (32 loc) · 1.29 KB

Variation of a classical billiard game in JavaScript

Written in TypeScript, with elastic collision implemented (for performance reasons) in Zig programming language and compiled into Web Assembly.

Live demo

https://kign.github.io/js-billiard

Game Screenshot

Installation

To install all node.js dependencies:

npm install

To compile directly with TypeScript compiler (JavaScript files will be generated in js); these files are not used for anything right now

tsc

To start dev server

npm start

Zig source code compilation to wasm

zig build-lib src/animation.zig -target wasm32-wasi --output-dir dist

To comple bundle with webpack (bundle will be generated in dist)

npm run-script build
zig build-lib src/animation.zig -target wasm32-wasi --output-dir dist && rm dist/*.o && chmod a-x dist/*
cp assets/favicon.png dist

TypeScript in Webpack

HtmlWebpackPlugin templates