Пример #1
0
VOID WINAPI CCommands::XApplicationEvents::ManualCallBackProc( PMANUALCALLBACK lpManuallCallBack )
{
	CString strError;
	switch(lpManuallCallBack->dwError)
	{
	case HR_ERROR_NOERROR:					// 无错误发生
		if (lpManuallCallBack->IsFinished != 1 ||
			0 == _tcslen(lpManuallCallBack->szFileName))
		{
			return;
		}
		strError = "无错误发生";
		break;
	case HR_ERROR_CANTCONNECT_SERVER:			// 无法连接到文件服务器
		strError = "无法连接到文件服务器";
		break;
	case HR_ERROR_OVERLIMITSIZE:					// 单个文件超过限制大小
		strError = "单个文件超过限制大小";
		break;
	case HR_ERROR_GETSIZEFAIL:					// 得到文件大小失败
		strError = "得到文件大小失败";
		break;
	case HR_ERROR_CANTACCESS:					// 文件无法访问
		strError = "文件无法访问";
		break;
	case HR_ERROR_CANTALLOCMEMORY:				// 堆分配空间错误
		strError = "堆分配空间错误";
		break;
	}

	SYSTEMTIME sysTime;
	CString strTime;
	GetLocalTime(&sysTime);
	strTime.Format("%d/%d/%d %d:%d:%d.%d", sysTime.wYear, sysTime.wMonth, sysTime.wDay, sysTime.wHour, sysTime.wMinute, sysTime.wSecond, sysTime.wMilliseconds);

	LPVOID lpMsgBuf;
	FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
		NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
		(LPTSTR) &lpMsgBuf, 0, NULL);

	CString strFileName;
	strFileName.Format("FileName: %s\tSendSize: %d\tFinish: %d\tError: %s\tApiLastError: %s\t%s",
		lpManuallCallBack->szFileName,
		lpManuallCallBack->dwSendSize,
		lpManuallCallBack->IsFinished,
		strError,
		lpMsgBuf,
		strTime);

	LocalFree( lpMsgBuf );
	
#ifdef _DEBUG
	CCommands* pCommands = (CCommands*)lpManuallCallBack->dwUserData;
	IApplication *pApplication = pCommands->GetApplicationObject();
	CComBSTR bsFileName(strFileName);
	pApplication->PrintToOutputWindow(bsFileName);
#else
	OutputDebugString(strFileName);
#endif // _DEBUG
}
Пример #2
0
wxGISToolBar::wxGISToolBar(wxWindow* parent, wxWindowID id, const wxPoint& position, const wxSize& size, long style, const wxString& sName, const wxString& sCaption, wxGISEnumCommandBars type ) : wxAuiToolBar(parent, id, position, size, style), wxGISCommandBar(sName, sCaption, type), m_pStatusBar(NULL)
{
	IApplication* pApp = dynamic_cast<IApplication*>(parent);
	if(pApp)
	{
		m_pStatusBar = pApp->GetStatusBar();
	}
}
Пример #3
0
int main()
{
	SDeviceContextSettings settings;
	settings.MultiSamplingCount = 4;
	settings.MultiSamplingQuality = 32;
	IApplication* device = createDevice(EDT_DIRECT3D11, 800, 600, EWS_NONE, true, settings);

	IVideoDriver* driver = device->getVideoDriver();
	ISceneManager* smgr = device->createSceneManager();
	IMeshManager* meshManager = driver->getMeshManager();

	IResourceGroupManager* resourceGroupManager = driver->getResourceGroupManager();
	resourceGroupManager->init("Resources.cfg");
	//resourceGroupManager->loadResourceGroup("General");

	XMFLOAT3 vertices[4];
	vertices[0] = XMFLOAT3(-10.0f, 0.0f, 10.0f);
	vertices[1] = XMFLOAT3(10.0f, 0.0f, 10.0f);
	vertices[2] = XMFLOAT3(-10.0f, 0.0f, -10.0f);
	vertices[3] = XMFLOAT3(10.0f, 0.0f, -10.0f);

	ISimpleMesh* mesh = meshManager->createSimpleMesh("pointlist", EVF_POSITION, 
		vertices, NULL, 4, sizeof(XMFLOAT3), 0, math::SAxisAlignedBox(), false);
	IMeshNode* meshNode = smgr->addMeshNode(mesh, nullptr, nullptr);
	meshNode->setMaterialName("test/ts_material");
	meshNode->setNeedCulling(false);

	ICameraNode* camera = smgr->addFpsCameraNode(1, nullptr, XMFLOAT3(0, 1.0f, -4.0f), XMFLOAT3(0, 1.0f, 0.0f));
	char caption[200];

	ITimer* timer = device->getTimer();
	timer->reset();

	while (device->run())
	{
		const float clearColor[] = { 0.0f, 0.0f, 0.0f, 1.0f };
		driver->beginScene(true, true, clearColor);

		float dt = timer->tick() * 0.001f;
		updateCamera(camera, dt);

		smgr->update(dt);
		smgr->drawAll();

		driver->endScene();

		sprintf(caption, "FPS:%f", getFps(dt));
		device->setWindowCaption(caption);
	}

	device->drop();

	return 0;
}
Пример #4
0
QJsonObject Application2Json::from(const IApplication& app)
{
    QJsonObject json;

    json["id"] = app.id();
    json["version"] = app.meta()->version();
    json["application_id"] = app.meta()->applicationId();
    json["name"] = app.meta()->name();
    json["description"] = app.meta()->description();
    json["catalog_image"] = app.meta()->catalogImageFilePath();
    json["status"] = app.stateString();
    json["is_free"] = app.meta()->isFree();

    return json;
}
void
TProfile::TreeItemProfile_DisplayApplicationsWithinNavigationTree()
	{
	if (!m_arraypaAccountsXmpp.FIsEmpty())
		new TMyRecommendations(this);	// Dislay the recommendations if there is at least one account
	//	new TTreeItemDemo(this, "My Reputation", eMenuIconReputation, "Display my reputation according to other organizations", "Search Reputation Feedback Comments");

	IApplication ** ppApplicationStop;
	IApplication ** ppApplication = m_arraypaApplications.PrgpGetApplicationsStop(OUT &ppApplicationStop);
	while (ppApplication != ppApplicationStop)
		{
		IApplication * pApplication = *ppApplication++;
		pApplication->TreeItemApplication_DisplayWithinNavigationTree();
		}

	TBrowser ** ppBrowserStop;
	TBrowser ** ppBrowser = m_arraypaBrowsers.PrgpGetBrowsersStop(OUT &ppBrowserStop);
	while (ppBrowser != ppBrowserStop)
		{
		TBrowser * pBrowser = *ppBrowser++;
		Assert(pBrowser->EGetRuntimeClass() == RTI(TBrowser));
		pBrowser->TreeItemBrowser_DisplayWithinNavigationTree();
		}

	TBrowserTabs ** ppBrowserTabsStop;
	TBrowserTabs ** ppBrowserTabs = m_arraypaBrowsersTabbed.PrgpGetBrowsersStop(&ppBrowserTabsStop);
	while(ppBrowserTabs != ppBrowserTabsStop)
		{
		TBrowserTabs * pBrowserTabs = *ppBrowserTabs++;
		Assert(pBrowserTabs->EGetRuntimeClass() == RTI(TBrowserTabs));
		pBrowserTabs->TreeItemBrowser_DisplayWithinNavigationTree();
		}


	TreeItemW_ExpandAccordingToSavedState();
	}
