本文整理汇总了Golang中github.com/rthornton128/goncurses.Window.NoutRefresh方法的典型用法代码示例。如果您正苦于以下问题:Golang Window.NoutRefresh方法的具体用法?Golang Window.NoutRefresh怎么用?Golang Window.NoutRefresh使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/rthornton128/goncurses.Window
的用法示例。
在下文中一共展示了Window.NoutRefresh方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: 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
}
}
}
示例2: windw
func windw() {
stdscr, err := gc.Init()
if err != nil {
log.Fatal(err)
}
defer gc.End()
// Turn off character echo, hide the cursor and disable input buffering
gc.Echo(false)
gc.CBreak(true)
gc.Cursor(0)
stdscr.Print("Use arrow keys to move the window. Press 'q' to exit")
stdscr.NoutRefresh()
// Determine the center of the screen and offset those coordinates by
// half of the window size we are about to create. These coordinates will
// be used to move our window around the screen
rows, cols := stdscr.MaxYX()
height, width := 20, 40
y, x := (rows-height)/2, (cols-width)/2
// Create a new window centered on the screen and enable the use of the
// keypad on it so the arrow keys are available
var win *gc.Window
win, err = gc.NewWindow(height, width, y, x)
if err != nil {
log.Fatal(err)
}
win.Keypad(true)
windw:
for {
// Clear the section of screen where the box is currently located so
// that it is blanked by calling Erase on the window and refreshing it
// so that the chances are sent to the virtual screen but not actually
// output to the terminal
win.Erase()
win.NoutRefresh()
// Move the window to it's new location (if any) and redraw it
win.MoveWindow(y, x)
win.Box(gc.ACS_VLINE, gc.ACS_HLINE)
win.NoutRefresh()
// Update will flush only the characters which have changed between the
// physical screen and the virtual screen, minimizing the number of
// characters which must be sent
gc.Update()
// In order for the window to display correctly, we must call GetChar()
// on it rather than stdscr
switch win.GetChar() {
case 'q':
break windw
case 'h':
if x > 0 {
x--
}
case 'l':
if x < cols-width {
x++
}
case 'k':
if y > 1 {
y--
}
case 'j':
if y < rows-height {
y++
}
}
}
win.Delete()
}