rename and refactor
This commit is contained in:
commit
2829f237a1
21 files changed
+1985
No files matched your search
@@ -0,0 +1,114 @@
|
||||
@font-face {
|
||||
font-family: departure;
|
||||
src: url('/style.css');
|
||||
font-display: swap;
|
||||
}
|
||||
|
||||
body {
|
||||
background-color: #5566aa;
|
||||
background-image: url('/assets/tile2.png');
|
||||
background-repeat: repeat;
|
||||
background-size: 128px 128px;
|
||||
image-rendering: pixelated;
|
||||
}
|
||||
|
||||
.content {
|
||||
background-color: #eaeaff;
|
||||
border: 2px solid #445588;
|
||||
box-shadow:
|
||||
inset 2px 2px 0 0 #445588,
|
||||
2px 2px 0 0 #ccddee;
|
||||
}
|
||||
|
||||
button, .start-btn {
|
||||
background-color: #aabbdd;
|
||||
border: 2px solid #ccddee;
|
||||
border-right-color: #445588;
|
||||
border-bottom-color: #445588;
|
||||
box-shadow:
|
||||
1px 1px 0 0 #334477,
|
||||
inset 1px 1px 0 0 #ddeeff;
|
||||
}
|
||||
|
||||
button:active, .start-btn:active {
|
||||
border-color: #445588;
|
||||
border-right-color: #ccddee;
|
||||
border-bottom-color: #ccddee;
|
||||
box-shadow:
|
||||
1px 1px 0 0 #ccddee,
|
||||
inset 1px 1px 0 0 #334477;
|
||||
}
|
||||
|
||||
.tk-img {
|
||||
border: 2px solid #445588;
|
||||
border-right-color: #ccddee;
|
||||
border-bottom-color: #ccddee;
|
||||
box-shadow:
|
||||
inset 1px 1px 0 0 #334477,
|
||||
1px 1px 0 0 #ccddee;
|
||||
}
|
||||
|
||||
input[type="text"] {
|
||||
border: 2px solid #445588;
|
||||
border-right-color: #ccddee;
|
||||
border-bottom-color: #ccddee;
|
||||
box-shadow:
|
||||
inset 1px 1px 0 0 #334477,
|
||||
1px 1px 0 0 #ccddee;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #3355bb;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
color: #5577dd;
|
||||
}
|
||||
|
||||
.app {
|
||||
border: 2px solid #445588;
|
||||
box-shadow:
|
||||
inset 1px 1px 0 0 #334477,
|
||||
1px 1px 0 0 #ccddee;
|
||||
}
|
||||
|
||||
.life-grid {
|
||||
background-color: #445588;
|
||||
border: 2px solid #445588;
|
||||
border-right-color: #ccddee;
|
||||
border-bottom-color: #ccddee;
|
||||
box-shadow:
|
||||
inset 1px 1px 0 0 #334477,
|
||||
1px 1px 0 0 #ccddee;
|
||||
}
|
||||
|
||||
.life-cell {
|
||||
border: 1px solid #445588;
|
||||
background-color: #eaeaff;
|
||||
}
|
||||
|
||||
.life-legend-color {
|
||||
border: 1px solid #445588;
|
||||
border-right-color: #ccddee;
|
||||
border-bottom-color: #ccddee;
|
||||
box-shadow:
|
||||
inset 1px 1px 0 0 #334477,
|
||||
1px 1px 0 0 #ccddee;
|
||||
}
|
||||
|
||||
.bloat-meter-container {
|
||||
border: 1px solid #5566aa;
|
||||
background-color: rgba(85, 102, 170, 0.05);
|
||||
}
|
||||
|
||||
.bloat-meter-container h3 {
|
||||
color: #5566aa;
|
||||
}
|
||||
|
||||
h1, h2, h3 {
|
||||
color: #445588;
|
||||
}
|
||||
|
||||
meta[name="theme-color"] {
|
||||
content: "#5566aa";
|
||||
}
|
||||
+91
@@ -0,0 +1,91 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<meta charset="utf-8" />
|
||||
<head>
|
||||
<title>Inner Breeze</title>
|
||||
<link href="/style.css" rel="stylesheet" />
|
||||
<link href="inbe.css" rel="stylesheet" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:url" content="https://waozi.xyz/">
|
||||
<meta property="og:title" content="Waozi - Personal Portfolio">
|
||||
<meta property="og:description" content="Inner Breeze - Guided breathing meditation based on the Wim Hof method">
|
||||
<meta property="og:image" content="https://waozi.xyz/og.png">
|
||||
<meta property="twitter:card" content="summary_large_image">
|
||||
<meta property="twitter:url" content="https://waozi.xyz/">
|
||||
<meta property="twitter:title" content="Waozi - Personal Portfolio">
|
||||
<meta property="twitter:description" content="Inner Breeze - Guided breathing meditation based on the Wim Hof method">
|
||||
<meta property="twitter:image" content="https://waozi.xyz/og.png">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="/icons/favicon-32x32.png">
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="/icons/apple-icon-180x180.png">
|
||||
<link rel="manifest" href="/manifest.json">
|
||||
<meta name="theme-color" content="#5566aa">
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="content">
|
||||
<section>
|
||||
<img class="tk-img" src="/assets/inbe.png" width="128px"/>
|
||||
|
||||
<h1>Inner Breeze</h1>
|
||||
<p>guided breathing meditation based on the Wim Hof method</p>
|
||||
|
||||
<a href="/inbe/wasm4/inbe.html" class="start-btn">Start Now</a>
|
||||
</section>
|
||||
<section>
|
||||
<details>
|
||||
<summary>All implementations</summary>
|
||||
<br/>
|
||||
<div class="grid">
|
||||
<div class="app-platform">
|
||||
<strong>Web</strong>
|
||||
<div class="row">
|
||||
<a href="/inbe/wasm4/inbe.html"><img width="32px" src="/assets/wasm4.png" alt="wasm4"/></a>
|
||||
<a href="/inbe/uxn/inbe.html"><img width="32px" src="/assets/uxn.png" alt="uxn"/></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="app-platform">
|
||||
<strong>Cartridges</strong>
|
||||
<div class="row">
|
||||
<img width="16px" src="/assets/uxn.png"/> <a href="/inbe/uxn/inbe.rom">.rom</a> <small>(3.0K)</small>
|
||||
</div>
|
||||
<div class="row">
|
||||
<img width="16px" src="/assets/wasm4.png"/> <a href="/inbe/wasm4/inbe.wasm">.wasm</a> <small>(1.1K)</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="app-platform">
|
||||
<strong>Windows</strong>
|
||||
<div class="row">
|
||||
<img width="16px" src="/assets/wasm4.png"/> <a href="/inbe/wasm4/inbe_x86_64.exe">inbe_x86_64.exe</a> <small>(240K)</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="app-platform">
|
||||
<strong>Linux</strong>
|
||||
<div class="row">
|
||||
<img width="16px" src="/assets/wasm4.png"/> <a href="/inbe/wasm4/inbe_x86_64">inbe_x86_64</a> <small>(212K)</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="app-platform">
|
||||
<strong>Scripts</strong>
|
||||
<div class="row">
|
||||
<img width="16px" src="/assets/cli.png"/> <a href="/inbe/rc/inbe.rc">.rc</a> <small>(1.8K)</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="app-platform">
|
||||
<strong>Source</strong>
|
||||
<div class="row">
|
||||
<img width="16px" src="/assets/uxn.png"/> <a href="/inbe/uxn/inbe.tal">.tal</a> <small>(20K)</small>
|
||||
</div>
|
||||
<div class="row">
|
||||
<img width="16px" src="/assets/wasm4.png"/> <a href="/inbe/wasm4/inbe/src/main.c">main.c</a> <small>(4.2K)</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</details>
|
||||
</section>
|
||||
<a href="/">go home</a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,19 @@
|
||||
# LÖVE2D build
|
||||
|
||||
.PHONY: all clean web
|
||||
|
||||
all:
|
||||
for dir in */; do \
|
||||
if [ "$$dir" != "build/" ]; then \
|
||||
cd "$$dir" && zip -r ../"$${dir%/}".love *; \
|
||||
cd ..; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
web: all
|
||||
npx love.js -t inbe inbe.love build/inbe -c
|
||||
rm build/inbe/index.html
|
||||
|
||||
clean:
|
||||
rm -f *.love
|
||||
rm -rf build
|
||||
@@ -0,0 +1,41 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<meta property='og:type' content='website'/>
|
||||
<meta property='og:site_name' content='Lotus'/>
|
||||
<meta property='og:description' content="Inbe - Guided Wim Hof Breathing"/>
|
||||
<meta property="og:title" content="Inbe - Guided Breathing"/>
|
||||
<meta property="og:url" content="https://waozi.xyz/lotus/love2d/inbe.html">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Inner Breeze - Guided Breathing</title>
|
||||
<link href="/style.css" rel="stylesheet" />
|
||||
<style>
|
||||
#loadingCanvas, #canvas { background: #000; display: block; margin: 20px auto; }
|
||||
#canvas { visibility: hidden; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="content">
|
||||
<h1>Inner Breeze</h1>
|
||||
<p>Guided Wim Hof Breathing</p>
|
||||
|
||||
<div>
|
||||
<canvas id="loadingCanvas" width="800" height="600"></canvas>
|
||||
<canvas id="canvas"></canvas>
|
||||
</div>
|
||||
|
||||
<center>
|
||||
<a href="inbe.love" download>Download inbe.love</a>
|
||||
<br>
|
||||
<button id="fullscreenButton" type="button">Fullscreen</button>
|
||||
</center>
|
||||
|
||||
<a href='/lotus'>back to lotus</a>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript" src="inbe.js"></script>
|
||||
<script type="text/javascript" src="build/inbe/game.js"></script>
|
||||
<script type="text/javascript" src="build/inbe/love.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,91 @@
|
||||
function goFullScreen() {
|
||||
var canvas = document.getElementById("canvas");
|
||||
if (canvas.requestFullScreen) {
|
||||
canvas.requestFullScreen();
|
||||
} else if (canvas.webkitRequestFullScreen) {
|
||||
canvas.webkitRequestFullScreen();
|
||||
} else if (canvas.mozRequestFullScreen) {
|
||||
canvas.mozRequestFullScreen();
|
||||
}
|
||||
}
|
||||
|
||||
document.getElementById("fullscreenButton").addEventListener("click", goFullScreen);
|
||||
document.getElementById("loadingCanvas").addEventListener("contextmenu", function(e) {
|
||||
e.preventDefault();
|
||||
});
|
||||
document.getElementById("canvas").addEventListener("contextmenu", function(e) {
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
var loadingContext = document.getElementById("loadingCanvas").getContext("2d");
|
||||
|
||||
function drawLoadingText(text) {
|
||||
var canvas = loadingContext.canvas;
|
||||
loadingContext.fillStyle = "rgb(142, 195, 227)";
|
||||
loadingContext.fillRect(0, 0, canvas.scrollWidth, canvas.scrollHeight);
|
||||
loadingContext.font = "2em arial";
|
||||
loadingContext.textAlign = "center";
|
||||
loadingContext.fillStyle = "rgb( 11, 86, 117 )";
|
||||
loadingContext.fillText(text, canvas.scrollWidth / 2, canvas.scrollHeight / 2);
|
||||
loadingContext.fillText("Powered By LOVE.", canvas.scrollWidth / 2, canvas.scrollHeight / 4 * 3);
|
||||
}
|
||||
|
||||
window.onload = function() {
|
||||
window.focus();
|
||||
};
|
||||
window.onclick = function() {
|
||||
window.focus();
|
||||
};
|
||||
window.addEventListener("keydown", function(e) {
|
||||
if ([32, 37, 38, 39, 40].indexOf(e.keyCode) > -1) {
|
||||
e.preventDefault();
|
||||
}
|
||||
}, false);
|
||||
|
||||
var Module = {
|
||||
arguments: ["/game.love"],
|
||||
locateFile: function(path) {
|
||||
return "build/inbe/" + path;
|
||||
},
|
||||
INITIAL_MEMORY: 16777216,
|
||||
printErr: console.error.bind(console),
|
||||
canvas: (function() {
|
||||
var canvas = document.getElementById("canvas");
|
||||
canvas.addEventListener("webglcontextlost", function(e) {
|
||||
alert("WebGL context lost. You will need to reload the page.");
|
||||
e.preventDefault();
|
||||
}, false);
|
||||
return canvas;
|
||||
})(),
|
||||
setStatus: function(text) {
|
||||
if (text) {
|
||||
drawLoadingText(text);
|
||||
} else if (Module.remainingDependencies === 0) {
|
||||
document.getElementById("loadingCanvas").style.display = "none";
|
||||
document.getElementById("canvas").style.visibility = "visible";
|
||||
}
|
||||
},
|
||||
totalDependencies: 0,
|
||||
remainingDependencies: 0,
|
||||
monitorRunDependencies: function(left) {
|
||||
this.remainingDependencies = left;
|
||||
this.totalDependencies = Math.max(this.totalDependencies, left);
|
||||
Module.setStatus(left ? "Preparing... (" + (this.totalDependencies - left) + "/" + this.totalDependencies + ")" : "All downloads complete.");
|
||||
}
|
||||
};
|
||||
|
||||
Module.setStatus("Downloading...");
|
||||
window.onerror = function() {
|
||||
Module.setStatus("Exception thrown, see JavaScript console");
|
||||
Module.setStatus = function(text) {
|
||||
if (text) {
|
||||
Module.printErr("[post-exception status] " + text);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
function applicationLoad() {
|
||||
Love(Module);
|
||||
}
|
||||
|
||||
window.addEventListener("load", applicationLoad);
|
||||
Binary file not shown.
@@ -0,0 +1,5 @@
|
||||
local ga = love.graphics
|
||||
|
||||
function love.draw()
|
||||
ga.print("Hi", 200, 200)
|
||||
end
|
||||
@@ -0,0 +1,11 @@
|
||||
let
|
||||
nixpkgs = fetchTarball "https://github.com/NixOS/nixpkgs/tarball/nixos-25.11";
|
||||
pkgs = import nixpkgs { config = {}; overlays = []; };
|
||||
in
|
||||
|
||||
pkgs.mkShellNoCC {
|
||||
packages = with pkgs; [
|
||||
love
|
||||
zip
|
||||
];
|
||||
}
|
||||
Executable
+84
@@ -0,0 +1,84 @@
|
||||
#!/usr/bin/env rc
|
||||
|
||||
today = `{date | awk 'BEGIN{m["Jan"]="01";m["Feb"]="02";m["Mar"]="03";m["Apr"]="04";m["May"]="05";m["Jun"]="06";m["Jul"]="07";m["Aug"]="08";m["Sep"]="09";m["Oct"]="10";m["Nov"]="11";m["Dec"]="12"}{printf "%s/%s/%02d\n", $6, m[$2], $3}'}
|
||||
daypath = $home/lib/lotus/$today
|
||||
mkdir -p $daypath
|
||||
|
||||
echo '=== Breathing Exercise ==='
|
||||
echo -n 'Press ENTER to start'
|
||||
junk = `{read}
|
||||
|
||||
results = ()
|
||||
|
||||
fn cleanup {
|
||||
if(! ~ $counter_pid '') {
|
||||
kill $counter_pid >[2]/dev/null
|
||||
}
|
||||
rm -f $flag
|
||||
exit
|
||||
}
|
||||
|
||||
trap cleanup SIGINT
|
||||
trap cleanup SIGTERM
|
||||
|
||||
for(round in 1 2 3 4) {
|
||||
echo ''
|
||||
echo '--- STARTING ROUND' $round '---'
|
||||
|
||||
# Breathing Phase: 30 cycles (In 1.5s, Out 1s)
|
||||
for(i in `{seq 1 30}) {
|
||||
echo -n 'in '
|
||||
sleep 1.5
|
||||
echo -n 'out '
|
||||
sleep 1
|
||||
}
|
||||
|
||||
echo 'BREATH IN'
|
||||
sleep 2
|
||||
echo 'BREATH OUT'
|
||||
sleep 2
|
||||
|
||||
echo '--- HOLDING ---'
|
||||
echo 'Press ENTER when you cannot hold anymore'
|
||||
|
||||
flag = /tmp/inbe.$pid
|
||||
touch $flag
|
||||
start_time = `{date -n}
|
||||
|
||||
{
|
||||
count = 1
|
||||
while(test -f $flag) {
|
||||
echo -n $count ' '
|
||||
sleep 1
|
||||
count = `{awk 'BEGIN{print '$count' + 1}'}
|
||||
}
|
||||
} &
|
||||
counter_pid = $apid
|
||||
|
||||
junk = `{read}
|
||||
rm -f $flag
|
||||
|
||||
end_time = `{date -n}
|
||||
hold_duration = `{awk 'BEGIN{print '$end_time' - '$start_time'}'}
|
||||
results = ($results $hold_duration)
|
||||
|
||||
echo 'Hold time:' $hold_duration 'seconds'
|
||||
|
||||
echo 'Recovery Hold: 15 seconds'
|
||||
for(s in `{seq 1 15}) {
|
||||
echo -n $s ' '
|
||||
sleep 1
|
||||
}
|
||||
echo 'Breath out.'
|
||||
sleep 3
|
||||
}
|
||||
|
||||
ts = `{date | awk '{gsub(/:/, "", $4); print $4}'}
|
||||
logfile = $daypath/inbe-^$ts
|
||||
|
||||
for(r in $results) {
|
||||
echo $r >> $logfile
|
||||
}
|
||||
|
||||
echo '=== ALL ROUNDS COMPLETE ==='
|
||||
echo 'Results saved to:' $logfile
|
||||
@@ -0,0 +1,53 @@
|
||||
package require Tk
|
||||
|
||||
wm title . "Inner Breeze"
|
||||
|
||||
canvas .c -width 300 -height 300
|
||||
pack .c -pady 20
|
||||
|
||||
set rmax 100
|
||||
set rmin 50
|
||||
|
||||
set my_circle [.c create oval 100 100 200 200 -outline black -fill lightblue -width 3]
|
||||
|
||||
proc animate_circle {} {
|
||||
global my_circle
|
||||
global rmax
|
||||
global rmin
|
||||
|
||||
set center_x 150
|
||||
set center_y 150
|
||||
set r 50
|
||||
|
||||
|
||||
for {set $r $rmin} {$r <= $rmax} {incr r 2} {
|
||||
set x0 [expr {$center_x - $r}]
|
||||
set y0 [expr {$center_y - $r}]
|
||||
set x1 [expr {$center_y + $r}]
|
||||
set y1 [expr {$center_y + $r}]
|
||||
|
||||
.c coords $my_circle $x0 $y0 $x1 $y1
|
||||
|
||||
update
|
||||
|
||||
after 20
|
||||
}
|
||||
|
||||
for {set r 100} {$r >= $rmin} {incr r -2} {
|
||||
set x0 [expr {$center_x - $r}]
|
||||
set y0 [expr {$center_y - $r}]
|
||||
set x1 [expr {$center_y + $r}]
|
||||
set y1 [expr {$center_y + $r}]
|
||||
|
||||
.c coords $my_circle $x0 $y0 $x1 $y1
|
||||
|
||||
update
|
||||
|
||||
after 20
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
animate_circle
|
||||
+145
@@ -0,0 +1,145 @@
|
||||
package require Tk
|
||||
package require yaml
|
||||
|
||||
# Function to read YAML config
|
||||
proc read_config {filename} {
|
||||
set fh [open $filename r]
|
||||
set data [read $fh]
|
||||
close $fh
|
||||
set config [::yaml::yaml2dict $data]
|
||||
|
||||
# Set default life_expectancy if missing
|
||||
if {![dict exists $config life_expectancy]} {
|
||||
dict set config life_expectancy 80
|
||||
}
|
||||
return $config
|
||||
}
|
||||
|
||||
# Function to get list of YAML files in data folder
|
||||
proc get_yaml_files {} {
|
||||
set files [glob -nocomplain -directory "data" *.yaml *.yml]
|
||||
set basenames {}
|
||||
foreach file $files {
|
||||
lappend basenames [file tail $file]
|
||||
}
|
||||
return $basenames
|
||||
}
|
||||
|
||||
# Function to update the timeline
|
||||
proc update_timeline {config years} {
|
||||
set name [dict get $config name]
|
||||
set dob [dict get $config date_of_birth]
|
||||
set dob_seconds [clock scan "${dob}-01" -format "%Y-%m-%d"]
|
||||
set life_periods [dict get $config life_periods]
|
||||
set period_count [llength $life_periods]
|
||||
|
||||
wm title . "My Life - $name"
|
||||
|
||||
# Clear existing grid
|
||||
foreach widget [winfo children .frame] {
|
||||
destroy $widget
|
||||
}
|
||||
|
||||
# Calculate rows based on years parameter
|
||||
set rows [expr {($years + 3) / 4}]
|
||||
|
||||
# Create a grid of specified years, 12 months per year, 4 years per row
|
||||
for {set i 0} {$i < $rows} {incr i} {
|
||||
for {set j 0} {$j < 48} {incr j} {
|
||||
set current_date [clock add $dob_seconds [expr {$i * 48 + $j}] months]
|
||||
set year [clock format $current_date -format "%Y"]
|
||||
set month [clock format $current_date -format "%m"]
|
||||
set color "white"
|
||||
|
||||
# Check which life period this month belongs to
|
||||
for {set period_index 0} {$period_index < $period_count} {incr period_index} {
|
||||
set period [lindex $life_periods $period_index]
|
||||
set start [clock scan "[dict get $period start]-01" -format "%Y-%m-%d"]
|
||||
set end [expr {$period_index == ($period_count - 1) ?
|
||||
[clock seconds] :
|
||||
[clock scan "[dict get [lindex $life_periods [expr {$period_index + 1}]] start]-01" -format "%Y-%m-%d"]}]
|
||||
if {$current_date >= $start && $current_date < $end} {
|
||||
set color [dict get $period color]
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
label .frame.cell$i-$j -width 1 -height 1 -bg $color -relief solid
|
||||
grid .frame.cell$i-$j -row $i -column $j -padx 0 -pady 0
|
||||
}
|
||||
}
|
||||
|
||||
# Create a legend
|
||||
set row $rows
|
||||
foreach period $life_periods {
|
||||
set name [dict get $period name]
|
||||
set color [dict get $period color]
|
||||
set start [dict get $period start]
|
||||
|
||||
label .frame.legend$row -text "$name (from $start)" -bg $color -fg white -relief solid
|
||||
grid .frame.legend$row -row $row -column 0 -columnspan 48 -sticky "ew"
|
||||
incr row
|
||||
}
|
||||
}
|
||||
|
||||
# Main window
|
||||
frame .frame
|
||||
pack .frame -fill both -expand 1
|
||||
|
||||
# Parse command line arguments
|
||||
set yaml_file ""
|
||||
set config {}
|
||||
set years 80
|
||||
|
||||
foreach arg $argv {
|
||||
if {[string match *.yaml $arg] || [string match *.yml $arg]} {
|
||||
set yaml_file $arg
|
||||
} else {
|
||||
set yaml_file "$arg.yaml"
|
||||
}
|
||||
}
|
||||
|
||||
if {$yaml_file ne ""} {
|
||||
if {[file exists "data/$yaml_file"]} {
|
||||
set config [read_config "data/$yaml_file"]
|
||||
set years [dict get $config life_expectancy]
|
||||
update_timeline $config $years
|
||||
} else {
|
||||
puts "Error: File 'data/$yaml_file' not found."
|
||||
exit 1
|
||||
}
|
||||
} else {
|
||||
# Create selector for YAML files
|
||||
set yaml_files [get_yaml_files]
|
||||
ttk::combobox .selector -values $yaml_files -state readonly
|
||||
pack .selector -pady 10
|
||||
bind .selector <<ComboboxSelected>> {
|
||||
set selected_file [.selector get]
|
||||
set config [read_config "data/$selected_file"]
|
||||
set years [dict get $config life_expectancy]
|
||||
update_timeline $config $years
|
||||
}
|
||||
}
|
||||
|
||||
# Life expectancy entry
|
||||
frame .life_exp_frame
|
||||
pack .life_exp_frame -pady 10
|
||||
|
||||
label .life_exp_frame.label -text "Life Expectancy (years):"
|
||||
entry .life_exp_frame.entry -width 5 -textvariable years
|
||||
button .life_exp_frame.update_button -text "Update" -command {
|
||||
if {$yaml_file ne "" && [file exists "data/$yaml_file"]} {
|
||||
update_timeline $config $years
|
||||
} elseif {![string equal [.selector get] ""]} {
|
||||
set selected_file [.selector get]
|
||||
set config [read_config "data/$selected_file"]
|
||||
update_timeline $config $years
|
||||
}
|
||||
}
|
||||
|
||||
pack .life_exp_frame.label -side left
|
||||
pack .life_exp_frame.entry -side left -padx 5
|
||||
pack .life_exp_frame.update_button -side left
|
||||
|
||||
# Start the event loop
|
||||
tkwait window .
|
||||
@@ -0,0 +1,14 @@
|
||||
{ pkgs ? import <nixpkgs> {} }:
|
||||
|
||||
pkgs.mkShell {
|
||||
buildInputs = with pkgs; [
|
||||
tcl
|
||||
tclPackages.tclx
|
||||
tclPackages.tk
|
||||
tclPackages.tcllib
|
||||
];
|
||||
|
||||
shellHook = ''
|
||||
echo "Tcl/tk environment loaded"
|
||||
'';
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<meta property='og:type' content='website'/>
|
||||
<meta property='og:site_name' content='Lotus'/>
|
||||
<meta property='og:description' content="Inbe - Guided Wim Hof Breathing"/>
|
||||
<meta property="og:title" content="Inbe - Guided Breathing"/>
|
||||
<meta property="og:url" content="https://waozi.xyz/inbe.html">
|
||||
<meta name="viewport" content="width=device-width" />
|
||||
|
||||
<!-- Twitter -->
|
||||
<meta property="twitter:card" content="summary_large_image">
|
||||
<meta property="twitter:url" content="https://waozi.xyz/inbe.html">
|
||||
<meta property="twitter:title" content="Inbe - Guided Breathing">
|
||||
<meta property="twitter:description" content="Inbe - Guided Wim Hof Breathing">
|
||||
<title>Inner Breeze - Guided Breathing</title>
|
||||
<link href="/style.css" rel="stylesheet" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="content">
|
||||
<h1>Inner Breeze</h1>
|
||||
<p>Guided Wim Hof Breathing</p>
|
||||
|
||||
<div id="emulator">
|
||||
<canvas id="display" width="100" height="100"></canvas>
|
||||
<div id='console'>
|
||||
<pre id='console_std'></pre>
|
||||
<pre id='console_err'></pre>
|
||||
</div>
|
||||
<center id='metadata'>
|
||||
|
||||
<ul>
|
||||
<li><button onclick="emulator.screen.toggle_zoom()">Zoom</button></li>
|
||||
<li><a href="inbe.rom" download>Download inbe.rom</a></li>
|
||||
<li><span id='metarom'>Loading inbe.rom...</span></li>
|
||||
</ul>
|
||||
</center>
|
||||
</div>
|
||||
<a href='/lotus'>back to lotus</a>
|
||||
<script src="/uxn/uxn.js"></script>
|
||||
<script src="/uxn/uxn-wasm.js"></script>
|
||||
<script src="/uxn/emu.js"></script>
|
||||
<script src="/uxn/devices/system.js"></script>
|
||||
<script src="/uxn/devices/console.js"></script>
|
||||
<script src="/uxn/devices/controller.js"></script>
|
||||
<script src="/uxn/devices/datetime.js"></script>
|
||||
<script src="/uxn/devices/mouse.js"></script>
|
||||
<script src="/uxn/devices/screen.js"></script>
|
||||
<script src="/uxn/boot.js"></script>
|
||||
<script>
|
||||
const emulator = new Emu(false)
|
||||
emulator.init()
|
||||
|
||||
fetch('inbe.rom')
|
||||
.then(response => {
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
||||
}
|
||||
return response.arrayBuffer();
|
||||
})
|
||||
.then(arrayBuffer => {
|
||||
const rom = new Uint8Array(arrayBuffer);
|
||||
emulator.load(rom);
|
||||
document.getElementById('metarom').textContent = `Running inbe.rom (${rom.length} bytes)`;
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Failed to load inbe.rom:', error);
|
||||
document.getElementById('console_err').textContent = `Failed to load inbe.rom: ${error.message}`;
|
||||
document.getElementById('metarom').textContent = 'Failed to load ROM';
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Binary file not shown.
+714
@@ -0,0 +1,714 @@
|
||||
( devices )
|
||||
|00 @System/vector $2 &expansion $2 &wst $1 &rst $1 &metadata $2 &r $2 &g $2 &b $2 &debug $1 &state $1
|
||||
|10 @Console/vector $2 &read $5 &type $1 &write $1 &error $1
|
||||
|20 @Screen/vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1
|
||||
|80 @Controller/vector $2 &button $1 &key $1
|
||||
|90 @Mouse/vector $2 &x $2 &y $2 &state $1 &pad $3 &sx $2 &sy $1 &sy-lb $1
|
||||
|a0 @File/vector $2 &success $1 &success-lb $1 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2
|
||||
|
||||
( variables )
|
||||
|0000
|
||||
@circle-cx $2
|
||||
@circle-cy $2
|
||||
@circle-r $2
|
||||
@circle-rsq $2
|
||||
@r-direction $1
|
||||
@timer $1
|
||||
@anim-delay $1
|
||||
@anim-delay-inhale $1
|
||||
@current-val $1
|
||||
@max-breath $1
|
||||
@state $1
|
||||
@view $1
|
||||
|
||||
( constants )
|
||||
%CIRCLE-R-MIN { #0020 }
|
||||
%CIRCLE-R-MAX { #0035 }
|
||||
|
||||
( --- Tabbar Layout --- )
|
||||
%TABBAR-HEIGHT { #0010 }
|
||||
%TABBAR-Y { #0000 }
|
||||
|
||||
( --- Sidebar Anchor Layout --- )
|
||||
%SIDEBAR-X { #0008 }
|
||||
%SIDEBAR-Y { #0000 }
|
||||
%BTN-SIZE { #0008 }
|
||||
|
||||
( --- Bitmasks --- )
|
||||
%MSK-PLAYING { #01 }
|
||||
%MSK-OPEN { #02 }
|
||||
%MSK-PRESSED { #04 }
|
||||
|
||||
%SCR-TITLE { #01 }
|
||||
%SCR-BREATH { #02 }
|
||||
%SCR-HOLD { #03 }
|
||||
%SCR-INHALE { #04 }
|
||||
%SCR-RESULT { #05 }
|
||||
|
||||
( main program )
|
||||
|0100
|
||||
;meta #06 DEO2
|
||||
|
||||
|
||||
#f0e9 .System/r DEO2
|
||||
#f0f9 .System/g DEO2
|
||||
#e0f5 .System/b DEO2
|
||||
load-theme
|
||||
|
||||
#012e .Screen/width DEO2
|
||||
#00f0 .Screen/height DEO2
|
||||
|
||||
|
||||
CIRCLE-R-MIN .circle-r STZ2
|
||||
#03 .anim-delay STZ
|
||||
#04 .anim-delay-inhale STZ
|
||||
#00 .current-val STZ
|
||||
#1e .max-breath STZ
|
||||
|
||||
MSK-OPEN .state STZ
|
||||
SCR-BREATH .view STZ
|
||||
|
||||
;on-frame .Screen/vector DEO2
|
||||
|
||||
|
||||
@on-frame
|
||||
#00 .Screen/auto DEO
|
||||
;handle-mouse JSR2
|
||||
;clear-screen JSR2
|
||||
;draw-ui JSR2
|
||||
|
||||
|
||||
.Screen/width DEI2 #01 SFT2 #0020 SUB2 .Screen/x DEO2
|
||||
#0000 .Screen/y DEO2
|
||||
|
||||
SCR-BREATH .view LDZ NEQ ,&skip-breath-text JCN
|
||||
;txt-breath ;draw-zstr JSR2
|
||||
|
||||
&skip-breath-text
|
||||
|
||||
SCR-HOLD .view LDZ NEQ ,&skip-hold-text JCN
|
||||
;txt-hold ;draw-zstr JSR2
|
||||
;txt-it ;draw-zstr JSR2
|
||||
|
||||
&skip-hold-text
|
||||
|
||||
SCR-INHALE .view LDZ NEQ ,&skip-inhale-text JCN
|
||||
;txt-breath ;draw-zstr JSR2
|
||||
;txt-in ;draw-zstr JSR2
|
||||
|
||||
&skip-inhale-text
|
||||
|
||||
|
||||
( Only process timing if MSK-PLAYING is set )
|
||||
.state LDZ MSK-PLAYING AND #00 EQU ,draw JCN
|
||||
|
||||
.timer LDZ INC .timer STZ
|
||||
|
||||
( Check if we are in HOLD view )
|
||||
.view LDZ SCR-BREATH NEQ ,&no-breath JCN
|
||||
;breath-logic JSR2
|
||||
&no-breath
|
||||
.view LDZ SCR-HOLD NEQ ,&no-hold JCN
|
||||
;hold-logic JSR2
|
||||
&no-hold
|
||||
.view LDZ SCR-INHALE NEQ ,&no-inhale JCN
|
||||
;inhale-logic JSR2
|
||||
&no-inhale
|
||||
|
||||
@draw
|
||||
.Screen/width DEI2 #01 SFT2 .Screen/height DEI2 #01 SFT2 .circle-r LDZ2
|
||||
;draw-circle JSR2
|
||||
;draw-center-stats JSR2
|
||||
|
||||
.Mouse/x DEI2 .Screen/x DEO2 .Mouse/y DEI2 .Screen/y DEO2
|
||||
;sprite-cursor .Screen/addr DEO2 #01 .Screen/sprite DEO
|
||||
BRK
|
||||
|
||||
|
||||
@load-theme ( -- )
|
||||
;&path .File/name DEO2
|
||||
#0002 .File/length DEO2
|
||||
;&r .File/read DEO2
|
||||
;&g .File/read DEO2
|
||||
;&b .File/read DEO2
|
||||
.File/success DEI2 ORA #01 [ JCN JMP2r ]
|
||||
LIT2 &r $2 .System/r DEO2
|
||||
LIT2 &g $2 .System/g DEO2
|
||||
LIT2 &b $2 .System/b DEO2
|
||||
|
||||
JMP2r
|
||||
&path ".theme $1
|
||||
|
||||
@breath-logic
|
||||
( --- Normal Breathing Logic --- )
|
||||
.timer LDZ .anim-delay LDZ LTH ,&return JCN
|
||||
#00 .timer STZ
|
||||
|
||||
.r-direction LDZ #01 EQU ,&shrink JCN
|
||||
|
||||
&grow
|
||||
.circle-r LDZ2 INC2 .circle-r STZ2
|
||||
.circle-r LDZ2 CIRCLE-R-MAX LTH2 ,&return JCN
|
||||
#01 .r-direction STZ
|
||||
,&return JMP
|
||||
|
||||
&shrink
|
||||
.circle-r LDZ2 #0001 SUB2 .circle-r STZ2
|
||||
.circle-r LDZ2 CIRCLE-R-MIN GTH2 ,&return JCN
|
||||
#00 .r-direction STZ
|
||||
|
||||
( Breath Counter Logic )
|
||||
.current-val LDZ INC .current-val STZ
|
||||
.current-val LDZ .max-breath LDZ LTH ,&return JCN
|
||||
|
||||
SCR-HOLD .view STZ
|
||||
#00 .current-val STZ
|
||||
|
||||
&return
|
||||
JMP2r
|
||||
|
||||
( --- Hold Logic: Increment every 60 frames --- )
|
||||
@hold-logic
|
||||
( Increment once per second )
|
||||
.timer LDZ #3c LTH ,&draw JCN
|
||||
#00 .timer STZ
|
||||
.current-val LDZ INC .current-val STZ
|
||||
|
||||
&draw
|
||||
( Set UI positions )
|
||||
.circle-cx LDZ2 #0014 SUB2 .Screen/x DEO2
|
||||
.circle-cy LDZ2 #0035 ADD2 .Screen/y DEO2
|
||||
;fill-icn .Screen/addr DEO2
|
||||
|
||||
&loop-bg
|
||||
#03 .Screen/sprite DEO
|
||||
.Screen/x DEI2 INC2 DUP2 .Screen/x DEO2
|
||||
.circle-cx LDZ2 #0015 ADD2 LTH2 ,&loop-bg JCN
|
||||
|
||||
( Draw Label )
|
||||
.circle-cx LDZ2 #0014 SUB2 .Screen/x DEO2
|
||||
.circle-cy LDZ2 #0035 ADD2 .Screen/y DEO2
|
||||
;txt-breath ;draw-zstr JSR2
|
||||
|
||||
JMP2r
|
||||
|
||||
@inhale-logic
|
||||
( State Machine: 0=Inhale, 1=Hold, 2=Exhale )
|
||||
.r-direction LDZ #01 EQU ,&hold JCN
|
||||
.r-direction LDZ #02 EQU ,&exhale JCN
|
||||
|
||||
&inhale
|
||||
.timer LDZ .anim-delay-inhale LDZ LTH ,&check JCN
|
||||
#00 .timer STZ
|
||||
.circle-r LDZ2 INC2 .circle-r STZ2
|
||||
.circle-r LDZ2 CIRCLE-R-MAX LTH2 ,&return JCN
|
||||
( Hit Max: Switch to Hold State )
|
||||
#01 .r-direction STZ
|
||||
#00 .current-val STZ ( Reset frame counter )
|
||||
#00 .timer STZ ( Reset seconds counter )
|
||||
,&return JMP
|
||||
|
||||
&exhale
|
||||
.timer LDZ .anim-delay-inhale LDZ LTH ,&check JCN
|
||||
#00 .timer STZ
|
||||
.circle-r LDZ2 #0001 SUB2 .circle-r STZ2
|
||||
.circle-r LDZ2 CIRCLE-R-MIN GTH2 ,&return JCN
|
||||
( Hit Min: Reset and go back to Breath screen )
|
||||
#00 .r-direction STZ
|
||||
#00 .current-val STZ
|
||||
SCR-BREATH .view STZ
|
||||
,&return JMP
|
||||
|
||||
&check
|
||||
( If not in hold state, just return )
|
||||
.r-direction LDZ #01 NEQ ,&return JCN
|
||||
|
||||
&hold
|
||||
( We use .current-val to count 60 frames )
|
||||
.timer LDZ #3c LTH ,&return JCN
|
||||
#00 .timer STZ
|
||||
.current-val LDZ INC .current-val STZ
|
||||
|
||||
( Check if we reached 15 seconds )
|
||||
.current-val LDZ #0f LTH ,&return JCN
|
||||
|
||||
( 15 Seconds Done: Switch to Exhale State )
|
||||
#02 .r-direction STZ
|
||||
#00 .timer STZ
|
||||
|
||||
&return
|
||||
JMP2r
|
||||
|
||||
|
||||
@handle-back-button ( -- )
|
||||
.Mouse/y DEI2 #0010 LTH2
|
||||
.Mouse/x DEI2 #0100 GTH2 AND ,click-back JCN
|
||||
JMP2r
|
||||
@click-back
|
||||
;potato-rom-path ;load-rom JSR2
|
||||
|
||||
@handle-hold-button ( -- )
|
||||
.view LDZ SCR-HOLD NEQ ,&skip JCN
|
||||
|
||||
( Check Y: circle-cy + 0x35 <= Mouse/y < circle-cy + 0x3d )
|
||||
.circle-cy LDZ2 #0035 ADD2
|
||||
DUP2 .Mouse/y DEI2 SWP2 LTH2 ,&skip JCN
|
||||
#0008 ADD2
|
||||
.Mouse/y DEI2 SWP2 GTH2 ,&skip JCN
|
||||
|
||||
( Check X: circle-cx - 0x14 <= Mouse/x < circle-cx + 0x1d )
|
||||
.circle-cx LDZ2 #0014 SUB2
|
||||
DUP2 .Mouse/x DEI2 SWP2 LTH2 ,&skip JCN
|
||||
#0031 ADD2
|
||||
.Mouse/x DEI2 SWP2 GTH2 ,&skip JCN
|
||||
|
||||
;to-inhale JMP2
|
||||
|
||||
&skip JMP2r
|
||||
|
||||
@handle-mouse
|
||||
.Mouse/state DEI #00 EQU ;released JCN2
|
||||
.state LDZ MSK-PRESSED AND ;done JCN2
|
||||
.state LDZ MSK-PRESSED ORA .state STZ
|
||||
|
||||
;handle-back-button JSR2
|
||||
;handle-hold-button JSR2
|
||||
|
||||
( Sidebar Toggle Check )
|
||||
.Mouse/y DEI2 SIDEBAR-Y LTH2 ,check-controls JCN
|
||||
.Mouse/y DEI2 SIDEBAR-Y BTN-SIZE ADD2 GTH2 ,check-controls JCN
|
||||
.Mouse/x DEI2 SIDEBAR-X #0048 ADD2 LTH2 ,check-controls JCN
|
||||
.Mouse/x DEI2 SIDEBAR-X #0048 ADD2 BTN-SIZE ADD2 GTH2 ,check-controls JCN
|
||||
.state LDZ MSK-OPEN EOR .state STZ
|
||||
;done JMP2
|
||||
|
||||
@check-controls
|
||||
;handle-mouse-controls JSR2
|
||||
|
||||
@done JMP2r
|
||||
@released
|
||||
.state LDZ MSK-PRESSED #ff EOR AND .state STZ
|
||||
JMP2r
|
||||
|
||||
@handle-mouse-controls
|
||||
.state LDZ MSK-OPEN AND #00 EQU ,skip-controls JCN
|
||||
;handle-speed-logic JSR2
|
||||
;handle-breath-logic JSR2
|
||||
;handle-play-logic JSR2
|
||||
@skip-controls JMP2r
|
||||
|
||||
|
||||
@to-breath
|
||||
SCR-BREATH .view STZ
|
||||
#00 .current-val STZ
|
||||
CIRCLE-R-MIN .circle-r STZ2
|
||||
JMP2r
|
||||
|
||||
@to-hold
|
||||
SCR-HOLD .view STZ
|
||||
#00 .current-val STZ
|
||||
CIRCLE-R-MIN .circle-r STZ2
|
||||
JMP2r
|
||||
|
||||
@to-inhale
|
||||
.r-direction STZ #01
|
||||
SCR-INHALE .view STZ
|
||||
#00 .current-val STZ
|
||||
CIRCLE-R-MIN .circle-r STZ2
|
||||
JMP2r
|
||||
|
||||
@handle-play-logic
|
||||
#0094 row-hit? #00 EQU ;skip-play JCN2
|
||||
|
||||
( Seek Back - Offset #0000 )
|
||||
#0000 btn-hit? #00 EQU ,&check-play JCN
|
||||
|
||||
( If view == BREATH, just reset current-val )
|
||||
.view LDZ SCR-BREATH EQU ;to-breath JCN2
|
||||
|
||||
( If view == HOLD, go to BREATH )
|
||||
.view LDZ SCR-HOLD EQU ;to-breath JCN2
|
||||
|
||||
( If view == INHALE, go to HOLD )
|
||||
.view LDZ SCR-INHALE EQU ;to-hold JCN2
|
||||
|
||||
;skip-play JCN2 ( Safety skip )
|
||||
|
||||
|
||||
&check-play ( Play/Pause - Offset #0010 )
|
||||
#0010 btn-hit? #00 EQU ,&check-seek-forward JCN
|
||||
.state LDZ MSK-PLAYING EOR .state STZ
|
||||
;skip-play JCN2
|
||||
|
||||
&check-seek-forward ( Seek Forward - Offset #0020 )
|
||||
#0020 btn-hit? #00 EQU ;skip-play JCN2
|
||||
|
||||
( If view == BREATH, go to hold state )
|
||||
.view LDZ SCR-BREATH EQU ;to-hold JCN2
|
||||
|
||||
( If view == HOLD, go to inhale state )
|
||||
.view LDZ SCR-HOLD EQU ;to-inhale JCN2
|
||||
|
||||
( If view == INHALE, go to HOLD )
|
||||
.view LDZ SCR-INHALE EQU ;to-breath JCN2
|
||||
|
||||
|
||||
;skip-play JCN2
|
||||
|
||||
@skip-play JMP2r
|
||||
|
||||
@handle-speed-logic
|
||||
#0024 row-hit? #00 EQU ,skip-speed JCN
|
||||
|
||||
#0000 btn-hit? #00 NEQ ,dec-speed JCN
|
||||
#0020 btn-hit? #00 EQU ,skip-speed JCN
|
||||
|
||||
.anim-delay LDZ #1e EQU ,skip-speed JCN
|
||||
.anim-delay LDZ INC .anim-delay STZ
|
||||
,skip-speed JMP
|
||||
|
||||
@dec-speed
|
||||
.anim-delay LDZ #01 EQU ,skip-speed JCN
|
||||
.anim-delay LDZ #01 SUB .anim-delay STZ ( DEC -> #01 SUB )
|
||||
|
||||
@skip-speed JMP2r
|
||||
|
||||
@handle-breath-logic
|
||||
#004c row-hit? #00 EQU ,skip-breath JCN
|
||||
|
||||
#0000 btn-hit? #00 NEQ ,dec-breath JCN
|
||||
#0020 btn-hit? #00 EQU ,skip-breath JCN
|
||||
|
||||
.max-breath LDZ #2b EQU ,skip-breath JCN
|
||||
.max-breath LDZ INC .max-breath STZ
|
||||
,skip-breath JMP
|
||||
|
||||
@dec-breath
|
||||
.max-breath LDZ #01 EQU ,skip-breath JCN
|
||||
.max-breath LDZ #01 SUB .max-breath STZ ( DEC -> #01 SUB )
|
||||
|
||||
@skip-breath JMP2r
|
||||
|
||||
@draw-ui
|
||||
;draw-tabbar JSR2
|
||||
;draw-ui-controls JSR2
|
||||
JMP2r
|
||||
|
||||
@draw-ui-controls
|
||||
( Header Content )
|
||||
SIDEBAR-X .Screen/x DEO2 SIDEBAR-Y .Screen/y DEO2
|
||||
;txt-controls ;draw-zstr JSR2
|
||||
SIDEBAR-X #0048 ADD2 .Screen/x DEO2 SIDEBAR-Y .Screen/y DEO2
|
||||
.state LDZ MSK-OPEN AND ,show-up JCN
|
||||
;sprite-down .Screen/addr DEO2 ,render-toggle JMP
|
||||
@show-up ;sprite-up .Screen/addr DEO2
|
||||
@render-toggle #01 .Screen/sprite DEO
|
||||
|
||||
( Draw content if open )
|
||||
|
||||
.state LDZ MSK-OPEN AND #00 EQU ;skip-children JCN2
|
||||
( Speed Section )
|
||||
SIDEBAR-X .Screen/x DEO2 SIDEBAR-Y #0018 ADD2 .Screen/y DEO2
|
||||
;txt-speed ;draw-zstr JSR2
|
||||
.anim-delay LDZ SIDEBAR-Y #0024 ADD2 ;draw-counter JSR2
|
||||
|
||||
( Breaths Section )
|
||||
SIDEBAR-X .Screen/x DEO2 SIDEBAR-Y #003c ADD2 .Screen/y DEO2
|
||||
;txt-breaths ;draw-zstr JSR2
|
||||
.max-breath LDZ SIDEBAR-Y #004c ADD2 ;draw-counter JSR2
|
||||
|
||||
( Player Control Section )
|
||||
SIDEBAR-X .Screen/x DEO2 SIDEBAR-Y #0084 ADD2 .Screen/y DEO2
|
||||
;txt-play ;draw-zstr JSR2
|
||||
SIDEBAR-Y #0094 ADD2 .Screen/y DEO2
|
||||
|
||||
|
||||
SIDEBAR-X .Screen/x DEO2
|
||||
;sprite-seek .Screen/addr DEO2
|
||||
#11 .Screen/sprite DEO
|
||||
|
||||
SIDEBAR-X #0010 ADD2 .Screen/x DEO2
|
||||
.state LDZ MSK-PLAYING AND ,show-pause JCN
|
||||
;sprite-play .Screen/addr DEO2 ,render-player JMP
|
||||
@show-pause ;sprite-pause .Screen/addr DEO2
|
||||
@render-player
|
||||
#01 .Screen/sprite DEO
|
||||
|
||||
SIDEBAR-X #0020 ADD2 .Screen/x DEO2
|
||||
;sprite-seek .Screen/addr DEO2
|
||||
#01 .Screen/sprite DEO
|
||||
@skip-children
|
||||
JMP2r
|
||||
|
||||
( --- Tabbar Drawing --- )
|
||||
|
||||
@draw-tabbar-bg ( -- )
|
||||
;fill-icn .Screen/addr DEO2
|
||||
#0000 .Screen/y DEO2
|
||||
#0000 .Screen/x DEO2
|
||||
@tbx #03 .Screen/sprite DEO
|
||||
.Screen/x DEI2 INC2 DUP2 .Screen/x DEO2
|
||||
.Screen/width DEI2 LTH2 ,tbx JCN
|
||||
JMP2r
|
||||
|
||||
@draw-tabbar-text ( -- )
|
||||
#0000 .Screen/y DEO2
|
||||
#0100 .Screen/x DEO2
|
||||
;tab-back ;draw-zstr JSR2
|
||||
JMP2r
|
||||
|
||||
@draw-tabbar ( -- )
|
||||
;draw-tabbar-bg JSR2
|
||||
;draw-tabbar-text JSR2
|
||||
JMP2r
|
||||
|
||||
@draw-counter ( val y* -- )
|
||||
.Screen/y DEO2 ( Set Y coordinate )
|
||||
SIDEBAR-X .Screen/x DEO2 ( Start at sidebar X )
|
||||
|
||||
( Minus Sprite )
|
||||
;sprite-minus .Screen/addr DEO2 #01 .Screen/sprite DEO
|
||||
|
||||
( Number )
|
||||
SIDEBAR-X #000c ADD2 .Screen/x DEO2
|
||||
;draw-num JSR2 ( val is already on stack )
|
||||
|
||||
( Plus Sprite )
|
||||
SIDEBAR-X #0020 ADD2 .Screen/x DEO2
|
||||
;sprite-plus .Screen/addr DEO2 #01 .Screen/sprite DEO
|
||||
JMP2r
|
||||
|
||||
|
||||
@draw-num ( val -- )
|
||||
DUP #0a DIV ( Get Tens )
|
||||
DUP #30 ADD ;draw-char JSR2 ( Print Tens )
|
||||
#0a MUL SUB ( Original - Tens*10 = Ones )
|
||||
#30 ADD ;draw-char JSR2 ( Print Ones )
|
||||
JMP2r
|
||||
|
||||
@draw-char ( char -- )
|
||||
#20 SUB ( Align: Space is now index 0 )
|
||||
#00 SWP ( Byte to Short )
|
||||
#30 SFT2 ( Multiply by 8 )
|
||||
;font ADD2 .Screen/addr DEO2
|
||||
#41 .Screen/sprite DEO
|
||||
.Screen/x DEI2 #0008 ADD2 .Screen/x DEO2
|
||||
JMP2r
|
||||
|
||||
@draw-center-stats
|
||||
.Screen/width DEI2 #01 SFT2 #0008 SUB2 .Screen/x DEO2
|
||||
.Screen/height DEI2 #01 SFT2 #0004 SUB2 .Screen/y DEO2
|
||||
.current-val LDZ
|
||||
|
||||
DUP #0a DIV ( Get Tens )
|
||||
SWP #0a DIVk MUL SUB ( Get Ones )
|
||||
|
||||
SWP #30 ADD ;draw-center-char JSR2
|
||||
#30 ADD ;draw-center-char JSR2
|
||||
JMP2r
|
||||
|
||||
@draw-center-char ( char -- )
|
||||
#20 SUB ( Align: Must match draw-char! )
|
||||
#00 SWP ( Byte to Short )
|
||||
#30 SFT2 ( Multiply by 8 )
|
||||
;font ADD2 .Screen/addr DEO2
|
||||
#41 .Screen/sprite DEO ( Color mode for center stats )
|
||||
.Screen/x DEI2 #0008 ADD2 .Screen/x DEO2
|
||||
JMP2r
|
||||
|
||||
@clear-screen
|
||||
#00 .Screen/auto DEO #0000 .Screen/y DEO2
|
||||
@y #0000 .Screen/x DEO2
|
||||
@x #40 .Screen/pixel DEO #00 .Screen/pixel DEO
|
||||
.Screen/x DEI2 INC2 DUP2 .Screen/x DEO2
|
||||
.Screen/width DEI2 LTH2 ,x JCN
|
||||
POP2 .Screen/y DEI2 INC2 DUP2 .Screen/y DEO2
|
||||
.Screen/height DEI2 LTH2 ,y JCN
|
||||
JMP2r
|
||||
|
||||
@draw-circle ( x* y* r* -- )
|
||||
.circle-r STZ2 .circle-cy STZ2 .circle-cx STZ2
|
||||
.circle-r LDZ2 DUP2 MUL2 .circle-rsq STZ2
|
||||
.circle-cy LDZ2 .circle-r LDZ2 SUB2
|
||||
@y-loop STH2 .circle-cx LDZ2 .circle-r LDZ2 SUB2
|
||||
@x-loop DUP2 .circle-cx LDZ2 SUB2 DUP2 MUL2
|
||||
STH2r DUP2 STH2 .circle-cy LDZ2 SUB2 DUP2 MUL2 ADD2
|
||||
.circle-rsq LDZ2 GTH2 ,skip-pixel JCN
|
||||
DUP2 .Screen/x DEO2 STH2r DUP2 STH2 .Screen/y DEO2 #03 .Screen/pixel DEO
|
||||
@skip-pixel #0001 ADD2
|
||||
DUP2 .circle-cx LDZ2 .circle-r LDZ2 ADD2 LTH2 ,x-loop JCN
|
||||
POP2 STH2r #0001 ADD2
|
||||
DUP2 .circle-cy LDZ2 .circle-r LDZ2 ADD2 LTH2 ,y-loop JCN
|
||||
POP2 JMP2r
|
||||
|
||||
@draw-zstr ( addr* -- )
|
||||
&loop
|
||||
LDAk DUP #00 EQU ,&end JCN ( If char is 0, we are done )
|
||||
;draw-char JSR2 ( Draw the character )
|
||||
INC2 ,&loop JMP ( Move to next character )
|
||||
&end
|
||||
POP2 ( Remove the string address from stack )
|
||||
JMP2r
|
||||
|
||||
|
||||
( Check if mouse Y is within a row: y-offset -- flag )
|
||||
@row-hit?
|
||||
SIDEBAR-Y ADD2
|
||||
DUP2 .Mouse/y DEI2 SWP2 LTH2 ,&no JCN
|
||||
BTN-SIZE ADD2
|
||||
.Mouse/y DEI2 SWP2 GTH2 ,&no JCN
|
||||
#01 JMP2r
|
||||
&no #00 JMP2r
|
||||
|
||||
( Check if mouse X is within a button: x-offset -- flag )
|
||||
@btn-hit?
|
||||
SIDEBAR-X ADD2
|
||||
DUP2 .Mouse/x DEI2 SWP2 LTH2 ,&no JCN
|
||||
BTN-SIZE ADD2
|
||||
.Mouse/x DEI2 SWP2 GTH2 ,&no JCN
|
||||
#01 JMP2r
|
||||
&no #00 JMP2r
|
||||
|
||||
|
||||
|
||||
@meta $1
|
||||
( name ) "Inner "Breeze 0a
|
||||
( details ) "A 20 "guided 20 "breathing 20 "meditation 0a
|
||||
( author ) "By 20 "Waozi 0a
|
||||
( date ) &date "18 20 "Feb 20 "2026 $1
|
||||
01
|
||||
( icon ) 83 =appicon
|
||||
|
||||
@load-rom ( filename* -- )
|
||||
.File/name DEO2
|
||||
( clear wst/rst )
|
||||
#0000 .System/wst DEO2
|
||||
( clear screen )
|
||||
#0000 DUP2 .Screen/x DEO2 .Screen/y DEO2
|
||||
[ LIT2 80 -Screen/pixel ] DEO
|
||||
[ LIT2 c0 -Screen/pixel ] DEO
|
||||
( reset device vectors )
|
||||
[ LIT2r 0000 ]
|
||||
#00
|
||||
&device-vector-loop
|
||||
DUP2r STHk DEO2r
|
||||
#10 ADD
|
||||
DUP ?&device-vector-loop
|
||||
POP POP2r
|
||||
( copy the zero-page-loader into f0-ff )
|
||||
;&zero-page-loader LITr f0
|
||||
©-loop
|
||||
LDAk STHkr STZ
|
||||
INC2 INCr
|
||||
STHkr ,©-loop JCN
|
||||
POP2 ( leave 00 on return stack )
|
||||
|
||||
( prepare the stack for the zero-page-loader )
|
||||
( the more we prepare here in advance, the less we'll have to overwrite )
|
||||
STHkr #00fe ( arguments for STZ2 at ff )
|
||||
STHkr ( argument for JMP at fe )
|
||||
DUPk #fcfe ( arguments for STZ2 at fd and JMP )
|
||||
OVR2 #fafe ( arguments for STZ2 at fd and JMP )
|
||||
OVR2 #f8fe ( arguments for STZ2 at fd and JMP )
|
||||
OVR2 #f6fe ( arguments for STZ2 at fd and JMP )
|
||||
OVR2 #f401 ( arguments for STZ2 at fd, plus an extra 01 )
|
||||
STHkr ( first argument for ADD2 )
|
||||
.File/success ( argument for DEI2 )
|
||||
#0100 .File/read ( arguments for DEO2 )
|
||||
#ff00 .File/length DEO2
|
||||
#00f0 JMP2
|
||||
|
||||
&zero-page-loader
|
||||
( f0 ) DEO2
|
||||
( f1 ) DEI2
|
||||
( f2 ) ADD2
|
||||
( f3 ) &loop DUPr
|
||||
( f4 ) STH2k
|
||||
( f5 ) STAr
|
||||
( f6 ) INC2
|
||||
( f7 ) NEQ2k
|
||||
( f8 ) ,&loop
|
||||
( f9 )
|
||||
( fa ) JCN
|
||||
( fb ) POPr
|
||||
( fc ) POP2
|
||||
( fd ) STZ2 ( deletes f4-fd through looping )
|
||||
( fe ) JMP
|
||||
( ff ) STZ2 ( deletes fe-ff )
|
||||
|
||||
&tmp $1
|
||||
|
||||
|
||||
( Graphics Data - Sprites )
|
||||
@sprite-play [ 0008 0c0e 0f0e 0c08 ]
|
||||
@sprite-pause [ 0066 6666 6666 6600 ]
|
||||
@sprite-plus [ 1818 187e 7e18 1818 ]
|
||||
@sprite-minus [ 0000 007e 7e00 0000 ]
|
||||
@sprite-cursor [ 80c0 e0f0 f8e0 1010 ]
|
||||
|
||||
@fill-icn [ ffff ffff ffff ffff ]
|
||||
|
||||
( Graphics Data - Fonts )
|
||||
@font
|
||||
[ 0000 0000 0000 0000 ] ( 0x20 Space )
|
||||
[ 0000 0000 0000 0000 0000 0000 0000 0000 ] ( 0x21-0x22 )
|
||||
[ 0000 0000 0000 0000 0000 0000 0000 0000 ] ( 0x23-0x24 )
|
||||
[ 0000 0000 0000 0000 0000 0000 0000 0000 ] ( 0x25-0x26 )
|
||||
[ 0000 0000 0000 0000 0000 0000 0000 0000 ] ( 0x27-0x28 )
|
||||
[ 0000 0000 0000 0000 0000 0000 0000 0000 ] ( 0x29-0x2a )
|
||||
[ 1818 187e 7e18 1818 ] ( 0x2b + )
|
||||
[ 0000 0000 0000 0000 ] ( 0x2c , )
|
||||
[ 0000 007e 7e00 0000 ] ( 0x2d - )
|
||||
[ 0000 0000 0000 0000 ] ( 0x2e . )
|
||||
[ 0000 0000 0000 0000 ] ( 0x2f / )
|
||||
[ 3c46 4e56 6642 3c00 1828 0808 0808 3e00 ( 0x30: 0 1 )
|
||||
3c42 023c 4040 7e00 3c42 021c 0242 3c00 ( 2 3 )
|
||||
0818 2848 7e08 0800 7e40 7c02 0242 3c00 ( 4 5 )
|
||||
3c40 7c42 4242 3c00 7e02 0408 1010 1000 ( 6 7 )
|
||||
3c42 423c 4242 3c00 3c42 423e 0202 3c00 ] ( 8 9 )
|
||||
[ 0000 0000 0000 0000 0000 0000 0000 0000 ( 0x3a-0x3b )
|
||||
0000 0000 0000 0000 0000 0000 0000 0000 ( 0x3c-0x3d )
|
||||
0000 0000 0000 0000 0000 0000 0000 0000 ( 0x3e-0x3f )
|
||||
0000 0000 0000 0000 ] ( 0x40 @ )
|
||||
[ 183c 6666 7e66 6600 7c66 667c 6666 7c00 ( 0x41: A B )
|
||||
3c66 6060 6066 3c00 786c 6666 666c 7800 ( C D )
|
||||
7e60 607c 6060 7e00 7e60 607c 6060 6000 ( E F )
|
||||
3c66 606e 6666 3c00 6666 667e 6666 6600 ( G H )
|
||||
3c18 1818 1818 3c00 1e0c 0c0c 0c6c 3800 ( I J )
|
||||
666c 7870 786c 6600 6060 6060 6060 7e00 ( K L )
|
||||
6377 7f6b 6363 6300 6676 7e7e 6e66 6600 ( M N )
|
||||
3c66 6666 6666 3c00 7c66 667c 6060 6000 ( O P )
|
||||
3c66 6666 663c 0e00 7c66 667c 786c 6600 ( Q R )
|
||||
3c66 603c 0666 3c00 7e18 1818 1818 1800 ( S T )
|
||||
6666 6666 6666 3c00 6666 6666 663c 1800 ( U V )
|
||||
6363 636b 7f77 6300 6666 3c18 3c66 6600 ( W X )
|
||||
6666 663c 1818 1800 7e06 0c18 3060 7e00 ] ( Y Z )
|
||||
|
||||
( strings )
|
||||
@txt-controls "CONTROLS $1
|
||||
@txt-speed "SPEED $1
|
||||
@txt-breaths "BREATHS $1
|
||||
@txt-rounds "ROUNDS $1
|
||||
@txt-play "PLAY $1
|
||||
@txt-breath "BREATH $1
|
||||
@txt-in "IN $1
|
||||
@txt-out "OUT $1
|
||||
@txt-it "IT $1
|
||||
@txt-hold "HOLD $1
|
||||
( Tab names )
|
||||
@tab-back "LOTUS $1
|
||||
|
||||
@potato-rom-path "bin/potato.rom $1
|
||||
@inbe-rom-path "bin/inbe.rom $1
|
||||
|
||||
@sprite-up [ 183c 7e7e 3c3c 1818 ]
|
||||
@sprite-down [ 1818 3c3c 7e7e 3c18 ]
|
||||
@sprite-seek [ b0b8 bcbe bcb8 b000 ]
|
||||
|
||||
|
||||
@appicon
|
||||
0000 0000 0000 0000 0000 0000 0000 0003 0007 1f3f 7f7e 7e7d 071f 3f7f ffff ffff
|
||||
0000 0000 1e7e fefe 8080 809f ffff ffff 0307 0f0f 0f0f 0f0f 0408 1010 1010 1010
|
||||
7bbf ffc7 e0e0 f0ff ff7f 3f3f 1710 0f0f fcfc f8e0 0000 0000 fefe fcf8 e000 0080
|
||||
0f0f 0707 0301 0000 1010 080f 0703 0100 ffff ffff ffff 7f00 1f1f 7fff ffff ff7f
|
||||
80c0 c0c0 c080 0000 c0e0 e0e0 e0c0 8000
|
||||
@@ -0,0 +1,73 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no">
|
||||
<meta name="generator" content="WASM-4 2.7.1">
|
||||
<script id="wasm4-disk-prefix" type="text/plain">Inner Breeze</script>
|
||||
<title>Inner Breeze</title>
|
||||
<style>html,body{height:100%;margin:0}@font-face{font-family:wasm4-font;src:url(data:font/woff2;base64,d09GMgABAAAAAAegAA0AAAAAKHwAAAdOAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGhYGYAA0CAQRCArGHLlRC4FCAAE2AiQDgUIEIAWDJgcgG4ggUVRQhkQRbBylAWCR/eGAmzBgcbVSEQV1MFRs8Ts/TVirjdcmzZum+foZqYGq4TdA2FbzSDx8f5+ee7Ns74fim/BWoE4AP1Wwc6lakA20VO54RMrR2gpfsF97s/P3xKMD8UIkBZNFk2ondPz/n9v9G4ROvGcJ9ejaJw8RK4kYUOt8zO4KgUDgofBQGDwMCjsf2FAHKMuSxfQKGICKTqpw8TAYfHywFNs02zbbJDAgUAD+z7l4byADjcSJjXhAkX+V15z5PA0HfmEHdHqW5OfXT1PsVLlV5AkPgm14EPW/1ds0nWuhRkHhmb/7JBfdZazTpbTGMrxynHPs9XO634fF7LHGGYvKrld7xSsgpTyfJqABJJGiNEP0JXXyPy/gUd+Oq0QckHKAEocXne/KDv7oOwSG0MMrDDRgQ0HCAFZ0Ar7LFhgi+t39/2Lzv/+fFLDLD/G/EugBH+CBbj+wXA/giv6ofkm3ZAqiNhrXlgkd4AIQwJg18/ES0QEKIZXedNDpbH9FmDzLD3D97q2rzT3TRXdngPKMRazVYXWiUtlpVnZTprWt4J6wbQiLK7o/u+vhZr91OWHc2/gH+Qyq505NGWB7ui1DWkl94VWLPsznaf1Socl++32X0B1fLASbyLYi6TAO6LlJoPwXg5YAIDQZ2GxXd7yaLzKdTNrAjkIbD1Sca4fUrWmNr+IUViUJVbuuu66KDZXmnH4fMCQ5ukPCRJDdgit52b4Et5RuCK2ZjuBXWu6K6zJkW4qAxA6Y0BWJpS9UgZPLQ3iSuQWAodKrD1VK44bhgApzKGely9pyBS45qWsGAx7ELrGRNkqZX2rpG1no3KgrF9zv29HXdcAmEYpTeqXQunmcM1KNLri1l3ETKhr/jkuZpYQWCtMUkAOA+G31Ezc8TlQCcX0AFiJM8A/Ja5ANNF3s+Aj1HaR91PPZwCslbEBH81Bta7KBGjhAdpteqxIHxKrVrglxhbYG0qRrxPwYd+RA3LtpvfDZhqQKKExdOI4SSCr8hboPCCdUxuYcsLQ2TWw8XO+W8S8kg28tTsGhGLgAGRwq7qpSd5XiJn8+0m7km8BBpAhQ5rqdtpQ58nsk6UVIA1DbFmX+klm8NFI+mk+Ll5BXDAY1ZsGRNeDGIUiLnIISx8u1n++kPlx5KbJLJOSiIDP1dfY4drhKlPE7oTwc9gEI5vBFDpQ2ih/QCB4V+GrFeAMbdFltBSpSqZm9jTuVVM1CVTyG+Haj1uZhNOXIU0xda+WccPIV0vAyy13AXHS7odKqX6lPnNQW29uptFF7hjud+bei1obGQ3mmpvE7YI+21Nlt7iq+tVb3XTcUFG5q31u2uVI1qvk971yZ+/NvzpZV1dNa7Wrems+vXZ7G0bjYrBMdM44xvrdfytxyouoAmPMIUnc0H1njzFfrgVdARZ2VnWXVw+0qv/fX8iYj698zzrSTOlorbpYF7dsMJFE7yW5kV/NV/wwJ/6VW+S3vk6u7s/frQR4kpi7JSQUksyJhl0BSNPS65eUmD+i8UGEYHhd5zmQA0oU5xN+qs8fdwfJZAQaqNDFTgSowOASAVTi4nNRD5CwJVyFK13cHxDEeWVQDvZU3CfsgXuwhIGxxAGE3sxM1QNCL5oTRpAtVec0/pJXNfeLQLO+973quQzeYBhK7GMFx18+4DtE1AX90lFeaawcfPwKbh9CZncWGRig514Ca6r5aIcMk1u7R7OyRfIjVldpkv/8QTig8xMfDoNqXMmPq6rWqoKMWvmXNIhNcLI1TokIhQLNwOGTfZxXWtBtNJFOwSQNl+3DGVwiBVU4+Oq0FeJi5E8VTE1ABD05R60ZWTc49DS4M1nMCCzmZSm7M8UWDSoiGvZPrWrGYd4bKvbh8oXu1Pnv2vrfKud0bz5t2kT7Ti8FNP4L9IJy/PdAULtKZAlxz2FahwUZvcI6aZm61UI4qEJ3XUpHb3NZcIBs7HYrbHf7GgFYvCv4JTMlVK5o9e10zmwVpEoUbhD8pWxVbCX6xdKM4RGTiZ/2PaYEZMh7uAHi1vTTwNaeeqsmWeoX+fERAY8Dlq8IlZUVTrzi35D7ANkN8liq6UConAkh2mBUCA+jNZ4cnuXvJDuFGvEUlaWfzT5MjGonslkNYRjXtmwJEQgbrm1xCr4/AZMWbVPGZ3SvOH9q/AaXqXNGRhP+VuL2mvmu8/zv9BnB5l14cMu1MBSJ04++6QDnTv1bPp6oZnRul1ORTFVkMUlS1LsSh2h2L41VW44wWXcvRhJYwoLfn7pCnX7rB3Zs4otOwC568tbQs/egw8kfbjvhpM06nOc/rWqbg7EicnAydmY7O4nomxNHJws4WxYXFJFGl55716GhGRqqjKI9kp3x0+aiPQqzthaSFKiR6LmZAzFysLXdGb3rZfIi6TEU7jgcy2geINtNWQpaBCnYWTmxqWDw0wzgfrJvzphPhoIstcvGIzuZO4UN1requPbF1HWhqLtgPf3YiwnTA/xIgKAA=)}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<script id="wasm4-cart-json" type="application/json">{"WASM4_CART":"0ax}=0rr910tU/C003yfE$8@$0ak[UE$4Da0E>c10X<\u002FWwO#U]A+e:5009gkzGVe8wQ5p%0T01KB{8-bvqC]A17=v[25N{*z/Qa80rAi62l>ed000932nd7wB97&hBn#BFB-p(1By+BQ2MU2o0rJQ)1{LIpla(^?k(:gT@0JGjdGz:qldtl32q#R-k)P^H^b>M>0SUH{lgryb2q#R-k[Dum@{Q1F0SSQU1owQOk[(P/i@]r.kMTgLkMTgLkTAuW04!fJk(>:h0%5D901e&[lbr6(eDt=p0DwLGl9P}Xc&%w(071o?04!fJmfC<#06@tl1vbnS]8G)kk(>ZU0SSSg3QIC%06{SD000Ad3M]Bn8CZG3l9P}XaojXdyC(j]3&{-4YZ(a?06g8W5c-IdXBPXi2mQ+D2TMA206{SD000Af3QC*=001exk].JU03Iwe8zq9>aP:%B]8Hfu06@.=mfC<\u00211}7F$aoB?*yEe12193QXocsm3}2Cg@%nJgvk)Qb7mfC>w6Hq<-0rskxk(>%]4fm1Clb-u{k(%7E01n(ok[(P!i@]r?k@Ra806@wa3j)h66Hq^Z0rtAU]8I6olhpG(0sP2q0ZG5Q]8Hfu03Rzef?R@Ql96OS5c&TAl9P}XaojXdybMa[3<3!rkTzst01YwT06}I{AT-1mU>4&q06{T3a]<I503znc8aLbolb-u{k)6dF01h9d]8Hfu06@.=4fm1A3&{-4-Q:6Y001hyk)6:?01YA4-Q:6L06{T2iSGdC-pA%{06g8W3QCE)13lI-lc]P$U>4&y0STzAyA-^40u.wd0DYH=aoh@Ok[(P^i@]sEWdsn-.#J9E01Ye%.1dK(.1dKO0SUH!ybMa[3UYRzE)FJb00tFe0716+0brRRk(>Zz04!fJ4fc+rkP*4)0CT[2n^4y40710-0brXUec2U]0ZO!t1va7gaoB?fyb#s{4*s6Rk}>t103znc0C-?U3<3!p3KYnc]8I7X&j]vK000x-0rW/NkP*7[WdsojeDt+{0.1jkaoiI+yaPz=a{gtQmfC<#0yl:3aPR#L3KX6UaoMx!h#%5f13^$ek)6QWkP*4)WdsojaojZd]8JIS0024W03znc0CS+T3&{.zaojZm]8JI>06g8W3KXu:070pH01fo6qBJ(Jnb$s#h2]r:fAszy]8Gda82%TpfFCfXfF+x.LMqqpvrc0(ByeS>vruTjwPFbc4@DDhvpB4:eOw)rvQT7]d?=/szGG]cAbYJexdW.mBz>(hBsN-dB.>?BzdNN5A^oevB7]o8eOffGd?uViw[u0]zEWlfBA}?pB1mPmB.(elC42ifwH!p2B.>?BzdNN5A^olPAc9PCv{%g&eOP9kx(W={Bs?AOwPzQ9zF5}H","WASM4_CART_SIZE":1102}</script>
|
||||
<script>var wasm4=function(t){"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2019 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/var e;const s=globalThis,i=s.ShadowRoot&&(void 0===s.ShadyCSS||s.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,n=Symbol(),r=new WeakMap;let o=class{constructor(t,e,s){if(this._$cssResult$=!0,s!==n)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(i&&void 0===t){const s=void 0!==e&&1===e.length;s&&(t=r.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&r.set(e,t))}return t}toString(){return this.cssText}};const a=(t,...e)=>{const s=1===t.length?t[0]:e.reduce(((e,s,i)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+t[i+1]),t[0]);return new o(s,t,n)},l=i?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return(t=>new o("string"==typeof t?t:t+"",void 0,n))(e)})(t):t
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2017 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/,{is:h,defineProperty:c,getOwnPropertyDescriptor:d,getOwnPropertyNames:u,getOwnPropertySymbols:p,getPrototypeOf:f}=Object,m=globalThis,y=m.trustedTypes,w=y?y.emptyScript:"",g=m.reactiveElementPolyfillSupport,b=(t,e)=>t,v={toAttribute(t,e){switch(e){case Boolean:t=t?w:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let s=t;switch(e){case Boolean:s=null!==t;break;case Number:s=null===t?null:Number(t);break;case Object:case Array:try{s=JSON.parse(t)}catch(i){s=null}}return s}},A=(t,e)=>!h(t,e),x={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:A};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),m.litPropertyMetadata??(m.litPropertyMetadata=new WeakMap);class k extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??(this.l=[])).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=x){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){const s=Symbol(),i=this.getPropertyDescriptor(t,s,e);void 0!==i&&c(this.prototype,t,i)}}static getPropertyDescriptor(t,e,s){const{get:i,set:n}=d(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get(){return null==i?void 0:i.call(this)},set(e){const r=null==i?void 0:i.call(this);n.call(this,e),this.requestUpdate(t,r,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??x}static _$Ei(){if(this.hasOwnProperty(b("elementProperties")))return;const t=f(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(b("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(b("properties"))){const t=this.properties,e=[...u(t),...p(t)];for(const s of e)this.createProperty(s,t[s])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,s]of e)this.elementProperties.set(t,s)}this._$Eh=new Map;for(const[e,s]of this.elementProperties){const t=this._$Eu(e,s);void 0!==t&&this._$Eh.set(t,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const s=new Set(t.flat(1/0).reverse());for(const t of s)e.unshift(l(t))}else void 0!==t&&e.push(l(t));return e}static _$Eu(t,e){const s=e.attribute;return!1===s?void 0:"string"==typeof s?s:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var t;this._$ES=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$E_(),this.requestUpdate(),null==(t=this.constructor.l)||t.forEach((t=>t(this)))}addController(t){var e;(this._$EO??(this._$EO=new Set)).add(t),void 0!==this.renderRoot&&this.isConnected&&(null==(e=t.hostConnected)||e.call(t))}removeController(t){var e;null==(e=this._$EO)||e.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const s of e.keys())this.hasOwnProperty(s)&&(t.set(s,this[s]),delete this[s]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((t,e)=>{if(i)t.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const i of e){const e=document.createElement("style"),n=s.litNonce;void 0!==n&&e.setAttribute("nonce",n),e.textContent=i.cssText,t.appendChild(e)}})(t,this.constructor.elementStyles),t}connectedCallback(){var t;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null==(t=this._$EO)||t.forEach((t=>{var e;return null==(e=t.hostConnected)?void 0:e.call(t)}))}enableUpdating(t){}disconnectedCallback(){var t;null==(t=this._$EO)||t.forEach((t=>{var e;return null==(e=t.hostDisconnected)?void 0:e.call(t)}))}attributeChangedCallback(t,e,s){this._$AK(t,s)}_$EC(t,e){var s;const i=this.constructor.elementProperties.get(t),n=this.constructor._$Eu(t,i);if(void 0!==n&&!0===i.reflect){const r=(void 0!==(null==(s=i.converter)?void 0:s.toAttribute)?i.converter:v).toAttribute(e,i.type);this._$Em=t,null==r?this.removeAttribute(n):this.setAttribute(n,r),this._$Em=null}}_$AK(t,e){var s;const i=this.constructor,n=i._$Eh.get(t);if(void 0!==n&&this._$Em!==n){const t=i.getPropertyOptions(n),r="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==(null==(s=t.converter)?void 0:s.fromAttribute)?t.converter:v;this._$Em=n,this[n]=r.fromAttribute(e,t.type),this._$Em=null}}requestUpdate(t,e,s){if(void 0!==t){if(s??(s=this.constructor.getPropertyOptions(t)),!(s.hasChanged??A)(this[t],e))return;this.P(t,e,s)}!1===this.isUpdatePending&&(this._$ES=this._$ET())}P(t,e,s){this._$AL.has(t)||this._$AL.set(t,e),!0===s.reflect&&this._$Em!==t&&(this._$Ej??(this._$Ej=new Set)).add(t)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){Line truncated
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2017 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
const S=globalThis,E=S.trustedTypes,$=E?E.createPolicy("lit-html",{createHTML:t=>t}):void 0,_="$lit$",P=`lit$${(Math.random()+"").slice(9)}$`,C="?"+P,U=`<${C}>`,I=document,T=()=>I.createComment(""),M=t=>null===t||"object"!=typeof t&&"function"!=typeof t,L=Array.isArray,O="[ \t\n\f\r]",R=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,N=/-->/g,B=/>/g,D=RegExp(`>|${O}(?:([^\\s"'>=/]+)(${O}*=${O}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),F=/'/g,H=/"/g,z=/^(?:script|style|textarea|title)$/i,j=(q=1,(t,...e)=>({_$litType$:q,strings:t,values:e})),V=Symbol.for("lit-noChange"),W=Symbol.for("lit-nothing"),G=new WeakMap,K=I.createTreeWalker(I,129);var q;function Y(t,e){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==$?$.createHTML(e):e}class J{constructor({strings:t,_$litType$:e},s){let i;this.parts=[];let n=0,r=0;const o=t.length-1,a=this.parts,[l,h]=((t,e)=>{const s=t.length-1,i=[];let n,r=2===e?"<svg>":"",o=R;for(let a=0;a<s;a++){const e=t[a];let s,l,h=-1,c=0;for(;c<e.length&&(o.lastIndex=c,l=o.exec(e),null!==l);)c=o.lastIndex,o===R?"!--"===l[1]?o=N:void 0!==l[1]?o=B:void 0!==l[2]?(z.test(l[2])&&(n=RegExp("<\u002F"+l[2],"g")),o=D):void 0!==l[3]&&(o=D):o===D?">"===l[0]?(o=n??R,h=-1):void 0===l[1]?h=-2:(h=o.lastIndex-l[2].length,s=l[1],o=void 0===l[3]?D:'"'===l[3]?H:F):o===H||o===F?o=D:o===N||o===B?o=R:(o=D,n=void 0);const d=o===D&&t[a+1].startsWith("/>")?" ":"";r+=o===R?e+U:h>=0?(i.push(s),e.slice(0,h)+_+e.slice(h)+P+d):e+P+(-2===h?a:d)}return[Y(t,r+(t[s]||"<?>")+(2===e?"<\u002Fsvg>":"")),i]})(t,e);if(this.el=J.createElement(l,s),K.currentNode=this.el.content,2===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(i=K.nextNode())&&a.length<o;){if(1===i.nodeType){if(i.hasAttributes())for(const t of i.getAttributeNames())if(t.endsWith(_)){const e=h[r++],s=i.getAttribute(t).split(P),o=/([.?@])?(.*)/.exec(e);a.push({type:1,index:n,name:o[2],strings:s,ctor:"."===o[1]?et:"?"===o[1]?st:"@"===o[1]?it:tt}),i.removeAttribute(t)}else t.startsWith(P)&&(a.push({type:6,index:n}),i.removeAttribute(t));if(z.test(i.tagName)){const t=i.textContent.split(P),e=t.length-1;if(e>0){i.textContent=E?E.emptyScript:"";for(let s=0;s<e;s++)i.append(t[s],T()),K.nextNode(),a.push({type:2,index:++n});i.append(t[e],T())}}}else if(8===i.nodeType)if(i.data===C)a.push({type:2,index:n});else{let t=-1;for(;-1!==(t=i.data.indexOf(P,t+1));)a.push({type:7,index:n}),t+=P.length-1}n++}}static createElement(t,e){const s=I.createElement("template");return s.innerHTML=t,s}}function X(t,e,s=t,i){var n,r;if(e===V)return e;let o=void 0!==i?null==(n=s._$Co)?void 0:n[i]:s._$Cl;const a=M(e)?void 0:e._$litDirective$;return(null==o?void 0:o.constructor)!==a&&(null==(r=null==o?void 0:o._$AO)||r.call(o,!1),void 0===a?o=void 0:(o=new a(t),o._$AT(t,s,i)),void 0!==i?(s._$Co??(s._$Co=[]))[i]=o:s._$Cl=o),void 0!==o&&(e=X(t,o._$AS(t,e.values),o,i)),e}class Z{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:s}=this._$AD,i=((null==t?void 0:t.creationScope)??I).importNode(e,!0);K.currentNode=i;let n=K.nextNode(),r=0,o=0,a=s[0];for(;void 0!==a;){if(r===a.index){let e;2===a.type?e=new Q(n,n.nextSibling,this,t):1===a.type?e=new a.ctor(n,a.name,a.strings,this,t):6===a.type&&(e=new nt(n,this,t)),this._$AV.push(e),a=s[++o]}r!==(null==a?void 0:a.index)&&(n=K.nextNode(),r++)}return K.currentNode=I,i}p(t){let e=0;for(const s of this._$AV)void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,e),e+=s.strings.length-2):s._$AI(t[e])),e++}}class Q{get _$AU(){var t;return(null==(t=this._$AM)?void 0:t._$AU)??this._$Cv}constructor(t,e,s,i){this.type=2,this._$AH=W,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=s,this.options=i,this._$Cv=(null==i?void 0:i.isConnected)??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===(null==t?void 0:t.nodeType)&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=X(this,t,e),M(t)?t===W||null==t||""===t?(this._$AH!==W&&this._$AR(),this._$AH=W):t!==this._$AH&&t!==V&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>L(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]))(t)?this.k(t):this._(t)}S(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.S(t))}_(t){this._$AH!==W&&M(this._$AH)?this._$AA.nextSibling.data=t:this.T(I.createTextNode(t)),this._$AH=t}$(t){var e;const{values:s,_$litType$:i}=t,n="number"==typeof i?this._$AC(t):(void 0===i.el&&(i.el=J.createElement(Y(i.h,i.h[0]),this.options)),i);if((null==(e=this._$AH)?void 0:e._$AD)===n)this._$AH.p(s);else{const t=new Z(n,this),e=t.u(this.options);t.p(s),this.T(e),this._$AH=t}}_$AC(t){let e=G.get(t.strings);return void 0===e&&G.set(t.strings,e=new J(t)),e}k(t){L(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let s,i=0;fLine truncated
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2017 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
class ot extends k{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t;const e=super.createRenderRoot();return(t=this.renderOptions).renderBefore??(t.renderBefore=e.firstChild),e}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=((t,e,s)=>{const i=(null==s?void 0:s.renderBefore)??e;let n=i._$litPart$;if(void 0===n){const t=(null==s?void 0:s.renderBefore)??null;i._$litPart$=n=new Q(e.insertBefore(T(),t),t,void 0,s??{})}return n._$AI(t),n})(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),null==(t=this._$Do)||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),null==(t=this._$Do)||t.setConnected(!1)}render(){return V}}ot._$litElement$=!0,ot.finalized=!0,null==(e=globalThis.litElementHydrateSupport)||e.call(globalThis,{LitElement:ot});const at=globalThis.litElementPolyfillSupport;null==at||at({LitElement:ot}),(globalThis.litElementVersions??(globalThis.litElementVersions=[])).push("4.0.4");
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2017 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
const lt=t=>(e,s)=>{void 0!==s?s.addInitializer((()=>{customElements.define(t,e)})):customElements.define(t,e)}
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2017 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/,ht={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:A},ct=(t=ht,e,s)=>{const{kind:i,metadata:n}=s;let r=globalThis.litPropertyMetadata.get(n);if(void 0===r&&globalThis.litPropertyMetadata.set(n,r=new Map),r.set(s.name,t),"accessor"===i){const{name:i}=s;return{set(s){const n=e.get.call(this);e.set.call(this,s),this.requestUpdate(i,n,t)},init(e){return void 0!==e&&this.P(i,void 0,t),e}}}if("setter"===i){const{name:i}=s;return function(s){const n=this[i];e.call(this,s),this.requestUpdate(i,n,t)}}throw Error("Unsupported decorator location: "+i)};
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2017 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
function dt(t){return function(t){return(e,s)=>"object"==typeof s?ct(t,e,s):((t,e,s)=>{const i=e.hasOwnProperty(s);return e.constructor.createProperty(s,i?{...t,wrapped:!0}:t),i?Object.getOwnPropertyDescriptor(e,s):void 0})(t,e,s)}({...t,state:!0,attribute:!1})}
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2017 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/const ut=(t,e,s)=>(s.configurable=!0,s.enumerable=!0,Reflect.decorate&&"object"!=typeof e&&Object.defineProperty(t,e,s),s)
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2017 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/;function pt(t,e){return(s,i,n)=>{const r=e=>{var s;return(null==(s=e.renderRoot)?void 0:s.querySelector(t))??null};if(e){const{get:t,set:e}="object"==typeof i?s:n??(()=>{const t=Symbol();return{get(){return this[t]},set(e){this[t]=e}}})();return ut(s,i,{get(){let s=t.call(this);return void 0===s&&(s=r(this),(null!==s||this.hasUpdated)&&e.call(this,s)),s}})}return ut(s,i,{get(){return r(this)}})}}const ft=160,mt=160,yt=1024,wt=[14743759,8831084,3172432,464929],gt=16,bt=32,vt=64,At=128,xt=Uint8Array.of(255,255,255,255,255,255,255,255,199,199,199,207,207,255,207,255,147,147,147,255,255,255,255,255,147,1,147,147,147,1,147,255,239,131,47,131,233,3,239,255,157,91,55,239,217,181,115,255,143,39,39,143,37,51,129,255,207,207,207,255,255,255,255,255,243,231,207,207,207,231,243,255,159,207,231,231,231,207,159,255,255,147,199,1,199,147,255,255,255,231,231,129,231,231,255,255,255,255,255,255,255,207,207,159,255,255,255,129,255,255,255,255,255,255,255,255,255,207,207,255,253,251,247,239,223,191,127,255,199,179,57,57,57,155,199,255,231,199,231,231,231,231,129,255,131,57,241,195,135,31,1,255,129,243,231,195,249,57,131,255,227,195,147,51,1,243,243,255,3,63,3,249,249,57,131,255,195,159,63,3,57,57,131,255,1,57,243,231,207,207,207,255,135,59,27,135,97,121,131,255,131,57,57,129,249,243,135,255,255,207,207,255,207,207,255,255,255,207,207,255,207,207,159,255,243,231,207,159,207,231,243,255,255,255,1,255,1,255,255,255,159,207,231,243,231,207,159,255,131,1,57,243,199,255,199,255,131,125,69,85,65,127,131,255,199,147,57,57,1,57,57,255,3,57,57,3,57,57,3,255,195,153,63,63,63,153,195,255,7,51,57,57,57,51,7,255,1,63,63,3,63,63,1,255,1,63,63,3,63,63,63,255,193,159,63,49,57,153,193,255,57,57,57,1,57,57,57,255,129,231,231,231,231,231,129,255,249,249,249,249,249,57,131,255,57,51,39,15,7,35,49,255,159,159,159,159,159,159,129,255,57,17,1,1,41,57,57,255,57,25,9,1,33,49,57,255,131,57,57,57,57,57,131,255,3,57,57,57,3,63,63,255,131,57,57,57,33,51,133,255,3,57,57,49,7,35,49,255,135,51,63,131,249,57,131,255,129,231,231,231,231,231,231,255,57,57,57,57,57,57,131,255,57,57,57,17,131,199,239,255,57,57,41,1,1,17,57,255,57,17,131,199,131,17,57,255,153,153,153,195,231,231,231,255,1,241,227,199,143,31,1,255,195,207,207,207,207,207,195,255,127,191,223,239,247,251,253,255,135,231,231,231,231,231,135,255,199,147,255,255,255,255,255,255,255,255,255,255,255,255,255,1,239,247,255,255,255,255,255,255,255,255,131,249,129,57,129,255,63,63,3,57,57,57,131,255,255,255,129,63,63,63,129,255,249,249,129,57,57,57,129,255,255,255,131,57,1,63,131,255,241,231,129,231,231,231,231,255,255,255,129,57,57,129,249,131,63,63,3,57,57,57,57,255,231,255,199,231,231,231,129,255,243,255,227,243,243,243,243,135,63,63,49,3,7,35,49,255,199,231,231,231,231,231,129,255,255,255,3,73,73,73,73,255,255,255,3,57,57,57,57,255,255,255,131,57,57,57,131,255,255,255,3,57,57,3,63,63,255,255,129,57,57,129,249,249,255,255,145,143,159,159,159,255,255,255,131,63,131,249,3,255,231,231,129,231,231,231,231,255,255,255,57,57,57,57,129,255,255,255,153,153,153,195,231,255,255,255,73,73,73,73,129,255,255,255,57,1,199,1,57,255,255,255,57,57,57,129,249,131,255,255,1,227,199,143,1,255,243,231,231,207,231,231,243,255,231,231,231,231,231,231,231,255,159,207,207,231,207,207,159,255,255,255,143,69,227,255,255,255,255,255,255,255,255,147,147,255,131,41,41,17,41,41,131,255,131,57,9,17,33,57,131,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,131,17,33,125,33,17,131,255,131,17,9,125,9,17,131,255,131,17,57,85,17,17,131,255,131,17,17,85,57,17,131,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,231,255,231,231,199,199,199,255,239,131,41,47,41,131,239,255,195,153,159,3,159,159,1,255,255,165,219,219,219,165,255,255,153,153,195,129,231,129,231,255,231,231,231,255,231,231,231,255,195,153,135,219,225,153,195,255,147,255,255,255,255,255,255,255,195,189,102,94,94,102,189,195,135,195,147,195,255,255,255,255,255,201,147,39,147,201,255,255,255,255,129,249,249,255,255,255,255,255,255,255,255,255,255,255,195,189,70,90,70,90,189,195,131,255,255,255,255,255,255,255,239,215,239,255,255,255,255,255,231,231,129,231,231,255,129,255,199,243,231,195,255,255,255,255,195,231,243,199,255,255,255,255,247,239,255,255,255,255,255,255,255,255,51,51,51,51,9,63,193,149,181,149,193,245,245Line truncated
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2021 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
function*ae(t,e){if(void 0!==t){let s=0;for(const i of t)yield e(i,s++)}}t.App=class extends ot{constructor(){var t;super(),this.hideGamepadOverlay=!1,this.showMenu=!1,this.inputState=new oe,this.gamepadUnavailableWarned=new Set,this.onPointerUp=t=>{"touch"==t.pointerType&&St(),this.runtime.unlockAudio()},this.diskPrefix=(null==(t=document.getElementById("wasm4-disk-prefix"))?void 0:t.textContent)??kt("disk-prefix"),this.runtime=new ee(`${this.diskPrefix}-disk`),this.init()}async init(){const t=this.runtime;await t.init();const e=t.canvas,s=kt("netplay");s?(this.netplay=this.createNetplay(),this.netplay.join(s)):await t.load(await async function(){const t=document.getElementById("wasm4-cart-json");if(t){const{WASM4_CART:e,WASM4_CART_SIZE:s}=JSON.parse(t.textContent??""),i=new Uint8Array(s);return Pt(e,i),i}{const t=kt("url")??"cart.wasm",e=await fetch(t);if(e.ok)return new Uint8Array(await e.arrayBuffer());throw new Error(`Could not load cart at url: ${t}`)}}());let i={toggleDevtools(){},updateCompleted(...t){}};this.netplay||t.start();let n=null;const r=t=>{if(document.body.style.cursor="",t.isPrimary){const s=e.getBoundingClientRect(),i=this.inputState;i.mouseX=Math.fround(ft*(t.clientX-s.left)/s.width),i.mouseY=Math.fround(mt*(t.clientY-s.top)/s.height),i.mouseButtons=7&t.buttons}};window.addEventListener("pointerdown",r),window.addEventListener("pointerup",r),window.addEventListener("pointermove",r),e.addEventListener("contextmenu",(t=>{t.preventDefault()}));const o={2:this.saveGameState.bind(this),4:this.loadGameState.bind(this),r:this.resetCart.bind(this),R:this.resetCart.bind(this),F8:i.toggleDevtools,F9:function(){t.composite(),e.toBlob((t=>{const e=URL.createObjectURL(t),s=document.createElement("a");s.href=e,s.download="wasm4-screenshot.png",s.click(),URL.revokeObjectURL(e)}))},F10:function(){if(null!=n)return;const t="video/webm",s=e.captureStream();n=new MediaRecorder(s,{mimeType:t,videoBitsPerSecond:25e6});const i=[];n.ondataavailable=t=>{i.push(t.data)},n.onstop=()=>{const e=new Blob(i,{type:t}),s=URL.createObjectURL(e),n=document.createElement("a");n.href=s,n.download="wasm4-animation.webm",n.click(),URL.revokeObjectURL(s)},n.start(),setTimeout((()=>{n&&(n.requestData(),n.stop(),n=null)}),4e3)},F11:St,Enter:this.onMenuButtonPressed.bind(this)},a=e=>{if(e.ctrlKey||e.altKey)return;if(e.srcElement instanceof HTMLElement&&"INPUT"==e.srcElement.tagName)return;const s="keydown"==e.type;if(t.unlockAudio(),document.body.style.cursor="none",s){const t=o[e.key];if(t)return t(),void e.preventDefault()}let i=0,n=0;switch(e.code){case"KeyX":case"KeyV":case"Space":case"Period":n=1;break;case"KeyZ":case"KeyC":case"Comma":n=2;break;case"ArrowUp":n=vt;break;case"ArrowDown":n=At;break;case"ArrowLeft":n=gt;break;case"ArrowRight":n=bt;break;case"KeyA":case"KeyQ":i=1,n=1;break;case"ShiftLeft":case"Tab":i=1,n=2;break;case"KeyE":i=1,n=vt;break;case"KeyD":i=1,n=At;break;case"KeyS":i=1,n=gt;break;case"KeyF":i=1,n=bt;break;case"NumpadMultiply":case"NumpadDecimal":i=2,n=1;break;case"NumpadSubtract":case"NumpadEnter":i=2,n=2;break;case"Numpad8":i=2,n=vt;break;case"Numpad5":i=2,n=At;break;case"Numpad4":i=2,n=gt;break;case"Numpad6":i=2,n=bt}if(0!=n){e.preventDefault();const t=this.inputState.gamepad;s?t[i]|=n:t[i]&=~n}};if(window.addEventListener("keydown",a),window.addEventListener("keyup",a),top&&top!=window)try{top.addEventListener("keydown",a),top.addEventListener("keyup",a)}catch{}const l=()=>{if(navigator.getGamepads)for(const t of navigator.getGamepads()){if(null==t)continue;if("standard"!=t.mapping){this.gamepadUnavailableWarned.has(t.id)||(this.gamepadUnavailableWarned.add(t.id),this.notifications.show("Unsupported gamepad: "+t.id));continue}const e=t.buttons,s=t.axes;let i=0;(e[12].pressed||s[1]<-.5)&&(i|=vt),(e[13].pressed||s[1]>.5)&&(i|=At),(e[14].pressed||s[0]<-.5)&&(i|=gt),(e[15].pressed||s[0]>.5)&&(i|=bt),(e[0].pressed||e[3].pressed||e[5].pressed||e[7].pressed)&&(i|=1),(e[1].pressed||e[2].pressed||e[4].pressed||e[6].pressed)&&(i|=2),e[9].pressed&&(this.showMenu=!0),this.inputState.gamepad[t.index%4]=i}};let h=performance.now();const c=e=>{requestAnimationFrame(c),l();let s=this.inputState;if(null!=this.menuOverlay){if(this.menuOverlay.applyInput(),!this.netplay)return;s=new oe}let i=!1;for(e-h>=200&&(h=e);e>=h;)if(h+=1e3/60,this.netplay)this.netplay.update(s.gamepad[0])&&(i=!0);else{for(let e=0;e<4;++e)t.setGamepad(e,s.gamepad[e]);t.setMouse(s.mouseX,s.mouseY,s.mouseButtons),t.update(),i=!0}i&&(this.hideGamepadOverlay=!!t.getSystemFlag(2),t.composite())};requestAnimationFrame(c)}onMenuButtonPressed(){this.showMenu?this.inputState.gamepad[0]|=1:this.showMenu=!0}closeMenu(){if(this.showMenu){this.showMenu=!1;for(let t=0;t<4;++t)this.inputState.gamepad[t]=0}}saveGameState(){let t=this.savedGameState;null==t&&(t=this.savedGameState=new Ct),t.read(this.runtime),this.notifications.show("State saved")}loadGameState(){if(this.netplay)return void this.notifications.show("State loading disabled during netplay");consLine truncated
|
||||
</script>
|
||||
<wasm4-app></wasm4-app>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,74 @@
|
||||
CC = clang
|
||||
CXX = clang++
|
||||
|
||||
WASM_OPT = wasm-opt
|
||||
WASM_OPT_FLAGS = -Oz --zero-filled-memory --strip-producers --enable-bulk-memory
|
||||
|
||||
DEBUG = 0
|
||||
|
||||
CFLAGS = -target wasm32 -W -Wall -Wextra -Werror -Wno-unused -Wconversion -Wsign-conversion \
|
||||
-MMD -MP -nostdlib -ffreestanding -mbulk-memory
|
||||
|
||||
ifeq ($(DEBUG), 1)
|
||||
CFLAGS += -DDEBUG -O0 -g
|
||||
else
|
||||
CFLAGS += -DNDEBUG -Oz -flto
|
||||
endif
|
||||
|
||||
LDFLAGS = -Wl,-zstack-size=14752 \
|
||||
-Wl,--no-entry \
|
||||
-Wl,--import-memory \
|
||||
-Wl,--allow-undefined \
|
||||
-Wl,--export=start \
|
||||
-Wl,--export=update \
|
||||
-Wl,--initial-memory=65536 \
|
||||
-Wl,--max-memory=65536 \
|
||||
-Wl,--stack-first
|
||||
|
||||
ifeq ($(DEBUG), 1)
|
||||
LDFLAGS += -Wl,--export-all,--no-gc-sections
|
||||
else
|
||||
LDFLAGS += -Wl,--strip-all,--gc-sections,--lto-O3
|
||||
endif
|
||||
|
||||
SOURCES = $(wildcard src/*.c) $(wildcard src/*.cpp)
|
||||
OBJECTS = $(patsubst src/%.c, build/%.o, $(patsubst src/%.cpp, build/%.o, $(SOURCES)))
|
||||
DEPS = $(OBJECTS:.o=.d)
|
||||
|
||||
all: build/cart.wasm
|
||||
|
||||
build/cart.wasm: $(OBJECTS)
|
||||
@mkdir -p build
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJECTS)
|
||||
ifneq ($(DEBUG), 1)
|
||||
@if command -v $(WASM_OPT) >/dev/null 2>&1; then \
|
||||
echo "Optimizing cart size with wasm-opt..."; \
|
||||
$(WASM_OPT) $(WASM_OPT_FLAGS) $@ -o $@; \
|
||||
else \
|
||||
echo "Tip: Install 'binaryen' in your shell.nix for smaller builds!"; \
|
||||
fi
|
||||
endif
|
||||
|
||||
build/%.o: src/%.c
|
||||
@mkdir -p build
|
||||
$(CC) -c $< -o $@ $(CFLAGS)
|
||||
|
||||
build/%.o: src/%.cpp
|
||||
@mkdir -p build
|
||||
$(CXX) -c $< -o $@ $(CFLAGS)
|
||||
|
||||
.PHONY: clean bundle dist
|
||||
clean:
|
||||
rm -rf build
|
||||
|
||||
bundle: build/cart.wasm
|
||||
w4 bundle build/cart.wasm --title "Inner Breeze" --html ../inbe.html
|
||||
|
||||
dist: build/cart.wasm
|
||||
cp build/cart.wasm ../inbe.wasm
|
||||
w4 bundle build/cart.wasm --title "Inner Breeze" --windows ../inbe_x86_64.exe --linux ../inbe_x86_64
|
||||
|
||||
.PHONY: all
|
||||
all: build/cart.wasm
|
||||
|
||||
-include $(DEPS)
|
||||
@@ -0,0 +1,26 @@
|
||||
# inbe
|
||||
|
||||
A game written in C for the [WASM-4](https://wasm4.org) fantasy console.
|
||||
|
||||
## Building
|
||||
|
||||
Build the cart by running:
|
||||
|
||||
```shell
|
||||
make
|
||||
```
|
||||
|
||||
Then run it with:
|
||||
|
||||
```shell
|
||||
w4 run build/cart.wasm
|
||||
```
|
||||
|
||||
For more info about setting up WASM-4, see the [quickstart guide](https://wasm4.org/docs/getting-started/setup?code-lang=c#quickstart).
|
||||
|
||||
## Links
|
||||
|
||||
- [Documentation](https://wasm4.org/docs): Learn more about WASM-4.
|
||||
- [Snake Tutorial](https://wasm4.org/docs/tutorials/snake/goal): Learn how to build a complete game
|
||||
with a step-by-step tutorial.
|
||||
- [GitHub](https://github.com/aduros/wasm4): Submit an issue or PR. Contributions are welcome!
|
||||
@@ -0,0 +1,32 @@
|
||||
{ pkgs ? import <nixpkgs> {} }:
|
||||
|
||||
pkgs.mkShell {
|
||||
packages = with pkgs; [
|
||||
llvmPackages.clang-unwrapped # Bypasses the hardening flags wrapper
|
||||
lld # The webassembly-capable linker
|
||||
wabt # WebAssembly tools
|
||||
binaryen # For wasm-opt sizing compression
|
||||
];
|
||||
|
||||
shellHook = ''
|
||||
# Point to the raw binary directly, escaping the Nix wrapper script
|
||||
export CC_UNWRAPPED="${pkgs.llvmPackages.clang-unwrapped}/bin/clang"
|
||||
export CXX_UNWRAPPED="${pkgs.llvmPackages.clang-unwrapped}/bin/clang++"
|
||||
|
||||
# Native display dependencies for w4 run-native
|
||||
export LD_LIBRARY_PATH="${pkgs.lib.makeLibraryPath (with pkgs; [
|
||||
xorg.libX11
|
||||
xorg.libXrandr
|
||||
xorg.libXinerama
|
||||
xorg.libXcursor
|
||||
xorg.libXi
|
||||
xorg.libXext
|
||||
libGL
|
||||
alsa-lib
|
||||
wayland
|
||||
libxkbcommon
|
||||
])}:$LD_LIBRARY_PATH"
|
||||
|
||||
echo "⚡ Pure C WASM-4 Toolchain Loaded (Unwrapped Clang Engine)!"
|
||||
'';
|
||||
}
|
||||
@@ -0,0 +1,181 @@
|
||||
#include "wasm4.h"
|
||||
|
||||
|
||||
void* memset(void* dest, int byte, unsigned long n) {
|
||||
uint8_t* d = dest;
|
||||
while (n--) {
|
||||
*d++ = (unsigned char)byte;
|
||||
}
|
||||
return dest;
|
||||
}
|
||||
|
||||
void start() {
|
||||
PALETTE[0] = 0xfff6d3;
|
||||
PALETTE[1] = 0xf9a875;
|
||||
PALETTE[2] = 0xeb6b6f;
|
||||
PALETTE[3] = 0x7c3f58;
|
||||
}
|
||||
|
||||
void pixel (int x, int y) {
|
||||
int idx = (y*160 + x) >> 2;
|
||||
|
||||
int shift = (x & 0b11) << 1;
|
||||
int mask = 0b11 << shift;
|
||||
|
||||
int palette_color = *DRAW_COLORS & 0b1111;
|
||||
if (palette_color == 0) {
|
||||
return;
|
||||
}
|
||||
int color = (palette_color - 1) & 0b11;
|
||||
|
||||
FRAMEBUFFER[idx] = (uint8_t)((color << shift) | (FRAMEBUFFER[idx] & ~mask));
|
||||
}
|
||||
|
||||
const int WINDOW_WIDTH = 160;
|
||||
const int WINDOW_HEIGHT = 160;
|
||||
|
||||
uint32_t radius = 25;
|
||||
uint8_t dir = 0;
|
||||
|
||||
uint8_t minr = 25;
|
||||
uint8_t maxr = 50;
|
||||
uint8_t speed = 2;
|
||||
int frame_count = 0;
|
||||
char count[4] = "000";
|
||||
char max_breaths[4] = "030";
|
||||
uint8_t phase = 0;
|
||||
uint8_t rounds = 0;
|
||||
uint8_t max_rounds = 4;
|
||||
|
||||
void incrstr(char *str) {
|
||||
int len = 0;
|
||||
while (str[len] != '\0') {
|
||||
len++;
|
||||
}
|
||||
|
||||
for (int i = len - 1; i >= 0; i--) {
|
||||
if (str[i] < '9') {
|
||||
str[i]++;
|
||||
return;
|
||||
}
|
||||
str[i] = '0';
|
||||
}
|
||||
|
||||
// fallback
|
||||
str[0] = '0';
|
||||
str[1] = '0';
|
||||
str[2] = '0';
|
||||
str[3] = '\0';
|
||||
}
|
||||
|
||||
int strcmp(const char *s1, const char *s2) {
|
||||
while (*s1 != '\0' && *s1 == *s2) {
|
||||
s1++;
|
||||
s2++;
|
||||
}
|
||||
return *(const uint8_t*)s1 - *(const uint8_t*)s2;
|
||||
}
|
||||
char* strcpy(char *dest, const char *src) {
|
||||
char *start = dest;
|
||||
while (*src != '\0') {
|
||||
*dest = *src;
|
||||
dest++;
|
||||
src++;
|
||||
}
|
||||
*dest = '\0';
|
||||
return start;
|
||||
}
|
||||
|
||||
void update () {
|
||||
*DRAW_COLORS = 4;
|
||||
int16_t mx = *MOUSE_X;
|
||||
int16_t my = *MOUSE_Y;
|
||||
uint8_t mb = *MOUSE_BUTTONS;
|
||||
|
||||
|
||||
int32_t center_x = (int32_t) (WINDOW_WIDTH * 0.5);
|
||||
int32_t center_y = (int32_t) (WINDOW_HEIGHT* 0.5);
|
||||
|
||||
switch (phase) {
|
||||
case 0:
|
||||
if (frame_count % speed == 0) {
|
||||
if (dir == 0) {
|
||||
if (radius < maxr) {
|
||||
radius++;
|
||||
} else {
|
||||
dir = 1;
|
||||
}
|
||||
} else {
|
||||
if (radius > minr) {
|
||||
radius--;
|
||||
} else {
|
||||
dir = 0;
|
||||
incrstr(count);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (strcmp(count, max_breaths) == 0) {
|
||||
strcpy(count, "000");
|
||||
phase++;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (frame_count % 60 == 0)
|
||||
incrstr(count);
|
||||
|
||||
|
||||
uint32_t rect_w = 50;
|
||||
uint32_t rect_h = 10;
|
||||
int32_t rect_x = center_x - 25;
|
||||
int32_t rect_y = center_y + 40;
|
||||
if( mx > rect_x && mx < rect_x + (int16_t)rect_w && my > rect_y && my < rect_y + (int16_t)rect_h) {
|
||||
*DRAW_COLORS = 4;
|
||||
if (mb & MOUSE_LEFT) {
|
||||
strcpy(count, "000");
|
||||
phase++;
|
||||
}
|
||||
|
||||
} else {
|
||||
*DRAW_COLORS = 3;
|
||||
}
|
||||
rect(rect_x, rect_y, rect_w, rect_h);
|
||||
*DRAW_COLORS = 2;
|
||||
text("BREATH", center_x - (6 * 4), rect_y + 1);
|
||||
|
||||
break;
|
||||
case 2:
|
||||
if (radius < maxr && strcmp(count, "000") == 0) {
|
||||
radius++;
|
||||
} else {
|
||||
if (strcmp(count, "015") == 0 && radius > minr) {
|
||||
radius--;
|
||||
if (radius == minr)
|
||||
phase++;
|
||||
}
|
||||
if (frame_count % 60 == 0)
|
||||
incrstr(count);
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (rounds < max_rounds) {
|
||||
strcpy(count, "000");
|
||||
rounds++;
|
||||
phase = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
*DRAW_COLORS = 3;
|
||||
int32_t current_x = center_x - (int32_t)radius;
|
||||
int32_t current_y = center_y - (int32_t)radius;
|
||||
oval(current_x, current_y, radius * 2, radius * 2);
|
||||
|
||||
|
||||
|
||||
*DRAW_COLORS = 2;
|
||||
text(count, center_x - (3 * 4), center_y - 4);
|
||||
|
||||
|
||||
|
||||
frame_count++;
|
||||
}
|
||||
@@ -0,0 +1,142 @@
|
||||
//
|
||||
// WASM-4: https://wasm4.org/docs
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define WASM_EXPORT(name) __attribute__((export_name(name)))
|
||||
#define WASM_IMPORT(name) __attribute__((import_name(name)))
|
||||
|
||||
WASM_EXPORT("start") void start ();
|
||||
WASM_EXPORT("update") void update ();
|
||||
|
||||
// ┌───────────────────────────────────────────────────────────────────────────┐
|
||||
// │ │
|
||||
// │ Platform Constants │
|
||||
// │ │
|
||||
// └───────────────────────────────────────────────────────────────────────────┘
|
||||
|
||||
#define SCREEN_SIZE 160
|
||||
#define FONT_SIZE 8
|
||||
|
||||
// ┌───────────────────────────────────────────────────────────────────────────┐
|
||||
// │ │
|
||||
// │ Memory Addresses │
|
||||
// │ │
|
||||
// └───────────────────────────────────────────────────────────────────────────┘
|
||||
|
||||
#define PALETTE ((uint32_t*)0x04)
|
||||
#define DRAW_COLORS ((uint16_t*)0x14)
|
||||
#define GAMEPAD1 ((const uint8_t*)0x16)
|
||||
#define GAMEPAD2 ((const uint8_t*)0x17)
|
||||
#define GAMEPAD3 ((const uint8_t*)0x18)
|
||||
#define GAMEPAD4 ((const uint8_t*)0x19)
|
||||
#define MOUSE_X ((const int16_t*)0x1a)
|
||||
#define MOUSE_Y ((const int16_t*)0x1c)
|
||||
#define MOUSE_BUTTONS ((const uint8_t*)0x1e)
|
||||
#define SYSTEM_FLAGS ((uint8_t*)0x1f)
|
||||
#define NETPLAY ((const uint8_t*)0x20)
|
||||
#define FRAMEBUFFER ((uint8_t*)0xa0)
|
||||
|
||||
#define BUTTON_1 1
|
||||
#define BUTTON_2 2
|
||||
#define BUTTON_LEFT 16
|
||||
#define BUTTON_RIGHT 32
|
||||
#define BUTTON_UP 64
|
||||
#define BUTTON_DOWN 128
|
||||
|
||||
#define MOUSE_LEFT 1
|
||||
#define MOUSE_RIGHT 2
|
||||
#define MOUSE_MIDDLE 4
|
||||
|
||||
#define SYSTEM_PRESERVE_FRAMEBUFFER 1
|
||||
#define SYSTEM_HIDE_GAMEPAD_OVERLAY 2
|
||||
|
||||
// ┌───────────────────────────────────────────────────────────────────────────┐
|
||||
// │ │
|
||||
// │ Drawing Functions │
|
||||
// │ │
|
||||
// └───────────────────────────────────────────────────────────────────────────┘
|
||||
|
||||
/** Copies pixels to the framebuffer. */
|
||||
WASM_IMPORT("blit")
|
||||
void blit (const uint8_t* data, int32_t x, int32_t y, uint32_t width, uint32_t height, uint32_t flags);
|
||||
|
||||
/** Copies a subregion within a larger sprite atlas to the framebuffer. */
|
||||
WASM_IMPORT("blitSub")
|
||||
void blitSub (const uint8_t* data, int32_t x, int32_t y, uint32_t width, uint32_t height,
|
||||
uint32_t srcX, uint32_t srcY, uint32_t stride, uint32_t flags);
|
||||
|
||||
#define BLIT_2BPP 1
|
||||
#define BLIT_1BPP 0
|
||||
#define BLIT_FLIP_X 2
|
||||
#define BLIT_FLIP_Y 4
|
||||
#define BLIT_ROTATE 8
|
||||
|
||||
/** Draws a line between two points. */
|
||||
WASM_IMPORT("line")
|
||||
void line (int32_t x1, int32_t y1, int32_t x2, int32_t y2);
|
||||
|
||||
/** Draws a horizontal line. */
|
||||
WASM_IMPORT("hline")
|
||||
void hline (int32_t x, int32_t y, uint32_t len);
|
||||
|
||||
/** Draws a vertical line. */
|
||||
WASM_IMPORT("vline")
|
||||
void vline (int32_t x, int32_t y, uint32_t len);
|
||||
|
||||
/** Draws an oval (or circle). */
|
||||
WASM_IMPORT("oval")
|
||||
void oval (int32_t x, int32_t y, uint32_t width, uint32_t height);
|
||||
|
||||
/** Draws a rectangle. */
|
||||
WASM_IMPORT("rect")
|
||||
void rect (int32_t x, int32_t y, uint32_t width, uint32_t height);
|
||||
|
||||
/** Draws text using the built-in system font. */
|
||||
WASM_IMPORT("text")
|
||||
void text (const char* text, int32_t x, int32_t y);
|
||||
|
||||
// ┌───────────────────────────────────────────────────────────────────────────┐
|
||||
// │ │
|
||||
// │ Sound Functions │
|
||||
// │ │
|
||||
// └───────────────────────────────────────────────────────────────────────────┘
|
||||
|
||||
/** Plays a sound tone. */
|
||||
WASM_IMPORT("tone")
|
||||
void tone (uint32_t frequency, uint32_t duration, uint32_t volume, uint32_t flags);
|
||||
|
||||
#define TONE_PULSE1 0
|
||||
#define TONE_PULSE2 1
|
||||
#define TONE_TRIANGLE 2
|
||||
#define TONE_NOISE 3
|
||||
#define TONE_MODE1 0
|
||||
#define TONE_MODE2 4
|
||||
#define TONE_MODE3 8
|
||||
#define TONE_MODE4 12
|
||||
#define TONE_PAN_LEFT 16
|
||||
#define TONE_PAN_RIGHT 32
|
||||
#define TONE_NOTE_MODE 64
|
||||
|
||||
// ┌───────────────────────────────────────────────────────────────────────────┐
|
||||
// │ │
|
||||
// │ Storage Functions │
|
||||
// │ │
|
||||
// └───────────────────────────────────────────────────────────────────────────┘
|
||||
|
||||
/** Reads up to `size` bytes from persistent storage into the pointer `dest`. */
|
||||
WASM_IMPORT("diskr")
|
||||
uint32_t diskr (void* dest, uint32_t size);
|
||||
|
||||
/** Writes up to `size` bytes from the pointer `src` into persistent storage. */
|
||||
WASM_IMPORT("diskw")
|
||||
uint32_t diskw (const void* src, uint32_t size);
|
||||
|
||||
/** Prints a message to the debug console. */
|
||||
WASM_IMPORT("trace") void trace (const char* str);
|
||||
|
||||
/** Prints a message to the debug console. */
|
||||
__attribute__((__format__ (__printf__, 1, 2)))
|
||||
WASM_IMPORT("tracef") void tracef (const char* fmt, ...);
|
||||
Reference in new issue
Block a user