本文整理匯總了Golang中github.com/MJKWoolnough/byteio.StickyReader.ReadInt64方法的典型用法代碼示例。如果您正苦於以下問題:Golang StickyReader.ReadInt64方法的具體用法?Golang StickyReader.ReadInt64怎麽用?Golang StickyReader.ReadInt64使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/MJKWoolnough/byteio.StickyReader
的用法示例。
在下文中一共展示了StickyReader.ReadInt64方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: generate
func generate(r *byteio.StickyReader, w *byteio.StickyWriter, of *os.File) error {
memoryLimit := r.ReadUint64()
size := r.ReadInt64()
gPath := data.ReadString(r)
levelName := data.ReadString(r)
mapPath := data.ReadString(r)
if r.Err != nil {
return r.Err
}
o, err := ora.Open(of, size)
if err != nil {
return err
}
f, err := os.Open(path.Join(gPath, "data.gen"))
if err != nil {
return err
}
g, err := LoadGenerator(f)
if e := f.Close(); e != nil {
return e
}
if err != nil {
return err
}
b := o.Bounds()
w.WriteUint8(2)
w.WriteInt32(int32(b.Max.X) >> 4)
w.WriteInt32(int32(b.Max.Y) >> 4)
c := make(chan paint, 1024)
m := make(chan string, 4)
e := make(chan struct{}, 0)
go func() {
defer close(e)
defer close(m)
defer close(c)
for {
select {
case message := <-m:
w.WriteUint8(3)
data.WriteString(w, message)
case p := <-c:
w.WriteUint8(4)
w.WriteInt32(p.X)
w.WriteInt32(p.Y)
r, g, b, a := p.RGBA()
w.WriteUint8(uint8(r >> 8))
w.WriteUint8(uint8(g >> 8))
w.WriteUint8(uint8(b >> 8))
w.WriteUint8(uint8(a >> 8))
case <-e:
return
}
}
}()
err = g.Generate(levelName, mapPath, o, c, m, memoryLimit)
e <- struct{}{}
<-e
return err
}