Class: RSokoban::UI::HelpDialog

Inherits:
TkToplevel
  • Object
show all
Defined in:
lib/rsokoban/ui/tk_dialogs.rb

Overview

As dialog box, I display some help.

Instance Method Summary collapse

Constructor Details

#initialize(root, title) ⇒ HelpDialog

Create and show the dialog

Parameters:

  • root (TkRoot|TkToplevel)

    the Tk widget I belong to

  • title (String)

    my window title



293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
# File 'lib/rsokoban/ui/tk_dialogs.rb', line 293

def initialize(root, title)
	super(root)
	title(title)
	minsize(200, 100)

	text = TkText.new(self) do
		borderwidth 1
		font 'TkTextFont'
		grid('row' => 0, 'column' => 0)
	end
	
	help=<<EOS
Welcome to RSokoban !

Goal of Sokoban game is to place each crate on a storage location.
Move the man using the arrow keys.
For a more comprehensive help, please visit the wiki at https://github.com/lkdjiin/RSokoban/wiki.
EOS
	
	text.insert 'end', help

	@ok = Tk::Tile::Button.new(self) do
		text 'OK'
		grid('row'=>1, 'column'=>0)
	end
	@ok.command { ok_on_clic }
end

Instance Method Details

#ok_on_clicObject



321
322
323
# File 'lib/rsokoban/ui/tk_dialogs.rb', line 321

def ok_on_clic
	destroy
end