Update DebugActor

This commit is contained in:
Nomango 2020-02-09 15:33:46 +08:00
parent 9329b6f888
commit 4633d7b6b9
2 changed files with 9 additions and 9 deletions

View File

@ -78,17 +78,17 @@ void DebugActor::OnRender(RenderContext& ctx)
ctx.SetCurrentBrush(background_brush_); ctx.SetCurrentBrush(background_brush_);
ctx.FillRoundedRectangle(GetBounds(), Vec2{ 5.f, 5.f }); ctx.FillRoundedRectangle(GetBounds(), Vec2{ 5.f, 5.f });
ctx.DrawTextLayout(debug_text_, Point(10, 10)); ctx.DrawTextLayout(debug_text_, Point(10, 10));
}
void DebugActor::OnUpdate(Duration dt)
{
KGE_NOT_USED(dt);
frame_time_.push_back(Time::Now()); frame_time_.push_back(Time::Now());
while (frame_time_.back() - frame_time_.front() >= Duration::Second) while (frame_time_.back() - frame_time_.front() >= Duration::Second)
{ {
frame_time_.erase(frame_time_.begin()); frame_time_.erase(frame_time_.begin());
} }
}
void DebugActor::OnUpdate(Duration dt)
{
KGE_NOT_USED(dt);
StringStream ss; StringStream ss;

View File

@ -48,10 +48,10 @@ protected:
bool CheckVisibility(RenderContext& ctx) const override; bool CheckVisibility(RenderContext& ctx) const override;
private: private:
std::locale comma_locale_; std::locale comma_locale_;
BrushPtr background_brush_; BrushPtr background_brush_;
TextLayout debug_text_; TextLayout debug_text_;
Vector<Time> frame_time_; List<Time> frame_time_;
}; };
/** @} */ /** @} */