void MainForm::OnAssetImport() { CFileDialog fileDialog( true, "*.*", NULL, 0, "RenderWare stream (*.rws)|*.rws|All Files (*.*)|*.*||", this ); // setup browsing from import directory char currentDir[1024]; GetCurrentDirectory( 1024, currentDir ); std::string initialDir = currentDir; initialDir += "\\res"; fileDialog.m_ofn.lpstrInitialDir = initialDir.c_str(); if( fileDialog.DoModal() == IDOK ) { // back to application current directory SetCurrentDirectory( currentDir ); // destroy previous asset destroyAsset(); // import new asset std::string fileName = fileDialog.GetPathName(); makeEngineCompatiblePath( fileName ); currentAsset = iEngine()->createAsset( engine::atImport, fileName.c_str() ); // preparate preparateAsset(); } }
int WINAPI main (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpszArgument, int nCmdShow) { sk::Konzole iKonzole; // sw::Pozice iPozice {screenX, screenY}; sw::Pozice iPozice {0, 0}; sw::Rozmery iRozmery {windowWidth, windowHeight}; // sw::Okno iOkno(iPozice, iRozmery, "Tree", hThisInstance); //vytvor okno sw::Okno iOkno(iPozice, "Tree", hThisInstance); //vytvor okno // sw::Okno iOkno(sw::Pozice(0.f, screenY), sw::Rozmery(230, 480), "Tree", hThisInstance); //vytvor okno pro acer se::Engine iEngine(&iOkno); iEngine.dejKonzoli(iKonzole); iEngine.priprav(); //vytvori si d3d a z nej g_pd3dDevice a pak geometrii iOkno.ukaz(); while ( iOkno.jeOtevrene() ) { // main loop iEngine.prectiVstupAUpravKameru(); if(!iOkno.postarejSeOZpravy()){ // krizek std::cout << "want to quit by X" << std::endl; iEngine.releaseD3d(); break; } else if(iEngine.prikaz == "odejdi" ){ // prikaz/mys std::cout << "want to quit by command or mouse" << std::endl; break; } iEngine.render3d(); } // system("pause"); return 0; }
void DoChangesL() { auto_ptr<CApp_context> appc(0); appc.reset(CApp_context::NewL(false, _L("unittest_changes"))); auto_ptr<CUTContactEngine> iEngine(CUTContactEngine::NewL()); auto_ptr<CContactIdArray> to_remove( CContactIdArray::NewL() ); TBuf<50> first, last, phoneno; int i; for (i=0; i<NO_OF_CONTACTS_TO_CREATE_1; i++) { first=_L("f"); first.AppendNum(i); last=_L("l"); last.AppendNum(i); phoneno=_L("050"); phoneno.AppendNum(i); TContactItemId id=iEngine->StoreContactL(first, last, phoneno); if (i % 10 == 0) { to_remove->AddL(id); } User::After( 50 ); } for (i=NO_OF_CONTACTS_TO_CREATE_1; i<NO_OF_CONTACTS_TO_CREATE_1+NO_OF_CONTACTS_TO_CREATE_2; i++) { first=_L("f"); first.AppendNum(i); last=_L("l"); last.AppendNum(i); phoneno=_L("050"); phoneno.AppendNum(i); TContactItemId id=iEngine->StoreContactL(first, last, phoneno); if (i % 10 == 0) { to_remove->AddL(id); } User::After( 50*1000 ); } iEngine->PbkEngine().DeleteContactsL( *to_remove ); }
void MainForm::OnAssetOpen() { CFileDialog fileDialog( true, "*.*", NULL, 0, "D3 binary asset (*.ba)|*.ba|DirectX file (*.x)|*.x||", this ); // setup browsing from import directory char currentDir[1024]; GetCurrentDirectory( 1024, currentDir ); std::string initialDir = currentDir; initialDir += "\\res"; fileDialog.m_ofn.lpstrInitialDir = initialDir.c_str(); if( fileDialog.DoModal() == IDOK ) { // back to application current directory SetCurrentDirectory( currentDir ); // destroy previous asset destroyAsset(); // choose asset type engine::AssetType assetType; if( stricmp( fileDialog.GetFileExt(), "ba" ) == 0 ) { assetType = engine::atBinary; } else if( stricmp( fileDialog.GetFileExt(), "x" ) == 0 ) { assetType = engine::atXFile; } else { AfxMessageBox( "Unknown asset type!" ); return; } // open new asset std::string fileName = fileDialog.GetPathName(); makeEngineCompatiblePath( fileName ); currentAsset = iEngine()->createAsset( assetType, fileName.c_str() ); // preparate preparateAsset(); } }
void MainForm::createDefaultStage(void) { defaultBSP = iEngine()->createBSP( "Default scene", Vector3f( -100000, -100000, -100000 ), Vector3f( 100000, 100000, 100000 ) ); engine::ILight* ambientLight = iEngine()->createLight( engine::ltAmbient ); engine::IFrame* ambientLightFrame = iEngine()->createFrame( "ambientLightFrame" ); ambientLight->setFrame( ambientLightFrame ); ambientLight->setDiffuseColor( Vector4f( 0.25f, 0.25f, 0.25f, 1.0f ) ); defaultBSP->add( ambientLight ); engine::ILight* pointLight = iEngine()->createLight( engine::ltPoint ); engine::IFrame* pointLightFrame = iEngine()->createFrame( "pointLightFrame" ); pointLight->setFrame( pointLightFrame ); pointLight->setDiffuseColor( Vector4f( 1, 1, 1, 1 ) ); pointLight->setSpecularColor( Vector4f( 1, 1, 1, 1 ) ); pointLight->setRange( 10000.0f ); pointLight->setAttenuation( Vector3f( 0, 0.001f, 0 ) ); pointLightFrame->translate( Vector3f( 1000,1000,1000 ) ); defaultBSP->add( pointLight ); }
void MainForm::OnAssetSave() { if( !currentAsset ) return; CFileDialog fileDialog( false, "*.ba", NULL, 0, "D3 binary asset (*.ba)|*.ba||", this ); // setup browsing from import directory char currentDir[1024]; GetCurrentDirectory( 1024, currentDir ); std::string initialDir = currentDir; initialDir += "\\res"; fileDialog.m_ofn.lpstrInitialDir = initialDir.c_str(); if( fileDialog.DoModal() == IDOK ) { // back to application current directory SetCurrentDirectory( currentDir ); // create binary asset std::string fileName = fileDialog.GetPathName(); makeEngineCompatiblePath( fileName ); engine::IAsset* binaryAsset = iEngine()->createAsset( engine::atBinary, fileName.c_str() ); // move current asset to binary asset binaryAsset->clear(); binaryAsset->seize( currentAsset ); currentAsset->release(); currentAsset = binaryAsset; // serialize asset currentAsset->serialize(); } }
void DoChanges2L() { auto_ptr<CApp_context> appc(0); appc.reset(CApp_context::NewL(false, _L("unittest_changes"))); auto_ptr<CUTContactEngine> iEngine(CUTContactEngine::NewL()); auto_ptr<CContactIdArray> to_remove( CContactIdArray::NewL() ); // Add and mark all to be removed TBuf<50> first, last, phoneno; int i; for (i=0; i<CONTACTS_CREATED_1; i++) { first=_L("f"); first.AppendNum(i); last=_L("l"); last.AppendNum(i); phoneno=_L("050"); phoneno.AppendNum(i); TContactItemId id=iEngine->StoreContactL(first, last, phoneno); to_remove->AddL(id); User::After( 50 ); } // Add and remove for (i=CONTACTS_CREATED_1; i<CONTACTS_CREATED_1 + CONTACTS_CREATED_2; i++) { first=_L("f"); first.AppendNum(i); last=_L("l"); last.AppendNum(i); phoneno=_L("050"); phoneno.AppendNum(i); TContactItemId id=iEngine->StoreContactL(first, last, phoneno); TInt toBeRemoved = to_remove->Count(); if (toBeRemoved > 0) { TInt lastIx = toBeRemoved - 1; TContactItemId id = (*to_remove)[lastIx]; to_remove->Remove(lastIx); iEngine->PbkEngine().DeleteContactL(id); // Remove last } User::After( 50 ); } }