core

package module
v0.0.0-...-6885dbb Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2018 License: BSD-3-Clause Imports: 23 Imported by: 4

README

InkyBlackness Shocked-Core

Obsolescence Notice: Due to the release of InkyBlackness - HackEd, this project here has become obsolete: HackEd is the new editor to be used and is fully self-contained. Furthermore, this project is based on pre-source-release information. Use it at your own risk.

This is a library as part of the InkyBlackness project, written in Go. This library provides the core functionality of the Shocked editor.

License

The project is available under the terms of the New BSD License (see LICENSE file).

Documentation

Index

Constants

View Source
const (
	DirNone  = Direction(0)
	DirNorth = Direction(1)
	DirEast  = Direction(2)
	DirSouth = Direction(4)
	DirWest  = Direction(8)
)
View Source
const MaximumLevelsPerArchive = 16

MaximumLevelsPerArchive is the constant of how many levels are possible.

Variables

This section is empty.

Functions

This section is empty.

Types

type Archive

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

Archive wraps a map archive

func NewArchive

func NewArchive(library io.StoreLibrary, storeName string) (archive *Archive, err error)

NewArchive creates a new archive wrapper for given store name. This wrapper is applicable for the "starting game" archive, as well as savegames.

func (*Archive) HasLevel

func (archive *Archive) HasLevel(id int) bool

HasLevel returns true when given level ID (0..15) refers to a valid level.

func (*Archive) Level

func (archive *Archive) Level(id int) (level *Level)

Level returns a level wrapper should the given ID refer to a valid level.

func (*Archive) LevelIDs

func (archive *Archive) LevelIDs() (result []int)

type Bitmaps

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

Bitmaps is the adapter for general bitmaps.

func NewBitmaps

func NewBitmaps(library io.StoreLibrary) (bitmaps *Bitmaps, err error)

NewBitmaps returns a new Bitmaps instance, if possible.

func (*Bitmaps) Image

func (bitmaps *Bitmaps) Image(key model.ResourceKey) (bmp image.Bitmap, err error)

Image returns the image data of identified bitmap.

func (*Bitmaps) SetImage

func (bitmaps *Bitmaps) SetImage(key model.ResourceKey, bmp image.Bitmap) (resultKey model.ResourceKey, err error)

SetImage requests to set the bitmap data of a resource.

type Direction

type Direction int

Direction describes a flag field.

type ElectronicMessages

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

ElectronicMessages handles all data related to electronic messages.

func NewElectronicMessages

func NewElectronicMessages(library io.StoreLibrary) (messages *ElectronicMessages, err error)

NewElectronicMessages returns a new instance of ElectronicMessages.

func (*ElectronicMessages) Message

func (messages *ElectronicMessages) Message(messageType model.ElectronicMessageType, id int) (message model.ElectronicMessage, err error)

Message tries to retrieve the message data for given identification.

func (*ElectronicMessages) MessageAudio

func (messages *ElectronicMessages) MessageAudio(messageType model.ElectronicMessageType, id int, language model.ResourceLanguage) (data audio.SoundData, err error)

MessageAudio tries to retrieve the audio data for given key.

func (*ElectronicMessages) Remove

func (messages *ElectronicMessages) Remove(messageType model.ElectronicMessageType, id int) (err error)

Remove tries to remove the message.

func (*ElectronicMessages) SetMessage

func (messages *ElectronicMessages) SetMessage(messageType model.ElectronicMessageType, id int, message model.ElectronicMessage) (err error)

SetMessage updates the properties of a message.

func (*ElectronicMessages) SetMessageAudio

func (messages *ElectronicMessages) SetMessageAudio(messageType model.ElectronicMessageType, id int, language model.ResourceLanguage,
	soundData audio.SoundData) (err error)

SetMessageAudio tries to set the audio data for given key.

type Fonts

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

Fonts represents the game fonts accessor

func NewFonts

func NewFonts(library io.StoreLibrary) (fonts *Fonts, err error)

NewFonts returns a new instance of Fonts.

func (*Fonts) Font

func (fonts *Fonts) Font(id res.ResourceID) (font *model.Font, err error)