Пример #6
0
// Dieser Code wird beim ersten Laden des Add-Ins und beim Starten der Anwendung aufgerufen
//  jeder nachfolgenden Developer Studio-Sitzung
STDMETHODIMP CDSAddIn::OnConnection(IApplication* pApp, VARIANT_BOOL bFirstTime,
		long dwCookie, VARIANT_BOOL* OnConnection)
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState());

	// An uns übergebene Info speichern
	IApplication* pApplication = NULL;
	if (FAILED(pApp->QueryInterface(IID_IApplication, (void**) &pApplication))
		|| pApplication == NULL)
	{
		*OnConnection = VARIANT_FALSE;
		return S_OK;
	}

	m_dwCookie = dwCookie;

	// Befehlsverteilung erzeugen, Rückmeldung an DevStudio
	CCommandsObj::CreateInstance(&m_pCommands);
	m_pCommands->AddRef();

	// Das obige QueryInterface hat AddRef auf das Objekt Application angewendet. Es
	//  wird im Destruktor von CCommand freigegeben.
	m_pCommands->SetApplicationObject(pApplication);

	// (siehe Definition von VERIFY_OK in stdafx.h)

	VERIFY_OK(pApplication->SetAddInInfo((long) AfxGetInstanceHandle(),
		(LPDISPATCH) m_pCommands, IDR_TOOLBAR_MEDIUM, IDR_TOOLBAR_LARGE, m_dwCookie));

	// DevStudio über die implementierten Befehle informieren

	VARIANT_BOOL bRet;
	CString strCmdString;

	LPCTSTR szNewQtProject = _T("New Qt Project");
	strCmdString.LoadString(IDS_NEWQTPROJECT_STRING);
	VERIFY_OK(pApplication->AddCommand(CComBSTR(szNewQtProject + strCmdString), CComBSTR(_T("QMsDevNewQtProject")), 0, m_dwCookie, &bRet));
#if 1
	LPCTSTR szGenerateQtProject = _T("Generate Qt Project");
	strCmdString.LoadString(IDS_GENERATEQTPROJECT_STRING);
	VERIFY_OK(pApplication->AddCommand(CComBSTR(szGenerateQtProject + strCmdString), CComBSTR(_T("QMsDevGenerateQtProject")), 1, m_dwCookie, &bRet));
#endif
	LPCTSTR szNewQtDialog = _T("New Qt Dialog");
	strCmdString.LoadString(IDS_NEWQTDIALOG_STRING);
	VERIFY_OK(pApplication->AddCommand(CComBSTR(szNewQtDialog + strCmdString), CComBSTR(_T("QMsDevNewQtDialog")), 2, m_dwCookie, &bRet));

	LPCTSTR szOpenDesigner = _T("Open Qt GUI Designer");
	strCmdString.LoadString(IDS_OPENDESIGNER_STRING);
	VERIFY_OK(pApplication->AddCommand(CComBSTR(szOpenDesigner + strCmdString), CComBSTR(_T("QMsDevStartDesigner")), 3, m_dwCookie, &bRet));

	LPCTSTR szUseQt = _T("Use Qt");
	strCmdString.LoadString(IDS_USEQT_STRING);
	VERIFY_OK(pApplication->AddCommand(CComBSTR(szUseQt + strCmdString), CComBSTR(_T("QMsDevUseQt")), 4, m_dwCookie, &bRet));

	LPCTSTR szAddMOCStep = _T("Add MOC step");
	strCmdString.LoadString(IDS_ADDMOCSTEP_STRING);
	VERIFY_OK(pApplication->AddCommand(CComBSTR(szAddMOCStep + strCmdString), CComBSTR(_T("QMsDevAddMOCStep")), 5, m_dwCookie, &bRet));

	LPCTSTR szAddUICStep = _T("Add UIC step");
	strCmdString.LoadString(IDS_ADDUICSTEP_STRING);
	VERIFY_OK(pApplication->AddCommand(CComBSTR(szAddUICStep + strCmdString), CComBSTR(_T("QMsDevAddUICStep")), 6, m_dwCookie, &bRet));

	if (bRet == VARIANT_FALSE)
	{
		*OnConnection = VARIANT_FALSE;
		return S_OK;
	}

	if (bFirstTime == VARIANT_TRUE)
	{
		VERIFY_OK(pApplication->
			AddCommandBarButton(dsGlyph, CComBSTR(szNewQtProject), m_dwCookie));
#if 1
		VERIFY_OK(pApplication->
			AddCommandBarButton(dsGlyph, CComBSTR(szGenerateQtProject), m_dwCookie));
#endif
		VERIFY_OK(pApplication->
			AddCommandBarButton(dsGlyph, CComBSTR(szNewQtDialog), m_dwCookie));
		VERIFY_OK(pApplication->
			AddCommandBarButton(dsGlyph, CComBSTR(szOpenDesigner), m_dwCookie));
		VERIFY_OK(pApplication->
			AddCommandBarButton(dsGlyph, CComBSTR(szUseQt), m_dwCookie));
		VERIFY_OK(pApplication->
			AddCommandBarButton(dsGlyph, CComBSTR(szAddMOCStep), m_dwCookie));
		VERIFY_OK(pApplication->
			AddCommandBarButton(dsGlyph, CComBSTR(szAddUICStep), m_dwCookie));
	}

	*OnConnection = VARIANT_TRUE;
	return S_OK;
}
Пример #7
0
	//------------------------------------------------------------------------------
	void CRole::Shutdown( IApplication& Application )
	{
		__QCS_FCONTEXT( "CRole::Shutdown" );
		Application.Shutdown();
		m_Impl->Shutdown( Application );
	}
Пример #8
0
int main()
{
	SDeviceContextSettings settings;
	settings.MultiSamplingCount = 4;
	settings.MultiSamplingQuality = 32;

	IApplication* device = gf::createDevice(EDT_DIRECT3D11, SCREEN_WIDTH, SCREEN_HEIGHT, EWS_NONE, true, settings);
	IVideoDriver* driver = device->getVideoDriver();
	ISceneManager* smgr = device->createSceneManager();
	IMeshManager* meshManager = driver->getMeshManager();
	IMaterialManager* materialManager = driver->getMaterialManager();
	ITextureManager* textureManager = driver->getTextureManager();
	IPipelineManager* pipelineManager = driver->getPipelineManager();

	IResourceGroupManager* resourceGroupManager = driver->getResourceGroupManager();
	resourceGroupManager->init("Resources.cfg");



	const f32 groundSize = 1000.0f;

	ISimpleMesh* groundMesh = meshManager->createPlaneMesh("ground", groundSize, groundSize, 100, 100, 100.0f, 100.0f);
	IMeshNode* groundNode = smgr->addMeshNode(groundMesh, nullptr, nullptr, false);
	groundNode->setMaterialName("ground_material");
	
	// add point lights
	const u32 lightColNum = 10;
	const u32 lightRowNum = 10;
	f32 xLightSpace = groundSize / (lightColNum - 1);
	f32 zLightSpace = groundSize / (lightRowNum - 1);

	for (u32 i = 0; i < lightRowNum; i++)
	{
		for (u32 j = 0; j < lightColNum; j++)
		{
			u32 id = i * lightColNum + j;
			f32 x = -groundSize * 0.5f + xLightSpace * j;
			f32 z = groundSize * 0.5f - zLightSpace * i;
			ILightNode* light = smgr->addPointLight(id, nullptr, true, XMFLOAT3(x, 50.0f, z), 200.0f);
			light->setSpecular(XMFLOAT4(12.0f, 12.0f, 12.0f, 32.0f));
			light->setDiffuse(XMFLOAT4(0.8f, 0.8f, 0.8f, 1.0f));
			light->setAttenuation(1.0f, 0.1f, 0);
		}
	}

	
	/*
	IModelMesh* carMesh = meshManager->getModelMesh("myfirst.mesh");
	IMeshNode* carNode = smgr->addModelMeshNode(carMesh, NULL, false);
	carNode->translate(0, 0.1f, 0);
	carNode->setNeedCulling(false);
	carNode->scale(0.05f, 0.05f, 0.05f);
	carNode->pitch(XM_PIDIV2);
	*/
	
	IModelMesh* carMesh = meshManager->getModelMesh("car B red.mesh");
	IMeshNode* carNode = smgr->addModelMeshNode(carMesh, NULL, false);
	carNode->translate(0, 1.0f, 0);
	//carNode->setNeedCulling(false);
	//carNode->scale(0.05f, 0.05f, 0.05f);
	//carNode->pitch(XM_PIDIV2);

	IModelMesh* wheelleftFrontMesh = meshManager->getModelMesh("wheel front left.mesh");
	IMeshNode* wheelleftFront = smgr->addModelMeshNode(wheelleftFrontMesh, carNode, false);
	//carNode->setNeedCulling(false);
	
	ICameraNode* camera = smgr->addFpsCameraNode(1, nullptr, XMFLOAT3(0, 1.0f, -4.0f), XMFLOAT3(0, 1.0f, 0.0f));
	camera->setFarZ(3000.0f);

	smgr->setAmbient(XMFLOAT4(0.8f, 0.8f, 0.8f, 1.0f));

	char caption[200];

	ITimer* timer = device->getTimer();
	timer->reset();

	const f32 color2[] = { 1.0f, 0.0f, 0.0f, 1.0f };

	while (device->run())
	{
		const float clearColor[] = { 0.0f, 0.0f, 0.0f, 1.0f };
		driver->beginScene(true, true, clearColor);

		u32 ms = timer->tick();
		float dt = ms * 0.001f;

		updateCamera(camera, dt);
		//updateCarPosition(dt, carNode, camera);

		smgr->update(ms);

		smgr->drawAll();

		driver->endScene();

		f32 fps = getFps(dt);
		sprintf_s(caption, "FPS:%f, delta:%f", fps, 1000.0f/fps);
		device->setWindowCaption(caption);
	}

	//sphereMaterial.drop();
	smgr->destroy();
	device->drop();

	return 0;
}
Пример #9
0
// This is called when the user first loads the add-in, and on start-up
//  of each subsequent Developer Studio session
STDMETHODIMP CDSAddIn::OnConnection (IApplication * pApp, VARIANT_BOOL bFirstTime,
				     long dwCookie, VARIANT_BOOL * OnConnection)
{
	AFX_MANAGE_STATE (AfxGetStaticModuleState ());
	*OnConnection = VARIANT_FALSE;

	// Store info passed to us
	IApplication *pApplication = NULL;
	HRESULT hr;

	hr = pApp->QueryInterface (IID_IApplication, (void **) &pApplication);
	if (FAILED (hr))
	{
		ReportLastError (hr);
		return E_UNEXPECTED;
	}
	if (pApplication == NULL)
	{
		ReportInternalError ("IApplication::QueryInterface");
		return E_UNEXPECTED;
	}

	m_dwCookie = dwCookie;

	// Create command dispatch, send info back to DevStudio
	CCommandsObj::CreateInstance (&m_pCommands);
	if (! m_pCommands)
	{
		ReportInternalError ("CCommandsObj::CreateInstance");
		return E_UNEXPECTED;
	}
	m_pCommands->AddRef ();

	// The QueryInterface above AddRef'd the Application object.  It will
	// be Release'd in CCommand's destructor.
	m_pCommands->SetApplicationObject (pApplication);

	hr = pApplication->SetAddInInfo ((long) AfxGetInstanceHandle (),
		(LPDISPATCH) m_pCommands, IDR_TOOLBAR_MEDIUM, IDR_TOOLBAR_LARGE,
		m_dwCookie);
	if (FAILED (hr))
	{
		ReportLastError (hr);
		return E_UNEXPECTED;
	}

	// Inform DevStudio of the commands we implement
	if (! AddCommand (pApplication, "VisVimDialog", "VisVimDialogCmd",
			  IDS_CMD_DIALOG, 0, bFirstTime))
		return E_UNEXPECTED;
	if (! AddCommand (pApplication, "VisVimEnable", "VisVimEnableCmd",
			  IDS_CMD_ENABLE, 1, bFirstTime))
		return E_UNEXPECTED;
	if (! AddCommand (pApplication, "VisVimDisable", "VisVimDisableCmd",
			  IDS_CMD_DISABLE, 2, bFirstTime))
		return E_UNEXPECTED;
	if (! AddCommand (pApplication, "VisVimToggle", "VisVimToggleCmd",
			  IDS_CMD_TOGGLE, 3, bFirstTime))
		return E_UNEXPECTED;
	if (! AddCommand (pApplication, "VisVimLoad", "VisVimLoadCmd",
			  IDS_CMD_LOAD, 4, bFirstTime))
		return E_UNEXPECTED;

	*OnConnection = VARIANT_TRUE;
	return S_OK;
}
Пример #10
0
	//------------------------------------------------------------------------------
	void CRole::Setup( IApplication& Application )
	{
		__QCS_FCONTEXT( "CRole::Setup" );
		m_Impl->Setup( Application );
		Application.Setup();
	}
Пример #11
0
// This is called when the user first loads the add-in, and on start-up
//  of each subsequent Developer Studio session
STDMETHODIMP CDSAddIn::OnConnection(IApplication* pApp, VARIANT_BOOL bFirstTime,
		long dwCookie, VARIANT_BOOL* OnConnection)
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState());
	
	// Store info passed to us
	IApplication* pApplication = NULL;
	if (FAILED(pApp->QueryInterface(IID_IApplication, (void**) &pApplication))
		|| pApplication == NULL)
	{
		*OnConnection = VARIANT_FALSE;
		return S_OK;
	}

	m_dwCookie = dwCookie;

	// Create command dispatch, send info back to DevStudio
	CCommandsObj::CreateInstance(&m_pCommands);
	m_pCommands->AddRef();

	// The QueryInterface above AddRef'd the Application object.  It will
	//  be Release'd in CCommand's destructor.
	m_pCommands->SetApplicationObject(pApplication);

	// (see stdafx.h for the definition of VERIFY_OK)

	VERIFY_OK(pApplication->SetAddInInfo((long) AfxGetInstanceHandle(),
		(LPDISPATCH) m_pCommands, IDR_TOOLBAR_MEDIUM, IDR_TOOLBAR_LARGE, m_dwCookie));

	// Inform DevStudio of the commands we implement

	// TODO: Replace the AddCommand call below with a series of calls,
	//  one for each command your add-in will add.

	// The command name should not be localized to other languages.  The 
	//  tooltip, command description, and other strings related to this
	//  command are stored in the string table (IDS_CMD_STRING) and should
	//  be localized.
	LPCTSTR szCommand = _T("ShowGroupsAddinCommand");
	VARIANT_BOOL bRet;
	CString strCmdString;
	strCmdString.LoadString(IDS_CMD_STRING);
	strCmdString = szCommand + strCmdString;
	CComBSTR bszCmdString(strCmdString);
	CComBSTR bszMethod(_T("ShowGroupsAddinCommandMethod"));
	CComBSTR bszCmdName(szCommand);
	VERIFY_OK(pApplication->AddCommand(bszCmdString, bszMethod, 0, m_dwCookie, &bRet));
	if (bRet == VARIANT_FALSE)
	{
		// AddCommand failed because a command with this name already
		//  exists.  You may try adding your command under a different name.
		//  Or, you can fail to load as we will do here.
		*OnConnection = VARIANT_FALSE;
		return S_OK;
	}

	// Add toolbar buttons only if this is the first time the add-in
	//  is being loaded.  Toolbar buttons are automatically remembered
	//  by Developer Studio from session to session, so we should only
	//  add the toolbar buttons once.
	if (bFirstTime == VARIANT_TRUE)
	{
		VERIFY_OK(pApplication->
			AddCommandBarButton(dsGlyph, bszCmdName, m_dwCookie));
	}

	// Create the WWhizInterface.
	g_wwhizInterface = WWhizInterface2Create(AfxGetInstanceHandle(), pApplication);

	*OnConnection = VARIANT_TRUE;
	return S_OK;
}
Пример #12
0
int main()
{
	SDeviceContextSettings settings;
	settings.MultiSamplingCount = 1;
	settings.MultiSamplingQuality = 0;
	IApplication* device = createDevice(EDT_DIRECT3D11, SCREEN_WIDTH, SCREEN_HEIGHT, EWS_NONE, true, settings);

	IVideoDriver* driver = device->getVideoDriver();
	ISceneManager* smgr = device->createSceneManager();
	IMeshManager* meshManager = driver->getMeshManager();
	IPipelineManager* pipelineManager = driver->getPipelineManager();

	IResourceGroupManager* resourceGroupManager = driver->getResourceGroupManager();
	resourceGroupManager->init("Resources.cfg");

	ISimpleMesh* mesh = createWaterMesh(meshManager, "waterwave", 1000.0f, 1000.0f, 30, 30);
	IMeshNode* meshNode = smgr->addMeshNode(mesh, nullptr, nullptr);
	meshNode->setMaterialName("test/wave_material");
	meshNode->setNeedCulling(false);

	IPipeline* pipeline = pipelineManager->get("test/wave_pipeline");

	ILightNode* light = smgr->addPointLight(1, nullptr, false, XMFLOAT3(10.0f, 50.0f, -10.0f), 1000.0f);
	light->setSpecular(XMFLOAT4(1.0f, 1.0f, 1.0f, 1.0f));
	light->setDiffuse(XMFLOAT4(1.0f, 1.0f, 1.0f, 1.0f));
	light->setAttenuation(1.0f, 0.0f, 0.0f);

	// gTangentWorldMatrix
	XMVECTOR normal = XMVectorSet(0, 1.0f, 0, 0);
	XMVECTOR tangent = XMVectorSet(1.0f, 0, 0, 0);
	XMVECTOR B = XMVector3Cross(normal, tangent);

	XMMATRIX TBN = XMMATRIX(tangent, B, normal, XMVectorSet(0, 0, 0, 1.0f));
	pipeline->setMatrix("gTangentWorldMatrix", TBN);

	ICameraNode* camera = smgr->addFpsCameraNode(1, nullptr, XMFLOAT3(0, 40.0f, -4.0f), XMFLOAT3(0, 40.0f, 0.0f));
	camera->setFarZ(10000.0f);
	char caption[200];

	ITimer* timer = device->getTimer();
	timer->reset();

	static float t1 = 0.0f;
	static float t2 = 0.0f;
	
	E_FILL_MODE fillMode = E_FILL_SOLID;

	/*
	SCompositorCreateParam param;
	param.Bloom.BlurPassCount = 3;
	param.Bloom.BrightnessThreshold = 0.85f;
	param.Bloom.BlurTexelDistance = 1.0f;
	param.Bloom.BlurTextureWidth = 400;
	param.Bloom.BlurTextureHeight = 300;
	
	ICompositor* bloom = smgr->createCompositor(ECT_BLOOM, param);
	smgr->addCompositor(bloom);

	*/

	while (device->run())
	{
		const float clearColor[] = { 0.0f, 0.0f, 0.0f, 1.0f };
		driver->beginScene(true, true, clearColor);

		float dt = timer->tick() * 0.001f;
		t1 += dt * 0.032f;
		t2 += dt * 0.02f;
		if (t1 > 1.0f)
			t1 -= 1.0f;
		if (t2 > 1.0f)
			t2 -= 1.0f;

		XMMATRIX texTransform1 = XMMatrixTranslation(t1, 0, 0);
		XMMATRIX texTransform2 = XMMatrixTranslation(0, t2, 0);

		pipeline->setMatrix("gTexTransform1", texTransform1);
		pipeline->setMatrix("gTexTransform2", texTransform2);

		updateCamera(camera, dt);

		smgr->update(dt);
		smgr->drawAll();

		driver->endScene();

		sprintf(caption, "FPS:%f", getFps(dt));
		device->setWindowCaption(caption);
	}

	device->drop();

	return 0;
}
Пример #13
0
HRESULT CCommands::XApplicationEvents::BeforeBuildStart()
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState());

	IApplication* pApplication;

	pApplication = m_pCommands->GetApplicationObject();

	CComPtr<IProjects> pIProjects = NULL;
	pApplication->get_Projects((IDispatch **)&pIProjects);

	long					lProjects			= 0;
	CComVariant				varProject			;
	VERIFY_OK( pIProjects->get_Count( &lProjects ) );

	for ( long lProject = 1 ; lProject < lProjects + 1 ; lProject++ )
	{
		varProject = lProject;

		CComPtr< IGenericProject > pIGenericProject;

		VERIFY_OK( pIProjects->Item(varProject, &pIGenericProject));

		if (pIGenericProject)
		{
			CComBSTR bType;
			CString strType;
			pIGenericProject->get_Type(&bType);
			strType = bType;
			if (strType.CompareNoCase(DS_BUILD_PROJECT) != 0) continue;

			CComBSTR bStr;
			pIGenericProject->get_FullName(&bStr);

			CString strProjectName = bStr;
			CString strProjectPath, strRcName, strConfigName;
			UINT uSvnVersion = 0;

			TCHAR sDrive[_MAX_DRIVE] = {0};
			TCHAR sDir[_MAX_DIR] = {0};
			TCHAR sFname[_MAX_FNAME] = {0};
			TCHAR sExt[_MAX_EXT] = {0};

			_tsplitpath(strProjectName, sDrive, sDir, sFname, sExt);

			strProjectPath = CString(sDrive) + CString(sDir);
			strConfigName = CString(sDrive) + CString(sDir) + CString(sFname) + CString(_T(".ini"));

			// 得到配置信息
			CONFIG config;
			COptionDlg::GetConfig(config, strConfigName);

			if (config.bCheckSvn && !config.bCheckSelfUpdata)
			{
				// const svn_version_t *ver = svn_wc_version();
				uSvnVersion = GetWorkSvnVersion(strProjectPath, config.iSvnVersionPath);

				if (uSvnVersion == 0)
				{
					return S_OK;
				}
			}

			CString Data;

			GetFileData(strProjectName, Data);

			if (Data.IsEmpty())
			{
				return S_OK;
			}

			strRcName = GetRegexpData(Data, _T("SOURCE=(?<SCR>.+\\.rc)$|SOURCE=\"(?<SCR>.+\\.rc)\""), MULTILINE | IGNORECASE, "SCR");

			if (strRcName.IsEmpty())
			{
				return S_OK;
			}

			CString strFileVersion, strFileVersionDescribe, strVersion, strVersionDescribe, RcData;
			UINT uFileVer[4], uFileVerDesc[4];
			BOOL bUpdata = FALSE;

			GetFileData(strProjectPath + strRcName, RcData);

			if (RcData.IsEmpty())
			{
				return S_OK;
			}

			// 进行 版本信息 更新
			strVersion = GetRegexpData(RcData, _T(".+VALUE.+\"FileVersion\",.+\"(.+)\""), MULTILINE | IGNORECASE);
			if (!strVersion.IsEmpty())
			{
				sscanf(strVersion, "%d, %d, %d, %d", &uFileVer[0], &uFileVer[1], &uFileVer[2], &uFileVer[3]);
				UpdataVersionInfo(uFileVer, config, uSvnVersion);
				strFileVersion.Format(_T("$1%d, %d, %d, %d\\0$2"),
					uFileVer[0], uFileVer[1], uFileVer[2], uFileVer[3]);

				if (-1 == strFileVersion.Find(strVersion))
				{
					RcData = ReplaceRegexpData(
						RcData,
						_T("(.+VALUE.+\"FileVersion\",.+\").+(\")"),
						MULTILINE | IGNORECASE,
						strFileVersion);
					bUpdata = TRUE;
				}
			}

			strVersion = GetRegexpData(RcData, _T(".+VALUE.+\"ProductVersion\",.+\"(.+)\""), MULTILINE | IGNORECASE);
			if (!strVersion.IsEmpty())
			{
				sscanf(strVersion, "%d, %d, %d, %d", &uFileVer[0], &uFileVer[1], &uFileVer[2], &uFileVer[3]);
				UpdataVersionInfo(uFileVer, config, uSvnVersion);
				strFileVersion.Format(_T("$1%d, %d, %d, %d\\0$2"),
					uFileVer[0], uFileVer[1], uFileVer[2], uFileVer[3]);

				if (-1 == strFileVersion.Find(strVersion))
				{
					RcData = ReplaceRegexpData(
						RcData,
						_T("(.+VALUE.+\"ProductVersion\",.+\").+(\")"),
						MULTILINE | IGNORECASE,
						strFileVersion);
					bUpdata = TRUE;
				}
			}

			strVersionDescribe = GetRegexpData(RcData, _T(".+FILEVERSION[ ]+(.+)"), MULTILINE | IGNORECASE);
			if (!strVersionDescribe.IsEmpty())
			{
				sscanf(strVersionDescribe, "%d,%d,%d,%d", &uFileVerDesc[0], &uFileVerDesc[1], &uFileVerDesc[2], &uFileVerDesc[3]);
				UpdataVersionInfo(uFileVerDesc, config, uSvnVersion);
				strFileVersionDescribe.Format(_T("$1%d,%d,%d,%d"),
					uFileVerDesc[0], uFileVerDesc[1], uFileVerDesc[2], uFileVerDesc[3]);

				if (-1 == strFileVersionDescribe.Find(strVersionDescribe))
				{
					RcData = ReplaceRegexpData(
						RcData,
						_T("(.+FILEVERSION[ ]+).+"),
						MULTILINE | IGNORECASE,
						strFileVersionDescribe);
					bUpdata = TRUE;
				}
			}

			strVersionDescribe = GetRegexpData(RcData, _T(".+ProductVersion[ ]+(.+)"), MULTILINE | IGNORECASE);
			if (!strVersionDescribe.IsEmpty())
			{
				sscanf(strVersionDescribe, "%d,%d,%d,%d", &uFileVerDesc[0], &uFileVerDesc[1], &uFileVerDesc[2], &uFileVerDesc[3]);
				UpdataVersionInfo(uFileVerDesc, config, uSvnVersion);
				strFileVersionDescribe.Format(_T("$1%d,%d,%d,%d"),
					uFileVerDesc[0], uFileVerDesc[1], uFileVerDesc[2], uFileVerDesc[3]);

				if (-1 == strFileVersionDescribe.Find(strVersionDescribe))
				{
					RcData = ReplaceRegexpData(
						RcData,
						_T("(.+ProductVersion[ ]+).+"),
						MULTILINE | IGNORECASE,
						strFileVersionDescribe);
					bUpdata = TRUE;
				}
			}

			if (bUpdata)
			{
				SetFileData(strProjectPath + strRcName, RcData);
			}
		}
	}

	return S_OK;
}
Пример #14
0
int main(int argc, char *argv[])
#endif
{
#ifndef LITEAPP_LIBRARY
    #if defined(_MSC_VER) && defined(_DEBUG)
        _CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | _CRTDBG_LEAK_CHECK_DF);
    #endif
#endif
    QApplication app(argc, argv);

#if QT_VERSION >= 0x050100
    app.setAttribute(Qt::AA_UseHighDpiPixmaps);
#endif

    //QFont::insertSubstitution(".Lucida Grande UI", "Lucida Grande");
    QTranslator translator;
    QTranslator qtTranslator;

    QString resPath = LiteApp::getResoucePath();
    QString locale = QLocale::system().name();
    QString qss;
    QSettings global(resPath+"/liteapp/config/global.ini",QSettings::IniFormat);
    bool storeLocal = global.value(LITEIDE_STORELOCAL,false).toBool();
    if (storeLocal) {
        const QSettings settings(resPath+"/liteapp/config/liteide.ini", QSettings::IniFormat);
        locale = settings.value(LITEAPP_LANGUAGE,locale).toString();
        qss = settings.value(LITEAPP_QSS,"default.qss").toString();
    } else {
        const QSettings settings(QSettings::IniFormat,QSettings::UserScope,"liteide","liteide");
        locale = settings.value(LITEAPP_LANGUAGE,locale).toString();
        qss = settings.value(LITEAPP_QSS,"default.qss").toString();
    }

    if (!locale.isEmpty()) {
        const QString &liteideTrPath = resPath+"/translations";
        if (translator.load(QLatin1String("liteide_") + locale, liteideTrPath)) {
            const QString &qtTrPath = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
            const QString &qtTrFile = QLatin1String("qt_") + locale;
            // Binary installer puts Qt tr files into creatorTrPath            
            app.installTranslator(&translator);
            if (qtTranslator.load(qtTrFile, qtTrPath) || qtTranslator.load(qtTrFile, liteideTrPath)) {
                app.installTranslator(&qtTranslator);
            }
            app.setProperty("liteide_locale", locale);
        }
    }
    if (!qss.isEmpty()) {
        QFile f(resPath+"/liteapp/qss/"+qss);
        if (f.open(QFile::ReadOnly)) {
            QString styleSheet = QLatin1String(f.readAll());
            app.setStyleSheet(styleSheet);
        }
    }

    QDir::addSearchPath("icon",resPath);
    QDir::addSearchPath("icon",resPath+"/liteapp");
    QDir::addSearchPath("icon",":/");
#if QT_VERSION >= 0x050000
    QString storage = QStandardPaths::writableLocation(QStandardPaths::DataLocation);
#else
    QString storage = QDesktopServices::storageLocation(QDesktopServices::DataLocation);
#endif
    QDir dir(storage);
    dir.mkdir("liteide");

    QStringList argList;
    QStringList fileList;
    if (argc >= 2) {
        for (int i = 1; i < argc; i++) {
            QString arg = argv[i];
            if (arg.startsWith("-")) {
                argList.append(arg);
                continue;
            } else {
                fileList.append(arg);
            }
        }
    }

    IApplication *liteApp = LiteApp::NewApplication(true,0);

    if (fileList.size() == 1) {
        QString file = fileList.at(0);
        QFileInfo f(file);
        if (f.isFile()) {
            liteApp->fileManager()->addFolderList(f.path());
            liteApp->fileManager()->openEditor(file);
        } else if (f.isDir()) {
            liteApp->fileManager()->addFolderList(file);
        }
    } else {
        foreach(QString file, fileList) {
            QFileInfo f(file);
            if (f.isFile()) {
                liteApp->fileManager()->openEditor(file);
            } else if (f.isDir()) {
                liteApp->fileManager()->addFolderList(file);
            }
        }
    }
