|
|
@@ -10,6 +10,7 @@
|
|
|
#include "game/engine/game_dispatch.hpp"
|
|
|
|
|
|
#include "game/engine/events.hpp"
|
|
|
+#include "game/engine/fps_counter.hpp"
|
|
|
#include "game/engine/scene.hpp"
|
|
|
#include "game/graphics/object.hpp"
|
|
|
#include "game/graphics/renderer.hpp"
|
|
|
@@ -25,8 +26,9 @@ namespace engine {
|
|
|
|
|
|
game_dispatch::game_dispatch(std::shared_ptr<graphics::renderer> renderer)
|
|
|
: renderer(renderer), screen_size(env::screen_size()),
|
|
|
- minimum_frame_duration(env::fps::v60), counter(minimum_frame_duration),
|
|
|
- scenes(), current_timestamp(env::clock::now()), curr_scene() {}
|
|
|
+ minimum_frame_duration(env::fps::v60),
|
|
|
+ counter(new fps_counter(minimum_frame_duration)), scenes(),
|
|
|
+ current_timestamp(env::clock::now()), curr_scene() {}
|
|
|
|
|
|
game_dispatch::current_scene_info::current_scene_info() {}
|
|
|
|
|
|
@@ -66,14 +68,14 @@ namespace engine {
|
|
|
|
|
|
void game_dispatch::update() {
|
|
|
env::clock::tick t = next_frame();
|
|
|
- counter.set_frame_step(t.since);
|
|
|
+ counter->set_frame_step(t.since);
|
|
|
// curr_scene.ptr->update(std::chrono::duration<float>(t.since).count());
|
|
|
}
|
|
|
|
|
|
void game_dispatch::render() {
|
|
|
graphics::batch_renderer batch(renderer.get());
|
|
|
batch.clear();
|
|
|
- for (auto & obj : counter.glyphs()) {
|
|
|
+ for (auto & obj : counter->glyphs()) {
|
|
|
batch.draw(obj);
|
|
|
}
|
|
|
// curr_scene.ptr->render(batch);
|