Font returns the font data for the identified font.

type GameObjects

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

GameObjects provides access to game-global information about objects.

func NewGameObjects

func NewGameObjects(library io.StoreLibrary) (gameObjects *GameObjects, err error)

NewGameObjects returns a new instance of GameObjects.

func (*GameObjects) Bitmap

func (gameObjects *GameObjects) Bitmap(id res.ObjectID, index int) (bmp image.Bitmap, err error)

Bitmap returns an image of the specified game object.

func (*GameObjects) Icon

func (gameObjects *GameObjects) Icon(id res.ObjectID) (bmp image.Bitmap)

Icon returns the icon image of the specified game object. It first tries to return the bitmap for the map icon. If that is all transparent, the function reverts to the object icon.

func (*GameObjects) Objects

func (gameObjects *GameObjects) Objects() []model.GameObject

Objects returns an array of all objects

func (*GameObjects) SetBitmap

func (gameObjects *GameObjects) SetBitmap(id res.ObjectID, index int, bmp image.Bitmap) (err error)

SetBitmap stores an image for the specified game object.

func (*GameObjects) SetObjectData

func (gameObjects *GameObjects) SetObjectData(id res.ObjectID, newData objprop.ObjectData) objprop.ObjectData

SetObjectData stores new object data

type InplaceDataStore

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

InplaceDataStore implements the model.DataStore interface with an inplace project. This store has only one project, called "(inplace)", which overwrites the source data files.

func NewInplaceDataStore

func NewInplaceDataStore(source release.Release, outQueue chan<- func(), autoSaveTimeoutMSec int) *InplaceDataStore

NewInplaceDataStore returns a new instance of an inplace data store.

func (*InplaceDataStore) AddLevelObject

func (inplace *InplaceDataStore) AddLevelObject(projectID string, archiveID string, levelID int, template model.LevelObjectTemplate,
	onSuccess func(object model.LevelObject), onFailure model.FailureFunc)

AddLevelObject implements the model.DataStore interface

func (*InplaceDataStore) Audio

func (inplace *InplaceDataStore) Audio(projectID string, key model.ResourceKey,
	onSuccess func(model.ResourceKey, audio.SoundData), onFailure model.FailureFunc)

Audio implements the model.DataStore interface

func (*InplaceDataStore) Bitmap

func (inplace *InplaceDataStore) Bitmap(projectID string, key model.ResourceKey,
	onSuccess func(model.ResourceKey, *model.RawBitmap), onFailure model.FailureFunc)

Bitmap implements the model.DataStore interface

func (*InplaceDataStore) ElectronicMessage

func (inplace *InplaceDataStore) ElectronicMessage(projectID string, messageType model.ElectronicMessageType, id int,
	onSuccess func(message model.ElectronicMessage), onFailure model.FailureFunc)

ElectronicMessage implements the model.DataStore interface.

func (*InplaceDataStore) ElectronicMessageAudio

func (inplace *InplaceDataStore) ElectronicMessageAudio(projectID string,
	messageType model.ElectronicMessageType, id int, language model.ResourceLanguage,
	onSuccess func(data audio.SoundData), onFailure model.FailureFunc)

ElectronicMessageAudio implements the model.DataStore interface.

func (*InplaceDataStore) Font

func (inplace *InplaceDataStore) Font(projectID string, fontID int,
	onSuccess func(font *model.Font), onFailure model.FailureFunc)

Font implements the model.DataStore interface

func (*InplaceDataStore) GameObjectBitmap

func (inplace *InplaceDataStore) GameObjectBitmap(projectID string, class, subclass, objType int, index int,
	onSuccess func(bmp *model.RawBitmap), onFailure model.FailureFunc)

GameObjectBitmap implements the model.DataStore interface

func (*InplaceDataStore) GameObjectIcon

func (inplace *InplaceDataStore) GameObjectIcon(projectID string, class, subclass, objType int,
	onSuccess func(bmp *model.RawBitmap), onFailure model.FailureFunc)

GameObjectIcon implements the model.DataStore interface

func (*InplaceDataStore) GameObjects

