website
This commit is contained in:
1
core.cm
1
core.cm
@@ -728,7 +728,6 @@ return {
|
||||
|
||||
// Draw API
|
||||
load_model: load_model,
|
||||
recalc_model_textures: recalc_model_textures,
|
||||
make_cube: make_cube,
|
||||
make_sphere: make_sphere,
|
||||
make_cylinder: make_cylinder,
|
||||
|
||||
@@ -173,10 +173,6 @@ function _switch_to_style(new_style) {
|
||||
if (style == new_style) return
|
||||
style = new_style
|
||||
lance3d.switch_style(style)
|
||||
// Recalculate model textures for new style
|
||||
if (model) {
|
||||
lance3d.recalc_model_textures(model)
|
||||
}
|
||||
log.console("Switched to " + style + " style")
|
||||
}
|
||||
|
||||
|
||||
157
website/index.html
Normal file
157
website/index.html
Normal file
@@ -0,0 +1,157 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Manual</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Doto:wght@100..900&display=swap" rel="stylesheet">
|
||||
|
||||
|
||||
<style>
|
||||
:root {
|
||||
--bg-color: #fff;
|
||||
--text-color: #333;
|
||||
--border-color: #ddd;
|
||||
--code-bg: #f4f4f4;
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
:root {
|
||||
--bg-color: #000;
|
||||
--text-color: #fff;
|
||||
--border-color: #444;
|
||||
--code-bg: #222;
|
||||
}
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
display: flex;
|
||||
font-family: "Doto", sans-serif;
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
background-color: var(--bg-color);
|
||||
color: var(--text-color);
|
||||
}
|
||||
|
||||
code {
|
||||
font-family: "Doto", monospace;
|
||||
font-weight: 900;
|
||||
font-size: 0.8em;
|
||||
}
|
||||
|
||||
nav {
|
||||
width: 280px;
|
||||
padding: 1rem;
|
||||
border-right: 1px solid var(--border-color);
|
||||
overflow-y: auto;
|
||||
font-size: 0.9rem;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
height: 100vh;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
nav a {
|
||||
display: block;
|
||||
color: var(--text-color);
|
||||
text-decoration: none;
|
||||
margin: 0.25rem 0;
|
||||
}
|
||||
|
||||
nav a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
main {
|
||||
max-width: 900px;
|
||||
padding: 2rem;
|
||||
}
|
||||
|
||||
pre {
|
||||
white-space: pre-wrap;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
code {
|
||||
background: var(--code-bg);
|
||||
padding: 0.2em 0.4em;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
pre code {
|
||||
display: block;
|
||||
padding: 1rem;
|
||||
overflow-x: auto;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<!-- Sidebar (empty without JS) -->
|
||||
<nav id="toc"></nav>
|
||||
|
||||
<!-- Fallback: raw markdown is readable without JS -->
|
||||
<main>
|
||||
<pre id="fallback">
|
||||
Loading manual…
|
||||
|
||||
If JavaScript is disabled, the Markdown below is the documentation.
|
||||
</pre>
|
||||
</main>
|
||||
|
||||
<noscript>
|
||||
<style>
|
||||
nav { display: none; }
|
||||
</style>
|
||||
</noscript>
|
||||
|
||||
<!-- Progressive enhancement -->
|
||||
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
|
||||
<script>
|
||||
// Configure marked to handle line breaks
|
||||
marked.setOptions({
|
||||
breaks: true, // Convert \n to <br>
|
||||
gfm: true // GitHub Flavored Markdown
|
||||
});
|
||||
|
||||
fetch("manual.md")
|
||||
.then(r => r.text())
|
||||
.then(md => {
|
||||
// Replace fallback with rendered HTML
|
||||
const main = document.querySelector("main");
|
||||
main.innerHTML = marked.parse(md);
|
||||
|
||||
// Build TOC
|
||||
const toc = document.getElementById("toc");
|
||||
const headers = main.querySelectorAll("h1, h2, h3");
|
||||
|
||||
headers.forEach(h => {
|
||||
if (!h.id) {
|
||||
h.id = h.textContent
|
||||
.toLowerCase()
|
||||
.replace(/[^a-z0-9]+/g, "-")
|
||||
.replace(/^-|-$/g, "");
|
||||
}
|
||||
|
||||
const a = document.createElement("a");
|
||||
a.href = "#" + h.id;
|
||||
a.textContent = h.textContent;
|
||||
a.style.marginLeft =
|
||||
h.tagName === "H2" ? "1rem" :
|
||||
h.tagName === "H3" ? "2rem" : "0";
|
||||
|
||||
toc.appendChild(a);
|
||||
});
|
||||
})
|
||||
.catch(err => {
|
||||
document.getElementById("fallback").textContent =
|
||||
"Failed to load manual.md\n\n" + err;
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,21 +1,23 @@
|
||||
## Core API
|
||||
# Lance 3D
|
||||
|
||||
# Core API
|
||||
Set style ps1 / n64 / saturn
|
||||
|
||||
set_style("ps1" | "n64" | "saturn")
|
||||
|
||||
Get time since game boot, in seconds
|
||||
time()
|
||||
Get time since game boot, in seconds **time()**
|
||||
|
||||
Get runtime statistics
|
||||
|
||||
stat(name: "draw_calls" | "triangles" | "fps" | "memory_bytes")
|
||||
|
||||
log(...args: any)
|
||||
|
||||
```
|
||||
set_lighting({
|
||||
sun_dir: [0.3,-1,0.2], // normalized internally
|
||||
sun_color: [1,1,1], // rgb
|
||||
ambient: [0.25,0.25,0.25] // rgb
|
||||
})
|
||||
```
|
||||
|
||||
set_fog({
|
||||
enabled: false,
|
||||
Reference in New Issue
Block a user