Documentation ¶
Index ¶
- Constants
- func Clear()
- func GetRandomString() string
- func MarshalBool(val bool) string
- func MarshalInterfaceArray(vals []interface{}) string
- func MarshalStringArray(vals []string) string
- type BroadcastMessage
- type FS
- type List
- type ScratchAsset
- type ScratchBlock
- type ScratchComment
- type ScratchCostume
- type ScratchField
- type ScratchInput
- func NewScratchInputNoShadow(val string) ScratchInput
- func NewScratchInputNoShadowBlock(val ScratchValue) ScratchInput
- func NewScratchInputObscured(val ScratchValue, below ScratchValue) ScratchInput
- func NewScratchInputShadow(val ScratchValue) ScratchInput
- func NewScratchInputStack(firstId string) ScratchInput
- type ScratchMetadata
- type ScratchMonitor
- type ScratchMutation
- type ScratchProject
- type ScratchSound
- type ScratchSprite
- type ScratchStage
- type ScratchTarget
- type ScratchTargetBase
- type ScratchValue
- func NewScratchAngle(val int) ScratchValue
- func NewScratchBlockInput(id string) ScratchValue
- func NewScratchBroadcast(name, id string) ScratchValue
- func NewScratchColor(hex string) ScratchValue
- func NewScratchFloat(val float64) ScratchValue
- func NewScratchInt(val int) ScratchValue
- func NewScratchList(name, id string) ScratchValue
- func NewScratchPosFloat(val float64) ScratchValue
- func NewScratchPosInt(val int) ScratchValue
- func NewScratchString(val string) ScratchValue
- func NewScratchVariable(name, id string) ScratchValue
- type ScratchVariableValue
- type Value
- type Variable
Constants ¶
View Source
const ( ScratchResolutionX = 480 ScratchResolutionY = 360 MaxBitmapResolution = 2 )
Variables ¶
This section is empty.
Functions ¶
func GetRandomString ¶
func GetRandomString() string
func MarshalBool ¶
func MarshalInterfaceArray ¶
func MarshalInterfaceArray(vals []interface{}) string
func MarshalStringArray ¶
Types ¶
type BroadcastMessage ¶
type BroadcastMessage struct { Name string // contains filtered or unexported fields }
func NewScratchBroadcastMessage ¶
func NewScratchBroadcastMessage(name, id string) *BroadcastMessage
func (*BroadcastMessage) ScratchID ¶
func (b *BroadcastMessage) ScratchID() string
type List ¶
type List struct { Name string InitialValues []interface{} Local bool // contains filtered or unexported fields }
func (*List) SetScratchListID ¶
func (*List) SetScratchSpriteName ¶
func (*List) SpriteName ¶
type ScratchAsset ¶
type ScratchBlock ¶
type ScratchBlock struct { Opcode string `json:"opcode"` Next *string `json:"next"` // string or null, id of next Parent *string `json:"parent"` // string or null - from scratch wiki: If the block is a stack block and is preceded, this is the ID of the preceding block. If the block is the first stack block in a C mouth, this is the ID of the C block. If the block is an input to another block, this is the ID of that other block. Otherwise it is null. Inputs map[string]ScratchInput `json:"inputs"` // map[inputName]InputValue, use Shadow for constand and Obscured for block in it Fields map[string]ScratchField `json:"fields"` // map[fieldName]FieldValue Shadow bool `json:"shadow"` TopLevel bool `json:"topLevel"` // False if the block has a parent and true otherwise. Mutation *ScratchMutation `json:"mutation,omitempty"` X *int `json:"x,omitempty"` // If toplevel Y *int `json:"y,omitempty"` Comment *string `json:"comment,omitempty"` // ID of comment if it has one }
type ScratchComment ¶
type ScratchCostume ¶
type ScratchCostume struct { ScratchAsset BitmapResolution int `json:"bitmapResolution"` // Usually 1 RotationCenterX int `json:"rotationCenterX"` RotationCenterY int `json:"rotationCenterY"` }
type ScratchField ¶
type ScratchField interface {
// contains filtered or unexported methods
}
func NewScratchFieldBroadcast ¶
func NewScratchFieldBroadcast(name, id string) ScratchField
func NewScratchFieldString ¶
func NewScratchFieldString(val string) ScratchField
func NewScratchValueFieldVariable ¶
func NewScratchValueFieldVariable(name, id string) ScratchField
type ScratchInput ¶
type ScratchInput []interface{}
func NewScratchInputNoShadow ¶
func NewScratchInputNoShadow(val string) ScratchInput
func NewScratchInputNoShadowBlock ¶
func NewScratchInputNoShadowBlock(val ScratchValue) ScratchInput
func NewScratchInputObscured ¶
func NewScratchInputObscured(val ScratchValue, below ScratchValue) ScratchInput
func NewScratchInputShadow ¶
func NewScratchInputShadow(val ScratchValue) ScratchInput
func NewScratchInputStack ¶
func NewScratchInputStack(firstId string) ScratchInput
type ScratchMetadata ¶
type ScratchMonitor ¶
type ScratchMonitor struct { // Data ID string `json:"id"` // ID of variable it shows Mode string `json:"mode"` // Default, Large, Slider, List Opcode string `json:"opcode"` // Seems to be `data_variable` or `data_listcontents` Params map[string]string `json:"params"` // Parameters, can have VARIABLE => variable name, LIST => list name SpriteName *string `json:"spriteName"` // Name of sprite its associated to, can be null or string Value interface{} `json:"value"` // Value on monitor // Characteristics Width int `json:"width"` Height int `json:"height"` X int `json:"x"` Y int `json:"y"` Visible bool `json:"visible"` // Slider SliderMin *int `json:"sliderMin,omitempty"` SliderMax *int `json:"sliderMax,omitempty"` IsDiscrete bool `json:"isDiscrete"` // Does slider allow integer values? }
type ScratchMutation ¶
type ScratchMutation struct { TagName string `json:"tagName"` // always "mutation" Children []bool `json:"children"` // seems to be just an empty array ProcCode *string `json:"proccode,omitempty"` // name of block, has parameters in it like "add %s %s label %b" where %s is string/number and %b is boolean ArgumentIDs *string `json:"argumentids,omitempty"` // []string, but marshal with JSON (use MarshalStringArray) ArgumentNames *string `json:"argumentnames,omitempty"` // []string, but marshal with JSON (use MarshalStringArray) ArgumentDefaults *string `json:"argumentdefaults,omitempty"` // []interface{}, but marshal each element with JSON into []string and then marshal that with JSON (use MarshalInterfaceArray) Warp *string `json:"warp,omitempty"` // run without screen refresh? (string of bool, with JSON) HasNext *string `json:"hasnext,omitempty"` // bool, marshal into JSON }
type ScratchProject ¶
type ScratchProject struct { Targets []ScratchTarget `json:"targets"` Monitors []ScratchMonitor `json:"monitors"` Extensions []string `json:"extensions"` Metadata ScratchMetadata `json:"meta"` }
type ScratchSound ¶
type ScratchSound struct { ScratchAsset Format string `json:"format"` // Not sure what this is, seems to be an empty string Rate int `json:"rate"` // Sampling rate in hertz SampleCount int `json:"sampleCount"` // Sample count of WAV }
type ScratchSprite ¶
type ScratchSprite struct { ScratchTargetBase LayerOrder int `json:"layerOrder"` // Layer on screen X int `json:"x"` Y int `json:"y"` Size int `json:"size"` // 0-100 percent, can go past 100 to scale up Direction int `json:"direction"` // degrees Draggable bool `json:"draggable"` RotationStyle string `json:"rotationStyle"` // Scratch rotation style, can be `all around`, `left-right`, and `don't rotate` Visible bool `json:"visible"` }
type ScratchStage ¶
type ScratchStage struct { ScratchTargetBase TextToSpeechLanguage *string `json:"textToSpeechLanguage"` // string or null VideoState string `json:"videoState"` // seems to be "on" always }
type ScratchTarget ¶
type ScratchTarget interface {
// contains filtered or unexported methods
}
type ScratchTargetBase ¶
type ScratchTargetBase struct { IsStage bool `json:"isStage"` Name string `json:"name"` Variables map[string]ScratchVariableValue `json:"variables"` Lists map[string]ScratchVariableValue `json:"lists"` Broadcasts map[string]string `json:"broadcasts"` // map[id]name, is an empty map on everything but stage Blocks map[string]ScratchBlock `json:"blocks"` // map[id]block Comments map[string]ScratchComment `json:"comments"` // map[id]comment CurrentCostume int `json:"currentCostume"` Costumes []ScratchCostume `json:"costumes"` Sounds []ScratchSound `json:"sounds"` Volume int `json:"volume"` }
type ScratchValue ¶
type ScratchValue interface {
// contains filtered or unexported methods
}
func NewScratchAngle ¶
func NewScratchAngle(val int) ScratchValue
func NewScratchBlockInput ¶
func NewScratchBlockInput(id string) ScratchValue
func NewScratchBroadcast ¶
func NewScratchBroadcast(name, id string) ScratchValue
func NewScratchFloat ¶
func NewScratchFloat(val float64) ScratchValue
func NewScratchInt ¶
func NewScratchInt(val int) ScratchValue
func NewScratchList ¶
func NewScratchList(name, id string) ScratchValue
func NewScratchPosFloat ¶
func NewScratchPosFloat(val float64) ScratchValue
func NewScratchPosInt ¶
func NewScratchPosInt(val int) ScratchValue
func NewScratchString ¶
func NewScratchString(val string) ScratchValue
func NewScratchVariable ¶
func NewScratchVariable(name, id string) ScratchValue
type ScratchVariableValue ¶
type ScratchVariableValue []interface{} // name (string), value (int, string, list, etc.)
type Value ¶
type Value interface {
Build() ScratchInput
}
type Variable ¶
type Variable struct { Name string InitialValue interface{} Local bool // contains filtered or unexported fields }
func (*Variable) SetScratchID ¶
func (*Variable) SetScratchSpriteName ¶
func (*Variable) SpriteName ¶
Click to show internal directories.
Click to hide internal directories.