gizzmo

package
v0.0.0-...-750f124 Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Alive int32 = iota
	Visited
	Next
	GRIDMOVER_COUNT
)
View Source
const (
	XAxis int = iota
	YAxis
	ZAxis
)
View Source
const Deepest float32 = 10000

Variables

View Source
var (
	Black   = color.RGBA{R: 0, G: 0, B: 0, A: 255}
	White   = color.RGBA{R: 255, G: 255, B: 255, A: 255}
	Red     = color.RGBA{R: 255, G: 0, B: 0, A: 255}
	Yellow  = color.RGBA{R: 255, G: 255, B: 0, A: 255}
	Green   = color.RGBA{R: 0, G: 255, B: 0, A: 255}
	Cyan    = color.RGBA{R: 0, G: 255, B: 255, A: 255}
	Blue    = color.RGBA{R: 0, G: 0, B: 255, A: 255}
	Magenta = color.RGBA{R: 255, G: 0, B: 255, A: 255}
)

Functions

func CompareDepths

func CompareDepths(zo, other DeepDrawer) int

func LoadGame

func LoadGame() (err error)

LoadGame reconstructs a game from the database. A game is selected from the top entry of the key stack file. The stack and database are created or updated at the end of the build process.

func NewLifeGridFromRecord

func NewLifeGridFromRecord(record *model.Record) model.Recorder

func NewLifeMoverFromRecord

func NewLifeMoverFromRecord(record *model.Record) model.Recorder

func SetupShape

func SetupShape[T any](sh *Shape[T], name string, classn int32,
	color color.RGBA, width float32, height float32, depth float32, custom ...float32)

func ShapeFromRecord

func ShapeFromRecord[T any](sh *Shape[T], record *model.Record)

Types

type Axis

type Axis struct {
	Position   float32
	Direction  float32
	LastUpdate float64 // seconds
	Extent     rl.Vector2
}

func (*Axis) Move

func (ax *Axis) Move(current, rate float64) float32

func (*Axis) Refresh

func (ax *Axis) Refresh(now float64, extent rl.Vector2)

func (*Axis) Setup

func (ax *Axis) Setup(now float64, min, max float32)

type Bounds

type Bounds struct {
	Width    rl.Vector2
	Height   rl.Vector2
	Depth    rl.Vector2
	Rotation rl.Vector2
}

type CellItemsOrg

type CellItemsOrg struct {
	Cols       int32
	Rows       int32
	Width      int32
	Height     int32
	SquareSize int32
	Playing    bool

	Colors []color.RGBA
	// contains filtered or unexported fields
}

type CellOrg

type CellOrg struct {
	Position rl.Vector2
	Size     rl.Vector2
	Alive    bool
	Next     bool
	Visited  bool
}

type CellsOrg

type CellsOrg struct {
	model.RecorderClass[CellItemsOrg]
}

func NewCellsOrg

func NewCellsOrg(width, height, squareSize int32) *CellsOrg

func NewCellsOrgFromRecord

func NewCellsOrgFromRecord(record *model.Record) *CellsOrg

func (*CellsOrg) Bounds

func (cs *CellsOrg) Bounds() rl.Vector4

func (*CellsOrg) Click

func (cs *CellsOrg) Click(x, y int32)

func (*CellsOrg) CountNeighbors

func (cs *CellsOrg) CountNeighbors(x, y int32) int

func (*CellsOrg) Draw

func (cs *CellsOrg) Draw(v rl.Vector4)

func (*CellsOrg) GetCells

func (cs *CellsOrg) GetCells() [][]*CellOrg

func (*CellsOrg) Input

func (cs *CellsOrg) Input()

func (*CellsOrg) Refresh

func (cs *CellsOrg) Refresh(float64, rl.Vector4, ...func(any))

func (*CellsOrg) SetColors

func (cs *CellsOrg) SetColors(aliveColor,
	visitedColor,
	gridColor color.RGBA)

func (*CellsOrg) Setup

func (cs *CellsOrg) Setup(clear bool)

func (*CellsOrg) Update

func (cs *CellsOrg) Update()

type DeepDrawer

