Successfully reported this slideshow.
Your SlideShare is downloading. ×

Curses

Loading in …3
×

Check these out next

1 of 25 Ad
1 of 25 Ad

Curses

Download to read offline

Hamamatsu.rb #61で発表したCursesについてのLT資料です。
RubyのCursesモジュールを紹介しました。

Hamamatsu.rb #61で発表したCursesについてのLT資料です。
RubyのCursesモジュールを紹介しました。

Advertisement
Advertisement

More Related Content

Advertisement

Curses

  1. 1. Curses Hamamatsu.rb #61 Langur(@osarusystem) Wed Feb 10 2016
  2. 2. About Me
  3. 3. CC-BY-SA 3.0 from Wikipedia Name : Langur Twitter : @osarusystem Jobs : Embedded Software Engineer Network Software Engineer Interestedness : OS/Cipher/FreeBSD/Ruby/ Primates/Making Sweets/ ...etc
  4. 4. Curses
  5. 5. Curses Curses : A terminal control library Developer : Ken Arnold Reference : vi Used : Rouge/Tin/Jack ... etc Provide : Interface on CLI like GUI Not all based applications employ like this Support : Linux/BSD/Windows ... etc
  6. 6. Ruby curses
  7. 7. Ruby curses def support?(version) if (version < 2.1) p “standard library” else p “gem library” end end
  8. 8. How to use require “curses” Curses.init_screen begin s = “Hello World!” Curses.setpos(1, 1) Curses.addstr(s) Curses.refresh Curses.getch ensure Cursese.close_screen end 1. 初期化処理 2. Cursesの設定 (省略可) 3. windowの操作 4. 入力待ち (省略可) 5. 終了処理
  9. 9. How to use require “curses” Curses.init_screen begin s = “Hello World!” Curses.setpos(1, 1) Curses.addstr(s) Curses.refresh Curses.getch ensure Cursese.close_screen end 1. 初期化処理 2. Cursesの設定 (省略可) 3. windowの操作 4. 入力待ち (省略可) 5. 終了処理
  10. 10. How to use require “curses” Curses.init_screen begin s = “Hello World!” Curses.setpos(1, 1) Curses.addstr(s) Curses.refresh Curses.getch ensure Cursese.close_screen end 1. 初期化処理 2. Cursesの設定 (省略可) 3. windowの操作 4. 入力待ち (省略可) 5. 終了処理
  11. 11. How to use require “curses” Curses.init_screen begin s = “Hello World!” Curses.setpos(1, 1) Curses.addstr(s) Curses.refresh Curses.getch ensure Cursese.close_screen end 1. 初期化処理 2. Cursesの設定 (省略可) 3. windowの操作 4. 入力待ち (省略可) 5. 終了処理
  12. 12. How to use require “curses” Curses.init_screen begin s = “Hello World!” Curses.setpos(1, 1) Curses.addstr(s) Curses.refresh Curses.getch ensure Cursese.close_screen end 1. 初期化処理 2. Cursesの設定 (省略可) 3. windowの操作 4. 入力待ち (省略可) 5. 終了処理
  13. 13. Uncool
  14. 14. Delete ‘Curses.’ require “curses” Curses.init_screen begin s = “Hello World!” Curses.setpos(1, 1) Curses.addstr(s) Curses.refresh Curses.getch ensure Curses.close_screen end require “curses” include Curses init_screen begin s = “Hello World!” setpos(1, 1) addstr(s) refresh getch ensure close_screen end
  15. 15. Execute
  16. 16. Execute
  17. 17. Execute
  18. 18. Window
  19. 19. Window stdscr sub2 sub1 ‘init_screan’ create ‘stdscr’. ‘stdscr’ is root window. ‘stdscr’ can create ‘sub window’.
  20. 20. Create sub window begin s = “stdscr”;ss = “subwindow” setpos(10, 10);addstr(s) sub = stdscr.subwin(3, 12, 1, 1) sub.box(?|, ?-, ?+) sub.setpos(1, 1);sub.addstr(ss) sub.refresh refresh getch ensure sub.close_screen close_screen end
  21. 21. Execute
  22. 22. Execute
  23. 23. Next step
  24. 24. Next step • I want to create text editor. • Help me! • How to use Git-Hub • Ruby’s manner • GTK or Qt
  25. 25. Thank you.

×