mirror of
https://github.com/litruv/picoGraph.git
synced 2026-07-24 10:46:06 +10:00
Initial commit
moved from private version control
This commit is contained in:
32
scripts/nodes/library/graphics/cls.js
Normal file
32
scripts/nodes/library/graphics/cls.js
Normal file
@@ -0,0 +1,32 @@
|
||||
import { createNodeModule } from "../../nodeTypes.js";
|
||||
|
||||
/**
|
||||
* Clears the screen and resets clipping.
|
||||
*/
|
||||
export const clsNode = createNodeModule(
|
||||
{
|
||||
id: "graphics_cls",
|
||||
title: "Clear Screen",
|
||||
category: "Graphics",
|
||||
description: "Clear the display, optionally filling with a specific color.",
|
||||
searchTags: ["cls", "clear", "screen", "background"],
|
||||
inputs: [
|
||||
{ id: "exec_in", name: "Exec", direction: "input", kind: "exec" },
|
||||
{ id: "color", name: "Color", direction: "input", kind: "number" },
|
||||
],
|
||||
outputs: [
|
||||
{ id: "exec_out", name: "Exec", direction: "output", kind: "exec" },
|
||||
],
|
||||
properties: [],
|
||||
},
|
||||
{
|
||||
emitExec: ({ indent, indentLevel, resolveValueInput, emitNextExec }) => {
|
||||
const OMIT = "__pg_omit__";
|
||||
const color = resolveValueInput("color", OMIT);
|
||||
const call = color === OMIT ? "cls()" : `cls(${color})`;
|
||||
const lines = [`${indent(indentLevel)}${call}`];
|
||||
lines.push(...emitNextExec("exec_out"));
|
||||
return lines;
|
||||
},
|
||||
}
|
||||
);
|
||||
Reference in New Issue
Block a user