15#define GETTEXT_DOMAIN "wesnoth-lib"
29#ifdef DUMP_FPS_TO_FILE
30#undef DUMP_FPS_TO_FILE
37class fps_report :
public modeless_dialog
41 : modeless_dialog(window_id())
47 const std::string& window_id()
const override;
50 void update()
override;
68 "col",
config{
"halign",
"right",
"text",
"min" },
69 "col",
config{
"halign",
"right",
"text",
"avg" },
70 "col",
config{
"halign",
"right",
"text",
"max" },
71 "col",
config{
"halign",
"right",
"text",
"act" },
75 "col",
config{
"halign",
"right",
"text",
"fps" },
76 "col",
config{
"halign",
"right",
"text",
info.min_fps },
77 "col",
config{
"halign",
"right",
"text",
info.avg_fps },
78 "col",
config{
"halign",
"right",
"text",
info.max_fps },
79 "col",
config{
"halign",
"right",
"text",
info.act_fps },
83 "col",
config{
"halign",
"right",
"text",
"ms" },
84 "col",
config{
"halign",
"right",
"text",
info.max_time },
85 "col",
config{
"halign",
"right",
"text",
info.avg_time },
86 "col",
config{
"halign",
"right",
"text",
info.min_time },
92void fps_report::update()
104 find_widget<rich_label>(
"values").set_dom(generate_markup(*info));
106#ifdef DUMP_FPS_TO_FILE
115 *fps_log << min <<
"," << avg <<
"," << max <<
"\n";
123std::unique_ptr<fps_report> report;
138 report.reset(
new fps_report(target));
144 report->disconnect();
A config object defines a single node in a WML file, with access to child nodes.
Middleware class that tracks framerate and times.
auto get_info() const -> utils::optional< frame_info >
Returns the current frame time and info, or nullopt if no times have been recorded.
bool poll()
Checks whether the counter is now a multiple of the chosen rate, then increments it by one.
Declarations for File-IO.
utils::rate_counter update_check_
Only update the displayed count every few update cycles.
const gui2::tracked_drawable & target_
The drawable whose render calls we are tracking.
std::vector< std::tuple< int, int, int > > fps_history_
Holds the prior (max 1000) displayed fps values.
#define REGISTER_DIALOG(window_id)
Wrapper for REGISTER_DIALOG2.
std::string get_user_data_dir()
filesystem::scoped_ostream ostream_file(const std::string &fname, std::ios_base::openmode mode=std::ios_base::binary, bool create_directory=true)
void hide()
Hides the fps report popup.
std::string filename
Filename.