示例#1
0
func nativeSetCursor(d dynamics.Dwimmer, s *term.SettingT, xt, yt term.T) term.T {
	x, err := represent.ToInt(d, xt)
	if err != nil {
		return term.Make("asked to move cursor, but received [] "+
			"while converting coordinate [] to an integer").T(err, xt)
	}
	y, err := represent.ToInt(d, yt)
	if err != nil {
		return term.Make("asked to move cursor, but received [] "+
			"while converting coordinate [] to an integer").T(err, yt)
	}
	d.SetCursor(x, y)
	return core.OK.T()
}
示例#2
0
func nativePutChar(d dynamics.Dwimmer, s *term.SettingT, char, xt, yt term.T) term.T {
	c, err := represent.ToRune(d, char)
	if err != nil {
		return term.Make("asked to write character, but received [] " +
			"while converting to a character").T(err)
	}
	x, err := represent.ToInt(d, xt)
	if err != nil {
		return term.Make("asked to write character, but received [] "+
			"while converting coordinate [] to an integer").T(err, xt)
	}
	y, err := represent.ToInt(d, yt)
	if err != nil {
		return term.Make("asked to write character, but received [] "+
			"while converting coordinate [] to an integer").T(err, yt)
	}
	d.SetCursor(x, y)
	d.PrintCh(c)
	return core.OK.T()
}