Class: RSokoban::UI::CursesConsole

Inherits:
BaseUI
  • Object
show all
Defined in:
lib/rsokoban/ui/curses_console.rb

Overview

I am a console user interface using curses library. I assume 24 lines height.

Constant Summary collapse

SET_LINE =
0
TITLE_LINE =
1
MOVES_LINE =
2
STATUS_LINE =
3
PICTURE_LINE =
5

Instance Method Summary collapse

Constructor Details

#initializeCursesConsole

Returns a new instance of CursesConsole.



13
14
15
16
17
18
# File 'lib/rsokoban/ui/curses_console.rb', line 13

def initialize
	super()
	init_screen
ensure
	Curses.close_screen
end

Instance Method Details

#get_action(hash) ⇒ Object



20
21
22
23
24
25
26
27
28
# File 'lib/rsokoban/ui/curses_console.rb', line 20

def get_action(hash)
	initialize_members_and_clear_screen hash
	if [:display, :start].include?(hash[:type]) 
		ask_player hash
	else
		# assuming :win
		ask_for_next_level hash
	end
end