From 32345876b90ad1bb45125cf9ea3784ae25545525 Mon Sep 17 00:00:00 2001 From: Dennis Ranke Date: Thu, 30 Dec 2021 22:39:55 +0100 Subject: [PATCH] v0.1pre5 + some virtual fireworks for today --- examples/curlywas/fireworks.cwa | 32 ++++++++++++++++++++++++++++++++ site/content/_index.md | 4 ++++ site/static/v0.1pre5/index.html | 1 + site/templates/index.html | 2 +- 4 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 examples/curlywas/fireworks.cwa create mode 100644 site/static/v0.1pre5/index.html diff --git a/examples/curlywas/fireworks.cwa b/examples/curlywas/fireworks.cwa new file mode 100644 index 0000000..3976171 --- /dev/null +++ b/examples/curlywas/fireworks.cwa @@ -0,0 +1,32 @@ +import "env.time" fn time() -> f32; +import "env.circle" fn circle(f32, f32, f32, i32); +import "env.cls" fn cls(i32); +import "env.randomSeed" fn seed(i32); +import "env.randomf" fn randomf() -> f32; +import "env.sin" fn sin(f32) -> f32; +import "env.cos" fn cos(f32) -> f32; +import "env.fmod" fn fmod(f32, f32) -> f32; + +export fn upd() { + cls(0); + + let i: i32; + loop pixels { + let inline rocket = i #>> 9; + let lazy local_time = fmod(time() + rocket as f32 / 5 as f32, 2 as f32); + let lazy rocket = rocket + nearest(time() - local_time) as i32 * 10; + seed(rocket); + let inline x = randomf() * 645 as f32; + let y = randomf() * 133 as f32; + let lazy angle = { seed(i); randomf() } * 44 as f32; + let inline dx = sin(angle); + let inline dy = cos(angle); + let lazy dist = local_time * (randomf() * 44 as f32); + circle( + x + dx * dist, + y + dy * dist + local_time * local_time * 24 as f32, + 1 as f32, (rocket % 11 + 1) * 16 - (local_time * 7 as f32) as i32 - (i % 4) + ); + branch_if (i := i + 1) < 5120: pixels; + } +} \ No newline at end of file diff --git a/site/content/_index.md b/site/content/_index.md index ccaf5b8..ccdd576 100644 --- a/site/content/_index.md +++ b/site/content/_index.md @@ -7,6 +7,7 @@ * [v0.1pre2](v0.1pre2) * [v0.1pre3](v0.1pre3) * [v0.1pre4](v0.1pre4) +* [v0.1pre5](v0.1pre5) ## Spec @@ -41,6 +42,8 @@ Other imports provided by the platform, also all in module `env`: * `fn hline(left: i32, right: i32, y: i32, color: i32)` * `fn rectangle(x1: f32, y1: f32, x2: f32, y2: f32, color: i32)` * `fn circle(cx: f32, cy: f32, radius: f32, color: i32)` +* `fn rectangle_outline(x1: f32, y1: f32, x2: f32, y2: f32, color: i32)` +* `fn circle_outline(cx: f32, cy: f32, radius: f32, color: i32)` * `fn line(x1: f32, y1: f32, x2: f32, y2: f32, color: i32)` * `fn time() -> f32` @@ -116,6 +119,7 @@ Writing code for MicroW8 in C, Rust, AssemblyScript etc. should absolutely possible but no examples are provided, yet. ## Examples +* [Fireworks](v0.1pre5#AgwvgP+M59snqjl4CMKw5sqm1Zw9yJCbSviMjeLUdHus2a3yl/a99+uiBeqZgP/2jqSjrLjRk73COMM6OSLpsxK8ugT1kuk/q4hQUqqPpGozHoa0laulzGGcahzdfdJsYaK1sIdeIYS9M5PnJx/Wk9H+PvWEPy2Zvv7I6IW7Fg==) (127 bytes): Some fireworks to welcome 2022. * [Skip Ahead](v0.1pre4#AiP94km33q5hBFbBcKl2W1ZMY67wHByUz15/qRHIr71Dvq8bTVux/DXZzSTKU5MufRXxnGEn6mOul4dil/5WLT1Y+Y/4TGd1E3U4rQaxlpcKObxc5YLdr4xo6jyBND96a569LoECv6Q4EIqxJi+3QPE21r/++js41XsBLr44X/O2XpP3kHQva3B8o6duD5WkLCf7PhsxjTBeND1ADIaJe05JCrBim18RPY9VYFmltqQ9gVzbxE/ZpojR/GJ4aCbx0hRn73RPhpA7Cd4jk0AVSOeRx+7kuHrLzpaeqeYWK5pYd/4Rv+8=) (230 bytes): A port of my [TIC-80 256byte game](http://tic80.com/play?cart=1735) from LoveByte'21 * [OhNoAnotherTunnel](v0.1pre4#Ag95rdCB5Ww5NofyQaKF4P1mrNRso4azgiem4hK99Gh8OMzSpFq3NsNDo7O7pqln10D11l9uXr/ritw7OEzKwbEfCdvaRnS2Z0Kz0iDEZt/gIqOdvFmxsL1MjPQ4XInPbUJpQUonhQq29oP2omFabnQxn0bzoK7mZjcwc5GetHG+hGajkJcRr8oOnjfCol8RD+ha33GYtPnut+GLe4ktzf5UxZwGs6oT9qqC61lRDakN) (177 bytes): A port of my [entry](http://tic80.com/play?cart=1871) in the Outline'21 bytebattle final * [Technotunnel](v0.1pre4#AqL8HeK1M9dn2nWNIF5vaq/Vh64pMt5nJIFoFKpBMPUsGtDtpqjo1JbT9LzPhAxCqJ7Yh4TA6oTGd4xhLowf+cWZMY73+7AZmfXJJsBi4cej/hH+4wlAgxFIrnOYnr/18IpnZbsHf0eGm1BhahX74+cVR0TRmNQmYC7GhCNS3mv/3MJn74lCj7t28aBJPjEZhP9fGXdG2u5Egh/Tjdg=) (158 bytes): A port of my [entry](https://tic80.com/play?cart=1873) in the Outline'21 bytebattle quater final diff --git a/site/static/v0.1pre5/index.html b/site/static/v0.1pre5/index.html new file mode 100644 index 0000000..658f372 --- /dev/null +++ b/site/static/v0.1pre5/index.html @@ -0,0 +1 @@ +MicroW8
\ No newline at end of file diff --git a/site/templates/index.html b/site/templates/index.html index c6cb0e6..0777deb 100644 --- a/site/templates/index.html +++ b/site/templates/index.html @@ -4,7 +4,7 @@

A WebAssembly based sizecoding platform

- +