Reworking the view

This commit is contained in:
Zoe Roux
2021-06-03 18:20:37 +02:00
parent ae2e419832
commit 0d37a560d7
16 changed files with 141 additions and 62 deletions
+33
View File
@@ -0,0 +1,33 @@
//
// Created by Zoe Roux on 6/3/21.
//
#include "Entity/Entity.hpp"
#include "Component/Position/PositionComponent.hpp"
#include "System/Movable/MovableSystem.hpp"
#include "System/Controllable/ControllableSystem.hpp"
#include <catch2/catch.hpp>
#include <Wal.hpp>
#include <Component/Controllable/ControllableComponent.hpp>
#define private public
#include <Component/Movable/MovableComponent.hpp>
using namespace WAL;
using namespace BBM;
TEST_CASE("View creation", "[View]")
{
Wal wal;
Scene scene(wal);
scene.addEntity("player")
.addComponent<PositionComponent>()
.addComponent<ControllableComponent>();
scene.addEntity("Box")
.addComponent<PositionComponent>();
REQUIRE(scene.view<PositionComponent>().size() == 2);
REQUIRE(scene.view<PositionComponent, ControllableComponent>().size() == 1);
Entity &entity = *scene.getEntities().begin();
Entity &firstView = *scene.view<PositionComponent, ControllableComponent>().begin();
REQUIRE(&entity == &firstView);
}