閃爍字符串在Ruby的微薄文檔詛咒我發現這個方法在詛咒應用
A_BLINK
Blinking
See ::attrset
不過,我不知道如何利用它。
win1 = Window.new
win1.addstr.a_blink "Blinking" #=> error
請不要怪我,關於詛咒在谷歌上幾乎沒有任何幫助。說實話,至少不用於紅寶石。
閃爍字符串在Ruby的微薄文檔詛咒我發現這個方法在詛咒應用
A_BLINK
Blinking
See ::attrset
不過,我不知道如何利用它。
win1 = Window.new
win1.addstr.a_blink "Blinking" #=> error
請不要怪我,關於詛咒在谷歌上幾乎沒有任何幫助。說實話,至少不用於紅寶石。
您可以使用Curses::Window#attrset
來設置屬性。下面是一個例子:
require "curses"
include Curses
init_screen
begin
attrs = {
A_NORMAL => 'Normal display (no highlight)',
A_STANDOUT => 'Best highlighting mode of the terminal.',
A_UNDERLINE => 'Underlining',
A_REVERSE => 'Reverse video',
A_BLINK => 'Blinking',
A_DIM => 'Half bright',
A_BOLD => 'Extra bright or bold',
A_PROTECT => 'Protected mode',
A_INVIS => 'Invisible or blank mode',
A_ALTCHARSET => 'Alternate character set',
}
attrs.each { |a, s|
attrset(a)
addstr("#{s}\n")
}
refresh
getch
ensure
close_screen
end
Ruby的'Curses'類只是一個包裝。你可以閱讀這裏的概念:http://tldp.org/HOWTO/NCURSES-Programming-HOWTO/ – Stefan