Lab1

package
v0.0.0-...-11048c4 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Automaton

type Automaton struct {
	Cells        [][]*Cell
	BackCells    [][]*Cell
	History      [][][]*Cell
	Size         *Vector2
	Depth        int
	StatesCount  int
	Rule         map[[3]int]int
	HistoryIndex int
}

func NewAutomaton

func NewAutomaton(randomGenerator *rand.Rand, size *Vector2, depth, statesCount int) *Automaton

func (*Automaton) BuildCells

func (automaton *Automaton) BuildCells(cells *[][]*Cell, randomGenerator *rand.Rand)

func (*Automaton) BuildHistory

func (automaton *Automaton) BuildHistory(randomGenerator *rand.Rand)

func (*Automaton) Copy

func (automaton *Automaton) Copy(a, b [][]*Cell)

func (*Automaton) Iterate

func (automaton *Automaton) Iterate()

func (*Automaton) TryToExplode

func (automaton *Automaton) TryToExplode(cell *Cell)

type Cell

type Cell struct {
	Neighbors  map[string]*Cell
	Position   *Vector2
	Energy     int
	CanExplode bool
}

func NewCell

func NewCell(position *Vector2, energy int) *Cell

type Drawer

type Drawer struct {
	Size     *Vector2
	Manager  *Manager
	Renderer *sdl.Renderer
	Display  *sdl.Texture
	MustDraw bool
}

func NewDrawer

func NewDrawer(manager *Manager, size *Vector2, renderer *sdl.Renderer, texture *sdl.Texture) *Drawer

func (*Drawer) Clear

func (drawer *Drawer) Clear()

func (*Drawer) Color

func (drawer *Drawer) Color(theColor *color.RGBA)

func (*Drawer) Draw

func (drawer *Drawer) Draw()

func (*Drawer) Rectangle

func (drawer *Drawer) Rectangle(rectangle *Rectangle)

func (*Drawer) Texture

func (drawer *Drawer) Texture(rectangle *Rectangle, name string)
type MainMenu struct {
	Manager *Manager
}

func NewMainMenu

func NewMainMenu(manager *Manager) *MainMenu
func (mainMenu *MainMenu) React(event sdl.Event)

type Manager

type Manager struct {
	Window          *sdl.Window
	Drawer          *Drawer
	TextureManager  *TextureManager
	DrawEvent       *sdl.UserEvent
	IterationEvent  *sdl.UserEvent
	Running         bool
	WaitGroup       sync.WaitGroup
	Automaton       *Automaton
	CellSize        *Vector2
	Colors          []*color.RGBA
	MaxColorCount   float64
	ColorStep       float64
	RandomGenerator *rand.Rand
}

func NewManager

func NewManager() *Manager

func (*Manager) BuildColors

func (manager *Manager) BuildColors()

func (*Manager) Draw

func (manager *Manager) Draw()

func (*Manager) Iterator

func (manager *Manager) Iterator()

func (*Manager) Main

func (manager *Manager) Main()

func (*Manager) RequestDraw

func (manager *Manager) RequestDraw()

func (*Manager) RequestIteration

func (manager *Manager) RequestIteration()

type Rectangle

type Rectangle struct {
	Position *Vector2
	Size     *Vector2
}

func NewRectangle

func NewRectangle(position, size *Vector2) *Rectangle

func (*Rectangle) ToSDL

func (rectangle *Rectangle) ToSDL() *sdl.Rect

type TextureManager

type TextureManager struct {
	Manager  *Manager
	Textures map[string]*sdl.Texture
}

func NewTextureManager

func NewTextureManager(manager *Manager) *TextureManager

func (*TextureManager) Load

func (textureManager *TextureManager) Load(name string)

type Vector2

type Vector2 struct {
	X int
	Y int
}

func NewVector2

func NewVector2(x, y int) *Vector2

Jump to

Keyboard shortcuts

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