Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'curses'
- require_relative 'logger'
- include Curses
- init_screen
- begin
- curs_set(0)
- x = cols / 2
- y = lines / 2
- stdscr.keypad = true
- setpos(y,x)
- addstr("X")
- while input = stdscr.getch
- case input
- when Key::UP
- y -= 1
- when Key::DOWN
- y += 1
- when Key::LEFT
- x -= 1
- when Key::RIGHT
- x += 1
- end
- stdscr.clear
- setpos(y,x)
- addstr("X")
- break if input == 'q'
- end
- ensure
- close_screen
- end
Add Comment
Please, Sign In to add comment