GaitGeneration by Graph Search
読み取り中…
検索中…
一致する文字列を見つけられません
fps_controller.h
[詳解]
1
3
4// Copyright(c) 2023-2025 Design Engineering Laboratory, Saitama University
5// Released under the MIT license
6// https://opensource.org/licenses/mit-license.php
7
8#ifndef DESIGNLAB_FPS_CONTROLLER_H_
9#define DESIGNLAB_FPS_CONTROLLER_H_
10
11#include <list>
12
13
14namespace designlab
15{
16
32class FpsController final
33{
34public:
35 FpsController() = delete;
36 explicit FpsController(int target_fps);
37
39 void Wait();
40
45 bool SkipDrawScene();
46
47 void DrawFps() const;
48
49private:
52 void RegisterTime(int now_time);
53
59 bool CheckNeedSkipDrawScreen(int* wait_time) const;
60
63 bool TargetFpsIsValid() const;
64
65
67 const int kTargetFpsValue;
68
70 const int kOneFrameTime;
71
74 const int kListMax;
75
77 std::list<int> time_list_;
78
81 bool need_skip_draw_screen_;
82};
83
84} // namespace designlab
85
86
87#endif // DESIGNLAB_FPS_CONTROLLER_H_
FPSを一定にキープするためのクラス.
void Wait()
処理が早すぎる場合,FPSを一定にするために待つ.
bool SkipDrawScene()
60Hz以上のモニター使用時に処理が詰まって画面がちらつかないように, 描画処理をスキップするかどうかを判定する.