Пример #15
0
int main(int argc, char *argv[])
#endif
{
#ifndef LITEAPP_LIBRARY
    #if defined(_MSC_VER) && defined(_DEBUG)
        _CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | _CRTDBG_LEAK_CHECK_DF);
    #endif
#endif
    
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
    QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
#endif
    
    QApplication app(argc, argv);

    QStringList arguments = app.arguments();

    //init load file or folder list
    QStringList fileList;

    //liteide --select-env [system|win32|cross-linux64|...]     select init environment id
    //liteide --reset-setting   reset current setting
    //liteide --local-setting   force user local setting
    //liteide --user-setting    force use user setting
    QString flagSelectEnv = "--select-env";
    QString argSelectEnv;
    QString flagResetSetting = "--reset-setting";
    QString flagLocalSetting = "--local-setting";
    QString flagUserSetting = "--user-setting";
    bool argResetSetting = false;
    bool argLocalSetting = false;
    bool argUserSetting = false;
    for(int i = 1; i < arguments.size(); i++) {
        QString arg = arguments[i];
        if (arg.startsWith("-")) {
            if (arg.indexOf(flagSelectEnv+"=") == 0) {
                argSelectEnv = arg.mid(flagSelectEnv.length()+1);
            } else if (arg == flagSelectEnv) {
                i++;
                if (i < arguments.size()) {
                    argSelectEnv = arguments[i];
                }
            } else if (arg == flagResetSetting) {
                argResetSetting = true;
            } else if (arg == flagLocalSetting) {
                argLocalSetting = true;
            } else if (arg == flagUserSetting) {
                argUserSetting = true;
            }
            continue;
        }
        fileList.append(arg);
    }

    //save to global
    if (!argSelectEnv.isEmpty()) {
        LiteApp::s_cookie.insert(flagSelectEnv,argSelectEnv);
    }
    if (argLocalSetting) {
        LiteApp::s_cookie.insert(flagLocalSetting,true);
    }
    if (argUserSetting) {
        LiteApp::s_cookie.insert(flagUserSetting,true);
    }

#if QT_VERSION >= 0x050100
    app.setAttribute(Qt::AA_UseHighDpiPixmaps);
#endif

    //QFont::insertSubstitution(".Lucida Grande UI", "Lucida Grande");
    QTranslator translator;
    QTranslator qtTranslator;

    QString resPath = LiteApp::getResoucePath();
    QString locale = QLocale::system().name();
    QString qss;
    QSettings global(resPath+"/liteapp/config/global.ini",QSettings::IniFormat);
    bool storeLocal = global.value(LITEIDE_STORELOCAL,false).toBool();

    if (argUserSetting) {
        storeLocal = false;
    } else if (argLocalSetting) {
        storeLocal = true;
    }

    if (storeLocal) {
        QSettings settings(resPath+"/liteapp/config/liteide.ini", QSettings::IniFormat);
        if (argResetSetting) {
            settings.clear();
        }
        locale = settings.value(LITEAPP_LANGUAGE,locale).toString();
        qss = settings.value(LITEAPP_QSS,"default.qss").toString();
    } else {
        QSettings settings(QSettings::IniFormat,QSettings::UserScope,"liteide","liteide");
        if (argResetSetting) {
            settings.clear();
        }
        locale = settings.value(LITEAPP_LANGUAGE,locale).toString();
        qss = settings.value(LITEAPP_QSS,"default.qss").toString();
    }

    if (!locale.isEmpty()) {
        const QString &liteideTrPath = resPath+"/translations";
        if (translator.load(QLatin1String("liteide_") + locale, liteideTrPath)) {
            const QString &qtTrPath = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
            const QString &qtTrFile = QLatin1String("qt_") + locale;
            // Binary installer puts Qt tr files into creatorTrPath            
            app.installTranslator(&translator);
            if (qtTranslator.load(qtTrFile, qtTrPath) || qtTranslator.load(qtTrFile, liteideTrPath)) {
                app.installTranslator(&qtTranslator);
            }
            app.setProperty("liteide_locale", locale);
        }
    }
    if (!qss.isEmpty()) {
        QFile f(resPath+"/liteapp/qss/"+qss);
        if (f.open(QFile::ReadOnly)) {
            QString styleSheet = QLatin1String(f.readAll());
            app.setStyleSheet(styleSheet);
        }
    }

    IApplication *liteApp = LiteApp::NewApplication("default",0);

    foreach(QString file, fileList) {
        QFileInfo f(file);
        if (f.isFile()) {
            liteApp->fileManager()->openEditor(file);
        } else if (f.isDir()) {
            liteApp->fileManager()->addFolderList(file);
        }
    }
