本文整理汇总了Golang中code/google/com/p/goplan9/draw.Display.InitMouse方法的典型用法代码示例。如果您正苦于以下问题:Golang Display.InitMouse方法的具体用法?Golang Display.InitMouse怎么用?Golang Display.InitMouse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类code/google/com/p/goplan9/draw.Display
的用法示例。
在下文中一共展示了Display.InitMouse方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: Play
func Play(pp []Piece, d *draw.Display) {
pieces = pp
N = len(pieces[0].d)
initPieces()
display = d
screen = d.ScreenImage
mousectl = d.InitMouse()
kbdctl = d.InitKeyboard()
rand.Seed(int64(time.Now().UnixNano() % (1e9 - 1)))
for i, col := range txpix {
tx[i], _ = d.AllocImage(image.Rect(0, 0, 1, 1), screen.Pix, true, col)
}
whitemask, _ = display.AllocImage(image.Rect(0, 0, 1, 1), draw.ARGB32, true, 0x7F7F7F7F)
tsleep = 50
timerc = time.Tick(time.Duration(tsleep/2) * time.Millisecond)
suspc = make(chan bool)
mousec = make(chan draw.Mouse)
kbdc = make(chan rune)
go suspproc()
redraw(false)
play()
}
示例2: Init
func (m *SpacewarPDP1) Init(d *draw.Display) {
m.disp = d
m.mc = d.InitMouse()
m.kc = d.InitKeyboard()
m.screen = d.ScreenImage
m.dx = m.screen.R.Dx()
m.dy = m.screen.R.Dy()
m.pix = make([][]uint8, m.dy)
m.oldpix = make([][]uint8, m.dy)
for i := range m.pix {
m.pix[i] = make([]uint8, m.dx)
m.oldpix[i] = make([]uint8, m.dx)
}
m.cmap = make([]*draw.Image, 256)
for i := range m.cmap {
var r, g, b draw.Color
r = draw.Color(min(0, 255))
g = draw.Color(min(i*2, 255))
b = draw.Color(min(0, 255))
m.cmap[i], _ = d.AllocImage(image.Rect(0, 0, 1, 1), d.ScreenImage.Pix, true, r<<24|g<<16|b<<8|0xff)
}
m.screen.Draw(m.screen.R, d.Black, nil, image.ZP)
}