Method: CDK::Draw.writeCharAttrib

Defined in:
lib/cdk/draw.rb

.writeCharAttrib(window, xpos, ypos, string, attr, align, start, endn) ⇒ Object

This writes out a char string with attributes



185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
# File 'lib/cdk/draw.rb', line 185

def Draw.writeCharAttrib(window, xpos, ypos, string, attr, align,
    start, endn)
  display = endn - start

  if align == CDK::HORIZONTAL
    # Draw the message on a horizontal axis
    display = [display, window.getmaxx - 1].min
    (0...display).each do |x|
      window.mvwaddch(ypos, xpos + x, string[x + start].ord | attr)
    end
  else
    # Draw the message on a vertical axis
    display = [display, window.getmaxy - 1].min
    (0...display).each do |x|
      window.mvwaddch(ypos + x, xpos, string[x + start].ord | attr)
    end
  end
end