graphics

package
v0.0.0-...-6f56cf3 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DoomPicture

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

DoomPicture holds an image in the doom picture format

func NewDoomPicture

func NewDoomPicture(buff []byte) *DoomPicture

NewDoomPicture gets picture from buffer

func (*DoomPicture) Height

func (p *DoomPicture) Height() int

Height return height of image

func (*DoomPicture) Left

func (p *DoomPicture) Left() int

Left offset. The number of pixels to the left of the center; where the first column gets drawn.

func (*DoomPicture) ToPng

func (p *DoomPicture) ToPng(out string, palette [256]color.RGBA) error

ToPng exports picture to PNG

func (*DoomPicture) ToRGBA

func (p *DoomPicture) ToRGBA(palette [256]color.RGBA) *image.RGBA

ToRGBA converts picture to go image

func (*DoomPicture) Top

func (p *DoomPicture) Top() int

Top offset. The number of pixels above the origin; where the top row is.

func (*DoomPicture) Width

func (p *DoomPicture) Width() int

Width return width of image

type Flat

type Flat struct {
	*DoomPicture
	// contains filtered or unexported fields
}

Flat floor / ceiling texture

func NewFlat

func NewFlat(name string, buff []byte) *Flat

NewFlat create a new flat

type FlatStore

type FlatStore map[string][]*Flat

FlatStore stores map of flats

func NewFlatStore

func NewFlatStore() FlatStore

func (FlatStore) Append

func (fs FlatStore) Append(name string, flat *Flat)

func (FlatStore) LoadWAD

func (fs FlatStore) LoadWAD(w *wad.WAD)

type FontBook

type FontBook map[FontName]font

FontBook is a collection of fonts

func NewFontBook

func NewFontBook() FontBook

NewFontBook initializes a new fontBook with the defined fonts

func (*FontBook) GetAllGraphics

func (fb *FontBook) GetAllGraphics() map[string]*DoomPicture

GetAllGraphics return a map of all DoomGraphics contained in the Fontbook

func (*FontBook) LoadWAD

func (fb *FontBook) LoadWAD(w *wad.WAD) error

LoadWAD fills the font book with embedded fonts from the WAD file

type FontName

type FontName int

FontName helps identifing the several embedded fonts in a WAD file

const (
	// font names
	FnNumGreySmall FontName = iota
	FnNumYellowSmall
	FnNumRedBig
	FnCompositeRed
)

type Image

type Image interface {
	ToRGBA(palette [256]color.RGBA) *image.RGBA
	ToPng(out string, palette [256]color.RGBA) error
	Width() int
	Height() int
	Top() int
	Left() int
}

Image generic Image

type Palette

type Palette struct {
	Colors [256]color.RGBA
}

Palette DOOM color palette

func DefaultPalette

func DefaultPalette() Palette

type Palettes

type Palettes [numPalettes]Palette

Palettes one or more palettes

func NewPalettes

func NewPalettes(w *wad.WAD) (*Palettes, error)

NewPalettes one or more palettes

type Patch

type Patch struct {
	*DoomPicture
	// contains filtered or unexported fields
}

Patch fragment of a wall texture

func NewPatch

func NewPatch(buff []byte) *Patch

NewPatch create a new patch

type Sprite

type Sprite struct {
	Name string
	// contains filtered or unexported fields
}

Sprite DOOM sprite

func NewSprite

func NewSprite(name string) Sprite

NewSprite Creates new sprite from lump

func (*Sprite) AddSpriteFrame

func (s *Sprite) AddSpriteFrame(lump *wad.Lump) *SpriteFrame

AddSpriteFrame Creates new sprite from lump

func (*Sprite) FirstFrame

func (s *Sprite) FirstFrame() *SpriteFrame

func (*Sprite) Frames

func (s *Sprite) Frames(cb func(sf *SpriteFrame))

func (*Sprite) GetFrame

func (s *Sprite) GetFrame(angle, frame byte) *SpriteFrame

type SpriteFrame

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

SpriteFrame DOOM sprite frame

func (*SpriteFrame) Angles

func (sf *SpriteFrame) Angles() [9]Image

func (*SpriteFrame) FrameID

func (sf *SpriteFrame) FrameID() byte

func (*SpriteFrame) Image

func (sf *SpriteFrame) Image(angle int) Image

func (*SpriteFrame) Name

func (sf *SpriteFrame) Name() string

type SpriteFrames

type SpriteFrames map[byte]SpriteFrame

SpriteFrames map of frames

type SpriteStore

type SpriteStore map[string]Sprite

SpriteStore string map of sprites

func NewSpriteStore

func NewSpriteStore() SpriteStore

NewSpriteStore creates new level store

func (SpriteStore) LoadWAD

func (ss SpriteStore) LoadWAD(w *wad.WAD)

type Texture

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

Texture - DOOM texture definition

func NewTexture

func NewTexture(buff []byte) (*Texture, error)

NewTexture create a new DOOM texture

func (*Texture) Height

func (t *Texture) Height() int

Height return height of image

func (*Texture) Left

func (t *Texture) Left() int

Left offset. The number of pixels to the left of the center; where the first column gets drawn.

func (*Texture) ToPng

func (t *Texture) ToPng(out string, palette [256]color.RGBA) error

ToPng exports picture to PNG

func (*Texture) ToRGBA

func (t *Texture) ToRGBA(palette [256]color.RGBA) *image.RGBA

ToRGBA generates a go image from all patches

func (*Texture) Top

func (t *Texture) Top() int

Top offset. The number of pixels above the origin; where the top row is.

func (*Texture) Width

func (t *Texture) Width() int

Width return width of image

type TextureStore

type TextureStore map[string]*Texture

TextureStore string map of textures

func NewTextureStore

func NewTextureStore() TextureStore

NewTextureStore creates new texture store

func (TextureStore) InitPatches

func (ts TextureStore) InitPatches()

func (TextureStore) LoadWAD

func (ts TextureStore) LoadWAD(w *wad.WAD)

Jump to

Keyboard shortcuts

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