type DeepDrawer struct {
	Depth  float32
	Drawer Drawer
}

func (*DeepDrawer) GetDepth

func (dp *DeepDrawer) GetDepth() float32

type Drawer

type Drawer interface {
	model.Recorder
	Bounds() rl.Vector4
	Refresh(now float64, rect rl.Vector4, funcs ...func(any))
	Draw(rl.Vector4)
}

type Ellipse

type Ellipse struct {
	Shape[EllipseItem]
}

func NewEllipse

func NewEllipse(rgba color.RGBA, width float32, height float32, depth float32) *Ellipse

func NewEllipseFromRecord

func NewEllipseFromRecord(record *model.Record) *Ellipse

func (*Ellipse) Draw

func (ell *Ellipse) Draw(v rl.Vector4)

type EllipseItem

type EllipseItem struct {
}

type Game

type Game struct {
	model.RecorderClass[GameItem]
	// contains filtered or unexported fields
}

func NewGameFromRecord

func NewGameFromRecord(record *model.Record) *Game

func (*Game) Actors

func (gs *Game) Actors() []Mover

func (*Game) AddActor

func (gs *Game) AddActor(a Mover, depth float32)

func (*Game) AddDrawer

func (gs *Game) AddDrawer(dr Drawer)

func (*Game) AddNotebooks

func (gs *Game) AddNotebooks(
	options *notebooks.OptionBook,
	capture *notebooks.CaptureBook)

func (*Game) BeginCapture

func (gs *Game) BeginCapture(mode string)

func (*Game) BuildDrawerList

func (gs *Game) BuildDrawerList()

BuildDrawerList of all drawers

func (*Game) BuildLists

func (gs *Game) BuildLists()

BuildLists for game operation

func (*Game) BuildNotes

func (gs *Game) BuildNotes()

func (*Game) BuildTextureList

func (gs *Game) BuildTextureList()

BuildTextureList of all textures from all drawers

func (*Game) CheckKeys

func (gs *Game) CheckKeys() notes.Command

func (*Game) CheckPad

func (gs *Game) CheckPad(padNum int32) notes.Command

func (*Game) Children

func (gs *Game) Children() (children []model.Recorder)

func (*Game) DrawStatus

func (gs *Game) DrawStatus()

func (*Game) Drawers

func (gs *Game) Drawers() []Drawer

func (*Game) Dump

func (game *Game) Dump()

func (*Game) EndCapture

func (gs *Game) EndCapture()

func (*Game) GetViewPort

func (gs *Game) GetViewPort() rl.Rectangle

func (*Game) LinkChild

func (gs *Game) LinkChild(recorder model.Recorder)

func (*Game) NewGameSetup

func (gs *Game) NewGameSetup(width, height, fps int32)

func (*Game) Options

func (gs *Game) Options() (options *notebooks.OptionBook)

func (*Game) ProcessInput

func (gs *Game) ProcessInput(repeatinterval float64,
	repeatCh <-chan float64, stop <-chan int)

func (*Game) Refresh

func (gs *Game) Refresh(current float64)

func (*Game) RefreshEnvironment

func (gs *Game) RefreshEnvironment()

main thread only

func (*Game) Run

func (gs *Game) Run()

func (*Game) Save

func (gs *Game) Save(data *gizzmodb.Data) (err error)

func (*Game) SetPad

func (gs *Game) SetPad(pad pad.PadG)

func (*Game) SetViewPort

func (gs *Game) SetViewPort(rw, rh float32) rl.Rectangle

func (*Game) SortDepthList

func (gs *Game) SortDepthList() []DeepDrawer

SortDepthList all drawers plus depth sorted by depth (ascending)

type GameItem

type GameItem struct {
	Title        string
	Description  string
	Rules        string
	Instructions string
	Author       string
	BuildTime    float64

	FixedWidth  float32
	FixedHeight float32
	FixedDepth  float32
	FixedSize   bool
	FrameRate   int64
	BackGround  color.RGBA // defaults to black

	CurrentFrameRate int64
	Width            float32
	Height           float32
	Depth            float32

	InputInterval   float64
	CaptureDelay    float64
	CaptureDuration float64

	Layout *layout.Layout

	OptionCurrent int32
	// contains filtered or unexported fields
}

