summaryrefslogtreecommitdiff
path: root/sample/curses/mouse.rb
diff options
context:
space:
mode:
authorshugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-12-09 04:39:49 +0000
committershugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-12-09 04:39:49 +0000
commit9c5b2fd8aa0fd343ad094d47a638cfd3f6ae0a81 (patch)
treebddeacaf7de997105c2e8e362cadc5604adcf91b /sample/curses/mouse.rb
parentd3363a96df2f68e4a9b0454bb5aeba7705d3662c (diff)
* ext/curses, sample/curses: removed curses.
* NEWS: added an entry for the above change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44089 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'sample/curses/mouse.rb')
-rw-r--r--sample/curses/mouse.rb52
1 files changed, 0 insertions, 52 deletions
diff --git a/sample/curses/mouse.rb b/sample/curses/mouse.rb
deleted file mode 100644
index cc4beeb83da..00000000000
--- a/sample/curses/mouse.rb
+++ /dev/null
@@ -1,52 +0,0 @@
-require "curses"
-
-def show_message(*msgs)
- message = msgs.join
- width = message.length + 6
- win = Curses::Window.new(5, width,
- (Curses.lines - 5) / 2, (Curses.cols - width) / 2)
- win.keypad = true
- win.attron(Curses.color_pair(Curses::COLOR_RED)){
- win.box(?|, ?-, ?+)
- }
- win.setpos(2, 3)
- win.addstr(message)
- win.refresh
- win.getch
- win.close
-end
-
-Curses.init_screen
-Curses.start_color
-Curses.init_pair(Curses::COLOR_BLUE, Curses::COLOR_BLUE, Curses::COLOR_WHITE)
-Curses.init_pair(Curses::COLOR_RED, Curses::COLOR_RED, Curses::COLOR_WHITE)
-Curses.crmode
-Curses.noecho
-Curses.stdscr.keypad(true)
-
-begin
- Curses.mousemask(
- Curses::BUTTON1_CLICKED|Curses::BUTTON2_CLICKED|Curses::BUTTON3_CLICKED|Curses::BUTTON4_CLICKED
- )
- Curses.setpos((Curses.lines - 5) / 2, (Curses.cols - 10) / 2)
- Curses.attron(Curses.color_pair(Curses::COLOR_BLUE)|Curses::A_BOLD){
- Curses.addstr("click")
- }
- Curses.refresh
- while( true )
- c = Curses.getch
- case c
- when Curses::KEY_MOUSE
- m = Curses::getmouse
- if( m )
- show_message("getch = #{c.inspect}, ",
- "mouse event = #{'0x%x' % m.bstate}, ",
- "axis = (#{m.x},#{m.y},#{m.z})")
- end
- break
- end
- end
- Curses.refresh
-ensure
- Curses.close_screen
-end