示例#1
0
文件: imp.go 项目: CaptainSoOmA/Uni
func (X *Imp) Write(l, c uint) {
	//
	r := rep[X.nr]
	switch format {
	case Short:
		switch system {
		case Life:
			f, b := r.cf[X.mark], r.cb[X.mark]
			if X.nr == nothing {
				f, b = b, f
			}
			x, y := int(8*c)+8, int(16*l)+8
			scr.Colour(f)
			scr.Circle(x, y, 6)
			scr.Circle(x, y, 5)
			scr.Colour(b)
			scr.CircleFull(x, y, 2)
		case Eco:
			for y := 0; y < Height; y++ {
				for x := 0; x < Width; x++ {
					f, b := r.cf[X.mark], r.cb[X.mark] // !
					if r.img[y][x] == ' ' {
						f, b = b, f
					}
					scr.Colours(f, b)
					scr.Point(Width*int(c)/2+x, Height*int(l)+y)
				}
			}
		}
	case Long:
		scr.Colour(r.cf[plantNothing])
		scr.Write(r.word, l, c)
	}
}
示例#2
0
文件: scr.go 项目: CaptainSoOmA/Uni
func writePlate(p uint, i bool) {
	//
	var r uint
	if nPhilos <= 7 {
		r = y0 / 8
	} else {
		r = y0 / 3
	}
	scr.Circle(xt[p], yt[p], r)
	if i {
		scr.Circle(xt[p], yt[p], (2*r)/1)
	}
}
示例#3
0
文件: imp.go 项目: CaptainSoOmA/Uni
func (f *Imp) Write() {
	//
	if f.Empty() {
		return
	}
	scr.Colour(f.colour)
	switch f.sort {
	case Pointset:
		scr.Pointset(f.x, f.y)
	case Segments:
		scr.Segments(f.x, f.y)
	case Polygon:
		scr.Polygon(f.x, f.y)
		if f.filled {
			//      scr.PolygonFull (f.x, f.y) // not yet implemented
		}
	case Curve:
		scr.Curve(f.x, f.y)
		if f.filled {
			n := len(f.x) - 1
			scr.CircleFull(f.x[n], f.y[n], 4) // ?
		}
	case InfLine:
		scr.InfLine(f.x[0], f.y[0], f.x[1], f.y[1])
	case Rectangle:
		if f.filled {
			scr.RectangleFull(f.x[0], f.y[0], f.x[1], f.y[1])
		} else {
			scr.Rectangle(f.x[0], f.y[0], f.x[1], f.y[1])
		}
	case Circle:
		if f.filled {
			scr.CircleFull(f.x[0], f.y[0], uint(f.x[1]))
		} else {
			scr.Circle(f.x[0], f.y[0], uint(f.x[1]))
		}
	case Ellipse:
		if f.filled {
			scr.EllipseFull(f.x[0], f.y[0], uint(f.x[1]), uint(f.y[1]))
		} else {
			scr.Ellipse(f.x[0], f.y[0], uint(f.x[1]), uint(f.y[1]))
		}
	case Text:
		bx.Wd(str.ProperLen(f.tx))
		bx.ColourF(f.colour)
		bx.WriteGr(f.tx, f.x[0], f.y[0])
	case Image:
		//    if bewegt {
		//      scr.RectangleFullInv (...)
		//    } else {
		//      copy from Imageptr in Framebuffer
		//    }
		img.Get(f.tx, uint(f.x[0]), uint(f.y[0]))
	}
}
示例#4
0
文件: imp.go 项目: CaptainSoOmA/Uni
func (x *Imp) write() {
	//
	r := x.Radius()
	/*
	   if r <= R0 {
	     scr.CircleFull (int(x.x), int(x.y), R0)
	   } else {
	     for n:= uint(0); n <= 1; n++ {
	       scr.Circle (int(x.x), int(x.y), r + n)
	     }
	   }
	*/
	if x.length > 0 {
		n := str.ProperLen(x.name)
		xx := x.x - (n*scr.NX1())/2 + 1
		yy := x.y - scr.NY1()/2 + 1
		switch x.lab {
		case zentral:

		case rechts:
			xx = x.x + scr.NX1() + 1
		case oben:
			yy -= 5 * scr.NY1() / 6
		case links:
			xx = x.x - n*scr.NX1() - scr.NX1() + 1
		case unten:
			yy += 5 * scr.NY1() / 6
		}
		bx.SetTransparent(transparent)
		bx.Wd(x.length)
		bx.WriteGr(x.name, int(xx), int(yy))
	}
	if r <= R0 {
		scr.CircleFull(int(x.x), int(x.y), R0)
	} else {
		for n := uint(0); n <= 1; n++ {
			scr.Circle(int(x.x), int(x.y), r+n)
		}
	}
}
示例#5
0
文件: main.go 项目: CaptainSoOmA/Uni
func paint(f figure, fo format, x0, y0, x, y int) {
	//
	var a, b uint
	if x >= x0 {
		a = uint(x - x0)
	} else {
		a = uint(x0 - x)
	}
	if y >= y0 {
		b = uint(y - y0)
	} else {
		b = uint(y0 - y)
	}
	switch f {
	case line:
		switch fo {
		case border:
			scr.Line(x0, y0, x, y)
		case inv:
			scr.LineInv(x0, y0, x, y)
		case full:
			// scr.StrichAusgeben (x0, y0, x, y, Staerke)
		}
	case rectangle:
		switch fo {
		case border:
			scr.Rectangle(x0, y0, x, y)
		case inv:
			scr.RectangleInv(x0, y0, x, y)
		case full:
			scr.RectangleFull(x0, y0, x, y)
		}
	case circle:
		if b > a {
			a = b
		}
		switch fo {
		case border:
			scr.Circle(x0, y0, a)
		case inv:
			scr.CircleInv(x0, y0, a)
		case full:
			scr.CircleFull(x0, y0, a)
		}
	case ellipse:
		switch fo {
		case border:
			/*
			     scr.Ellipse ((x0 + x) / 2, (y0 + y) / 2, a, b)
			   case invers:
			     scr.EllipseInv ((x0 + x) / 2, (y + y0) / 2, a, b)
			   case full:
			     scr.EllipseFull ((x0 + x) / 2, (y0 + y) / 2, a, b)
			*/
			scr.Ellipse(x0, y0, a, b)
		case inv:
			scr.EllipseInv(x0, y0, a, b)
		case full:
			scr.EllipseFull(x0, y0, a, b)
		}
	}
	//  scr.Colour (paintColour), (* Wörkeraund: Bildschirm....Invertieren f *)
}
示例#6
0
文件: murus.go 项目: CaptainSoOmA/Uni
func circ(c col.Colour, x, y uint) {
	//
	scr.Colour(c)
	scr.Circle(int(8*x), int(16*y/2), 16*y/2-1)
}
示例#7
0
文件: imp.go 项目: CaptainSoOmA/Uni
func (x *Imp) Write(aktuell bool) {
	//
	xx, yy := scale.Scale(x.breite, x.länge)
	lw := scr.ActLinewidth()
	scr.SetLinewidth(scr.Thin)
	if aktuell {
		scr.Colours(linie.Farbe[x.linie], col.ScreenB)
	} else { // umstieg
		scr.Colours(col.Black, col.ScreenB)
	}
	const r = 2
	if xx >= r && yy >= r {
		scr.Circle(xx, yy, r)
		//    scr.Colour (col.ScreenB)
		scr.CircleFull(xx, yy, r-1)
	}
	scr.SetLinewidth(lw)
	n := int(str.ProperLen(x.name))
	if n <= 2 {
		return
	}
	n1 := int(str.ProperLen(x.name1))
	if n1 > n {
		n = n1
	}
	xn, yn := 0, 0
	w, h := int(scr.NX1()), int(scr.NY1())
	switch x.beschriftung {
	case 'r':
		xn = xx + w + 1
		if n1 == 0 {
			yn = yy - h/2
		} else {
			yn = yy - h
		}
	case 'o':
		xn = xx - (n*w)/2 + 1
		if n1 == 0 {
			yn = yy - h - 1
		} else {
			yn = yy - 2*h - 1
		}
	case 'l':
		xn = xx - n*w - w + 1
		if n1 == 0 {
			yn = yy - h/2
		} else {
			yn = yy - h
		}
	case 'u':
		xn = xx - (n*w)/2 + 1
		yn = yy + h/2 - 2
	default:
		xn = xx - (n*w)/2 + 1
		if n1 == 0 {
			yn = yy - h/2
		} else {
			yn = yy - h
		}
	}
	xxx := x.name
	for i := uint(0); i < uint(len(xxx)); i++ {
		if xxx[i] == '_' {
			str.Replace(&xxx, i, ' ')
		}
	}
	xxx1 := x.name1
	for i := uint(0); i < uint(len(xxx1)); i++ {
		if xxx1[i] == '_' {
			str.Replace(&xxx1, i, ' ')
		}
	}
	if aktuell {
		scr.Colours(linie.Farbe[x.linie], col.ScreenB)
	} else { // umstieg
		scr.Colours(col.Black, col.ScreenB)
		scr.Colours(col.Black, col.Pink)
	}
	scr.WriteGr(xxx, xn, yn)
	scr.WriteGr(xxx1, xn, yn+h+0)
}