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
>
23
#include <
neogfx/game/system.hpp
>
24
#include <
neogfx/game/box_collider.hpp
>
25
#include <
neogfx/game/mesh_filter.hpp
>
26
#include <
neogfx/game/rigid_body.hpp
>
27
#include <
neogfx/game/mesh_render_cache.hpp
>
28
29
namespace
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
:
34
simple_physics
(
i_ecs
& aEcs);
35
~simple_physics
();
36
public
:
37
const
system_id
&
id
()
const override
;
38
const
i_string
&
name
()
const override
;
39
public
:
40
bool
apply
()
override
;
41
public
:
42
bool
universal_gravitation_enabled
()
const
;
43
void
enable_universal_gravitation
();
44
void
disable_universal_gravitation
();
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
}
box_collider.hpp
neogfx::game::simple_physics
Definition
simple_physics.hpp:32
neogfx::game::simple_physics::disable_universal_gravitation
void disable_universal_gravitation()
neogfx::game::simple_physics::universal_gravitation_enabled
bool universal_gravitation_enabled() const
neogfx::game::simple_physics::yield_after
void yield_after(std::chrono::duration< double, std::milli > aTime)
neogfx::game::simple_physics::id
const system_id & id() const override
neogfx::game::simple_physics::simple_physics
simple_physics(i_ecs &aEcs)
neogfx::game::simple_physics::name
const i_string & name() const override
neogfx::game::simple_physics::apply
bool apply() override
neogfx::game::simple_physics::enable_universal_gravitation
void enable_universal_gravitation()
neogfx::game::simple_physics::~simple_physics
~simple_physics()
neolib::ecs::i_ecs
Definition
i_ecs.hpp:85
neolib::ecs::system
Definition
system.hpp:58
neolib::i_string
Definition
i_string.hpp:49
mesh_filter.hpp
mesh_render_cache.hpp
neogfx::game
Definition
aabb_octree.hpp:31
event.hpp
system.hpp
neogfx.hpp
rigid_body.hpp
neogfx::game::simple_physics::meta
Definition
simple_physics.hpp:49
neogfx::game::simple_physics::meta::id
static const neolib::uuid & id()
Definition
simple_physics.hpp:50
neogfx::game::simple_physics::meta::name
static const i_string & name()
Definition
simple_physics.hpp:55
neolib::uuid
Definition
uuid.hpp:51
include
neogfx
game
simple_physics.hpp
Generated by
1.9.8