Skip to content

Instantly share code, notes, and snippets.

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
{
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.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
{
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.
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);
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.
@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");
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:df8fd05fd503098a1635d0a06b94c138
Created July 19, 2017 05:34
Fluent script code that's extensible by adding new things to build and extensible by adding new generic and custom builder API's with no dup.
package org.geepawhill.contentment.script;
public class FluentScriptBuilder
{
///////////////////////////////////////////////////////////////////////////////
// This class and following function just get a line started
static class MarkContext
{
// pretend convenience method for super-common agent-type 'Letters'.
@GeePawHill
GeePawHill / gist:ee786e0a653893403be98f806a4559a1
Created January 9, 2018 19:41
My (Current 1\1\2018) Twenty-Five Most Beloved Novels
(In no particular order)
Nancy Willard -- Things Invisible To See
CJ Cherryh -- Cuckoo's Egg
David Foster Wallace -- Infinite Jest
John Sayles -- Pride of the Bimbos
George Eliot -- Middlemarch
Neal Stephenson -- Snow Crash
Vladimir Nabokov -- Lolita
Marilynn Robinson -- Housekeeping