Ejemplo n.º 1
0
void loadScene(const char* _scenePath, bool _setPositionFromScene) {
    LOG("Loading scene file: %s", _scenePath);

    auto sceneString = stringFromFile(setResourceRoot(_scenePath).c_str(), PathType::resource);

    bool setPositionFromCurrentView = bool(m_scene);

    auto scene = std::make_shared<Scene>();
    if (m_view) {
        scene->view() = std::make_shared<View>(*m_view);
    }
    if (SceneLoader::loadScene(sceneString, *scene)) {
        m_scene = scene;
        m_scene->fontContext()->addFont("firasans", "medium", "");
        if (setPositionFromCurrentView && !_setPositionFromScene) {
            m_scene->view()->setPosition(m_view->getPosition());
            m_scene->view()->setZoom(m_view->getZoom());
        }
        m_view = m_scene->view();
        m_inputHandler->setView(m_view);
        m_tileManager->setDataSources(scene->dataSources());
        setPixelScale(m_view->pixelScale());

        m_tileWorker->setScene(scene);
    }
}
Ejemplo n.º 2
0
TEST_F(FS, setResourceRoot) {

	// Set properly.
	EXPECT_EQ(
		resourceRoot().string(),
		(exePath() / "resource" / "FS" / "setResourceRoot").string()
	);

	// Non-existent root.
	EXPECT_THROW(
		setResourceRoot("/this/will/throw"),
		boost::filesystem::filesystem_error
	);

}
Ejemplo n.º 3
0
	virtual void SetUp() {

		// Get info about the currently running test.
		const ::testing::TestInfo* const test_info = ::testing::UnitTest::GetInstance()->current_test_info();

		boost::filesystem::path root;

		// Set the engine root based on the test case running, if it exists.
		root = engineRoot() / test_info->test_case_name() / test_info->name();
		if (boost::filesystem::exists(root)) {
			setEngineRoot(root);
		}

		// Set the resource root based on the test case running, if it exists.
		root = resourceRoot() / test_info->test_case_name() / test_info->name();
		if (boost::filesystem::exists(root)) {
			setResourceRoot(root);
		}
	}