Ejemplo n.º 1
0
func joke(x0, x1, y0, nx1, ny1, x, y, w int, cl col.Colour, s string, b bool) {
	//
	h := y + 8 + 1
	y1 := y0 + 8*h
	if b {
		y1 -= 40
	}
	dr(x0, x0+x*nx1, y0+y*ny1, cl, false)
	scr.SaveGr(uint(x0+x*nx1), uint(y1), uint(x0+(x+w)*nx1), uint(y1+8*w))
	img.Get(s, uint(x0+x*nx1), uint(y1))
	t := uint(1)
	if b {
		t = 2
	}
	ker.Sleep(t)
	scr.RestoreGr(uint(x0+x*nx1), uint(y1), uint(x0+(x+w)*nx1), uint(y1+8*w))
	if b {
		w = 2 * w / 3
	}
	dr(x0+(x+w)*nx1, x1, y0+y*ny1, cl, false)
}
Ejemplo n.º 2
0
func April1st() {
	col.ScreenF, col.ScreenB = col.White, col.Black
	scr.Cls()
	scr.MouseCursor(false)
	scr.Colour(col.White)
	scr.Write("Found evil software: \"       \"", 7, x0)
	doof(7, 22)
	scr.Colour(col.White)
	scr.Write("Remove (yes/no) ?", y0, x0)
	b := box.New()
	b.Wd(3)
	t := "yes"
	b.Edit(&t, y0, 23)
	scr.WarpMouseGr(2*int(scr.NX()), 2*int(scr.NY()))
	b.Colours(col.LightOrange, col.Black)
	b.Write("yes", y0, 23)
	doodle(col.LightWhite, 2)
	doodle(col.LightWhite, 2)
	doodle(col.LightYellow, 5)
	doodle(col.Yellow, 3)
	doodle(col.LightOrange, 5)
	doodle(col.Orange, 8)
	doodle(col.LightRed, 3)
	// TODO erase all (f + "*.tmp")
	t = str.Clr(70)
	scr.Write(t, y0, x0)
	scr.Write(t, y0+1, x0)
	col.ScreenF, col.ScreenB = col.LightGreen, col.DarkBlue
	scr.Cls()
	scr.Write("The murus-tool has removed \"       \" - your disk is reformatted :-)", y0, x0)
	doof(y0, 28)
	scr.Colour(col.LightWhite)
	scr.Write("Please install Linux, TeX, mercurial, Go and murus completely new !", y0+2, x0)
	ker.Sleep(20)
	ker.Terminate()
}
Ejemplo n.º 3
0
func wait(t uint) {
	//
	ker.Sleep(1 + (rand.Natural(3)))
}
Ejemplo n.º 4
0
func main() {
	//
	/*
	   h:= [...]string {
	     "     <              Rücktaste <--                      ",
	     " <<    >>           Pfeiltaste auf-/abwärts            ",
	     "|<<    >>|          Pos1-Taste/Endetaste               ",
	     "    2 .. 12         F2 .. F12-Taste                    ",
	     "   13 .. 24         Umschalt- + F1 .. F12-Taste        ",
	     "               oder Mausklick auf entsprechende Zeile  ",
	     " Zufallsstück       Rollen-Taste                       ",
	     "                                                       ",
	     "  <  1 sek >        Bildtaste auf-/abwärts             ",
	     " << 10 sek >>       Umschalt- + Bildtaste auf-/abwärts ",
	     "<<<  1 min >>>      Alt- + Bildtaste auf-/abwärts      ",
	     "                                                       ",
	     "  Lautstärke        Pfeiltaste Links/Rechts und        ",
	     "                    Umschalt- + Pfeiltaste Links/Rechts",
	     "               oder mit Maus auf entsprechende Anzeige ",
	     "   Balance          Alt- + Pfeiltaste Links/Rechts     ",
	     "               oder mit Maus auf entsprechende Anzeige ",
	     "                                                       ",
	     " Pause/weiter       Pause-Taste                        ",
	     " Ende/CD raus       Abbruch-/Entfernungstaste          " }
	   Help:= make ([]string, len(h))
	   for i:= 0; i < len(h); i++ { str.Set (&Help[i], h[i]) }
	*/
	errh.WriteHeadline(program, version, author, col.LightWhite, col.DarkBlue)
	f := model.Soundfile()
	if f == nil {
		model.Term1()
		errh.Error("kein Zugriff auf CD", 0)
		ker.Terminate()
		return
	}
	view.WriteMask()
	var (
		help, stop bool
	)
	quit := make(chan bool)
	go func() {
		for !stop {
			ker.Sleep(1)
			if !help {
				view.Write()
			}
		}
		quit <- true
	}()
	model.PlayTrack(0)
loop:
	for {
		c, t := kbd.Command()
		help = false
		scr.MouseCursor(true)
		switch c {
		case kbd.Esc:
			if t == 0 {
				model.Term()
			} else {
				model.Term1()
			}
			stop = true
			break loop
		case kbd.Enter:
			if t == 0 {
				model.PlayTrack1(true)
			} else {
				model.PlayTrack(model.NTracks() - 1)
			}
		case kbd.Back:
			switch t {
			case 0:
				model.PlayTrack0()
			case 1:
				model.PlayTrack1(false)
			default:
				model.PlayTrack(0)
			}
		case kbd.Left, kbd.Right:
			switch t {
			case 0:
				model.Ctrl1(model.All, c == kbd.Right)
			case 1:
				_ = uint(model.Volume(model.All))
				for j := 0; j < 8; j++ {
					model.Ctrl1(model.All, c == kbd.Right)
				}
			default:
				model.Ctrl1(model.Balance, c == kbd.Left)
			}
		case kbd.Pos1:
			model.PlayTrack(0)
		case kbd.End:
			model.PlayTrack(model.NTracks() - 1)
		case kbd.Up, kbd.Down:
			switch t {
			case 0, 1:
				model.PlayTrack1(c == kbd.Down)
			case 2:
				model.PosTime1(c == kbd.Down, 1)
			case 3:
				model.PosTime1(c == kbd.Down, 10)
			default:
				model.PosTime1(c == kbd.Down, 60)
			}
		case kbd.Tab:
			model.PlayTrack1(t == 0)
		case kbd.Del:
			model.Term1()
			return
		case kbd.Help, kbd.LookFor, kbd.Act, kbd.Cfg,
			kbd.Mark, kbd.Demark, kbd.Deposit, kbd.Paste,
			kbd.Black, kbd.Red, kbd.Green, kbd.Blue:
			if t == 0 {
				if c == kbd.Help {
					//          help = true
					//          errh.WriteHelp (Help)
				} else {
					model.PlayTrack(uint8(c - kbd.Help))
				}
			} else {
				model.PlayTrack(10 + uint8(c-kbd.Help))
			}
		case kbd.Roll:
			model.PlayTrack(uint8(rand.Natural(uint(model.NTracks()))))
		case kbd.Pause:
			model.Switch()
		case kbd.Here, kbd.Pull:
			var ctrl model.Controller
			if track, b := view.TrackUnderMouse(); b {
				if c == kbd.Here {
					model.PlayTrack(track)
				}
			} else if ls, c := view.ControlUnderMouse(&ctrl); c {
				model.Ctrl(ctrl, uint8(ls))
			} else if b, sek, c := view.TimeUnderMouse(); c {
				model.PosTime(b, sek)
			}
		case kbd.Navigate:
			/*
			   var mov, rot space.Gridcoordinate
			   &mov, &rot = mouse3d.Read()
			   model.Ctrl1 (model.All, mov [space.Top] < 0)
			   model.Ctrl1 (model.All, rot [space.Right] < 0)
			   model.Ctrl1 (model.Balance, rot [space.Front] < 0)
			*/
		}
	}
	<-quit
	_ = f.Close()
	ker.Terminate()
}