Skip to content

Commit 3685eff

Browse files
committed
Help > Asset Editor Reference
1 parent 34f2eff commit 3685eff

2 files changed

Lines changed: 51 additions & 0 deletions

File tree

index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@
118118
<ul class="dropdown-menu" id="help_menu">
119119
<li><a class="dropdown-item" target="_8bws_help" href="https://8bitworkshop.com/docs/docs/ide.html">IDE Help</a></li>
120120
<li><a class="dropdown-item" href="javascript:void(0)" id="item_keyboard_shortcuts">Keyboard Shortcuts</a></li>
121+
<li><a class="dropdown-item" href="javascript:void(0)" id="item_asset_editor_help">Asset Editor Reference</a></li>
121122
</ul>
122123
</li>
123124
<li class="dropdown dropdown-submenu">

src/ide/ui.ts

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1509,6 +1509,7 @@ function setupDebugControls() {
15091509
$("#item_request_persist").click(() => requestPersistPermission(true, false));
15101510
$("#item_settings").click(openSettings);
15111511
$("#item_keyboard_shortcuts").click(openKeyboardShortcuts);
1512+
$("#item_asset_editor_help").click(openAssetEditorHelp);
15121513
updateDebugWindows();
15131514
// code analyzer?
15141515
if (platform.newCodeAnalyzer) {
@@ -1569,6 +1570,55 @@ function openKeyboardShortcuts() {
15691570
});
15701571
}
15711572

1573+
function openAssetEditorHelp() {
1574+
const row = (field: string, dflt: string, desc: string) =>
1575+
`<tr><td><code>${field}</code></td><td>${dflt}</td><td>${desc}</td></tr>`;
1576+
bootbox.dialog({
1577+
title: "Asset Editor Reference",
1578+
onEscape: true,
1579+
message: `
1580+
<p>Add asset headers in source code as comments containing JSON format descriptors:</p>
1581+
<p>
1582+
C: <code>/*{w:8,h:8}*/</code> followed by data, terminated by <code>;</code><br>
1583+
ASM: <code>;;{w:8,h:8};;</code> followed by data, terminated by <code>;;</code>
1584+
</p>
1585+
<table class="help">
1586+
<tr><th colspan="3">Image Format</th></tr>
1587+
<tr><td><b>Field</b></td><td><b>Default</b></td><td><b>Description</b></td></tr>
1588+
${row('w', '<i>required</i>', 'Width in pixels')}
1589+
${row('h', '<i>required</i>', 'Height in pixels')}
1590+
${row('count', '1', 'Number of images')}
1591+
${row('bpp', '1', 'Bits per pixel')}
1592+
${row('np', '1', 'Number of bitplanes (total colors = 2<sup>bpp&times;np</sup>)')}
1593+
${row('bpw', '8', 'Bits per word (8, 16, 32)')}
1594+
${row('sl', 'ceil(w&times;bpp/bpw)', 'Words per scanline (stride)')}
1595+
${row('brev', 'false', 'Bit reverse: true = MSB is leftmost pixel')}
1596+
${row('flip', 'false', 'Flip vertically (y=0 is bottom row)')}
1597+
${row('skip', '0', 'Skip bytes at start of each image')}
1598+
${row('pofs', 'sl&times;h&times;count', 'Offset between bitplanes')}
1599+
${row('remap', '&mdash;', 'Bit remapping table for address lines')}
1600+
${row('reindex', '&mdash;', 'Pixel-to-byte/bit remapping')}
1601+
${row('wpimg', 'sl&times;h', 'Words per image')}
1602+
${row('aspect', '1', 'Pixel aspect ratio for display')}
1603+
${row('xform', '&mdash;', 'CSS transform on canvas')}
1604+
<tr><th colspan="3">Palette Format</th></tr>
1605+
<tr><td><b>Field</b></td><td><b>Default</b></td><td><b>Description</b></td></tr>
1606+
${row('pal', '&mdash;', 'Palette: number (e.g. 332 = 3R,3G,2B) or name (nes, vcs, c64, ap2lores, astrocade)')}
1607+
${row('n', '&mdash;', 'Number of palette entries')}
1608+
${row('layout', '&mdash;', 'Palette editor layout (nes, astrocade)')}
1609+
<tr><th colspan="3">Examples</th></tr>
1610+
<tr><td colspan="2"><code>/*{w:8,h:8,bpp:1,brev:1}*/</code></td><td>8x8 1bpp, MSB first (NES-style)</td></tr>
1611+
<tr><td colspan="2"><code>;;{w:7,h:8};;</code></td><td>7x8 1bpp, LSB first (Apple II HGR)</td></tr>
1612+
<tr><td colspan="2"><code>/*{w:16,h:16,bpp:4,np:1}*/</code></td><td>16x16 4bpp</td></tr>
1613+
<tr><td colspan="2"><code>/*{pal:332,n:16}*/</code></td><td>16-entry RGB332 palette</pre></td></tr>
1614+
</table>`,
1615+
buttons: {
1616+
ok: { label: "OK", className: "btn-primary" }
1617+
},
1618+
size: "large"
1619+
});
1620+
}
1621+
15721622
function setupReplaySlider() {
15731623
var replayslider = $("#replayslider");
15741624
var clockslider = $("#clockslider");

0 commit comments

Comments
 (0)