func (inplace *InplaceDataStore) GameObjects(projectID string,
	onSuccess func(objects []model.GameObject), onFailure model.FailureFunc)

GameObjects implements the model.DataStore interface

func (*InplaceDataStore) LevelObjects

func (inplace *InplaceDataStore) LevelObjects(projectID string, archiveID string, levelID int,
	onSuccess func(objects *model.LevelObjects), onFailure model.FailureFunc)

LevelObjects implements the model.DataStore interface

func (*InplaceDataStore) LevelProperties

func (inplace *InplaceDataStore) LevelProperties(projectID string, archiveID string, levelID int,
	onSuccess func(properties model.LevelProperties), onFailure model.FailureFunc)

LevelProperties implements the model.DataStore interface.

func (*InplaceDataStore) LevelSurveillanceObjects

func (inplace *InplaceDataStore) LevelSurveillanceObjects(projectID string, archiveID string, levelID int,
	onSuccess func(objects []model.SurveillanceObject), onFailure model.FailureFunc)

LevelSurveillanceObjects implements the model.DataStore interface.

func (*InplaceDataStore) LevelTextureAnimations

func (inplace *InplaceDataStore) LevelTextureAnimations(projectID string, archiveID string, levelID int,
	onSuccess func(animations []model.TextureAnimation), onFailure model.FailureFunc)

LevelTextureAnimations implements the model.DataStore interface

func (*InplaceDataStore) LevelTextures

func (inplace *InplaceDataStore) LevelTextures(projectID string, archiveID string, levelID int,
	onSuccess func(textureIDs []int), onFailure model.FailureFunc)

LevelTextures implements the model.DataStore interface

func (*InplaceDataStore) Levels

func (inplace *InplaceDataStore) Levels(projectID string, archiveID string,
	onSuccess func(levels []model.Level), onFailure model.FailureFunc)

Levels implements the model.DataStore interface

func (*InplaceDataStore) NewProject

func (inplace *InplaceDataStore) NewProject(projectID string,
	onSuccess func(), onFailure model.FailureFunc)

NewProject implements the model.DataStore interface

func (*InplaceDataStore) Palette

func (inplace *InplaceDataStore) Palette(projectID string, paletteID string,
	onSuccess func(colors [256]model.Color), onFailure model.FailureFunc)

Palette implements the model.DataStore interface

func (*InplaceDataStore) Projects

func (inplace *InplaceDataStore) Projects(onSuccess func(projects []string), onFailure model.FailureFunc)

Projects implements the model.DataStore interface

func (*InplaceDataStore) RemoveElectronicMessage

func (inplace *InplaceDataStore) RemoveElectronicMessage(projectID string, messageType model.ElectronicMessageType, id int,
	onSuccess func(), onFailure model.FailureFunc)

RemoveElectronicMessage implements the model.DataStore interface.

func (*InplaceDataStore) RemoveLevelObject

func (inplace *InplaceDataStore) RemoveLevelObject(projectID string, archiveID string, levelID int, objectID int,
	onSuccess func(), onFailure model.FailureFunc)

RemoveLevelObject implements the model.DataStore interface

func (*InplaceDataStore) SaveProject

func (inplace *InplaceDataStore) SaveProject(projectID string)

SaveProject implements the model.DataStore interface

func (*InplaceDataStore) SetAudio

func (inplace *InplaceDataStore) SetAudio(projectID string, key model.ResourceKey, data audio.SoundData,
	onSuccess func(model.ResourceKey), onFailure model.FailureFunc)

SetAudio implements the model.DataStore interface

func (*InplaceDataStore) SetBitmap

func (inplace *InplaceDataStore) SetBitmap(projectID string, key model.ResourceKey, rawBitmap *model.RawBitmap,
	onSuccess func(model.ResourceKey, *model.RawBitmap), onFailure model.FailureFunc)

SetBitmap implements the model.DataStore interface

func (*InplaceDataStore) SetElectronicMessage

func (inplace *InplaceDataStore) SetElectronicMessage(projectID string, messageType model.ElectronicMessageType,
	id int, message model.ElectronicMessage,
	onSuccess func(message model.ElectronicMessage), onFailure model.FailureFunc)

