Internalise the map rect
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"compress/gzip"
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
"image"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
@@ -173,6 +174,15 @@ type GameMap struct {
|
||||
Text string
|
||||
}
|
||||
|
||||
func (m *GameMap) Rect() image.Rectangle {
|
||||
return image.Rect(
|
||||
int(m.Header.MinWidth),
|
||||
int(m.Header.MinLength),
|
||||
int(m.Header.MaxWidth),
|
||||
int(m.Header.MaxLength),
|
||||
)
|
||||
}
|
||||
|
||||
// A game map contains a .txt and a .map. If they're in the same directory,
|
||||
// just pass the directory + basename to load both
|
||||
func LoadGameMap(prefix string) (*GameMap, error) {
|
||||
|
Reference in New Issue
Block a user