type GridMover

type GridMover[T numbers.NumberType] struct {
	model.RecorderClass[GridMoverItem[T]]
}

func NewGridMover

func NewGridMover[T numbers.NumberType](bounds rl.Vector4, pixelRateX float64) *GridMover[T]

func (*GridMover[T]) AddDrawer

func (cm *GridMover[T]) AddDrawer(dr *NumberGrid[T])

func (*GridMover[T]) Bounds

func (cm *GridMover[T]) Bounds() rl.Vector4

func (*GridMover[T]) Children

func (cm *GridMover[T]) Children() []model.Recorder

func (*GridMover[T]) Click

func (cm *GridMover[T]) Click(clickX, clickY int32)

func (*GridMover[T]) CountNeighbors

func (cs *GridMover[T]) CountNeighbors(cellX, cellY int32) int

func (*GridMover[T]) Draw

func (cm *GridMover[T]) Draw(v rl.Vector4)

func (*GridMover[T]) GetDepth

func (cm *GridMover[T]) GetDepth() float32

func (*GridMover[T]) GetDrawer

func (cm *GridMover[T]) GetDrawer() Drawer

func (*GridMover[T]) Input

func (cm *GridMover[T]) Input()

INPUT

func (*GridMover[T]) LinkChild

func (cm *GridMover[T]) LinkChild(recorder model.Recorder)

func (*GridMover[T]) Move

func (cm *GridMover[T]) Move(can_move bool, now float64)

func (*GridMover[T]) Refresh

func (cm *GridMover[T]) Refresh(now float64, v rl.Vector4, f ...func(any))

func (*GridMover[T]) Update

func (cm *GridMover[T]) Update()

type GridMoverItem

type GridMoverItem[T numbers.NumberType] struct {
	Bounds     rl.Vector4
	PixelRateX float64
	Playing    bool
	// contains filtered or unexported fields
}

type HasDepth

type HasDepth interface {
	GetDepth() float32
}

type Inputer

type Inputer interface {
	Input()
}

type Motor

type Motor interface {
	Position() int32
	Direction() int32
	Move(current, rate float64) (position int32)
	Refresh(now float64, max int32)
}

type Mover

type Mover interface {
	model.Recorder
	Drawer
	Move(can_move bool, current float64)
	GetDrawer() Drawer
	GetDepth() float32
}

type NumberCell

type NumberCell[T numbers.NumberType] struct {
	States []T
}

func NewNumberCell

func NewNumberCell[T numbers.NumberType](states int) *NumberCell[T]

func (*NumberCell[T]) Clear

func (c *NumberCell[T]) Clear()

func (*NumberCell[T]) Get

func (c *NumberCell[T]) Get(i int32) T

func (*NumberCell[T]) Set

func (c *NumberCell[T]) Set(i int32, v T)

type NumberGrid

type NumberGrid[T numbers.NumberType] struct {
	model.RecorderClass[NumberGridItem[T]]
}

func NewGrid

func NewGrid[T numbers.NumberType](bounds rl.Vector4,
	columns, rows int32, horizontalColor color.RGBA, verticalColor color.RGBA,
	colors ...color.RGBA) *NumberGrid[T]

func (*NumberGrid[T]) Bounds

func (cs *NumberGrid[T]) Bounds() rl.Vector4

func (*NumberGrid[T]) Draw

func (cs *NumberGrid[T]) Draw(rl.Vector4)

func (*NumberGrid[T]) GetCells

func (cs *NumberGrid[T]) GetCells() [][]*NumberCell[T]

func (*NumberGrid[T]) Position

func (cs *NumberGrid[T]) Position(x, y int32) (int32, int32)

func (*NumberGrid[T]) PositionToCell

func (cs *NumberGrid[T]) PositionToCell(posX, posY int32) (x, y int32)

func (*NumberGrid[T]) Refresh

func (cs *NumberGrid[T]) Refresh(now float64, v rl.Vector4, funcs ...func(any))

func (*NumberGrid[T]) SetupCells

