film

package module
v0.0.0-...-1f52f27 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2020 License: MIT Imports: 19 Imported by: 0

README

basicly-go-forth-film

golang code to generate a short experimental film

Documentation

Overview

BASICLY GO FORTH mencoder mf://*.png -mf w=1280:h=720:fps=60:type=png -ovc copy -oac copy -o output.avi

BASICLY GO FORTH the STORY of how a GEEK with no artistic skills CODES his way through LIFE mencoder mf://*.png -mf w=1280:h=720:fps=60:type=png -ovc copy -oac copy -o output.avi

Index

Constants

View Source
const (
	W = 1280
	H = 720
)
View Source
const BAMA = "" /* 277-byte string literal not displayed */
View Source
const Credits = `` /* 745-byte string literal not displayed */
View Source
const FPS = 30
View Source
const WhenToStartTerm2 = 9200

const WhenToStartTerm2 = 1000

View Source
const WhenToStartTerm3 = 9800

Variables

View Source
var (
	BLACK       = C.RGB(0, 0, 0)
	LIGHT_GRAY  = C.RGB(50, 50, 50)
	LIGHT_GREEN = C.RGB(10, 150, 10)
	GREEN       = C.RGB(20, 250, 20)
	BLUE        = C.RGB(20, 20, 250)
	YELLOW      = C.RGB(250, 250, 20)
	WHITE       = C.RGB(250, 250, 250)
	ORANGE      = C.RGB(250, 120, 20)
	RED         = C.RGB(250, 0, 0)
)
View Source
var HEADER = flag.Bool("h", false, "produce header")
View Source
var M_CELL = regexp.MustCompile(`^([a-z])([0-9]+)$`).FindStringSubmatch
View Source
var M_WAIT = regexp.MustCompile(`^([-+@])([0-9]+)$`).FindStringSubmatch
View Source
var N = flag.Int("n", 720, "frames to generate")
View Source
var PeriVec = MakePerimeterVec()
View Source
var TAIL = flag.Bool("t", false, "produce trailer")

Functions

func Atoi

func Atoi(s string) int

func Check

func Check(err error)

func CreateFrame

func CreateFrame(t int, can *C.Canvas, term *Term) bool

func CreateSlate

func CreateSlate()

func DrawMorse

func DrawMorse(can *C.Canvas)

func Export

func Export(can *C.Canvas, filename string)

func Main

func Main()

func Move

func Move(speed, lx, ly, px, py int, z *[]Point)

func Must

func Must(b bool)

func NewRand

func NewRand(seed int64) *rand.Rand

func RunBasic

func RunBasic(program string) string

func RunCredits

func RunCredits(can *C.Canvas)

func RunTerm

func RunTerm()

func Scribble

func Scribble(x0, y0 int, s string, mag int, clr C.Color, can *C.Canvas)

func Times

func Times(n int, fn func())

func WriteHeaderFrames

func WriteHeaderFrames(img image.Image, secs int, prefix rune)

Types

type Dart

type Dart struct {
	X, Y    float64
	DX, DY  float64
	Disable bool
}

type FloatingTriangle

type FloatingTriangle struct {
	X1, Y1, X2, Y2, X3, Y3 int
	R                      *rand.Rand
}

func NewFloatingTriangle

func NewFloatingTriangle(a int) *FloatingTriangle

func (*FloatingTriangle) Paint

func (o *FloatingTriangle) Paint(clr C.Color, can *C.Canvas)

func (*FloatingTriangle) Step

func (o *FloatingTriangle) Step(n int)

type Keystroke

type Keystroke struct {
	Bytes []byte
	Pos   int
}

Keystroke is a source of keystrokes, which the Step method returns.

var KSSquares *Keystroke

KSSquares is a an instance of Keystroke that emits squares of the naturals.

func NewKeystroke

func NewKeystroke(s string) *Keystroke

func (*Keystroke) Step

func (o *Keystroke) Step() byte

type Lambda

type Lambda func(t *Term, s *Sprite) bool // Return true if this step is done.

func (Lambda) Step

func (lam Lambda) Step(t *Term, s *Sprite) bool

type Life

