本文整理匯總了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
}
}
}