mirror of
https://bjh21.me.uk/bedstead/.git
synced 2026-07-09 13:33:06 -04:00
webstead: generate initialisers to paste into bedstead.c
This commit is contained in:
parent
02514737cd
commit
74463d2a76
@ -40,6 +40,7 @@
|
||||
import Bedstead from './bedstead.js';
|
||||
function update_glyph() {
|
||||
var args = [];
|
||||
var cstr = "";
|
||||
for (var row of document.getElementById("pixels").rows) {
|
||||
var arg = 0;
|
||||
for (var pixel of row.getElementsByTagName('input')) {
|
||||
@ -48,12 +49,15 @@
|
||||
arg += 1
|
||||
}
|
||||
}
|
||||
args.push(arg.toString())
|
||||
args.push(arg.toString());
|
||||
cstr += "\\" + arg.toString(8).padStart(2, "0");
|
||||
}
|
||||
document.getElementById("c").textContent =
|
||||
` {"${cstr}", U() },`;
|
||||
Bedstead({
|
||||
arguments: args,
|
||||
print: function(charstring) {
|
||||
document.getElementById("output").textContent = charstring;
|
||||
document.getElementById("charstring").textContent = charstring;
|
||||
document.getElementById("rendered")
|
||||
.setAttribute("d", charstring
|
||||
.replaceAll(/<!--(?:[^-]|-[^-])*-->/g, "")
|
||||
@ -68,6 +72,7 @@
|
||||
for (var e of document.getElementsByTagName('input')) {
|
||||
e.onchange = update_glyph;
|
||||
}
|
||||
update_glyph();
|
||||
]]>
|
||||
</script>
|
||||
</head>
|
||||
@ -148,6 +153,7 @@
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
<p><code id="output"></code></p>
|
||||
<p><code id="c"></code></p>
|
||||
<p><code id="charstring"></code></p>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user