spriteManager

package
v0.0.0-...-126e10b Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2024 License: MIT Imports: 31 Imported by: 0

README

Sprite Manager Service

The purpose of this Service Mesh service is to use the DC6, DCC, DS1, and DT1 files to generate graphical sprites in PNG and GIF format.

Dependencies

This service has dependencies on the following services:

Integration with other services

This service integrates with the following services:

The integrations are optional, meaning that the web router and cache manager can be safely omitted from the servicemesh.


This service exports an integration interface IsSpriteLoader with an alias Dependencncy which are intended to be used by other services for dependency resolution (see servicemesh.HasDependencies), and expose just the methods which other services should use.

type Dependency = IsSpriteLoader

type IsSpriteLoader interface {
    LoadDc6ToPngSpriteAtlas(pathDC6 string, pathPL2 string) ([]byte, error)
    LoadDc6ToAnimatedGif(pathDC6 string, pathPL2 string) ([]byte, error)
    
    LoadDccToPngSpriteAtlas(pathDC6 string, pathPL2 string) ([]byte, error)
    LoadDccToAnimatedGif(pathDC6 string, pathPL2 string) ([]byte, error)
    
    LoadDt1ToPngSpriteAtlas(pathDC6 string, pathPL2 string) ([]byte, error)
    
    LoadDs1ToPngSpriteAtlas(pathDC6 string, pathPL2 string) ([]byte, error)
}

Web router service integration

If the web router service is present at servicemesh, this service will register routes for flushing all caches and for getting cache statistics.

The route slug for this service is sprite, so all routes defined will be under that route group.

route method purpose
sprite/png/:palette/*path GET generates and serves a png image (with packed JSON sprite atlas information after the PNG data) using the specified filepath (supports dcc, dc6, dt1, ds1)
sprite/gif/:palette/*path GET generates and serves and animated gif from the specified filepath (supports dcc, dc6)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dependency

type Dependency = IsSpriteLoader

type Frame

type Frame struct {
	Image  image.Image
	Offset image.Point
}

type FrameComposite

type FrameComposite struct {
	GridSize int
	Layout   []int
	// contains filtered or unexported fields
}

type IsSpriteLoader

type IsSpriteLoader interface {
	LoadDc6ToLayeredAnimation(pathDC6 string, pathPL2 string) (*LayeredAnimation, error)
	LoadDc6ToPngSpriteAtlas(pathDC6 string, pathPL2 string) ([]byte, error)
	LoadDc6ToAnimatedGif(pathDC6 string, pathPL2 string) ([]byte, error)

	LoadDccToPngSpriteAtlas(pathDC6 string, pathPL2 string) ([]byte, error)
	LoadDccToAnimatedGif(pathDC6 string, pathPL2 string) ([]byte, error)

	LoadDt1ToPngSpriteAtlas(pathDC6 string, pathPL2 string) ([]byte, error)

	LoadDs1ToPngSpriteAtlas(pathDC6 string, pathPL2 string) ([]byte, error)
}

type Layer

type Layer struct {
	Frames []Frame
}

type LayeredAnimation

type LayeredAnimation struct {
	Layers []Layer
}

type Service

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

func (*Service) CacheBudget

func (s *Service) CacheBudget() int

CacheBudget implements cacheManager.HasCache

func (*Service) ConfigFileName

func (s *Service) ConfigFileName() string

func (*Service) DefaultConfig

func (s *Service) DefaultConfig() (cfg configFile.Config)

func (*Service) DependenciesResolved

func (s *Service) DependenciesResolved() bool

func (*Service) ExportToLua

func (s *Service) ExportToLua(state *lua.LState)

func (*Service) FlushCache

func (s *Service) FlushCache(newCache *cache.Cache)

FlushCache implements cacheManager.HasCache

func (*Service) Init

func (s *Service) Init(mesh servicemesh.Mesh)

func (*Service) InitRoutes

func (s *Service) InitRoutes(group *gin.RouterGroup)

func (*Service) LoadConfig

func (s *Service) LoadConfig(config *configFile.Config)

func (*Service) LoadDc6ToAnimatedGif

func (s *Service) LoadDc6ToAnimatedGif(pathDC6 string, pathPL2 string) ([]byte, error)

func (*Service) LoadDc6ToLayeredAnimation

func (s *Service) LoadDc6ToLayeredAnimation(pathDC6 string, pathPL2 string) (*LayeredAnimation, error)

func (*Service) LoadDc6ToPngSpriteAtlas

func (s *Service) LoadDc6ToPngSpriteAtlas(pathDC6 string, pathPL2 string) ([]byte, error)

func (*Service) LoadDccToAnimatedGif

func (s *Service) LoadDccToAnimatedGif(pathDCC string, pathPL2 string) ([]byte, error)

func (*Service) LoadDccToPngSpriteAtlas

func (s *Service) LoadDccToPngSpriteAtlas(pathDCC string, pathPL2 string) ([]byte, error)

func (*Service) LoadDs1ToPngSpriteAtlas

func (s *Service) LoadDs1ToPngSpriteAtlas(pathDS1 string, pathPL2 string) ([]byte, error)

func (*Service) LoadDt1ToPngSpriteAtlas

func (s *Service) LoadDt1ToPngSpriteAtlas(pathDT1 string, pathPL2 string) ([]byte, error)

func (*Service) Logger

func (s *Service) Logger() *slog.Logger

func (*Service) Name

func (s *Service) Name() string

func (*Service) Ready

func (s *Service) Ready() bool

func (*Service) ResolveDependencies

func (s *Service) ResolveDependencies(services []servicemesh.Service)

func (*Service) SetLogger

func (s *Service) SetLogger(logger *slog.Logger)

func (*Service) Slug

func (s *Service) Slug() string

func (*Service) UnexportFromLua

func (s *Service) UnexportFromLua(state *lua.LState)

Jump to

Keyboard shortcuts

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