Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
require "rubygems" require "rubygame" require "rbgooey" require "yaml" include Rubygame TTF.setup class TestWeirdBug def initialize @data = UiData.new('data/mapedit.yml') @string = [] @cycle = 0 @return = 0 @debug = 0 end def text @data.declare(:listing) @data.text.add("Listing content in map directory...",0,0) end def change @cycle += 1 if @cycle == @return @cycle = 0 end end def process @debug += 1 puts @debug n = 1 limit = 1 y = 30 cycle = 0 @string.each do |s| if cycle == @cycle @data.text.add("#{n} #{s}",0,y) if limit == 10 if @string.size() > 10 @data.text.add("And #{3 - @cycle} more down the list.",0,y+30) end return end limit += 1 y += 30 else cycle += 1 end n += 1 end end def randomdata n = 0 13.times do @string << "Random #{rand(101)}" n += 1 end @return = (n - 10) + 1 end def execute @data.clear() text() change() process() end end test = TestWeirdBug.new() test.randomdata() loop do test.execute() end
This paste will be private.
From the Design Piracy series on my blog: