Skip to content

Commit

Permalink
FrameBuffer size counter.
Browse files Browse the repository at this point in the history
  • Loading branch information
pda committed Jan 15, 2012
1 parent 59d951f commit b682ef3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions asc.rb
Expand Up @@ -55,6 +55,7 @@ def render start_time
end end
buffer << "\n" buffer << "\n"
end end
buffer << "chars: #{@fb.size} "
buffer << " ." * (width / 2) buffer << " ." * (width / 2)


dt = Time.new.to_f - start_time; dt = Time.new.to_f - start_time;
Expand All @@ -77,6 +78,9 @@ def get x, y
n = (233.1 - 1.1 * Math.sin((x + Time.new.to_f * 10) / 5 + y / 5)).to_i n = (233.1 - 1.1 * Math.sin((x + Time.new.to_f * 10) / 5 + y / 5)).to_i
@pixels[x][y] || "\033[48;5;#{n}m \033[0m" @pixels[x][y] || "\033[48;5;#{n}m \033[0m"
end end
def size
@pixels.values.reduce(0) { |a, v| a + v.size }
end
end end


class World class World
Expand Down

0 comments on commit b682ef3

Please sign in to comment.