From 6c19724a36d17d56f9ae0782171b29e18658dd07 Mon Sep 17 00:00:00 2001 From: BlackMATov Date: Thu, 6 Feb 2020 17:52:01 +0700 Subject: [PATCH] fix main after update --- sources/main.cpp | 45 +++++++++++++++++++++++++++++++++++---------- 1 file changed, 35 insertions(+), 10 deletions(-) diff --git a/sources/main.cpp b/sources/main.cpp index 9202f91..fa502e7 100644 --- a/sources/main.cpp +++ b/sources/main.cpp @@ -9,10 +9,13 @@ using namespace e2d; namespace { - class game_system final : public ecs::system { + class game_system final : public systems::update_system { public: - void process(ecs::registry& owner) override { - E2D_UNUSED(owner); + void process( + ecs::registry& owner, + const systems::update_event& event) override + { + E2D_UNUSED(owner, event); const keyboard& k = the().keyboard(); if ( k.is_key_just_released(keyboard_key::f12) ) { @@ -32,14 +35,36 @@ namespace class game final : public starter::application { public: bool initialize() final { - ecs::registry_filler(the().registry()) - .system(world::priority_update); + { + ecs::registry_filler(the().registry()) + .feature(ecs::feature() + .add_system()); + } + + { + prefab scene_prefab; + scene_prefab.prototype() + .component(named() + .name("scene")) + .component(); + + prefab camera_prefab; + camera_prefab.prototype() + .component(named() + .name("camera")) + .component(camera() + .background({1.f, 0.4f, 0.f, 1.f})) + .component(); + + gobject scene_go = the().instantiate(scene_prefab); + gobject camera_go = the().instantiate(camera_prefab); + + node_iptr scene_node = scene_go.component()->node(); + node_iptr camera_node = camera_go.component()->node(); + + scene_node->add_child(camera_node); + } - const gobject_iptr camera_i = the().instantiate(); - camera_i->entity_filler() - .component(camera() - .background({1.f, 0.4f, 0.f, 1.f})) - .component(node::create(camera_i)); return true; } };