本文整理汇总了Golang中github.com/rthornton128/goncurses.Window.MoveAddChar方法的典型用法代码示例。如果您正苦于以下问题:Golang Window.MoveAddChar方法的具体用法?Golang Window.MoveAddChar怎么用?Golang Window.MoveAddChar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/rthornton128/goncurses.Window
的用法示例。
在下文中一共展示了Window.MoveAddChar方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: Draw
func (h *Office) Draw(screen *gc.Window, y, x int) {
f := h.Frames
v, p := (*f)["Office"]
if !p {
frames := [][]string{[]string{
"<----->",
"|XXXXX|",
"| |",
"|XXXXX|",
"| |",
"|XXXXX|",
"[-----]"}, []string{
"<----->",
"|XXXXX|",
"| |",
"| |",
"| |",
"|XXXXX|",
"[-----]"}}
(*f)["Office"] = frames
v = frames
}
for ly, row := range v[h.Frame] {
for lx, c := range row {
screen.MoveAddChar(y+ly, x+lx, MapChar(c))
}
}
}
示例2: display
func (c *Circuit) display() {
stdscr, err := gc.Init()
if err != nil {
log.Println(err)
}
defer gc.End()
rows, cols := stdscr.MaxYX()
height, width := len(c.circuit)+1, len(c.circuit[0])+1
y, x := (rows-height)/2, (cols-width)/2
var win *gc.Window
win, err = gc.NewWindow(height, width, y, x)
if err != nil {
log.Println(err)
}
defer win.Delete()
win.Timeout(500)
for i := 0; i != height-1; i++ {
for j := 0; j != width-1; j++ {
if c.circuit[i][j] == "" {
continue
}
char := gc.Char([]rune(c.circuit[i][j])[0])
win.MoveAddChar(i, j, char)
}
}
main:
for {
for _, com := range c.Components {
com.Update()
}
for _, com := range c.Components {
cx, cy, _, _ := com.Space()
for coord, out := range com.Visual() {
char := gc.Char([]rune(*out)[0])
win.MoveAddChar(cx+coord.X, cy+coord.Y, char)
}
}
win.NoutRefresh()
gc.Update()
switch win.GetChar() {
case 'q':
break main
}
}
}