data

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2021 License: BSD-3-Clause, MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FontContainer

type FontContainer struct {
	// TODO Flyweight pattern re-use same fonts or add new
	Font *ttf.Font
	// contains filtered or unexported fields
}

FontContainer data storage

func NewFontContainer

func NewFontContainer() (*FontContainer, error)

NewFontContainer initialise new font container

func (*FontContainer) Clear

func (f *FontContainer) Clear()

Clear font data container

func (*FontContainer) LoadFromFile

func (f *FontContainer) LoadFromFile(d *FontData) (err error)

LoadFromFile a font

type FontData

type FontData struct {
	sync.Mutex

	// ID unique name
	ID string
	// FontFilePath loaded once and cannot be changed later
	FontFilePath string
	// Size of font
	Size uint32
}

FontData that will be used for in scene

type TextureContainer

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

TextureContainer data storage

func NewTexturesContainer

func NewTexturesContainer(r *sdl.Renderer) *TextureContainer

NewTexturesContainer for loaded textures

func (*TextureContainer) Get

func (t *TextureContainer) Get(d *TextureData) (*sdl.Texture, error)

Get texture by id

func (*TextureContainer) GetAll

func (t *TextureContainer) GetAll() map[string]*sdl.Texture

GetAll all loaded textures

func (*TextureContainer) LoadFromFile

func (t *TextureContainer) LoadFromFile(d *TextureData) error

LoadFromFile texture

type TextureData

type TextureData struct {
	// ImageFilePath which will be used on screen
	ImageFilePath string
	// ID unique name
	ID string
}

TextureData ...

Jump to

Keyboard shortcuts

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