![]() |
GDevelop JS Platform
Platform for developing HTML5/Javascript based games with GDevelop
|
Export a project or a layout to a playable HTML5/Javascript based game. More...
#include <ExporterHelper.h>
Public Member Functions | |
| ExporterHelper (gd::AbstractFileSystem &fileSystem, gd::String gdjsRoot_, gd::String codeOutputDir) | |
| const gd::String & | GetLastError () const |
| Return the error that occurred during the last export. | |
| void | AddLibsInclude (bool pixiRenderers, bool pixiInThreeRenderers, bool isInGameEdition, bool includeWebsocketDebuggerClient, bool includeWindowMessageDebuggerClient, bool includeMinimalDebuggerClient, bool includeCaptureManager, bool includeInAppTutorialMessage, gd::String gdevelopLogoStyle, std::vector< gd::String > &includesFiles) |
| Add libraries files to the list of includes. | |
| void | RemoveIncludes (bool pixiRenderers, std::vector< gd::String > &includesFiles) |
| Remove include files that are Pixi renderers. | |
| bool | ExportIncludesAndLibs (const std::vector< gd::String > &includesFiles, gd::String exportDir, bool exportSourceMaps) |
| Copy all the specified files to the export directory. Relative files are copied from "<GDJS root>/Runtime" directory. More... | |
| bool | ExportScenesEventsCode (const gd::Project &project, gd::String outputDir, std::vector< gd::String > &includesFiles, gd::WholeProjectDiagnosticReport &wholeProjectDiagnosticReport, bool exportForPreview) |
| Generate the events JS code, and save them to the export directory. More... | |
| bool | ExportEffectIncludes (gd::Project &project, std::vector< gd::String > &includesFiles) |
| Add the project effects include files. | |
| bool | ExportIndexFile (const gd::Project &project, gd::String source, gd::String exportDir, const std::vector< gd::String > &includesFiles, const std::vector< gd::SourceFileMetadata > &sourceFiles, unsigned int nonRuntimeScriptsCacheBurst, gd::String additionalSpec="") |
| Generate the standard index file and save it to the export directory. More... | |
| bool | CompleteIndexFile (gd::String &indexFileContent, gd::String exportDir, const std::vector< gd::String > &includesFiles, unsigned int nonRuntimeScriptsCacheBurst, gd::String additionalSpec) |
| Replace the annotations in a index.html file by the specified content. More... | |
| const gd::String | GenerateWebManifest (const gd::Project &project) |
| Generates a WebManifest, a metadata file that allow to make the exported game a working PWA. More... | |
| bool | ExportCordovaFiles (const gd::Project &project, gd::String exportDir, std::set< gd::String > usedExtensions) |
| Generate the Cordova configuration file and save it to the export directory. More... | |
| bool | ExportElectronFiles (const gd::Project &project, gd::String exportDir, std::set< gd::String > usedExtensions) |
| Generate the Electron files for packaging and save it to the export directory. More... | |
| bool | ExportBuildResourcesElectronFiles (const gd::Project &project, gd::String exportDir) |
| Generate the Build Resources files for Electron (mainly for the icons) for packaging and save it to the export directory. More... | |
| bool | ExportFacebookInstantGamesFiles (const gd::Project &project, gd::String exportDir) |
| Generate the Facebook Instant Games files for packaging and save it to the export directory. More... | |
| bool | ExportHtml5Files (const gd::Project &project, gd::String exportDir) |
| Generate any HTML5 specific file. More... | |
| bool | ExportProjectForPixiPreview (const PreviewExportOptions &options, std::vector< gd::String > &includesFiles) |
| Create a preview for the specified options. More... | |
| void | SetCodeOutputDirectory (gd::String codeOutputDir_) |
| Change the directory where code files are generated. More... | |
Static Public Member Functions | |
| static gd::String | ExportProjectData (gd::AbstractFileSystem &fs, gd::Project &project, gd::String filename, const gd::SerializerElement &runtimeGameOptions, bool isInGameEdition, const std::vector< gd::InGameEditorResourceMetadata > &inGameEditorResources) |
| Export a project without its events and options to 2 JS variables. More... | |
| static void | SerializeProjectData (gd::AbstractFileSystem &fs, const gd::Project &project, const PreviewExportOptions &options, gd::SerializerElement &projectDataElement, const std::vector< gd::InGameEditorResourceMetadata > &inGameEditorResources) |
| Serialize a project without its events to JSON. More... | |
| static void | SerializeRuntimeGameOptions (gd::AbstractFileSystem &fs, const gd::String &gdjsRoot, const PreviewExportOptions &options, std::vector< gd::String > &includesFiles, gd::SerializerElement &runtimeGameOptionsElement) |
| Serialize the content of the extra configuration to store in gdjs.runtimeGameOptions to JSON. More... | |
| static void | ExportResources (gd::AbstractFileSystem &fs, gd::Project &project, gd::String exportDir) |
| Copy all the resources of the project to to the export directory, updating the resources filenames. More... | |
| static gd::String | GetExportedIncludeFilename (gd::AbstractFileSystem &fs, const gd::String &gdjsRoot, const gd::String &include, unsigned int nonRuntimeScriptsCacheBurst=0) |
| Given an include file, returns the name of the file to reference in the exported game. More... | |
| static void | AddDeprecatedFontFilesToFontResources (gd::AbstractFileSystem &fs, gd::ResourcesContainer &resourcesManager, const gd::String &exportDir, gd::String urlPrefix="") |
Public Attributes | |
| gd::AbstractFileSystem & | fs |
| The abstract file system to be used for exportation. | |
| gd::String | lastError |
| The last error that occurred. | |
| gd::String | gdjsRoot |
| The root directory of GDJS, used to copy runtime files. | |
| gd::String | codeOutputDir |
Export a project or a layout to a playable HTML5/Javascript based game.
| bool gdjs::ExporterHelper::CompleteIndexFile | ( | gd::String & | indexFileContent, |
| gd::String | exportDir, | ||
| const std::vector< gd::String > & | includesFiles, | ||
| unsigned int | nonRuntimeScriptsCacheBurst, | ||
| gd::String | additionalSpec | ||
| ) |
Replace the annotations in a index.html file by the specified content.
| indexFileContent | The source of the index.html file. |
| exportDir | The directory where the project must be generated. |
| includesFiles | "<!--GDJS_CODE_FILES -->" will be replaced by HTML tags to include the filenames contained inside the vector. |
| nonRuntimeScriptsCacheBurst | If non zero, add an additional cache bursting parameter to scripts, that are not part of the runtime/extensions, to force the browser to reload them. |
| additionalSpec | The string "GDJS_ADDITIONAL_SPEC" surrounded by comments marks will be replaced by the content of this string. |
| bool gdjs::ExporterHelper::ExportBuildResourcesElectronFiles | ( | const gd::Project & | project, |
| gd::String | exportDir | ||
| ) |
Generate the Build Resources files for Electron (mainly for the icons) for packaging and save it to the export directory.
| project | The original (non modified) project to be used. |
| exportDir | The directory where the files must be created. |
| bool gdjs::ExporterHelper::ExportCordovaFiles | ( | const gd::Project & | project, |
| gd::String | exportDir, | ||
| std::set< gd::String > | usedExtensions | ||
| ) |
Generate the Cordova configuration file and save it to the export directory.
| project | The project to be used to generate the configuration file. |
| exportDir | The directory where the config.xml must be created. |
| bool gdjs::ExporterHelper::ExportElectronFiles | ( | const gd::Project & | project, |
| gd::String | exportDir, | ||
| std::set< gd::String > | usedExtensions | ||
| ) |
Generate the Electron files for packaging and save it to the export directory.
| project | The project to be used to generate the files. |
| exportDir | The directory where the files must be created. |
| bool gdjs::ExporterHelper::ExportFacebookInstantGamesFiles | ( | const gd::Project & | project, |
| gd::String | exportDir | ||
| ) |
Generate the Facebook Instant Games files for packaging and save it to the export directory.
| project | The project to be used to generate the files. |
| exportDir | The directory where the files must be created. |
| bool gdjs::ExporterHelper::ExportHtml5Files | ( | const gd::Project & | project, |
| gd::String | exportDir | ||
| ) |
Generate any HTML5 specific file.
| project | The project to be used to generate the files. |
| exportDir | The directory where the files must be created. |
| bool gdjs::ExporterHelper::ExportIncludesAndLibs | ( | const std::vector< gd::String > & | includesFiles, |
| gd::String | exportDir, | ||
| bool | exportSourceMaps | ||
| ) |
Copy all the specified files to the export directory. Relative files are copied from "<GDJS root>/Runtime" directory.
| includesFiles | A vector with filenames to be copied. |
| exportDir | The directory where the files must be copied. |
| exportSourceMaps | Should the source maps be copied? Should be true on previews only. |
| bool gdjs::ExporterHelper::ExportIndexFile | ( | const gd::Project & | project, |
| gd::String | source, | ||
| gd::String | exportDir, | ||
| const std::vector< gd::String > & | includesFiles, | ||
| const std::vector< gd::SourceFileMetadata > & | sourceFiles, | ||
| unsigned int | nonRuntimeScriptsCacheBurst, | ||
| gd::String | additionalSpec = "" |
||
| ) |
Generate the standard index file and save it to the export directory.
The includes files must be relative to the export directory.
| project | The project with layouts to be exported. |
| source | The file to be used as a template for the final file. |
| exportDir | The directory where the preview must be created. |
| includesFiles | The JS files to be included in the HTML file. Order is important. |
| nonRuntimeScriptsCacheBurst | If non zero, add an additional cache bursting parameter to scripts, that are not part of the runtime/extensions, to force the browser to reload them. |
| additionalSpec | JSON string that will be passed to the gdjs.RuntimeGame object. |
|
static |
Export a project without its events and options to 2 JS variables.
| fs | The abstract file system to use to write the file |
| project | The project to be exported. |
| filename | The filename where export the project |
| runtimeGameOptions | The content of the extra configuration to store in gdjs.runtimeGameOptions |
| bool gdjs::ExporterHelper::ExportProjectForPixiPreview | ( | const PreviewExportOptions & | options, |
| std::vector< gd::String > & | includesFiles | ||
| ) |
Create a preview for the specified options.
| options | The options to generate the preview. |
| includesFiles | The list of scripts files - useful for hot-reloading |
|
static |
Copy all the resources of the project to to the export directory, updating the resources filenames.
| fs | The abstract file system to use |
| project | The project with resources to be exported. |
| exportDir | The directory where the preview must be created. |
| progressDlg | Optional wxProgressDialog which will be updated with the progress. |
| bool gdjs::ExporterHelper::ExportScenesEventsCode | ( | const gd::Project & | project, |
| gd::String | outputDir, | ||
| std::vector< gd::String > & | includesFiles, | ||
| gd::WholeProjectDiagnosticReport & | wholeProjectDiagnosticReport, | ||
| bool | exportForPreview | ||
| ) |
Generate the events JS code, and save them to the export directory.
Files are named "codeX.js", X being the number of the layout in the project.
| project | The project with resources to be exported. |
| outputDir | The directory where the events code must be generated. |
| includesFiles | A reference to a vector that will be filled with JS files to be exported along with the project. ( including "codeX.js" files ). |
| const gd::String gdjs::ExporterHelper::GenerateWebManifest | ( | const gd::Project & | project | ) |
Generates a WebManifest, a metadata file that allow to make the exported game a working PWA.
| project | The project containing the game properties to generate the manifest from. |
|
static |
Given an include file, returns the name of the file to reference in the exported game.
| fs | The abstract file system to use |
| gdjsRoot | The root directory of GDJS, used to copy runtime files. |
|
static |
Serialize a project without its events to JSON.
| fs | The abstract file system to use to write the file |
| project | The project to be exported. |
| options | The content of the extra configuration |
| projectDataElement | The element where the project data is serialized |
| inGameEditorResources | The list of in-game editor resources to be used. |
|
static |
Serialize the content of the extra configuration to store in gdjs.runtimeGameOptions to JSON.
| fs | The abstract file system to use to write the file |
| gdjsRoot | The root directory of GDJS, used to copy runtime files. |
| options | The content of the extra configuration |
| includesFiles | The list of scripts files - useful for hot-reloading |
| runtimeGameOptionsElement | The element where the game options are serialized |
|
inline |
Change the directory where code files are generated.
By default, this is set to a temporary directory.
| gd::String gdjs::ExporterHelper::codeOutputDir |
The directory where JS code is outputted. Will be then copied to the final output directory.