示例#1
0
文件: ifsrnd.go 项目: taysom/va
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
		}
	}
}
示例#2
0
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})
	}
}
示例#3
0
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()
}
示例#4
0
文件: ifsrnd.go 项目: taysom/va
func inlineplot(w draw.Window, v []Point) {
	s := w.Screen()

	plot(s, v)
	w.FlushImage()
}