mirror of
https://github.com/cyberarm/i-mic-fps.git
synced 2025-12-15 15:42:35 +00:00
Extracted frame timings graph to CyberarmEngine
This commit is contained in:
@@ -21,31 +21,6 @@ class IMICFPS
|
|||||||
Gosu.draw_rect(2, 2, width - 4, (@text.height + 4) - 4, Gosu::Color.rgba(100, 100, 100, 100))
|
Gosu.draw_rect(2, 2, width - 4, (@text.height + 4) - 4, Gosu::Color.rgba(100, 100, 100, 100))
|
||||||
|
|
||||||
@text.draw
|
@text.draw
|
||||||
|
|
||||||
sample_points = 256
|
|
||||||
frame_stats = CyberarmEngine::Stats.frames.select(&:complete?)
|
|
||||||
return if frame_stats.empty?
|
|
||||||
|
|
||||||
right_origin = CyberarmEngine::Vector.new(10, 128)
|
|
||||||
nodes = Array.new(sample_points) { [] }
|
|
||||||
|
|
||||||
slice = 0
|
|
||||||
frame_stats.each_slice((CyberarmEngine::Stats.max_frame_history / sample_points.to_f).ceil) do |bucket|
|
|
||||||
bucket.each do |frame|
|
|
||||||
nodes[slice] << frame.frame_timing.duration
|
|
||||||
end
|
|
||||||
|
|
||||||
slice += 1
|
|
||||||
end
|
|
||||||
|
|
||||||
points = []
|
|
||||||
nodes.each_with_index do |cluster, i|
|
|
||||||
break if cluster.empty?
|
|
||||||
|
|
||||||
points << CyberarmEngine::Vector.new(right_origin.x + 1 * i, right_origin.y - cluster.max)
|
|
||||||
end
|
|
||||||
|
|
||||||
Gosu.draw_path(points, Gosu::Color::WHITE, Float::INFINITY) if points.size > 1
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
|
|||||||
Reference in New Issue
Block a user