SetElectronicMessage implements the model.DataStore interface.

func (*InplaceDataStore) SetElectronicMessageAudio

func (inplace *InplaceDataStore) SetElectronicMessageAudio(projectID string,
	messageType model.ElectronicMessageType, id int, language model.ResourceLanguage, data audio.SoundData,
	onSuccess func(), onFailure model.FailureFunc)

SetElectronicMessageAudio implements the model.DataStore interface.

func (*InplaceDataStore) SetGameObject

func (inplace *InplaceDataStore) SetGameObject(projectID string, class, subclass, objType int, properties *model.GameObjectProperties,
	onSuccess func(properties *model.GameObjectProperties), onFailure model.FailureFunc)

SetGameObject implements the model.DataStore interface

func (*InplaceDataStore) SetGameObjectBitmap

func (inplace *InplaceDataStore) SetGameObjectBitmap(projectID string, class, subclass, objType int, index int, bmp *model.RawBitmap,
	onSuccess func(), onFailure model.FailureFunc)

SetGameObjectBitmap implements the model.DataStore interface

func (*InplaceDataStore) SetLevelObject

func (inplace *InplaceDataStore) SetLevelObject(projectID string, archiveID string, levelID int, objectID int,
	properties *model.LevelObjectProperties, onSuccess func(properties *model.LevelObjectProperties), onFailure model.FailureFunc)

SetLevelObject implements the model.DataStore interface.

func (*InplaceDataStore) SetLevelProperties

func (inplace *InplaceDataStore) SetLevelProperties(projectID string, archiveID string, levelID int, properties model.LevelProperties,
	onSuccess func(properties model.LevelProperties), onFailure model.FailureFunc)

SetLevelProperties implements the model.DataStore interface.

func (*InplaceDataStore) SetLevelSurveillanceObject

func (inplace *InplaceDataStore) SetLevelSurveillanceObject(projectID string, archiveID string, levelID int,
	surveillanceIndex int, data model.SurveillanceObject,
	onSuccess func(objects []model.SurveillanceObject), onFailure model.FailureFunc)

SetLevelSurveillanceObject implements the model.DataStore interface.

func (*InplaceDataStore) SetLevelTextureAnimation

func (inplace *InplaceDataStore) SetLevelTextureAnimation(projectID string, archiveID string, levelID int,
	animationGroup int, properties model.TextureAnimation,
	onSuccess func(animations []model.TextureAnimation), onFailure model.FailureFunc)

SetLevelTextureAnimation implements the model.DataStore interface

func (*InplaceDataStore) SetLevelTextures

func (inplace *InplaceDataStore) SetLevelTextures(projectID string, archiveID string, levelID int, textureIDs []int,
	onSuccess func(textureIDs []int), onFailure model.FailureFunc)

SetLevelTextures implements the model.DataStore interface

func (*InplaceDataStore) SetText

func (inplace *InplaceDataStore) SetText(projectID string, key model.ResourceKey, text string,
	onSuccess func(model.ResourceKey, string), onFailure model.FailureFunc)

SetText implements the model.DataStore interface

func (*InplaceDataStore) SetTextureBitmap

func (inplace *InplaceDataStore) SetTextureBitmap(projectID string, textureID int, size string, rawBitmap *model.RawBitmap,
	onSuccess func(*model.RawBitmap), onFailure model.FailureFunc)

SetTextureBitmap implements the model.DataStore interface

func (*InplaceDataStore) SetTextureProperties

func (inplace *InplaceDataStore) SetTextureProperties(projectID string, textureID int, newProperties *model.TextureProperties,
	onSuccess func(properties *model.TextureProperties), onFailure model.FailureFunc)

SetTextureProperties implements the model.DataStore interface.

func (*InplaceDataStore) SetTile

func (inplace *InplaceDataStore) SetTile(projectID string, archiveID string, levelID int, x, y int, properties model.TileProperties,
	onSuccess func(properties model.TileProperties), onFailure model.FailureFunc)

SetTile implements the model.DataStore interface

func (*InplaceDataStore) Text

