diff --git a/cursor.rb b/cursor.rb new file mode 100755 index 0000000..8eae3f2 --- /dev/null +++ b/cursor.rb @@ -0,0 +1,53 @@ +#!usr/bin/env ruby +# -*- coding: utf-8 -*- + +def hyouzi(x,y,z) + setpos(x,y) + addstr (z) + refresh +end + +require 'curses' +include Curses +require 'io/console' + +init_screen +cbreak +noecho + +begin + choice = 1 + while true + hyouzi(2,5,"予定表") + hyouzi(4,5,"日記") + if choice == 1 + hyouzi(2,2,"→") + elsif choice == 2 + hyouzi(4,2,"→") + end + while true + cursor_key1 = STDIN.getch + if cursor_key1 == "\e" + cursor_key2 = STDIN.getch + if cursor_key2 == "[" + cursor_key3 = STDIN.getch + if cursor_key3 == "A" + choice = 1 + end + end + break + elsif cursor_key1 = STDIN.getch + if cursor_key1 == "\e" + cursor_key2 = STDIN.getch + if cursor_key2 == "[" + cursor_key3 = STDIN.getch + if cursor_key3 == "A" + choice = 2 + end + end + end + break + end + end + end +end diff --git a/last/j2106_last,rb b/last/j2106_last,rb new file mode 100755 index 0000000..ec1939f --- /dev/null +++ b/last/j2106_last,rb @@ -0,0 +1,2 @@ +#!usr/bin/env ruby +# -*- coding: utf-8 -*- diff --git a/last/j2106_last.rb b/last/j2106_last.rb new file mode 100755 index 0000000..ddd0a0d --- /dev/null +++ b/last/j2106_last.rb @@ -0,0 +1,31 @@ +#!usr/bin/env ruby +# -*- coding: utf-8 -*- + +date = [] +hozon = [] + +puts "日記" +while true + choice = gets.chomp + if choice == "1" + year = Time.now.year + mon = Time.now.mon + day = Time.now.day + data = "#{year}#{mon}#{day}" + date.each do + if data =~ date + puts "今日の日記はもう書き終わっています。" + end + end + naiyou = gets.chomp + date << data + hozon << naiyou + printf("%d年 %d月 %d日\n%s\n",year,mon,day,naiyou) + redo + elsif choice == "2" + p hozon + redo + elsif choice == "3" + break + end +end diff --git a/tetris.rb b/tetris.rb new file mode 100755 index 0000000..ed6bb72 --- /dev/null +++ b/tetris.rb @@ -0,0 +1,16 @@ +#!usr/bin/env ruby +# -*- coding: utf-8 -*- + +require "sdl" + +SCREEN_W = 640 +SCREEN_H = 480 + +SDL.init(SDL::INIT_EVERYTHING) +SDL.set_video_mode(SCREEN_W,SCREEN_H,16,SDL::SWSURFACE) + +screen.fill_rect(0,0,SCREEN_W,HOLIZON,[128,225,225]) +screen.fill_rect(1,HOLIZON,SCREEN_H-HOLIZON,[0,128,0]) +screen.update_rect(0,0,0,0) + +sleep(2)