mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Share FpsControl code between game and menu
This commit is contained in:
parent
0c3a4cc7b9
commit
13a0e5fb4a
5 changed files with 70 additions and 123 deletions
|
@ -46,6 +46,19 @@ class RenderingCore;
|
|||
// Instead of a mechanism to disable fog we just set it to be really far away
|
||||
#define FOG_RANGE_ALL (100000 * BS)
|
||||
|
||||
struct FpsControl {
|
||||
FpsControl() : last_time(0), busy_time(0), sleep_time(0) {}
|
||||
|
||||
void reset();
|
||||
|
||||
void limit(IrrlichtDevice *device, f32 *dtime, bool assume_paused = false);
|
||||
|
||||
u32 getBusyMs() const { return busy_time / 1000; }
|
||||
|
||||
// all values in microseconds (us)
|
||||
u64 last_time, busy_time, sleep_time;
|
||||
};
|
||||
|
||||
class RenderingEngine
|
||||
{
|
||||
public:
|
||||
|
@ -103,11 +116,6 @@ public:
|
|||
return s_singleton->m_device;
|
||||
}
|
||||
|
||||
u32 get_timer_time()
|
||||
{
|
||||
return m_device->getTimer()->getTime();
|
||||
}
|
||||
|
||||
gui::IGUIEnvironment *get_gui_env()
|
||||
{
|
||||
return m_device->getGUIEnvironment();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue