Vob::VobInformation Vob::asVob(World::WorldInstance& world, Handle::EntityHandle e) { VobInformation info; info.logic = nullptr; info.visual = nullptr; info.object = nullptr; info.position = nullptr; info.entity = e; info.world = &world; if (!e.isValid()) return info; Components::ComponentAllocator& alloc = world.getComponentAllocator(); Components::EntityComponent& entity = alloc.getElement<Components::EntityComponent>(e); if (Components::hasComponent<Components::LogicComponent>(entity)) info.logic = alloc.getElement<Components::LogicComponent>(e).m_pLogicController; if (Components::hasComponent<Components::VisualComponent>(entity)) info.visual = alloc.getElement<Components::VisualComponent>(e).m_pVisualController; if (Components::hasComponent<Components::ObjectComponent>(entity)) info.object = &alloc.getElement<Components::ObjectComponent>(e); if (Components::hasComponent<Components::PositionComponent>(entity)) info.position = &alloc.getElement<Components::PositionComponent>(e); return info; }
Handle::EntityHandle Vob::constructVob(World::WorldInstance& world) { // Create main entity Handle::EntityHandle e = world.addEntity(); Components::EntityComponent& entity = world.getEntity<Components::EntityComponent>(e); // Add components Components::Actions::initComponent<Components::LogicComponent>(world.getComponentAllocator(), e); Components::Actions::initComponent<Components::VisualComponent>(world.getComponentAllocator(), e); Components::Actions::initComponent<Components::BBoxComponent>(world.getComponentAllocator(), e); Components::ObjectComponent& obj = Components::Actions::initComponent<Components::ObjectComponent>(world.getComponentAllocator(), e); obj.m_Type = Components::ObjectComponent::Other; Components::Actions::initComponent<Components::PositionComponent>(world.getComponentAllocator(), e); //Components::addComponent<Components::PhysicsComponent>(entity); //Components::Actions::initComponent<Components::PhysicsComponent>(world.getComponentAllocator(), e); return e; }
Handle::EntityHandle Content::Wrap::createEntity(World::WorldInstance& world, Components::ComponentMask mask) { return world.addEntity(mask); }
Handle::TextureHandle Content::Wrap::loadTextureVDF(World::WorldInstance& world, const std::string& file) { return world.getTextureAllocator().loadTextureVDF(file); }