mirror of
https://github.com/litruv/picoGraph.git
synced 2026-07-24 10:46:06 +10:00
Add initial Pico-8 cartridges for testing
- Created test_cart.p8 with basic drawing functionality and a print statement. - Created test_unix.p8 with a simple initialization function.
This commit is contained in:
41
scripts/nodes/library/math/add.js
Normal file
41
scripts/nodes/library/math/add.js
Normal file
@@ -0,0 +1,41 @@
|
||||
import { createNodeModule } from "../../nodeTypes.js";
|
||||
|
||||
/**
|
||||
* Adds two numeric values.
|
||||
*/
|
||||
export const mathAddNode = createNodeModule(
|
||||
{
|
||||
id: "math_add",
|
||||
title: "Add",
|
||||
category: "Math",
|
||||
description: "Add two numbers.",
|
||||
searchTags: ["add", "math", "sum", "plus", "number", "+"],
|
||||
inputs: [
|
||||
{
|
||||
id: "a",
|
||||
name: "A",
|
||||
direction: "input",
|
||||
kind: "number",
|
||||
defaultValue: 0,
|
||||
},
|
||||
{
|
||||
id: "b",
|
||||
name: "B",
|
||||
direction: "input",
|
||||
kind: "number",
|
||||
defaultValue: 0,
|
||||
},
|
||||
],
|
||||
outputs: [
|
||||
{ id: "res", name: "Result", direction: "output", kind: "number" },
|
||||
],
|
||||
properties: [],
|
||||
},
|
||||
{
|
||||
evaluateValue: ({ resolveValueInput }) => {
|
||||
const a = resolveValueInput("a", "0");
|
||||
const b = resolveValueInput("b", "0");
|
||||
return `(${a}) + (${b})`;
|
||||
},
|
||||
}
|
||||
);
|
||||
41
scripts/nodes/library/math/divide.js
Normal file
41
scripts/nodes/library/math/divide.js
Normal file
@@ -0,0 +1,41 @@
|
||||
import { createNodeModule } from "../../nodeTypes.js";
|
||||
|
||||
/**
|
||||
* Divides one numeric value by another.
|
||||
*/
|
||||
export const mathDivideNode = createNodeModule(
|
||||
{
|
||||
id: "math_divide",
|
||||
title: "Divide",
|
||||
category: "Math",
|
||||
description: "Divide one number by another (floating point division).",
|
||||
searchTags: ["divide", "division", "math", "slash", "number", "/"],
|
||||
inputs: [
|
||||
{
|
||||
id: "a",
|
||||
name: "A",
|
||||
direction: "input",
|
||||
kind: "number",
|
||||
defaultValue: 0,
|
||||
},
|
||||
{
|
||||
id: "b",
|
||||
name: "B",
|
||||
direction: "input",
|
||||
kind: "number",
|
||||
defaultValue: 1,
|
||||
},
|
||||
],
|
||||
outputs: [
|
||||
{ id: "res", name: "Result", direction: "output", kind: "number" },
|
||||
],
|
||||
properties: [],
|
||||
},
|
||||
{
|
||||
evaluateValue: ({ resolveValueInput }) => {
|
||||
const a = resolveValueInput("a", "0");
|
||||
const b = resolveValueInput("b", "1");
|
||||
return `(${a}) / (${b})`;
|
||||
},
|
||||
}
|
||||
);
|
||||
@@ -1,3 +1,7 @@
|
||||
import { mathAddNode } from "./add.js";
|
||||
import { mathSubtractNode } from "./subtract.js";
|
||||
import { mathMultiplyNode } from "./multiply.js";
|
||||
import { mathDivideNode } from "./divide.js";
|
||||
import { mathMaxNode } from "./max.js";
|
||||
import { mathMinNode } from "./min.js";
|
||||
import { mathMidNode } from "./mid.js";
|
||||
@@ -25,6 +29,10 @@ import { mathDivNode } from "./div.js";
|
||||
* All math-related node modules backed by PICO-8 helpers.
|
||||
*/
|
||||
export const mathNodes = [
|
||||
mathAddNode,
|
||||
mathSubtractNode,
|
||||
mathMultiplyNode,
|
||||
mathDivideNode,
|
||||
mathMaxNode,
|
||||
mathMinNode,
|
||||
mathMidNode,
|
||||
@@ -54,6 +62,10 @@ export const mathNodes = [
|
||||
* @type {Array<{ function: string, nodeId: string, implemented: boolean }>}
|
||||
*/
|
||||
export const mathFunctionChecklist = [
|
||||
{ function: "+", nodeId: "math_add", implemented: true },
|
||||
{ function: "-", nodeId: "math_subtract", implemented: true },
|
||||
{ function: "*", nodeId: "math_multiply", implemented: true },
|
||||
{ function: "/", nodeId: "math_divide", implemented: true },
|
||||
{ function: "MAX", nodeId: "math_max", implemented: true },
|
||||
{ function: "MIN", nodeId: "math_min", implemented: true },
|
||||
{ function: "MID", nodeId: "math_mid", implemented: true },
|
||||
|
||||
41
scripts/nodes/library/math/multiply.js
Normal file
41
scripts/nodes/library/math/multiply.js
Normal file
@@ -0,0 +1,41 @@
|
||||
import { createNodeModule } from "../../nodeTypes.js";
|
||||
|
||||
/**
|
||||
* Multiplies two numeric values.
|
||||
*/
|
||||
export const mathMultiplyNode = createNodeModule(
|
||||
{
|
||||
id: "math_multiply",
|
||||
title: "Multiply",
|
||||
category: "Math",
|
||||
description: "Multiply two numbers.",
|
||||
searchTags: ["multiply", "product", "math", "times", "*"],
|
||||
inputs: [
|
||||
{
|
||||
id: "a",
|
||||
name: "A",
|
||||
direction: "input",
|
||||
kind: "number",
|
||||
defaultValue: 0,
|
||||
},
|
||||
{
|
||||
id: "b",
|
||||
name: "B",
|
||||
direction: "input",
|
||||
kind: "number",
|
||||
defaultValue: 0,
|
||||
},
|
||||
],
|
||||
outputs: [
|
||||
{ id: "res", name: "Result", direction: "output", kind: "number" },
|
||||
],
|
||||
properties: [],
|
||||
},
|
||||
{
|
||||
evaluateValue: ({ resolveValueInput }) => {
|
||||
const a = resolveValueInput("a", "0");
|
||||
const b = resolveValueInput("b", "0");
|
||||
return `(${a}) * (${b})`;
|
||||
},
|
||||
}
|
||||
);
|
||||
41
scripts/nodes/library/math/subtract.js
Normal file
41
scripts/nodes/library/math/subtract.js
Normal file
@@ -0,0 +1,41 @@
|
||||
import { createNodeModule } from "../../nodeTypes.js";
|
||||
|
||||
/**
|
||||
* Subtracts one numeric value from another.
|
||||
*/
|
||||
export const mathSubtractNode = createNodeModule(
|
||||
{
|
||||
id: "math_subtract",
|
||||
title: "Subtract",
|
||||
category: "Math",
|
||||
description: "Subtract one number from another.",
|
||||
searchTags: ["subtract", "math", "minus", "difference", "-"],
|
||||
inputs: [
|
||||
{
|
||||
id: "a",
|
||||
name: "A",
|
||||
direction: "input",
|
||||
kind: "number",
|
||||
defaultValue: 0,
|
||||
},
|
||||
{
|
||||
id: "b",
|
||||
name: "B",
|
||||
direction: "input",
|
||||
kind: "number",
|
||||
defaultValue: 0,
|
||||
},
|
||||
],
|
||||
outputs: [
|
||||
{ id: "res", name: "Result", direction: "output", kind: "number" },
|
||||
],
|
||||
properties: [],
|
||||
},
|
||||
{
|
||||
evaluateValue: ({ resolveValueInput }) => {
|
||||
const a = resolveValueInput("a", "0");
|
||||
const b = resolveValueInput("b", "0");
|
||||
return `(${a}) - (${b})`;
|
||||
},
|
||||
}
|
||||
);
|
||||
Reference in New Issue
Block a user