gblocks

package module
v0.0.0-...-56ca850 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 13, 2021 License: MIT Imports: 10 Imported by: 0

README

gblocks

A gopherjs wrapper for Blockly.

The impetuous for this library is to provide a visual editor for iffy - an interactive fiction engine. Gblocks, the editor, and iffy are all works in progress.

NOTE: I've archived this project. After working with Blockly for quite a while, and on this adapter, I don't feel it's the best match for iffy. If i had the time for both projects, I would love to make this more usable. Blockly is a great tool for certain uses.

Goals

  1. Define blocks using Go-lang types.
  2. Simplify mutations to reduce the need for per-block custom code.
  3. Build toolboxes from Go-lang instances.
  4. Mirror Go-lang data to/from Blocky blocks ( to provide alternative serialization and processing. )

In progress

  • refactor to omit mirror: esp. domToMutation, mutationToDom, decompose, compose, saveConnections, toolbox instance generation.
    • this should fix the issues with temporary blocks on flyouts not being able to mirror properly.
  • consider changing mutation lists to next/prev to properly handle the first block check statements in mutation ui
  • consider changing registration to implicitly register blocks via toolbox, and mutation palette definitions
  • evaluate possibly unification of compose and domToMutation in some fashion.
  • future: re-enable mirroring

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Maker

type Maker struct {
	// contains filtered or unexported fields
}

func NewMaker

func NewMaker(pairs enum.Pairs, mutations tin.Mutations, types []*tin.TypeInfo) *Maker

func (*Maker) GetPairs

func (m *Maker) GetPairs(n string) []enum.Pair

func (*Maker) GetStatements

func (m *Maker) GetStatements(n string) (block.Limits, error)

func (*Maker) GetStatementsByType

func (m *Maker) GetStatementsByType(t r.Type) block.Limits

func (*Maker) GetTerms

func (m *Maker) GetTerms(n string) (block.Limits, error)

func (*Maker) GetTermsByType

func (m *Maker) GetTermsByType(t r.Type) block.Limits

func (*Maker) RegisterBlocks

func (m *Maker) RegisterBlocks(p block.Project, mbs *mutant.MutatedBlocks, opts map[string]block.Dict) (err error)

submit all previously added blocks to a blockly-like project. mbs is the target for user generated mutation instance data ( where these blocks will write to if necessary ) opts contains per-block type extra options.

type TypeCollector

type TypeCollector struct {
	// contains filtered or unexported fields
}

provide a sink ( similar to gblocks.TypeCollector ) to collect blocks visited during toolbox creation

func NewTypeCollector

func NewTypeCollector(names UniqueNames) *TypeCollector

func (*TypeCollector) AddStatement

func (tc *TypeCollector) AddStatement(ptr interface{}) *TypeCollector

you're either a statement, which can contain input terms; or you're a term, which can contain input statements. fix: used for testing only; public b/c system tests are in a different package

func (*TypeCollector) AddTerm

func (tc *TypeCollector) AddTerm(ptr interface{}) *TypeCollector

you're either a term, which can contain input statements; or you're statement, which can contain input terms. fix: used for testing only; public b/c system tests are in a different package

func (*TypeCollector) AddTopStatement

func (tc *TypeCollector) AddTopStatement(ptr interface{}) *TypeCollector

a top statement is a statement with no previous connection. fix: used for testing only; public b/c system tests are in a different package

func (*TypeCollector) GetTypes

func (tc *TypeCollector) GetTypes() (ret []*tin.TypeInfo, err error)

func (*TypeCollector) NewBlocks

func (tc *TypeCollector) NewBlocks() *toolbox.Builder

return a toolbox builder which registers blocks to this maker

func (*TypeCollector) NewShadows

func (tc *TypeCollector) NewShadows(s toolbox.Shadowing) *toolbox.Builder

return a toolbox builder which registers blocks to this maker same as: TypeCollector.NewBlocks(toolbox.SubShadow)

type UniqueNames

type UniqueNames interface{ GenerateUniqueName() string }

Directories

Path Synopsis
Package blockly wraps google's blocky javascript api for use with gopherjs.
Package blockly wraps google's blocky javascript api for use with gopherjs.
extremely minimial wrapper for javascript dom
extremely minimial wrapper for javascript dom
package test provides structures and defintions for testing
package test provides structures and defintions for testing
Package tin provides blockly like information for golang types
Package tin provides blockly like information for golang types

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL