Module: GamesAndRpgParadise::GUI::Gtk::Mastermind::BlackWhiteBoxModule
- Includes:
- Gtk::BaseModule
- Included in:
- BlackWhiteBox
- Defined in:
- lib/games_and_rpg_paradise/games/mastermind/shared_code/black_white_box_module.rb
Constant Summary collapse
- TITLE =
#
TITLE
#
'Black White Box Module'
- WIDTH =
#
WIDTH
#
1200
- HEIGHT =
#
HEIGHT
#
1000
Class Method Summary collapse
-
.run ⇒ Object
# === GamesAndRpgParadise::GUI::Gtk::BlackWhiteBoxModule.run ========================================================================= #.
Instance Method Summary collapse
-
#create_black_img ⇒ Object
# === create_black_img ========================================================================= #.
-
#create_blank_img ⇒ Object
# === create_blank_img ========================================================================= #.
-
#create_white_img ⇒ Object
# === create_white_img ========================================================================= #.
-
#initialize(reveal_or_dont_reveal = false) ⇒ Object
# === initialize ========================================================================= #.
-
#reset ⇒ Object
# === reset ========================================================================= #.
-
#set_boxes(black = 1, white = 3) ⇒ Object
# === set_boxes ========================================================================= #.
Class Method Details
.run ⇒ Object
#
GamesAndRpgParadise::GUI::Gtk::BlackWhiteBoxModule.run
#
131 132 133 134 135 136 137 138 |
# File 'lib/games_and_rpg_paradise/games/mastermind/shared_code/black_white_box_module.rb', line 131 def self.run require 'gtk_paradise/run' _ = ::GamesAndRpgParadise::GUI::Gtk::BlackWhiteBox.new r = ::Gtk.run r << _ r.set_size_request(_.width?, _.height?) r.top_left_then_run end |
Instance Method Details
#create_black_img ⇒ Object
#
create_black_img
#
89 90 91 |
# File 'lib/games_and_rpg_paradise/games/mastermind/shared_code/black_white_box_module.rb', line 89 def create_black_img gtk_image(DIRECTORY_TO_THE_IMAGES+'games/misc/DOT_BLACK.png') end |
#create_blank_img ⇒ Object
#
create_blank_img
#
75 76 77 |
# File 'lib/games_and_rpg_paradise/games/mastermind/shared_code/black_white_box_module.rb', line 75 def create_blank_img gtk_image(DIRECTORY_TO_THE_IMAGES+'games/misc/DOT_BLANK.png') end |
#create_white_img ⇒ Object
#
create_white_img
#
82 83 84 |
# File 'lib/games_and_rpg_paradise/games/mastermind/shared_code/black_white_box_module.rb', line 82 def create_white_img gtk_image(DIRECTORY_TO_THE_IMAGES+'games/misc/DOT_GREY.png') end |
#initialize(reveal_or_dont_reveal = false) ⇒ Object
#
initialize
#
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/games_and_rpg_paradise/games/mastermind/shared_code/black_white_box_module.rb', line 43 def initialize( reveal_or_dont_reveal = false ) super(:horizontal) reset show @array_boxes = [] @array_boxes[0] = create_blank_img pack_maximal(@array_boxes[0],1) @array_boxes[1] = create_blank_img pack_maximal(@array_boxes[1],1) @array_boxes[2] = create_blank_img pack_maximal(@array_boxes[2],1) @array_boxes[3] = create_blank_img pack_maximal(@array_boxes[3],1) end |
#reset ⇒ Object
#
reset
#
63 64 65 66 67 68 69 70 |
# File 'lib/games_and_rpg_paradise/games/mastermind/shared_code/black_white_box_module.rb', line 63 def reset reset_the_internal_variables infer_the_namespace # ======================================================================= # # === @configuration # ======================================================================= # @configuration = [true, __dir__, namespace?] end |
#set_boxes(black = 1, white = 3) ⇒ Object
#
set_boxes
#
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
# File 'lib/games_and_rpg_paradise/games/mastermind/shared_code/black_white_box_module.rb', line 96 def set_boxes(black = 1, white = 3) # e "Black: "+black.to_s # e "White: "+white.to_s counter = 0 black = black.to_i white = white.to_i black.times { if ::Gtk.use_gtk2? @array_boxes[counter].set("#{DIRECTORY_TO_THE_IMAGES}games/misc/DOT_BLACK.png") else @array_boxes[counter].set_file("#{DIRECTORY_TO_THE_IMAGES}games/misc/DOT_BLACK.png") end counter += 1 } white.times { if ::Gtk.use_gtk2? @array_boxes[counter].set("#{DIRECTORY_TO_THE_IMAGES}games/misc/DOT_GREY.png") else @array_boxes[counter].set_file("#{DIRECTORY_TO_THE_IMAGES}games/misc/DOT_GREY.png") end counter += 1 } (4-counter).times { if ::Gtk.use_gtk2? @array_boxes[counter].set("#{DIRECTORY_TO_THE_IMAGES}games/misc/DOT_BLANK.png") else @array_boxes[counter].set_file("#{DIRECTORY_TO_THE_IMAGES}games/misc/DOT_BLANK.png") end counter += 1 } end |