mirror of
https://github.com/OpenDiablo2/OpenDiablo2
synced 2024-09-29 06:36:30 -04: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
|
height int
|
||||||
}
|
}
|
||||||
|
|
||||||
func (fg *FontGlyph) setHeight(h int) {
|
func (fg *FontGlyph) SetSize(w, h int) {
|
||||||
fg.height = h
|
fg.width, fg.height = w, h
|
||||||
}
|
}
|
||||||
|
|
||||||
// Size returns glyph's size
|
// Size returns glyph's size
|
||||||
@ -41,6 +41,10 @@ func (fg *FontGlyph) Size() (w, h int) {
|
|||||||
return fg.width, fg.height
|
return fg.width, fg.height
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (fg *FontGlyph) SetFrameIndex(idx int) {
|
||||||
|
fg.frame = idx
|
||||||
|
}
|
||||||
|
|
||||||
// FrameIndex returns glyph's frame
|
// FrameIndex returns glyph's frame
|
||||||
func (fg *FontGlyph) FrameIndex() int {
|
func (fg *FontGlyph) FrameIndex() int {
|
||||||
return fg.frame
|
return fg.frame
|
||||||
@ -94,7 +98,7 @@ func (f *Font) SetBackground(sheet d2interface.Animation) {
|
|||||||
_, h := f.sheet.GetFrameBounds()
|
_, h := f.sheet.GetFrameBounds()
|
||||||
|
|
||||||
for i := range f.Glyphs {
|
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