Merge pull request #1109 from gucio321/d2font

d2dat: add New method for DATPalette
This commit is contained in:
Tim Sarbin 2021-03-28 12:02:01 -04:00 committed by GitHub
commit cfcd303252
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 0 deletions

View File

@ -15,6 +15,16 @@ type DATPalette struct {
colors [numColors]d2interface.Color
}
// New creates a new dat palette
func New() *DATPalette {
result := &DATPalette{}
for i := range result.colors {
result.colors[i] = &DATColor{}
}
return result
}
// NumColors returns the number of colors in the palette
func (p *DATPalette) NumColors() int {
return len(p.colors)