gpt4 book ai didi

c++ - Ncurses:面板的 doupdate() 和 refresh() 之间的区别

转载 作者:太空狗 更新时间:2023-10-29 21:02:46 25 4
gpt4 key购买 nike

doupdate()refresh() 有什么区别?

看来 refresh () 可以代替 doupdate(),但是除非调用 refresh(),否则文本不会出现。

此外,refresh() 是刷新所有窗口,还是应该为面板内的每个窗口调用 refresh()

最佳答案

来自 Dan Gookin 的 Programmer's Guide to NCurses (第 513 页):

The refresh operation in NCurses consists of two parts:

  • First, NCurses takes those portions of a window that have been changed or touched and writes those portions from the window data
    structure to a virtual screen in memory.
  • Second, the contents of the virtual screen touched since the last refresh are displayed on the terminal.

The copying of information from a window data structure to the virtual screen is carried out by the wnoutrefresh() function. The updating of the virtual screen to the terminal is handled by another function, doupdate(). Together they form the two components of a refresh() or wrefresh() call.

The advantage of using wnoutrefresh() comes when updating multiple windows. In that case, repeated calls to wnoutrefresh() followed by a sin- gle doupdate() call is more efficient than a series of wrefresh() calls, plus it results in less flicker.

就面板而言,它们是窗口的包装器(因此每个面板只有一个窗口)。调用 update_panels()(以面板给定的正确堆叠顺序将窗口写入虚拟屏幕)然后调用 doupdate() 输出虚拟屏幕就足够了屏幕到终端。

如果您想进一步划分面板,请考虑使用子窗口。

关于c++ - Ncurses:面板的 doupdate() 和 refresh() 之间的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14899708/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com