sources

package
v0.0.0-...-aac1211 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2022 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Animation

type Animation struct {
	FrameDelay,
	FrameX,
	FrameY,
	FrameWidth,
	FrameHeight float64

	FrameNum int
}

type Audio

type Audio struct {
	sync.Mutex

	Collection map[string]*Cell
}

func NewAudio

func NewAudio() *Audio

func (*Audio) GetAudioController

func (a *Audio) GetAudioController(path string) *Cell

func (*Audio) IsAllAudioLoaded

func (a *Audio) IsAllAudioLoaded() bool

Checks if there is any unloaded audio

func (*Audio) Load

func (a *Audio) Load(fs embed.FS, path string, wg *sync.WaitGroup)

type Cell

type Cell struct {
	sync.Mutex
	Track *Track
}

type Colliders

type Colliders struct {
	sync.Mutex

	Collection map[string][]*CollidersModel
}

func NewColliders

func NewColliders() *Colliders

func (*Colliders) GetCollider

func (c *Colliders) GetCollider(path string) ([]*CollidersModel, error)

func (*Colliders) Load

func (c *Colliders) Load(fs embed.FS, path string, wg *sync.WaitGroup)

type CollidersModel

type CollidersModel struct {
	Name                  string
	X, Y                  float64
	TileHeight, TileWidth int
	Properties            struct {
		IsCollision, IsWalkable bool
	}
}

func (*CollidersModel) GetSizeMaxX

func (m *CollidersModel) GetSizeMaxX() float64

func (*CollidersModel) GetSizeMaxY

func (m *CollidersModel) GetSizeMaxY() float64

func (*CollidersModel) GetSizeMinX

func (m *CollidersModel) GetSizeMinX() float64

func (*CollidersModel) GetSizeMinY

func (m *CollidersModel) GetSizeMinY() float64

type CollidersParseModel

type CollidersParseModel struct {
	ImageHeight int `json:"imageheight"`
	ImageWidth  int `json:"imagewidth"`
	TileHeight  int `json:"tileheight"`
	TileWidth   int `json:"tilewidth"`
	Tiles       []struct {
		Objectgroup struct {
			Id      int `json:"id"`
			Objects []struct {
				Id     int     `json:"id"`
				Height float64 `json:"height"`
				Width  float64 `json:"width"`
				X      float64 `json:"x"`
				Y      float64 `json:"y"`
			} `json:"objects"`
		} `json:"objectgroup"`
		Properties []struct {
			Name  string      `json:"name"`
			Type  string      `json:"type"`
			Value interface{} `json:"value"`
		} `json:"properties"`
	} `json:"tiles"`
}

Model used only for input files parsing

type Font

type Font struct {
	sync.Mutex

	Collection map[string]font.Face
}

func NewFont

func NewFont() *Font

func (*Font) GetFont

func (f *Font) GetFont(path string) font.Face

func (*Font) Load

func (f *Font) Load(fs embed.FS, path string, wg *sync.WaitGroup)

type FontColor

type FontColor string
const (
	White FontColor = "white"
	Black FontColor = "black"
)

type GameRole

type GameRole string
const (
	GameMap GameRole = "gamemap"
)

type Images

type Images struct {
	sync.Mutex

	Collection map[string]*ebiten.Image
}

func NewImages

func NewImages() *Images

func (*Images) GetCopyOfImage

func (i *Images) GetCopyOfImage(path string) *ebiten.Image

func (*Images) GetImage

func (i *Images) GetImage(path string) *ebiten.Image

func (*Images) Load

func (i *Images) Load(fs embed.FS, path string, s, wg *sync.WaitGroup)

type Metadata

type Metadata struct {
	sync.Mutex

	Collection map[string]*MetadataModel
}

func NewMetadata

func NewMetadata() *Metadata

func (*Metadata) GetMetadata

func (m *Metadata) GetMetadata(path string) *MetadataModel

func (*Metadata) Load

func (m *Metadata) Load(fs embed.FS, path string, s, wg *sync.WaitGroup)

type MetadataModel

type MetadataModel struct {
	Type

	Animation Animation

	Transition Transition

	//Information about metadata file
	Info struct {
		//Parent file metadata one related to
		GameRole

		Parent                   string
		ScrollableX, ScrollableY bool
	}

	Size types.Vec2

	Margins types.Vec2

	Spawns []*server_external.PositionInt

	Physics struct {
		G float64
	}

	Buffs struct {
		Speed float64
	}

	Scale types.Vec2

	Offset types.Vec2

	Text struct {
		Symbols  string
		Position TextPosition
	}

	Fonts struct {
		FontColor
	}

	Camera struct {
		MaxZoom, MinZoom, InitZoom float64
	}

	Effects struct {
		TraceColorBegin [4]float32
		TraceColorEnd   [4]float32
	}
}

All the positioning properties should be in range (0; 100)

func (*MetadataModel) GetBuffSpeed

func (m *MetadataModel) GetBuffSpeed() types.Vec2

func (*MetadataModel) GetMargins

func (m *MetadataModel) GetMargins() types.Vec2

func (*MetadataModel) GetOffset

func (m *MetadataModel) GetOffset() types.Vec2

func (*MetadataModel) GetScale

func (m *MetadataModel) GetScale() types.Vec2

func (*MetadataModel) GetSize

func (m *MetadataModel) GetSize() types.Vec2

func (*MetadataModel) GetSizeMaxX

func (m *MetadataModel) GetSizeMaxX() float64

func (*MetadataModel) GetSizeMaxY

func (m *MetadataModel) GetSizeMaxY() float64

func (*MetadataModel) GetSizeMinX

func (m *MetadataModel) GetSizeMinX() float64

func (*MetadataModel) GetSizeMinY

func (m *MetadataModel) GetSizeMinY() float64

type Parser

type Parser struct {
	sync.WaitGroup
	// contains filtered or unexported fields
}

func NewParser

func NewParser(fs embed.FS, path string, callback func(embed.FS, string)) *Parser

func (*Parser) Parse

func (p *Parser) Parse()

type RuntimeDefined

type RuntimeDefined struct {
	ZoomedScale types.Vec2
}

Runtime defined metadata model

type Shaders

type Shaders struct {
	sync.Mutex

	Collection map[string]*ebiten.Shader
}

func NewShaders

func NewShaders() *Shaders

func (*Shaders) GetShader

func (i *Shaders) GetShader(path string) *ebiten.Shader

func (*Shaders) Load

func (i *Shaders) Load(fs embed.FS, path string, wg *sync.WaitGroup)

type SourcesProvider

type SourcesProvider interface {
	LoadSources(embed.FS)

	Audio() *Audio
	Font() *Font
	Images() *Images
	Metadata() *Metadata
	Shaders() *Shaders
	Colliders() *Colliders
	IsLoadingEnded() bool
}

func UseSources

func UseSources() SourcesProvider

type TextPosition

type TextPosition string
const (
	Center TextPosition = "center"
	Left   TextPosition = "left"
	Right  TextPosition = "right"
)

Predefined options of allowed text positions

type Track

type Track struct {
	Volume    *effects.Volume
	Ctrl      *beep.Ctrl
	Format    beep.Format
	Buffer    *beep.Buffer
	TrackPath string
}

type Transition

type Transition struct {
	StartScale, EndScale types.Vec2
}

type Type

type Type []string

func (*Type) Contains

func (t *Type) Contains(q string) bool

Jump to

Keyboard shortcuts

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