Пример #16
0
void CSDKAPWZAppWiz::CustomizeProject(IBuildProject* pProject)
{
	// TODO: Add code here to customize the project.  If you don't wish
	//  to customize project, you may remove this virtual override.
	
	// This is called immediately after the default Debug and Release
	//  configurations have been created for each platform.  You may customize
	//  existing configurations on this project by using the methods
	//  of IBuildProject and IConfiguration such as AddToolSettings,
	//  RemoveToolSettings, and AddCustomBuildStep. These are documented in
	//  the Developer Studio object model documentation.

	// WARNING!!  IBuildProject and all interfaces you can get from it are OLE
	//  COM interfaces.  You must be careful to release all new interfaces
	//  you acquire.  In accordance with the standard rules of COM, you must
	//  NOT release pProject, unless you explicitly AddRef it, since pProject
	//  is passed as an "in" parameter to this function.  See the documentation
	//  on CCustomAppWiz::CustomizeProject for more information.
	
	//The following sets the project settings for 'Addtional include directories:'
	//maxsdk/include, maxsdk/lib and 'Output file name:' 3dsmax/plugin/*.*

	CString sPath, pPath, ePath, sInc, sRC, sL, sG, pName, pExt;
	IConfigurations *pConfigs;
	long count;
	IConfiguration *pConfig;		
	CString base_address;	

	// Generate a random 64K mutliple base address
	int K64 = 64*1024;
	base_address.Format(_T("0x%x"), ((rand() + rand() + ((rand()+(rand()<<16))))/K64)*K64);
	lookup_key(_T("root"),		pName);
	lookup_key(_T("PLUGEXT"),	pExt);
	lookup_key(_T("SDKPATH"),	sPath);
	lookup_key(_T("PLGPATH"),	pPath);
	lookup_key(_T("EXEPATH"),	ePath);
	
//	pName.SetAt(0, toupper(pName[0]));

	// 3dsmax.exe and maxsdk include paths
	sInc =  "/I" + sPath + "\\include "; 

	// Linker settings
	sL = 
		//output filename
		"/out:" + pPath + "\\" + pName + "." + pExt + " " +
			
		//sdk libs
		" comctl32.lib " + GetPluginLibs(pExt) + 

		//maxsdk libpath
		" /LIBPATH:" + sPath + "\\lib " + " /DLL /base:" + base_address;

	// General Settings
	sG = CString("0");		//To specify Not Using MFC

	BSTR bszComp = CString("cl.exe").AllocSysString();
	BSTR bszLink = CString("link.exe").AllocSysString();	
	BSTR bszMfc  = CString("mfc").AllocSysString();
	
	// Compiler settings
	BSTR bszSettingsC[] = { 
		("/MDd /G6 /LD " + sInc).AllocSysString(), // Debug
		("/MD /G6 /LD "  + sInc).AllocSysString(), // Hybrid
		("/MD /G6 /LD "  + sInc).AllocSysString()  // Release
		};

	BSTR bszRemSettingsC = CString(_T("/GX /D_MBCS /GZ")).AllocSysString();
	BSTR bszHyb = CString("Hybrid").AllocSysString();
	BSTR bszSettingsL = sL.AllocSysString();
	BSTR bszSettingsG = sG.AllocSysString();
	
	COleVariant res;

	pProject->AddConfiguration(bszHyb, res);
	pProject->get_Configurations(&pConfigs);		
	pConfigs->get_Count(&count);	
	for (long i = 1; i <= count; i++)
	{
		COleVariant varInd(i);
		pConfigs->Item(varInd , &pConfig);
		
		COleVariant var(0L,VT_ERROR);
		var.scode=DISP_E_PARAMNOTFOUND;

		pConfig->AddToolSettings(bszMfc, bszSettingsG, var);		
		pConfig->AddToolSettings(bszLink, bszSettingsL, var);
		
		COleVariant varStr;

		pConfig->get_Name(&V_BSTR(&varStr));
		
		varStr.vt = VT_BSTR;

		if (varStr == COleVariant(pName + " - Win32 Debug"))
		{
			pConfig->AddToolSettings(bszComp, bszSettingsC[0], var);
			SysFreeString(bszSettingsC[0]);
		}
		else if (varStr == COleVariant(pName + " - Win32 Hybrid"))
		{
			pConfig->AddToolSettings(bszComp, bszSettingsC[1], var);
			SysFreeString(bszSettingsC[1]);
		}
		else // release
		{
			pConfig->AddToolSettings(bszComp, bszSettingsC[2], var);
			SysFreeString(bszSettingsC[2]);

			// For release config add "/release" flag to linker settings
			BSTR rel = CString(_T("/release")).AllocSysString();
			pConfig->AddToolSettings(bszLink, rel, var);
			SysFreeString(rel);
		}
		pConfig->RemoveToolSettings(bszComp, bszRemSettingsC, var);		
		pConfig->Release();
	}
	SysFreeString(bszComp);
	SysFreeString(bszLink);
	SysFreeString(bszMfc);	
	SysFreeString(bszRemSettingsC);
	SysFreeString(bszHyb);
	SysFreeString(bszSettingsL);
	SysFreeString(bszSettingsG);	
	pConfigs->Release();

#if (1)
	//The following opens the Root.cpp document in the DevStudio
	IApplication *pApp;
	IDocuments *pDocs;
	IDocuments *pDoc;
	BSTR bszRoot = (pName + CString(_T(".cpp"))).AllocSysString();
	COleVariant varOpenAs(CString(_T("Text")));
	COleVariant varReadOnly(0L, VT_BOOL);

	pProject->get_Application((IDispatch **)&pApp);
	pApp->get_Documents((IDispatch **)&pDocs);
	pDocs->Open(bszRoot, varOpenAs, varReadOnly, (IDispatch **)&pDoc);
	
	SysFreeString(bszRoot);
	pApp->Release();
	pDocs->Release();
	pDoc->Release();
#endif
}
Пример #17
0
int Starter::Run(int& argc, char** argv,
    Poco::Util::AbstractConfiguration* config)
{

  // The CTK PluginFramework needs a QCoreApplication
  if (!qApp)
  {
    BERRY_FATAL << "No QCoreApplication instance found. You need to create one prior to calling Starter::Run()";
  }

  InternalPlatform* platform = InternalPlatform::GetInstance();

  int returnCode = 0;

  // startup the internal platform
  platform->Initialize(argc, argv, config);
  platform->Launch();

  bool consoleLog = platform->ConsoleLog();

  // run the application
  IExtensionPointService::Pointer service =
      platform->GetExtensionPointService();
  if (service == 0)
  {
    platform->GetLogger()->log(
        Poco::Message(
            "Starter",
            "The extension point service could not be retrieved. This usually indicates that the BlueBerry OSGi plug-in could not be loaded.",
            Poco::Message::PRIO_FATAL));
    std::unexpected();
    returnCode = 1;
  }
  else
  {
    IConfigurationElement::vector extensions(
        service->GetConfigurationElementsFor(Starter::XP_APPLICATIONS));
    IConfigurationElement::vector::iterator iter;

    for (iter = extensions.begin(); iter != extensions.end();)
    {
      if ((*iter)->GetName() != "application")
        iter = extensions.erase(iter);
      else
        ++iter;
    }

    std::string argApplication = Platform::GetConfiguration().getString(
        Platform::ARG_APPLICATION, "");

    IApplication* app = 0;
    if (extensions.size() == 0)
    {
      BERRY_FATAL
          << "No extensions configured into extension-point '" << Starter::XP_APPLICATIONS << "' found. Aborting.\n";
      returnCode = 0;
    }
    else if (extensions.size() == 1)
    {
      if (!argApplication.empty())
        BERRY_INFO(consoleLog)
            << "One '" << Starter::XP_APPLICATIONS << "' extension found, ignoring "
            << Platform::ARG_APPLICATION << " argument.\n";
      std::vector<IConfigurationElement::Pointer> runs(
          extensions[0]->GetChildren("run"));
      app = runs.front()->CreateExecutableExtension<IApplication> ("class");
      if (app == 0)
      {
        // support legacy BlueBerry extensions
        app = runs.front()->CreateExecutableExtension<IApplication> ("class", IApplication::GetManifestName());
      }
    }
    else
    {
      if (argApplication.empty())
      {
        BERRY_WARN << "You must provide an application id via \""
            << Platform::ARG_APPLICATION << "=<id>\"";
        BERRY_INFO << "Possible application ids are:";
        for (iter = extensions.begin(); iter != extensions.end(); ++iter)
        {
          std::string appid;
          if ((*iter)->GetAttribute("id", appid) && !appid.empty())
          {
            BERRY_INFO << appid;
          }
        }
        returnCode = 0;
      }
      else
      {
        for (iter = extensions.begin(); iter != extensions.end(); ++iter)
        {
          BERRY_INFO(consoleLog) << "Checking applications extension from: "
              << (*iter)->GetContributor() << std::endl;

          std::string appid;
          if ((*iter)->GetAttribute("id", appid))
          {
            BERRY_INFO(consoleLog) << "Found id: " << appid << std::endl;
            if (appid.size() > 0 && appid == argApplication)
            {
              std::vector<IConfigurationElement::Pointer> runs(
                  (*iter)->GetChildren("run"));
              app = runs.front()->CreateExecutableExtension<IApplication> ("class");
              if (app == 0)
              {
                // try legacy BlueBerry extensions
                app = runs.front()->CreateExecutableExtension<IApplication> (
                  "class", IApplication::GetManifestName());
              }
              break;
            }
          }
          else
            throw CoreException("missing attribute", "id");
        }
      }
    }

    if (app == 0)
    {
      BERRY_ERROR
          << "Could not create executable application extension for id: "
          << argApplication << std::endl;
      returnCode = 1;
    }
    else
    {
      returnCode = app->Start();
    }
  }

  platform->Shutdown();
  return returnCode;
}
Пример #18
0
int main()
{
	SDeviceContextSettings settings;
	settings.MultiSamplingCount = 4;
	settings.MultiSamplingQuality = 32;

	IApplication* device = gf::createDevice(EDT_DIRECT3D11, SCREEN_WIDTH, SCREEN_HEIGHT, EWS_NONE, true, settings);
	IVideoDriver* driver = device->getVideoDriver();
	ISceneManager* smgr = device->createSceneManager();
	IMeshManager* meshManager = driver->getMeshManager();
	IMaterialManager* materialManager = driver->getMaterialManager();
	ITextureManager* textureManager = driver->getTextureManager();

	IResourceGroupManager* resourceGroupManager = driver->getResourceGroupManager();
	resourceGroupManager->init("Resources.cfg");
//	resourceGroupManager->loadResourceGroup("General");

	ILightNode* light = smgr->addDirectionalLight(1, nullptr, XMFLOAT3(3.0f, -2.0f, 1.5f));
	light->setSpecular(XMFLOAT4(1.0f, 1.0f, 1.0f, 32.0f));
	light->setDiffuse(XMFLOAT4(0.4f, 0.4f, 0.4f, 1.0f));

	ILightNode* light2 = smgr->addDirectionalLight(2, nullptr, XMFLOAT3(-2.0f, -3.0f, -2.0f));
	light2->setSpecular(XMFLOAT4(1.0f, 1.0f, 1.0f, 32.0f));
	light2->setDiffuse(XMFLOAT4(0.5f, 0.5f, 0.5f, 1.0f));

	ICameraNode* camera = smgr->addFpsCameraNode(1, nullptr, XMFLOAT3(0, 30.0f, -4.0f), XMFLOAT3(0, 30.0f, 0.0f), XMFLOAT3(0, 1.0f, 0), true);
	camera->setViewWidth(300);
	camera->setViewHeight(200);

	char caption[200];
	
	std::string rawFileName("heightmap.raw");
	ITerrainMesh* mesh = meshManager->createTerrainMesh("terrain", rawFileName,
		3.0f, 0.4f, false, true, 1.0f);

	ITerrainNode* terrainNode = smgr->addTerrainNode(mesh);
	//terrainNode->setMaterialName("terrain/tessellation_material");
	terrainNode->setMaterialName("terrain/terrain_material");

	ITextureCube* skyTexture = textureManager->loadCubeTexture("Snow.dds");
	smgr->setSkyDome(skyTexture);

	
	IRenderTarget* pRenderTarget = textureManager->getRenderTarget("target1");

		
	ITimer* timer = device->getTimer();
	timer->reset();

	while (device->run())
	{
		const float clearColor[] = { 0.0f, 0.0f, 0.0f, 1.0f };
		driver->beginScene(true, true, clearColor);

		u32 ms = timer->tick();
		float dt = ms * 0.001f;
		updateCamera(camera, dt);

		XMFLOAT3 camPos = camera->getPosition();
		float terrainHeight = terrainNode->getHeight(camPos.x, camPos.z, true);
		camPos.y = terrainHeight + 3.0f;
		//camera->setPosition(camPos);

		smgr->update(ms);
		smgr->drawAll();

		driver->endScene();

		u32 num = smgr->getRenderedMeshNum();

		sprintf(caption, "FPS:%f num:%d", getFps(dt), num);
		device->setWindowCaption(caption);
	}

	smgr->destroy();
	device->drop();

	return 0;
}
Пример #19
0
HRESULT CCommands::XApplicationEvents::BuildFinish(long nNumErrors, long nNumWarnings)
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState());

	if (nNumErrors == 0)
	{
		CComPtr<IGenericProject> pProjectItem = NULL;
		IApplication* pApplication;
		CComPtr<IConfiguration> pConfig = NULL;
		CComBSTR bsBuildName;
		CString strBuildName;

		pApplication = m_pCommands->GetApplicationObject();
		VERIFY_OK(pApplication->get_ActiveProject((IDispatch **)&pProjectItem));
		VERIFY_OK(pApplication->get_ActiveConfiguration((IDispatch **)&pConfig));
		pConfig->get_Name(&bsBuildName);
		strBuildName = bsBuildName;

		if (!pProjectItem)
		{
			return S_OK;
		}

		CComBSTR bsFullName, bsName;
		CString strProjectFullName, strProjectPath,
			strConfigName, strProjectName;
		UINT uSvnVersion = 0;

		pProjectItem->get_FullName(&bsFullName);
		pProjectItem->get_Name(&bsName);

		strProjectFullName = bsFullName;
		strProjectName = bsName;

		TCHAR sDrive[_MAX_DRIVE] = {0};
		TCHAR sDir[_MAX_DIR] = {0};
		TCHAR sFname[_MAX_FNAME] = {0};
		TCHAR sExt[_MAX_EXT] = {0};

		_tsplitpath(strProjectFullName, sDrive, sDir, sFname, sExt);

		strProjectPath = CString(sDrive) + CString(sDir);
		strConfigName = CString(sDrive) + CString(sDir) + CString(sFname) + CString(_T(".ini"));

		CONFIG config;
		COptionDlg::GetConfig(config, strConfigName);

		if (config.bPdbAutoCommit &&
			-1 != config.strCommitList.Find(strBuildName + '#'))
		{
			CString strPdbPath, strOutputDir, strReg, strOutPut, strOutData, strData;
			const TCHAR sReg[] = _T("IF[ ]+\"\\$\\(CFG\\)\" == \"%s\"([^!]+)");
			const TCHAR sRegOutputDir[] = _T("^.+PROP Output_Dir[ ]+\"(.+)\"$");
			const TCHAR sRegPdbPath[] = _T("^# ADD LINK32(?:.+/pdb:\"(?<PDB>[^\"]+)\".+/debug)|(?:.+(?<PDB>/debug))");
			const TCHAR sRegOutPut[] = _T("^# ADD LINK32(?:.+/out:\"(?<OUT>[^\"]+)\")");

			strReg.Format(sReg, strBuildName);

			// Get PDB File Path
			GetFileData(strProjectFullName, strOutData);
			if (strOutData.IsEmpty())
			{
				return S_OK;
			}
			strData = GetRegexpData(strOutData, strReg, MULTILINE | IGNORECASE);
			strOutputDir = GetRegexpData(strData, sRegOutputDir, MULTILINE | IGNORECASE);
			strPdbPath = GetRegexpData(strData, sRegPdbPath, MULTILINE | IGNORECASE, "PDB");
			strOutPut = GetRegexpData(strData, sRegOutPut, MULTILINE | IGNORECASE, "OUT");
			if (strPdbPath.IsEmpty())
			{
				pApplication->PrintToOutputWindow(CComBSTR("Not Find Pdb File Path So Can't Auto Commit PDB\r\n"));
				return S_OK;
			}
			if (!strPdbPath.CompareNoCase(_T("/debug")))
			{
				if (strOutPut.IsEmpty())
				{
					strPdbPath = strOutputDir + '\\' + strProjectName + ".pdb";
				}
				else
				{
					TCHAR ssFname[_MAX_FNAME] = {0};

					_tsplitpath(strOutPut, NULL, NULL, ssFname, NULL);
					strPdbPath = strOutputDir + '\\' + ssFname + ".pdb";
				}
			}

			// Commit PDB File To Server
			MANUALBACKUP ManualBackup = {0};
			ManualBackup.dwMaxSingleFileSize = -1;
			ManualBackup.dwUserData = (DWORD)m_pCommands;
			ManualBackup.pfnCallBackProc = ManualCallBackProc;
			strcpy(ManualBackup.szExtName, "*.pdb");
			ManualBackup.pFileName = new ANSIPATH[1];
			strcpy(ManualBackup.pFileName[0], strProjectPath + strPdbPath);
			ManualBackup.uFileCount = 1;
			strcpy(ManualBackup.szServerIP, config.strPdbServer);
			strcpy(ManualBackup.szReason, _T("PDB:"));
			ManualBackupToServer(&ManualBackup);
			delete []ManualBackup.pFileName;
		}
	}
	return S_OK;
}