Simulant
21.12-574
A portable game engine for Windows, OSX, Linux, Dreamcast, and PSP
simulant
scenes
physics_scene.h
1
#pragma once
2
3
#include "scene.h"
4
#include "../application.h"
5
#include "../behaviours/physics/simulation.h"
6
7
namespace
smlt
{
8
9
template
<
typename
T>
10
class
PhysicsScene
:
11
public
Scene
<T> {
12
13
protected
:
14
PhysicsScene
(
Window
* window):
15
Scene<T>
(window) {}
16
17
virtual
void
_fixed_update_thunk(
float
step) {
18
if
(physics_) {
19
physics_->fixed_update(step);
20
}
21
22
Scene<T>::_fixed_update_thunk
(step);
23
}
24
25
private
:
26
void
pre_load()
override
{
27
physics_ = smlt::behaviours::RigidBodySimulation::create(get_app()->time_keeper);
28
}
29
30
void
post_unload()
override
{
31
physics_.reset();
32
}
33
34
std::shared_ptr<smlt::behaviours::RigidBodySimulation> physics_;
35
36
protected
:
37
S_DEFINE_PROPERTY(physics, &PhysicsScene::physics_);
38
};
39
40
}
smlt
Definition:
animation.cpp:25
smlt::Window
Definition:
window.h:65
smlt::Scene
Definition:
scene.h:165
smlt::PhysicsScene
Definition:
physics_scene.h:11
Generated by
1.8.20