ETHBackBufferTargetManager::ETHBackBufferTargetManager(gs2d::VideoPtr video, const ETHAppEnmlFile& file, const Platform::Logger& logger)
{
	const gs2d::str_type::string fixedWidth  = file.GetFixedWidth();
	const gs2d::str_type::string fixedHeight = file.GetFixedHeight();
	if (!ComputeLength(video, fixedWidth, fixedHeight, true))
	{
		ComputeLength(video, fixedHeight, fixedWidth, false);
	}
	const gs2d::math::Vector2 screenSize(video->GetScreenSizeF());
	m_bufferSize.x = gs2d::math::Min(screenSize.x, m_bufferSize.x);
	m_bufferSize.y = gs2d::math::Min(screenSize.y, m_bufferSize.y);

	gs2d::str_type::stringstream ss; ss << GS_L("Backbuffer created as ") << m_bufferSize.x << GS_L(", ") << m_bufferSize.y
										<< GS_L(" on ");
	if (m_bufferSize == screenSize)
	{
		m_backBuffer = ETHDynamicBackBufferPtr(new ETHNoDynamicBackBuffer(video, m_bufferSize));
		ss << GS_L("default backbuffer mode");
	}
	else
	{
		m_backBuffer = ETHDynamicBackBufferPtr(new ETHDefaultDynamicBackBuffer(video, m_bufferSize));
		ss << GS_L("dynamic framebuffer mode");
	}
	m_targetScale = m_bufferSize.x / screenSize.x;

	CreateOBB();

	logger.Log(ss.str(), Platform::Logger::INFO);
}
Esempio n. 2
0
int FindCallbackFunction(asIScriptModule* pModule, const ETHScriptEntity* entity, const str_type::string& prefix, const Platform::Logger& logger)
{
	const str_type::string entityName = Platform::RemoveExtension(entity->GetEntityName().c_str());
	str_type::stringstream funcName;
	funcName << prefix << entityName;
	const int id = CScriptBuilder::GetFunctionIdByName(pModule, funcName.str());

	if (id == asMULTIPLE_FUNCTIONS)
	{
		str_type::stringstream ss;
		ss << GS_L("ETHScene::FindCallbackFunction: found multiple functions named (") << funcName.str() << GS_L(").");
		logger.Log(ss.str(), Platform::FileLogger::ERROR);
	}
	return id;
}
ETHBackBufferTargetManager::ETHBackBufferTargetManager(gs2d::VideoPtr video, const gs2d::enml::File& file, const Platform::Logger& logger)
{
	const gs2d::str_type::string fixedWidth  = file.get(GS_L("window"), GS_L("fixedWidth"));
	const gs2d::str_type::string fixedHeight = file.get(GS_L("window"), GS_L("fixedHeight"));
	if (!ComputeLength(video, fixedWidth, fixedHeight, true))
	{
		ComputeLength(video, fixedHeight, fixedWidth, false);
	}
	const gs2d::math::Vector2 screenSize(video->GetScreenSizeF());
	m_bufferSize.x = gs2d::math::Min(screenSize.x, m_bufferSize.x);
	m_bufferSize.y = gs2d::math::Min(screenSize.y, m_bufferSize.y);

	m_backBuffer = (m_bufferSize == screenSize) ? 
					ETHDynamicBackBufferPtr(new ETHNoDynamicBackBuffer(video, m_bufferSize)) :
					ETHDynamicBackBufferPtr(new ETHDefaultDynamicBackBuffer(video, m_bufferSize));
	m_targetScale = m_bufferSize.x / screenSize.x;

	gs2d::str_type::stringstream ss; ss << GS_L("Backbuffer created as ") << m_bufferSize.x << GS_L(", ") << m_bufferSize.y;
	logger.Log(ss.str(), Platform::Logger::INFO);
}