neoGFX
Cross-platform C++ app/game engine
time.hpp
Go to the documentation of this file.
1 // time.hpp
2 /*
3  neogfx C++ GUI Library
4  Copyright (c) 2018 Leigh Johnston. All Rights Reserved.
5 
6  This program is free software: you can redistribute it and / or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19 #pragma once
20 
21 #include <neogfx/neogfx.hpp>
22 #include <neogfx/game/chrono.hpp>
23 #include <neogfx/game/system.hpp>
24 
25 namespace neogfx::game
26 {
27  class time : public system
28  {
29 
30  public:
31  time(game::i_ecs& aEcs);
32  public:
33  const system_id& id() const override;
34  const i_string& name() const override;
35  public:
36  void apply() override;
37  public:
38  step_time system_time() const;
39  step_time world_time() const;
40  public:
41  struct meta
42  {
43  static const neolib::uuid& id()
44  {
45  static const neolib::uuid sId = { 0x714a0e4a, 0xd0be, 0x4737, 0xbd25, { 0xe8, 0x3e, 0x2a, 0x5c, 0xd7, 0x65 } };
46  return sId;
47  }
48  static const i_string& name()
49  {
50  static const string sName = "Time";
51  return sName;
52  }
53  };
54  private:
55  mutable optional_step_time iSystemTimeOffset;
56  };
57 }
static const neolib::uuid & id()
Definition: time.hpp:43
static const i_string & name()
Definition: time.hpp:48
const system_id & id() const override
std::optional< step_time > optional_step_time
Definition: chrono.hpp:42
time(game::i_ecs &aEcs)
step_time world_time() const
step_time_interval step_time
Definition: chrono.hpp:41
const i_string & name() const override
void apply() override
step_time system_time() const