mirror of
https://github.com/OpenDiablo2/OpenDiablo2
synced 2024-12-27 20:46:32 -05:00
font table format: methods to set size and frame index
This commit is contained in:
parent
7a54465eb3
commit
66ac5ff657
@ -32,8 +32,8 @@ type FontGlyph struct {
|
||||
height int
|
||||
}
|
||||
|
||||
func (fg *FontGlyph) setHeight(h int) {
|
||||
fg.height = h
|
||||
func (fg *FontGlyph) SetSize(w, h int) {
|
||||
fg.width, fg.height = w, h
|
||||
}
|
||||
|
||||
// Size returns glyph's size
|
||||
@ -41,6 +41,10 @@ func (fg *FontGlyph) Size() (w, h int) {
|
||||
return fg.width, fg.height
|
||||
}
|
||||
|
||||
func (fg *FontGlyph) SetFrameIndex(idx int) {
|
||||
fg.frame = idx
|
||||
}
|
||||
|
||||
// FrameIndex returns glyph's frame
|
||||
func (fg *FontGlyph) FrameIndex() int {
|
||||
return fg.frame
|
||||
@ -94,7 +98,7 @@ func (f *Font) SetBackground(sheet d2interface.Animation) {
|
||||
_, h := f.sheet.GetFrameBounds()
|
||||
|
||||
for i := range f.Glyphs {
|
||||
f.Glyphs[i].setHeight(h)
|
||||
f.Glyphs[i].SetSize(f.Glyphs[i].width, h)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user