Skip to content

Instantly share code, notes, and snippets.

assume() starts the context for setting defaults, so assume().format(...) sets a default format
mark(ms) starts the script step context, saying, at time ms, do the action
then() just continues the previous mark
head() is a custom action, not a built-in, it clears the existing column and puts a headline up.
sketch() is a built-in, it will cause the following actor to be sketched.
letters() is a custom object(), creating a text and modifying it.
group(), name(), at() and format() are all built-ins, all objects support them.
private Step stack2()
{
@GeePawHill
GeePawHill / gist:e5a0a87acaa30b1bbce7c1a02a82e4b6
Created July 18, 2017 19:28
Existing code to draw stack screen.
private Step stack()
{
buildPhrase();
head("A Program's Stack");
drawStack();
mark(22);
head("The Household Program");
Pattern is context().action().object().
assume() starts the context for setting defaults, so assume().format(...) sets a default format
mark(ms) starts the script step context, saying, at time ms, do the action
then() just continues the previous mark
head() is a custom action, not a built-in, it clears the existing column and puts a headline up.
sketch() is a built-in, it will cause the following actor to be sketched.
letters() is a custom object(), creating a text and modifying it.
group(), name(), at() and format() are all built-ins, all objects support them.
Actors allButOvals = new Actors();
buildPhrase();
clear();
head("Dependencies");
mark(146);
OvalText thrower = new OvalText("Thrower", new Point(1000d, 200d), commentFormat);
sketch(1000d, thrower);
OvalText catcher = new OvalText("Catcher", new Point(1500d, 200d), commentFormat);
sketch(1000d, catcher);
Spot throwerSpot = new Spot(1000d, 850d);
Desired code inside a thing that writes scripts:
Script writeIt()
{
Format boxFormat = new Format(...);
LabelBox box1 = new LabelBox("Box 1", new Point(400d,400d), boxFormat);
LabelBox box2 = new LabelBox("Box 2", new Point(600d,600d), boxFormat);
Arrow arrow = new Arrow(box1,false,box2,true,boxFormat):
// here's the script proper
cue(3); // wait until the clock says it's 3.
package org.geepawhill.whiteboard.action;
import javafx.geometry.Bounds;
import javafx.scene.Node;
import javafx.scene.layout.Pane;
import javafx.scene.paint.Color;
import javafx.scene.shape.Rectangle;
public class EnterBoundsBox implements Action
{
package org.geepawhill.whiteboard.action;
import javafx.animation.Transition;
import javafx.geometry.Bounds;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.Pane;
import javafx.scene.paint.Color;
import javafx.scene.text.Font;
import javafx.scene.text.Text;
import javafx.scene.text.TextAlignment;
package org.geepawhill.whiteboard.util;
import javafx.geometry.Bounds;
import javafx.geometry.Point2D;
import javafx.scene.Node;
import javafx.scene.shape.Rectangle;
public class PointPair
{