func (cs *NumberGrid[T]) SetupCells()

type NumberGridItem

type NumberGridItem[T numbers.NumberType] struct {
	Cols            int32
	Rows            int32
	CellWidth       int32
	CellHeight      int32
	Start           time.Time
	Duration        time.Duration
	HorizontalColor color.RGBA
	VerticalColor   color.RGBA
	StateColors     []color.RGBA

	StateCount int
	// contains filtered or unexported fields
}

type Pane

type Pane struct {
	model.RecorderClass[PaneItem]
}

func NewPane

func NewPane(rectangle rl.Rectangle) *Pane

func NewPaneFromRecord

func NewPaneFromRecord(record *model.Record) *Pane

type PaneItem

type PaneItem struct {
	Rectangle rl.Rectangle
}

type Player

type Player struct {
}

type ResizeState

type ResizeState int
const (
	RESIZE_SMALL ResizeState = iota
	RESIZE_NORMAL
	RESIZE_FULLSCREEN
	RESIZE_MINIMUM = RESIZE_SMALL
)

type Shape

type Shape[T any] struct {
	model.RecorderClass[ShapeItem[T]]
}

func (*Shape[T]) Bounds

func (sh *Shape[T]) Bounds() rl.Vector4

func (*Shape[T]) GetDepth

func (sh *Shape[T]) GetDepth() float32

func (*Shape[T]) Refresh

func (sh *Shape[T]) Refresh(now float64, v rl.Vector4, f ...func(any))

type ShapeItem

type ShapeItem[T any] struct {
	Color           color.RGBA
	Dimensions      rl.Vector4
	ScaleToScreen   bool
	KeepAspectRatio bool

	Custom T
}

type Texture

type Texture struct {
	Shape[TextureItem]
}

func NewTexture

func NewTexture(viewPort rl.Rectangle, path string, depth float32) *Texture

func NewTextureFromRecord

func NewTextureFromRecord(record *model.Record) (tex *Texture)

func (*Texture) Draw

func (tex *Texture) Draw(v rl.Vector4)

func (*Texture) Load

func (tex *Texture) Load() *Texture

func (*Texture) Unload

func (tex *Texture) Unload()

type TextureItem

type TextureItem struct {
	Resource model.Resource
	// contains filtered or unexported fields
}

type Tracker

type Tracker struct {
	model.RecorderClass[TrackerItem]
}

func NewTracker

func NewTracker(bounds rl.Vector4, rates rl.Vector4,
	minV rl.Vector3, maxV rl.Vector3) *Tracker

func NewTrackerFromRecord

func NewTrackerFromRecord(record *model.Record) *Tracker

func (*Tracker) AddDrawer

func (tr *Tracker) AddDrawer(dr Drawer)

func (*Tracker) Bounds

func (tr *Tracker) Bounds() rl.Vector4

func (*Tracker) Children

func (tr *Tracker) Children() []model.Recorder

func (*Tracker) Draw

func (tr *Tracker) Draw(v rl.Vector4)

func (*Tracker) GetDepth

func (tr *Tracker) GetDepth() float32

func (*Tracker) GetDrawer

func (tr *Tracker) GetDrawer() Drawer

func (*Tracker) LinkChild

func (tr *Tracker) LinkChild(recorder model.Recorder)

func (*Tracker) Move

func (tr *Tracker) Move(can_move bool, now float64)

func (*Tracker) Refresh

func (tr *Tracker) Refresh(now float64, bounds rl.Vector4, fs ...func(any))

type TrackerItem

type TrackerItem struct {
	Bounds       rl.Vector4
	Position     rl.Vector4
	Source       rl.Vector4
	PixelRateX   float64
	PixelRateY   float64 // pixels per second
	PixelRateZ   float64 // pixels per second
	Rotation     float32
	RotationRate float32
	Axes         [3]Axis
	// contains filtered or unexported fields
}

type ViewPort

type ViewPort struct {
	Width  float32
	Height float32
	Depth  float32
	Spin   float32
}

func (*ViewPort) FromVector4

func (vp *ViewPort) FromVector4(v rl.Vector4)

Jump to

Keyboard shortcuts

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