//----------------------------------------------------------------------------- //! //----------------------------------------------------------------------------- tTripTabPage::tTripTabPage( tLogType type, int logNumber, int numKeys, QWidget *pParent ) : QWidget( pParent ), m_NumKeys( numKeys ), m_InstanceId( logNumber ), m_eLogType( type ) { m_ResetOptionLookup.clear(); m_ResetOptionLookup.insert( eTripItem_Time, tr( "Time" ) ); m_ResetOptionLookup.insert( eTripItem_Distance, tr( "Distance" ) ); m_ResetOptionLookup.insert( eTripItem_WaterDistance, tr( "Water Distance" ) ); m_ResetOptionLookup.insert( eTripItem_AverageSpeed, tr( "Average Speed" ) ); m_ResetOptionLookup.insert( eTripItem_MaximumSpeed, tr( "Maximum Speed" ) ); m_ResetOptionLookup.insert( eTripItem_All, tr( "All" ) ); GenerateLayout(); GenerateSoftkeys(); }
// Generates the character and texture data for the layer. bool FontFaceLayer::Initialise(const FontFaceHandle* _handle, FontEffect* _effect, const FontFaceLayer* clone, bool deep_clone) { handle = _handle; effect = _effect; if (effect != NULL) { effect->AddReference(); colour = effect->GetColour(); } const FontGlyphList& glyphs = handle->GetGlyphs(); // Clone the geometry and textures from the clone layer. if (clone != NULL) { // Copy the cloned layer's characters. size_t character_count = clone->characters.size(); characters.resize(character_count, NULL); for (size_t i = 0; i < character_count; ++i) { const Character* clone_character = clone->characters[i]; if (clone_character) characters[i] = new Character(*clone_character); } // Copy (and reference) the cloned layer's textures. for (size_t i = 0; i < clone->textures.size(); ++i) textures.push_back(new Texture(*clone->textures[i])); // Request the effect (if we have one) adjust the origins as appropriate. if (!deep_clone && effect != NULL) { for (FontGlyphList::const_iterator i = glyphs.begin(); i != glyphs.end(); ++i) { const FontGlyph* glyph = *i; if (!glyph) continue; if (glyph->character >= character_count) continue; Character* character = characters[glyph->character]; ROCKET_ASSERT(character); Vector2i glyph_origin(Math::RealToInteger(character->origin.x), Math::RealToInteger(character->origin.y)); Vector2i glyph_dimensions(Math::RealToInteger(character->dimensions.x), Math::RealToInteger(character->dimensions.y)); if (effect->GetGlyphMetrics(glyph_origin, glyph_dimensions, *glyph)) { character->origin.x = (float) glyph_origin.x; character->origin.y = (float) glyph_origin.y; } else character->texture_index = -1; } } } else { // Initialise the texture layout for the glyphs. characters.resize(glyphs.size(), NULL); for (FontGlyphList::const_iterator i = glyphs.begin(); i != glyphs.end(); ++i) { const FontGlyph* glyph = *i; if (!glyph) continue; GenerateCharacter(*glyph); } if (!GenerateLayout()) return false; } return true; }
FMetalVertexDeclaration::FMetalVertexDeclaration(const FVertexDeclarationElementList& InElements) : Elements(InElements) , Layout(nil) { GenerateLayout(InElements); }
void CExport::DoExport(bool previewMode, const CString& pathName, bool bApp, int layoutid) { // Progress dialog is going from 10% to 100% in this function // Make the DLL list CList<CString, CString&> dllList; CPath path; path.SetToCurrentDirectory(); // Allocate some initial space for the binary blocks imageBlock.allocate(20000); // 20kb initial image buffer eventBlock.allocate(5000); // 5kb initial event buffer LayoutBlock.allocate(5000); // 5kb initial frame buffer appBlock.allocate(1000); // 1kb initial app buffer hlslBlock.allocate(5000); // 5kb initial hlsl buffer menuBlock.allocate(1000); // Generate GenerateLayout(dllList); // also loads DLLs to dllList ProgressDlg.SetProgress(15); GenerateEvents(); ProgressDlg.SetProgress(20); GenerateApplicationData(layoutid); ProgressDlg.SetProgress(25); GenerateImages(); // Longest job, use 25-80% ProgressDlg.SetProgress(80); // Open the file for addition of file data in resource m_UpdateHandle = BeginUpdateResource(pathName, FALSE); // Do python GeneratePython(); // HLSL UpdateResource(m_UpdateHandle, "HLSL", MAKEINTRESOURCE(994), MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), hlslBlock.ptr(), hlslBlock.size()); ProgressDlg.SetProgress(81); // Images UpdateResource(m_UpdateHandle, "IMAGEBLOCK", MAKEINTRESOURCE(995), MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), imageBlock.ptr(), imageBlock.size()); ProgressDlg.SetProgress(82); // Application settings UpdateResource(m_UpdateHandle, "APPBLOCK", MAKEINTRESOURCE(997), MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), appBlock.ptr(), appBlock.size()); ProgressDlg.SetProgress(83); // Layouts UpdateResource(m_UpdateHandle, "LEVELBLOCK", MAKEINTRESOURCE(998), MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), LayoutBlock.ptr(), LayoutBlock.size()); ProgressDlg.SetProgress(84); // Events UpdateResource(m_UpdateHandle, "EVENTBLOCK", MAKEINTRESOURCE(999), MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), eventBlock.ptr(), eventBlock.size()); ProgressDlg.SetProgress(85); // Number of DLLs long c = dllList.GetCount(); CString ibuf; long te = c; te += MvtLookup.size(); ibuf.Format("%d", te); int ilen = 0; // Make string of DLL count in to resource string format wchar_t* resString = AllocStringResourceFormat(ibuf, 1, &ilen); // String of DLL count is a string at resource 1 UpdateResource(m_UpdateHandle, RT_STRING, MAKEINTRESOURCE(1), MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), resString, ilen); // AllocStringResourceFormat makes a new string delete [] resString; CString dll; POSITION pos4 = dllList.GetHeadPosition(); int d = 0; for (d = 1000; d < (1000 + c); d++) { // In preview mode, we only put the string of the plugin name in the resources if (previewMode) { dll = dllList.GetNext(pos4); ilen = 0; // Make string of DLL count in to resource string format wchar_t* resString = AllocStringResourceFormat(dll, 1, &ilen); UpdateResource(m_UpdateHandle, RT_STRING, MAKEINTRESOURCE(d), MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), resString, ilen); delete [] resString; } // In export EXE mode, the actual DLL file must be dumped in resources else { CString dllPath; dllPath.Format("%sPlugins\\Runtime\\%s", path.GetFullPath(), dllList.GetNext(pos4)); // Get the DLL file binary FILE* f = fopen(dllPath, "rb"); fseek(f, 0, SEEK_END); int fsize = ftell(f); fseek(f, 0, SEEK_SET); BYTE* fdata = new BYTE[fsize]; fread(fdata, 1, fsize, f); fclose(f); UpdateResource(m_UpdateHandle, "DLLBLOCK", MAKEINTRESOURCE(d), MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), fdata, fsize); delete [] fdata; } }//for ProgressDlg.SetProgress(88); // Behavior DLLs are added afterwards int iter = 0; for (int Mvt = d; Mvt < (d + MvtLookup.size()); Mvt++) { if (previewMode) { dll = MvtLookup[iter].Name; ilen = 0; // Make string of DLL count in to resource string format wchar_t* resString = AllocStringResourceFormat(dll, 1, &ilen); UpdateResource(m_UpdateHandle, RT_STRING, MAKEINTRESOURCE(Mvt), MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), resString, ilen); delete [] resString; iter++; } // In EXE mode export actual DLL file else { CString dllPath; dllPath.Format("%sPlugins\\Runtime\\%s", path.GetFullPath(), MvtLookup[iter].Name); // Get the DLL file binary FILE* f = fopen(dllPath, "rb"); fseek(f, 0, SEEK_END); int fsize = ftell(f); fseek(f, 0, SEEK_SET); BYTE* fdata = new BYTE[fsize]; fread(fdata, 1, fsize, f); fclose(f); UpdateResource(m_UpdateHandle, "DLLBLOCK", MAKEINTRESOURCE(Mvt), MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), fdata, fsize); delete [] fdata; iter++; } }//for ProgressDlg.SetProgress(90); ExportResources(previewMode); ProgressDlg.SetProgress(99); UpdateResource(m_UpdateHandle, "MENUBLOCK", MAKEINTRESOURCE(993), MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), menuBlock.ptr(), menuBlock.size()); // Write DLL segment EndUpdateResource(m_UpdateHandle, FALSE); // Free the bin data imageBlock.free(); eventBlock.free(); appBlock.free(); LayoutBlock.free(); hlslBlock.free(); menuBlock.free(); if (m_bInstaller) { // Now create an installer if necessary CreateInstaller(); // Delete the old file DeleteFile(m_Out); // Transfer installer to path CPath Transfer; Transfer.SetPath(m_Out); CopyFile(m_InstallerOut, m_Out, FALSE); } // Now we're done ProgressDlg.SetProgress(100); }