neoGFX
Cross-platform C++ app/game engine
Loading...
Searching...
No Matches
simple_physics.hpp
Go to the documentation of this file.
1// simple_physics.hpp
2/*
3 neogfx C++ App/Game Engine
4 Copyright (c) 2018, 2020 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/core/event.hpp>
28
29namespace neogfx::game
30{
31 class simple_physics : public game::system<entity_info, box_collider, box_collider_2d, mesh_filter, rigid_body, mesh_render_cache>
32 {
33 public:
36 public:
37 const system_id& id() const override;
38 const i_string& name() const override;
39 public:
40 bool apply() override;
41 public:
45 public:
46 void yield_after(std::chrono::duration<double, std::milli> aTime);
47 public:
48 struct meta
49 {
50 static const neolib::uuid& id()
51 {
52 static const neolib::uuid sId = { 0x49443e26, 0x762e, 0x4517, 0xbbb8,{ 0xc3, 0xd6, 0x95, 0x7b, 0xe9, 0xd4 } };
53 return sId;
54 }
55 static const i_string& name()
56 {
57 static const string sName = "Simple Physics";
58 return sName;
59 }
60 };
61 private:
62 std::chrono::duration<double, std::milli> iYieldTime = std::chrono::duration<double, std::milli>{ 1.0 };
63 };
64}
bool universal_gravitation_enabled() const
void yield_after(std::chrono::duration< double, std::milli > aTime)
const system_id & id() const override
const i_string & name() const override
static const neolib::uuid & id()
static const i_string & name()