Start loading .fnt files. No display yet
This commit is contained in:
@@ -20,6 +20,7 @@ type Record struct {
|
||||
SpriteId int
|
||||
X int
|
||||
Y int
|
||||
Desc string
|
||||
|
||||
// FIXME: turn these into first-class data
|
||||
properties map[string]string
|
||||
@@ -174,7 +175,30 @@ func setProperty(r *Record, k, v string) {
|
||||
r.X = vInt
|
||||
case "Y-CORD":
|
||||
r.Y = vInt
|
||||
case "DESC":
|
||||
r.Desc = v
|
||||
default:
|
||||
r.properties[k] = v
|
||||
}
|
||||
}
|
||||
|
||||
type Replacer interface {
|
||||
Replace(int, *string)
|
||||
}
|
||||
|
||||
func (r *Record) Internationalize(replacer Replacer) {
|
||||
id, err := strconv.Atoi(r.Desc)
|
||||
if err == nil {
|
||||
replacer.Replace(id, &r.Desc)
|
||||
}
|
||||
|
||||
for _, child := range r.Children {
|
||||
child.Internationalize(replacer)
|
||||
}
|
||||
}
|
||||
|
||||
func (m *Menu) Internationalize(replacer Replacer) {
|
||||
for _, record := range m.Records {
|
||||
record.Internationalize(replacer)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user