Method: Othello::BoardView#initialize
- Defined in:
- sample/tcltklib/sample2.rb
#initialize(othello, board) ⇒ BoardView
———————–> class Square ends here
232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 |
# File 'sample/tcltklib/sample2.rb', line 232 def initialize(othello, board) super($ip, $root, $canvas) @othello = othello @board = board @board.add_observer(self) @squares = Array.new(8) for i in 0 .. 7 @squares[i] = Array.new(8) end @left = 1 @top = 0.5 @right = @left + 8 @bottom = @top + 8 i = self.e("create rectangle", *tk_rect(@left, @top, @right, @bottom)) self.e("itemconfigure", i, "-width 1m -outline #{BORDER_COLOR} -fill #{BACK_GROUND_COLOR}") for row in 0 .. 7 for col in 0 .. 7 @squares[row][col] = Square.new(self, row, col) end end update end |