module RoomDraw

Public Instance Methods

draw( gc ) click to toggle source
# File lib/rooms/room_draw.rb, line 3
def draw( gc )
  gc.rectangle( @min_x, @min_y, @max_x, @max_y )

  # Squares
  1.upto( Room::ROOM_SQUARE_SIZE ).each do |t|
    gc.line( @min_x + DrawableObject::SQUARE_SIZE_IN_PIXELS*t, @min_y, @min_x + DrawableObject::SQUARE_SIZE_IN_PIXELS*t, @max_y )
    gc.line( @min_x, @min_y + DrawableObject::SQUARE_SIZE_IN_PIXELS*t, @max_x, @min_y + DrawableObject::SQUARE_SIZE_IN_PIXELS*t )
  end

  if @content
    print_text( gc, @content )
  end

  @decorations.each do |decoration|
    draw_four_columns(gc, decoration[:decoration_data] ) if decoration[:decoration_type] == :four_columns
  end
end

Private Instance Methods

draw_four_columns(gc, columns_data ) click to toggle source
# File lib/rooms/room_draw.rb, line 32
def draw_four_columns(gc, columns_data )
  gc.stroke( DrawableObject::GRID_COLOR )
  gc.fill( DrawableObject::GRID_COLOR )

  columns_data.each do |c_data|
    min_x = (c_data[:left]+1)*DrawableObject::SQUARE_SIZE_IN_PIXELS + @min_x
    min_y = (c_data[:top]+1)*DrawableObject::SQUARE_SIZE_IN_PIXELS + @min_y
    perim_x = min_x+3
    perim_y = min_y - DrawableObject::SQUARE_SIZE_IN_PIXELS+3

    gc.circle( min_x, min_y, perim_x, perim_y )
  end
  gc.fill( DrawableObject::BACKGROUND_COLOR )
end
print_text( gc, text ) click to toggle source