func (inplace *InplaceDataStore) Text(projectID string, key model.ResourceKey,
	onSuccess func(model.ResourceKey, string), onFailure model.FailureFunc)

Text implements the model.DataStore interface

func (*InplaceDataStore) TextureBitmap

func (inplace *InplaceDataStore) TextureBitmap(projectID string, textureID int, size string,
	onSuccess func(bmp *model.RawBitmap), onFailure model.FailureFunc)

TextureBitmap implements the model.DataStore interface

func (*InplaceDataStore) Textures

func (inplace *InplaceDataStore) Textures(projectID string,
	onSuccess func(textures []model.TextureProperties), onFailure model.FailureFunc)

Textures implements the model.DataStore interface

func (*InplaceDataStore) Tile

func (inplace *InplaceDataStore) Tile(projectID string, archiveID string, levelID int, x, y int,
	onSuccess func(properties model.TileProperties), onFailure model.FailureFunc)

Tile implements the model.DataStore interface

func (*InplaceDataStore) Tiles

func (inplace *InplaceDataStore) Tiles(projectID string, archiveID string, levelID int,
	onSuccess func(tiles model.Tiles), onFailure model.FailureFunc)

Tiles implements the model.DataStore interface

type Level

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

Level is a structure holding level specific information.

func NewLevel

func NewLevel(store *io.DynamicChunkStore, id int) *Level

NewLevel returns a new instance of a Level structure.

func (*Level) AddObject

func (level *Level) AddObject(template *model.LevelObjectTemplate) (entry model.LevelObject, err error)

AddObject adds a new object at given tile.

func (*Level) ID

func (level *Level) ID() int

ID returns the identifier of the level.

func (*Level) LevelSurveillanceObjects

func (level *Level) LevelSurveillanceObjects() []model.SurveillanceObject

LevelSurveillanceObjects returns the surveillance objects of this level

func (*Level) Objects

func (level *Level) Objects() []model.LevelObject

Objects returns an array of all used objects.

func (*Level) Properties

func (level *Level) Properties() (result model.LevelProperties)

Properties returns the properties of the level.

func (*Level) RemoveObject

func (level *Level) RemoveObject(objectIndex int) (err error)

RemoveObject removes an object from the level.

func (*Level) SetLevelSurveillanceObject

func (level *Level) SetLevelSurveillanceObject(index int, data model.SurveillanceObject) []model.SurveillanceObject

SetLevelSurveillanceObject updates one surveillance object

func (*Level) SetObject

func (level *Level) SetObject(objectIndex int, newProperties *model.LevelObjectProperties) (properties model.LevelObjectProperties, err error)

SetObject modifies the properties of identified object.

func (*Level) SetProperties

func (level *Level) SetProperties(properties model.LevelProperties)

SetProperties updates the properties of a level.

func (*Level) SetTextureAnimation

func (level *Level) SetTextureAnimation(animationGroup int, properties model.TextureAnimation)

SetTextureAnimation modifies the properties of identified animation group.

func (*Level) SetTextures

func (level *Level) SetTextures(newIds []int)

SetTextures sets the texture identifier for this level.

func (*Level) SetTileProperties

func (level *Level) SetTileProperties(x, y int, properties model.TileProperties)

SetTileProperties sets the properties of a specific tile.

func (*Level) TextureAnimations

func (level *Level) TextureAnimations() (result []model.TextureAnimation)

TextureAnimations returns the properties of the animation groups.

func (*Level) Textures

func (level *Level) Textures() (result []int)

Textures returns the texture identifier used in this level.

func (*Level) TileProperties

func (level *Level) TileProperties(x, y int) (result model.TileProperties)

TileProperties returns the properties of a specific tile.

type Palettes

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

func NewPalettes

func NewPalettes(library io.StoreLibrary) (palettes *Palettes, err error)

func (*Palettes) GamePalette

func (palettes *Palettes) GamePalette() (color.Palette, error)

type Project

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

Project represents one editor project, including access to all the resources.

func NewProject

func NewProject(name string, library io.StoreLibrary) (project *Project, err error)

NewProject creates a new project based on given store library.

