Permalink
Browse files

FrameBuffer size counter.

  • Loading branch information...
1 parent 59d951f commit b682ef3914782b7ae996c2a8b868b029e02f2e62 @pda committed Jan 15, 2012
Showing with 4 additions and 0 deletions.
  1. +4 −0 asc.rb
View
4 asc.rb
@@ -55,6 +55,7 @@ def render start_time
end
buffer << "\n"
end
+ buffer << "chars: #{@fb.size} "
buffer << " ." * (width / 2)
dt = Time.new.to_f - start_time;
@@ -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
@pixels[x][y] || "\033[48;5;#{n}m \033[0m"
end
+ def size
+ @pixels.values.reduce(0) { |a, v| a + v.size }
+ end
end
class World

0 comments on commit b682ef3

Please sign in to comment.