type Life struct {
	Slot []byte
	W, H int
}

func NewLife

func NewLife(w, h int, initial []Point) *Life

func (*Life) Paint

func (o *Life) Paint(x, y int, clr C.Color, can *C.Canvas)

func (*Life) Step

func (o *Life) Step() *Life

type Monster

type Monster struct {
	Char  byte
	X, Y  int
	Shape []Point // extra shape besides the center point.
}

func Alien

func Alien(x, y int, char byte) *Monster

type MoveTo

type MoveTo struct {
	MX, MY int
}

func (MoveTo) Step

func (m MoveTo) Step(t *Term, s *Sprite) bool

type PeriTriangle

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

func NewPeriTriangle

func NewPeriTriangle() *PeriTriangle

func (*PeriTriangle) Paint

func (o *PeriTriangle) Paint(clr C.Color, can *C.Canvas)

func (*PeriTriangle) Step

func (o *PeriTriangle) Step(n int)

type Pipe

type Pipe struct {
	Char byte
	Path []Point
}

type Point

type Point struct {
	X, Y int
}

func MakePerimeterVec

func MakePerimeterVec() []Point

type Room

type Room struct {
	X0, Y0, X9, Y9 int
	Typed          string // chars already typed
	Visible        bool
}

type Screen

type Screen struct {
	Slot   []byte
	W, H   int
	P      int
	Mag    int
	X0, Y0 int
}

Screen is a rectangular ASCII console you can type on.

func NewScreen

func NewScreen(w, h, mag, x0, y0 int) *Screen

func (*Screen) OptionalClearUntil

func (o *Screen) OptionalClearUntil(clr C.Color, can *C.Canvas)

func (*Screen) Paint

func (o *Screen) Paint(clr C.Color, can *C.Canvas)

func (*Screen) Step

func (o *Screen) Step(ch byte)

type Sprite

type Sprite struct {
	Char   byte
	Plan   []Stepper
	RX, RY int // recently at
}

type Stepper

type Stepper interface {
	Step(t *Term, s *Sprite) bool // Return true if this step is done.
}

type Stop

type Stop string

func (Stop) Step

func (s Stop) Step(_ *Term, _ *Sprite) bool

type Strafe

type Strafe struct {
	Left, Right, Y int
	Leftward       bool
	Rand           *rand.Rand
}

func (*Strafe) Step

func (o *Strafe) Step(t *Term, s *Sprite) bool

type Term

type Term struct {
	Mag          int
	TW, TH       int
	S            []byte // screen chars
	Vis          []bool // visibility
	Rooms        []*Room
	Sprites      []*Sprite
	Pipes        []*Pipe
	Monsters     []*Monster
	Darts        []*Dart
	Tick         int
	Tombstone    string
	TombstonePos Point
}

func NewTerm

func NewTerm(tw, th int) *Term

func NewTerm1

func NewTerm1() *Term

func NewTerm2

func NewTerm2() *Term

func NewTerm3

func NewTerm3() *Term

func (*Term) Draw

func (t *Term) Draw(w io.Writer)

func (*Term) Paint

func (o *Term) Paint(clr C.Color, can *C.Canvas)

func (*Term) RenderDart

func (t *Term) RenderDart(dart *Dart)

func (*Term) RenderMonster

func (t *Term) RenderMonster(m *Monster)

func (*Term) RenderPipe

func (t *Term) RenderPipe(p *Pipe)

func (*Term) RenderRoom

func (t *Term) RenderRoom(r *Room, sprite *Sprite)

func (*Term) RenderSprite

func (t *Term) RenderSprite(s *Sprite)

type Trigger

type Trigger struct {
	P *bool
}

func (Trigger) Step

func (trig Trigger) Step(t *Term, s *Sprite) bool

type Typewriter

type Typewriter struct {
	Room *Room
	S    string
}

func (Typewriter) Step

func (tty Typewriter) Step(t *Term, s *Sprite) bool

type WaitN

type WaitN struct {
	N int
}

func (*WaitN) Step

func (w *WaitN) Step(t *Term, s *Sprite) bool

Jump to

Keyboard shortcuts

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