本文整理汇总了Golang中exp/draw.Window类的典型用法代码示例。如果您正苦于以下问题:Golang Window类的具体用法?Golang Window怎么用?Golang Window使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Window类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: demuxEvents
func demuxEvents(w draw.Window, kc chan int) {
for event := range w.EventChan() {
switch e := event.(type) {
case draw.KeyEvent:
kc <- e.Key
}
}
os.Exit(0)
}
开发者ID:GNA-SERVICES-INC,项目名称:MoNGate,代码行数:9,代码来源:spacewar.go
示例2: flushFunc
func flushFunc(ctxt draw.Window) func(r image.Rectangle) {
if fctxt, ok := ctxt.(RectFlusherWindow); ok {
return func(r image.Rectangle) {
fctxt.FlushImageRect(r)
}
}
return func(_ image.Rectangle) {
ctxt.FlushImage()
}
}
开发者ID:juanman2,项目名称:dot-emacs,代码行数:10,代码来源:shape.go
示例3: goplot
func goplot(w draw.Window, ch chan []Point, wait chan int) {
s := w.Screen()
for {
v := <-ch
plot(s, v)
w.FlushImage()
if *waitForGraphics {
wait <- 1
}
}
}
开发者ID:taysom,项目名称:va,代码行数:12,代码来源:ifsrnd.go
示例4: demuxEvents
func demuxEvents(w draw.Window) {
for event := range w.EventChan() {
switch e := event.(type) {
case draw.MouseEvent:
mousec <- e
case draw.ConfigEvent:
resizec <- true
case draw.KeyEvent:
kbdc <- e.Key
}
}
os.Exit(0)
}
开发者ID:GNA-SERVICES-INC,项目名称:MoNGate,代码行数:13,代码来源:xs.go
示例5: Init
func (m *SpacewarPDP1) Init(ctxt draw.Window, kc chan int) {
m.ctxt = ctxt
m.kc = kc
m.screen = ctxt.Screen()
m.dx = m.screen.Bounds().Dx()
m.dy = m.screen.Bounds().Dy()
m.colorModel = m.screen.ColorModel()
m.pix = make([][]uint8, m.dy)
for i := range m.pix {
m.pix[i] = make([]uint8, m.dx)
}
m.cmap = make([]image.Color, 256)
for i := range m.cmap {
var r, g, b uint8
r = uint8(min(0, 255))
g = uint8(min(i*2, 255))
b = uint8(min(0, 255))
m.cmap[i] = m.colorModel.Convert(image.RGBAColor{r, g, b, 0xff})
}
}
开发者ID:GNA-SERVICES-INC,项目名称:MoNGate,代码行数:20,代码来源:spacewar.go
示例6: Play
func Play(pp []Piece, ctxt draw.Window) {
display = ctxt
screen = ctxt.Screen()
screenr = screen.Bounds()
pieces = pp
N = len(pieces[0].d)
initPieces()
rand.Seed(int64(time.Nanoseconds() % (1e9 - 1)))
whitemask = image.NewColorImage(image.AlphaColor{0x7F})
tsleep = 50
timerc = time.Tick(int64(tsleep/2) * 1e6)
suspc = make(chan bool)
mousec = make(chan draw.MouseEvent)
resizec = make(chan bool)
kbdc = make(chan int)
go demuxEvents(ctxt)
go suspproc()
points = 0
redraw(false)
play()
}
开发者ID:GNA-SERVICES-INC,项目名称:MoNGate,代码行数:21,代码来源:xs.go
示例7: inlineplot
func inlineplot(w draw.Window, v []Point) {
s := w.Screen()
plot(s, v)
w.FlushImage()
}
开发者ID:taysom,项目名称:va,代码行数:6,代码来源:ifsrnd.go
注:本文中的exp/draw.Window类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论