goclips

package module
v0.5.0-alpha Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2023 License: MPL-2.0 Imports: 3 Imported by: 0

README

go-clips

Implementation of the entire MovieClip API in Go

Method Implementation Status

  • attachAudio
  • attachBitmap
  • attachMovie (stub implemented)
  • beginBitmapFill
  • beginFill
  • beginGradientFill
  • clear
  • createEmptyMovieClip
  • createTextField
  • curveTo
  • duplicateMovieClip
  • endFill
  • getBounds
  • getBytesLoaded
  • getBytesTotal
  • getDepth
  • getInstanceAtDepth
  • getNextHighestDepth
  • getRect
  • getSWFVersion
  • getTextSnapshot
  • getURL Won't Implement
  • globalToLocal
  • gotoAndPlay
  • gotoAndStop
  • hitTest
  • lineGradientStyle
  • lineStyle
  • lineTo
  • loadMovie SWF won't be supported
  • loadVariables
  • localToGlobal
  • moveTo
  • nextFrame partial
  • play
  • prevFrame
  • removeMovieClip
  • setMask
  • startDrag
  • stop
  • stopDrag
  • swapDepths
  • unloadMovie Maybe won't be implemented

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Root = MovieClip{
	Children: []MovieClip{},
	Events:   ClipFuncs{},
}

Root clip

View Source
var Successful = true

Functions

func CallEventFuncs

func CallEventFuncs(w screen.Window, eventFuncs *ClipFuncs)

func InitClips

func InitClips(events *ClipFuncs) bool

Initialize goclips, note that only MainLoop and event funcs get executed after this function is called Events is a pointer to a ClipFuncs struct, so that events can be added and removed on the fly

func MainLoop

func MainLoop(w screen.Window, eventFuncs *ClipFuncs) bool

Types

type ClipFuncs

type ClipFuncs struct {
	OnData           func()
	OnDragOut        func()
	OnDragOver       func()
	OnEnterFrame     func() (bool, bool)
	OnKeyDown        func()
	OnKeyUp          func()
	OnKillFocus      func(newFocus any)
	OnLoad           func()
	OnMouseDown      func()
	OnMouseMove      func()
	OnMouseUp        func()
	OnPress          func()
	OnRelease        func()
	OnReleaseOutside func()
	OnRollOut        func()
	OnRollOver       func()
	OnSetFocus       func()
	OnUnload         func()
}

holds clip events, for convienence

type EventID

type EventID int
const (
	OnDataID EventID = iota
	OnDragOutID
	OnDragOverID
	OnEnterFrameID
	OnKeyDownID
	OnKeyUpID
	OnKillFocusID
	OnLoadID
	OnMouseDownID
	OnMouseMoveID
	OnMouseUpID
	OnPressID
	OnReleaseID
	OnRollOutID
	OnRollOverID
	OnSetFocusID
	OnUnloadID
)

type MovieClip

type MovieClip struct {
	Children     []MovieClip
	Events       ClipFuncs
	InstanceName string
	Depth        int
	// contains filtered or unexported fields
}

MovieClip struct, do not create this yourself, instead use (MovieClip).CreateEmptyMovieClip

func (MovieClip) AttachMovie

func (this MovieClip) AttachMovie(id string, name string, depth int) *MovieClip

func (MovieClip) CreateEmptyMovieClip

func (this MovieClip) CreateEmptyMovieClip(instanceName string, depth int) *MovieClip

Creates an empty movie clip as a child of the current clip. Returns pointer to created clip. P.S. Yes, I know, you aren't supposed to use "this" as a reciever, but I'm trying to remain as close to the original flash version as possible

func (MovieClip) GetChild

func (this MovieClip) GetChild(childIndex int) *MovieClip

Gets a child clip

func (MovieClip) NextFrame

func (this MovieClip) NextFrame()

func (MovieClip) PassEventCallToChildren

func (this MovieClip) PassEventCallToChildren(event EventID, data any) (bool, bool)

type MovieClipIface

type MovieClipIface interface {
	CreateEmptyMovieClip()
	GetChild()
	NextFrame()
	PassEventCallToChildren()
}

Interface for movieclips

Jump to

Keyboard shortcuts

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