world

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2018 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Overview

Package world and its subpackages contain everything a typical simulated world requires.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ResourceViewStrategy

func ResourceViewStrategy() resource.ViewStrategy

ResourceViewStrategy returns a strategy that is typical for the game.

Types

type Manifest

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

Manifest contains all the data and information of concrete things in a world.

func NewManifest

func NewManifest(modified resource.ModificationCallback) *Manifest

NewManifest returns a new instance that notifies changes to the provided callback.

func (Manifest) Entry

func (manifest Manifest) Entry(at int) (*ManifestEntry, error)

Entry returns the entry at given index.

func (Manifest) EntryCount

func (manifest Manifest) EntryCount() int

EntryCount returns the number of entries currently in the manifest.

func (Manifest) Filter

func (manifest Manifest) Filter(lang resource.Language, id resource.ID) resource.List

Filter finds all resources in the world that match the given parameters.

func (*Manifest) InsertEntry

func (manifest *Manifest) InsertEntry(at int, entry *ManifestEntry) error

InsertEntry puts the provided entry at the specified index. Any entry at the identified index, and all those after that, are moved by one.

func (*Manifest) LocalizedResources

func (manifest *Manifest) LocalizedResources(lang resource.Language) resource.Selector

LocalizedResources produces a selector to retrieve resources for a specific language from the manifest. The returned selector has the strategy to merge the typical compound resource lists, such as the small textures, or string lookups. It is based on StandardResourceViewStrategy().

func (*Manifest) MoveEntry

func (manifest *Manifest) MoveEntry(to, from int) error

MoveEntry removes an entry and reinserts it at another index. Both indices are resolved before the move.

func (*Manifest) RemoveEntry

func (manifest *Manifest) RemoveEntry(at int) error

RemoveEntry removes the entry at given index.

func (*Manifest) ReplaceEntry

func (manifest *Manifest) ReplaceEntry(at int, entry *ManifestEntry) error

ReplaceEntry removes the current entry at the identified index and puts the provided one instead.

type ManifestEntry

type ManifestEntry struct {
	ID        string
	Resources resource.LocalizedResourcesList
}

ManifestEntry describes a set of localized resources under a collective identifier.

func (ManifestEntry) LocalizedResources

func (entry ManifestEntry) LocalizedResources(lang resource.Language) resource.Selector

LocalizedResources produces a selector to retrieve resources for a specific language from this entry.

Directories

Path Synopsis
Package ids contains constants for all necessary identifier used in the world.
Package ids contains constants for all necessary identifier used in the world.

Jump to

Keyboard shortcuts

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