func (*Project) Archive

func (project *Project) Archive() *Archive

Archive returns the wrapper for the main archive file.

func (*Project) Bitmaps

func (project *Project) Bitmaps() *Bitmaps

Bitmaps returns the wrapper for bitmaps.

func (*Project) ElectronicMessages

func (project *Project) ElectronicMessages() *ElectronicMessages

ElectronicMessages returns the wrapper for the electronic messages.

func (*Project) Fonts

func (project *Project) Fonts() *Fonts

Fonts returns the wrapper for fonts.

func (*Project) GameObjects

func (project *Project) GameObjects() *GameObjects

GameObjects returns the wrapper for the game objects.

func (*Project) Name

func (project *Project) Name() string

Name returns the name of the project.

func (*Project) Palettes

func (project *Project) Palettes() *Palettes

Palettes returns the wrapper for palettes.

func (*Project) Save

func (project *Project) Save()

Save requests to persist all currently pending changes.

func (*Project) Sounds

func (project *Project) Sounds() *Sounds

Sounds returns the wrapper for sounds.

func (*Project) Texts

func (project *Project) Texts() *Texts

Texts returns the wrapper for texts.

func (*Project) Textures

func (project *Project) Textures() *Textures

Textures returns the wrapper for textures.

type Sounds

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

Sounds is the adapter for general sounds.

func NewSounds

func NewSounds(library io.StoreLibrary) (sounds *Sounds, err error)

NewSounds returns a new Sounds instance, if possible.

func (*Sounds) Audio

func (sounds *Sounds) Audio(key model.ResourceKey) (data audio.SoundData, err error)

Audio returns the audio of identified sound.

func (*Sounds) SetAudio

func (sounds *Sounds) SetAudio(key model.ResourceKey, soundData audio.SoundData) (resultKey model.ResourceKey, err error)

SetAudio requests to set the audio of a sound resource.

type Texts

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

Texts is the adapter for general texts.

func NewTexts

func NewTexts(library io.StoreLibrary) (texts *Texts, err error)

NewTexts returns a new Texts instance, if possible.

func (*Texts) SetText

func (texts *Texts) SetText(key model.ResourceKey, value string) (resultKey model.ResourceKey, err error)

SetText requests to set the string of a text resource.

func (*Texts) Text

func (texts *Texts) Text(key model.ResourceKey) (result string, err error)

Text returns the string of identified text.

type Textures

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

Textures is the adapter of texture information.

func NewTextures

func NewTextures(library io.StoreLibrary) (textures *Textures, err error)

NewTextures returns a new Textures instance, if possible.

func (*Textures) Image

func (textures *Textures) Image(index int, size model.TextureSize) (bmp image.Bitmap)

Image returns the bitmap of identified & sized texture.

func (*Textures) Properties

func (textures *Textures) Properties(index int) model.TextureProperties

Properties returns the texture properties of the identified texture.

func (*Textures) SetImage

func (textures *Textures) SetImage(index int, size model.TextureSize, imgBitmap image.Bitmap)

SetImage requests to set the bitmap of identified & sized texture..

func (*Textures) SetProperties

func (textures *Textures) SetProperties(index int, prop model.TextureProperties)

SetProperties requests to update the properties of identified texture.

func (*Textures) TextureCount

func (textures *Textures) TextureCount() int

TextureCount returns the number of available textures.

type Workspace

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

Workspace describes a container of projects.

func NewWorkspace

func NewWorkspace(source release.Release, projects release.ReleaseContainer, autoSaveTimeoutMSec int) *Workspace

NewWorkspace takes a Release as a basis for existing resources and returns a new workspace instance. With this instance, projects from given projects container can be worked with.

func (*Workspace) NewProject

func (ws *Workspace) NewProject(name string) (project *Project, err error)

NewProject tries to create a new project in the workspace.

func (*Workspace) Project

func (ws *Workspace) Project(name string) (project *Project, err error)

Project returns a project matching the given identifier.

func (*Workspace) ProjectNames

func (ws *Workspace) ProjectNames() []string

ProjectNames returns all currently known project identifiers.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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