mirror of
https://github.com/4ian/GDevelop.git
synced 2025-10-15 10:19:04 +00:00
Run clang-format on some missing files
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
namespace gd {
|
||||
class EventsCodeGenerator;
|
||||
class EventsCodeGenerationContext;
|
||||
}
|
||||
} // namespace gd
|
||||
|
||||
/**
|
||||
* \brief Callbacks called to generate the code for getting a variable.
|
||||
|
@@ -11,7 +11,7 @@ class RuntimeScene;
|
||||
namespace gd {
|
||||
class Variable;
|
||||
class String;
|
||||
};
|
||||
}; // namespace gd
|
||||
|
||||
bool GD_API FileExists(const gd::String& file);
|
||||
bool GD_API GroupExists(const gd::String& file, const gd::String& group);
|
||||
|
@@ -62,7 +62,7 @@ file(GLOB_RECURSE f3 GDJS/IDE/Dialogs/*)
|
||||
set(source_files ${source_files} ${f3})
|
||||
ENDIF()
|
||||
|
||||
file(GLOB_RECURSE formatted_source_files GDJS/Events/* GDJS/Extensions/* GDJS/IDE/*.cpp)
|
||||
file(GLOB_RECURSE formatted_source_files GDJS/Events/* GDJS/Extensions/* GDJS/IDE/*)
|
||||
list(REMOVE_ITEM formatted_source_files "${CMAKE_CURRENT_SOURCE_DIR}/GDJS/IDE/Dialogs/GDJSDialogs.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/GDJS/IDE/Dialogs/GDJSDialogs.h" "${CMAKE_CURRENT_SOURCE_DIR}/GDJS/IDE/Dialogs/GDJSDialogsBitmaps.cpp")
|
||||
list(REMOVE_ITEM formatted_source_files "${CMAKE_CURRENT_SOURCE_DIR}/GDJS/IDE/mongoose/mongoose.c" "${CMAKE_CURRENT_SOURCE_DIR}/GDJS/IDE/mongoose/mongoose.h")
|
||||
gd_add_clang_utils(GDJS "${formatted_source_files}")
|
||||
|
@@ -12,7 +12,7 @@
|
||||
namespace gd {
|
||||
class EventsCodeGenerator;
|
||||
class EventsCodeGenerationContext;
|
||||
}
|
||||
} // namespace gd
|
||||
|
||||
namespace gdjs {
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* GDevelop JS Platform
|
||||
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
|
||||
* This project is released under the MIT License.
|
||||
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights
|
||||
* reserved. This project is released under the MIT License.
|
||||
*/
|
||||
#if defined(GD_IDE_ONLY) && !defined(GD_NO_WX_GUI)
|
||||
#ifndef COCOONJSUPLOADDIALOG_H
|
||||
@@ -11,13 +11,13 @@
|
||||
/**
|
||||
* \brief Dialog used to explain how to use CocoonJS.
|
||||
*/
|
||||
class CocoonJSUploadDialog : public BaseCocoonJSUploadDialog
|
||||
{
|
||||
public:
|
||||
CocoonJSUploadDialog(wxWindow* parent, wxString packageLocation);
|
||||
virtual ~CocoonJSUploadDialog();
|
||||
protected:
|
||||
virtual void OnCloseBtClicked(wxCommandEvent& event);
|
||||
class CocoonJSUploadDialog : public BaseCocoonJSUploadDialog {
|
||||
public:
|
||||
CocoonJSUploadDialog(wxWindow* parent, wxString packageLocation);
|
||||
virtual ~CocoonJSUploadDialog();
|
||||
|
||||
protected:
|
||||
virtual void OnCloseBtClicked(wxCommandEvent& event);
|
||||
};
|
||||
#endif // COCOONJSUPLOADDIALOG_H
|
||||
#endif // COCOONJSUPLOADDIALOG_H
|
||||
#endif
|
||||
|
@@ -1,20 +1,20 @@
|
||||
/*
|
||||
* GDevelop JS Platform
|
||||
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
|
||||
* This project is released under the MIT License.
|
||||
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights
|
||||
* reserved. This project is released under the MIT License.
|
||||
*/
|
||||
#if defined(GD_IDE_ONLY) && !defined(GD_NO_WX_GUI)
|
||||
#ifndef CORDOVAPACKAGEDIALOG_H
|
||||
#define CORDOVAPACKAGEDIALOG_H
|
||||
#include "GDJSDialogs.h"
|
||||
|
||||
class CordovaPackageDialog : public BaseCordovaPackageDialog
|
||||
{
|
||||
public:
|
||||
CordovaPackageDialog(wxWindow* parent, wxString packageLocation);
|
||||
virtual ~CordovaPackageDialog();
|
||||
protected:
|
||||
virtual void OnCloseClicked(wxCommandEvent& event);
|
||||
class CordovaPackageDialog : public BaseCordovaPackageDialog {
|
||||
public:
|
||||
CordovaPackageDialog(wxWindow* parent, wxString packageLocation);
|
||||
virtual ~CordovaPackageDialog();
|
||||
|
||||
protected:
|
||||
virtual void OnCloseClicked(wxCommandEvent& event);
|
||||
};
|
||||
#endif // CORDOVAPACKAGEDIALOG_H
|
||||
#endif // CORDOVAPACKAGEDIALOG_H
|
||||
#endif
|
@@ -1,33 +1,40 @@
|
||||
/*
|
||||
* GDevelop JS Platform
|
||||
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
|
||||
* This project is released under the MIT License.
|
||||
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights
|
||||
* reserved. This project is released under the MIT License.
|
||||
*/
|
||||
#if defined(GD_IDE_ONLY) && !defined(GD_NO_WX_GUI)
|
||||
#ifndef JSCODEEVENTDIALOG_H
|
||||
#define JSCODEEVENTDIALOG_H
|
||||
#include "GDJSDialogs.h"
|
||||
namespace gd { class Project; }
|
||||
namespace gd { class Layout; }
|
||||
namespace gdjs { class JsCodeEvent; }
|
||||
namespace gd {
|
||||
class Project;
|
||||
}
|
||||
namespace gd {
|
||||
class Layout;
|
||||
}
|
||||
namespace gdjs {
|
||||
class JsCodeEvent;
|
||||
}
|
||||
|
||||
class JsCodeEventDialog : public BaseJsCodeEventDialog
|
||||
{
|
||||
public:
|
||||
JsCodeEventDialog(wxWindow* parent, gdjs::JsCodeEvent & event_, gd::Project & project_, gd::Layout & layout_);
|
||||
virtual ~JsCodeEventDialog();
|
||||
class JsCodeEventDialog : public BaseJsCodeEventDialog {
|
||||
public:
|
||||
JsCodeEventDialog(wxWindow* parent,
|
||||
gdjs::JsCodeEvent& event_,
|
||||
gd::Project& project_,
|
||||
gd::Layout& layout_);
|
||||
virtual ~JsCodeEventDialog();
|
||||
|
||||
protected:
|
||||
virtual void onCancelBtClick(wxCommandEvent& event);
|
||||
virtual void onHelpBtClick(wxHyperlinkEvent& event);
|
||||
virtual void onObjectsButtonClick(wxCommandEvent& event);
|
||||
virtual void onOkBtClick(wxCommandEvent& event);
|
||||
|
||||
private:
|
||||
gdjs::JsCodeEvent & event;
|
||||
gd::Project & project;
|
||||
gd::Layout & layout;
|
||||
protected:
|
||||
virtual void onCancelBtClick(wxCommandEvent& event);
|
||||
virtual void onHelpBtClick(wxHyperlinkEvent& event);
|
||||
virtual void onObjectsButtonClick(wxCommandEvent& event);
|
||||
virtual void onOkBtClick(wxCommandEvent& event);
|
||||
|
||||
private:
|
||||
gdjs::JsCodeEvent& event;
|
||||
gd::Project& project;
|
||||
gd::Layout& layout;
|
||||
};
|
||||
#endif // JSCODEEVENTDIALOG_H
|
||||
#endif // JSCODEEVENTDIALOG_H
|
||||
#endif
|
||||
|
@@ -1,18 +1,19 @@
|
||||
/*
|
||||
* GDevelop JS Platform
|
||||
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
|
||||
* This project is released under the MIT License.
|
||||
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights
|
||||
* reserved. This project is released under the MIT License.
|
||||
*/
|
||||
#if defined(GD_IDE_ONLY) && !defined(GD_NO_WX_GUI)
|
||||
#ifndef PROJECTEXPORTDIALOG_H
|
||||
#define PROJECTEXPORTDIALOG_H
|
||||
#include "GDJSDialogs.h"
|
||||
#include "GDCore/CommonTools.h"
|
||||
#include "GDCore/String.h"
|
||||
namespace gd { class Project; }
|
||||
#include "GDJSDialogs.h"
|
||||
namespace gd {
|
||||
class Project;
|
||||
}
|
||||
|
||||
namespace gdjs
|
||||
{
|
||||
namespace gdjs {
|
||||
|
||||
/**
|
||||
* \brief Dialogs shown to setup the export of a project.
|
||||
@@ -20,50 +21,44 @@ namespace gdjs
|
||||
*
|
||||
* \see Exporter
|
||||
*/
|
||||
class ProjectExportDialog : public BaseProjectExportDialog
|
||||
{
|
||||
public:
|
||||
ProjectExportDialog(wxWindow* parent, gd::Project & project);
|
||||
virtual ~ProjectExportDialog();
|
||||
class ProjectExportDialog : public BaseProjectExportDialog {
|
||||
public:
|
||||
ProjectExportDialog(wxWindow* parent, gd::Project& project);
|
||||
virtual ~ProjectExportDialog();
|
||||
|
||||
enum ExportType
|
||||
{
|
||||
Pixi,
|
||||
PixiCordova,
|
||||
Cocos2d
|
||||
};
|
||||
enum ExportType { Pixi, PixiCordova, Cocos2d };
|
||||
|
||||
/**
|
||||
* \brief Get the type of the export to be done.
|
||||
*/
|
||||
ExportType GetExportType();
|
||||
/**
|
||||
* \brief Get the type of the export to be done.
|
||||
*/
|
||||
ExportType GetExportType();
|
||||
|
||||
/**
|
||||
* \brief Get the directory where project must be exported.
|
||||
*/
|
||||
gd::String GetExportDir();
|
||||
/**
|
||||
* \brief Get the directory where project must be exported.
|
||||
*/
|
||||
gd::String GetExportDir();
|
||||
|
||||
/**
|
||||
* \brief Check if the user wants to minify the JS files.
|
||||
*/
|
||||
bool RequestMinify();
|
||||
/**
|
||||
* \brief Check if the user wants to minify the JS files.
|
||||
*/
|
||||
bool RequestMinify();
|
||||
|
||||
/**
|
||||
* \brief Check if the export must be done with debug mode activated.
|
||||
*/
|
||||
bool IsDebugMode();
|
||||
/**
|
||||
* \brief Check if the export must be done with debug mode activated.
|
||||
*/
|
||||
bool IsDebugMode();
|
||||
|
||||
protected:
|
||||
virtual void OnCocosExportBrowseBtClick(wxCommandEvent& event);
|
||||
virtual void OnBrowseBtClick(wxCommandEvent& event);
|
||||
virtual void OnCloseBtClicked(wxCommandEvent& event);
|
||||
virtual void OnExportBtClicked(wxCommandEvent& event);
|
||||
protected:
|
||||
virtual void OnCocosExportBrowseBtClick(wxCommandEvent& event);
|
||||
virtual void OnBrowseBtClick(wxCommandEvent& event);
|
||||
virtual void OnCloseBtClicked(wxCommandEvent& event);
|
||||
virtual void OnExportBtClicked(wxCommandEvent& event);
|
||||
|
||||
wxString DeleteInvalidCharacters(const wxString & directoryName) const;
|
||||
gd::Project & project;
|
||||
bool hasNode;
|
||||
wxString DeleteInvalidCharacters(const wxString& directoryName) const;
|
||||
gd::Project& project;
|
||||
bool hasNode;
|
||||
};
|
||||
|
||||
}
|
||||
#endif // PROJECTEXPORTDIALOG_H
|
||||
} // namespace gdjs
|
||||
#endif // PROJECTEXPORTDIALOG_H
|
||||
#endif
|
||||
|
@@ -1,97 +1,120 @@
|
||||
/*
|
||||
* GDevelop JS Platform
|
||||
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
|
||||
* This project is released under the MIT License.
|
||||
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights
|
||||
* reserved. This project is released under the MIT License.
|
||||
*/
|
||||
#ifndef EXPORTER_H
|
||||
#define EXPORTER_H
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "GDCore/IDE/ProjectExporter.h"
|
||||
namespace gd { class Project; }
|
||||
namespace gd { class Layout; }
|
||||
namespace gd { class ExternalLayout; }
|
||||
namespace gd { class AbstractFileSystem; }
|
||||
namespace gd {
|
||||
class Project;
|
||||
}
|
||||
namespace gd {
|
||||
class Layout;
|
||||
}
|
||||
namespace gd {
|
||||
class ExternalLayout;
|
||||
}
|
||||
namespace gd {
|
||||
class AbstractFileSystem;
|
||||
}
|
||||
|
||||
namespace gdjs
|
||||
{
|
||||
namespace gdjs {
|
||||
|
||||
/**
|
||||
* \brief Export a project or a layout to a playable HTML5/Javascript based game.
|
||||
* \brief Export a project or a layout to a playable HTML5/Javascript based
|
||||
* game.
|
||||
*/
|
||||
class Exporter : public gd::ProjectExporter
|
||||
{
|
||||
public:
|
||||
Exporter(gd::AbstractFileSystem & fileSystem, gd::String gdjsRoot_ = "./JsPlatform");
|
||||
virtual ~Exporter();
|
||||
class Exporter : public gd::ProjectExporter {
|
||||
public:
|
||||
Exporter(gd::AbstractFileSystem& fileSystem,
|
||||
gd::String gdjsRoot_ = "./JsPlatform");
|
||||
virtual ~Exporter();
|
||||
|
||||
/**
|
||||
* \brief Show a dialog that will enable the user to export the project.
|
||||
*/
|
||||
virtual void ShowProjectExportDialog(gd::Project & project);
|
||||
/**
|
||||
* \brief Show a dialog that will enable the user to export the project.
|
||||
*/
|
||||
virtual void ShowProjectExportDialog(gd::Project& project);
|
||||
|
||||
/**
|
||||
* \brief Return the label that will be displayed on the button or menu item
|
||||
* allowing the user to export the project for the JS Platform.
|
||||
*/
|
||||
virtual gd::String GetProjectExportButtonLabel();
|
||||
/**
|
||||
* \brief Return the label that will be displayed on the button or menu item
|
||||
* allowing the user to export the project for the JS Platform.
|
||||
*/
|
||||
virtual gd::String GetProjectExportButtonLabel();
|
||||
|
||||
/**
|
||||
* \brief Create a preview for the specified layout.
|
||||
* \note The preview is not launched, it is the caller responsibility to open a browser pointing to the preview.
|
||||
*
|
||||
* \param layout The layout to be previewed.
|
||||
* \param exportDir The directory where the preview must be created.
|
||||
* \return true if export was successful.
|
||||
*/
|
||||
bool ExportLayoutForPixiPreview(gd::Project & project, gd::Layout & layout, gd::String exportDir);
|
||||
/**
|
||||
* \brief Create a preview for the specified layout.
|
||||
* \note The preview is not launched, it is the caller responsibility to open
|
||||
* a browser pointing to the preview.
|
||||
*
|
||||
* \param layout The layout to be previewed.
|
||||
* \param exportDir The directory where the preview must be created.
|
||||
* \return true if export was successful.
|
||||
*/
|
||||
bool ExportLayoutForPixiPreview(gd::Project& project,
|
||||
gd::Layout& layout,
|
||||
gd::String exportDir);
|
||||
|
||||
/**
|
||||
* \brief Create a preview for the specified external layout and layout.
|
||||
* \note The preview is not launched, it is the caller responsibility to open a browser pointing to the preview.
|
||||
*
|
||||
* \param layout The layout to be previewed.
|
||||
* \param externalLayout The external layout with objects to be created at scene startup.
|
||||
* \param exportDir The directory where the preview must be created.
|
||||
* \return true if export was successful.
|
||||
*/
|
||||
bool ExportExternalLayoutForPixiPreview(gd::Project & project, gd::Layout & layout,
|
||||
gd::ExternalLayout & externalLayout, gd::String exportDir);
|
||||
/**
|
||||
* \brief Create a preview for the specified external layout and layout.
|
||||
* \note The preview is not launched, it is the caller responsibility to open
|
||||
* a browser pointing to the preview.
|
||||
*
|
||||
* \param layout The layout to be previewed.
|
||||
* \param externalLayout The external layout with objects to be created at
|
||||
* scene startup. \param exportDir The directory where the preview must be
|
||||
* created. \return true if export was successful.
|
||||
*/
|
||||
bool ExportExternalLayoutForPixiPreview(gd::Project& project,
|
||||
gd::Layout& layout,
|
||||
gd::ExternalLayout& externalLayout,
|
||||
gd::String exportDir);
|
||||
|
||||
/**
|
||||
* \brief Export the specified project, using Pixi.js.
|
||||
*
|
||||
* Called by ShowProjectExportDialog if the user clicked on Ok.
|
||||
*/
|
||||
bool ExportWholePixiProject(gd::Project & project, gd::String exportDir,
|
||||
bool minify, bool exportForCordova);
|
||||
/**
|
||||
* \brief Export the specified project, using Pixi.js.
|
||||
*
|
||||
* Called by ShowProjectExportDialog if the user clicked on Ok.
|
||||
*/
|
||||
bool ExportWholePixiProject(gd::Project& project,
|
||||
gd::String exportDir,
|
||||
bool minify,
|
||||
bool exportForCordova);
|
||||
|
||||
/**
|
||||
* \brief Export the specified project, using Cocos2d.
|
||||
*
|
||||
* Called by ShowProjectExportDialog if the user clicked on Ok.
|
||||
*/
|
||||
bool ExportWholeCocos2dProject(gd::Project & project, bool debugMode, gd::String exportDir);
|
||||
/**
|
||||
* \brief Export the specified project, using Cocos2d.
|
||||
*
|
||||
* Called by ShowProjectExportDialog if the user clicked on Ok.
|
||||
*/
|
||||
bool ExportWholeCocos2dProject(gd::Project& project,
|
||||
bool debugMode,
|
||||
gd::String exportDir);
|
||||
|
||||
/**
|
||||
* \brief Return the error that occurred during the last export.
|
||||
*/
|
||||
const gd::String & GetLastError() const { return lastError; };
|
||||
/**
|
||||
* \brief Return the error that occurred during the last export.
|
||||
*/
|
||||
const gd::String& GetLastError() const { return lastError; };
|
||||
|
||||
/**
|
||||
* \brief Change the directory where code files are generated.
|
||||
*
|
||||
* By default, this is set to a temporary directory.
|
||||
*/
|
||||
void SetCodeOutputDirectory(gd::String codeOutputDir_) { codeOutputDir = codeOutputDir_; }
|
||||
/**
|
||||
* \brief Change the directory where code files are generated.
|
||||
*
|
||||
* By default, this is set to a temporary directory.
|
||||
*/
|
||||
void SetCodeOutputDirectory(gd::String codeOutputDir_) {
|
||||
codeOutputDir = codeOutputDir_;
|
||||
}
|
||||
|
||||
private:
|
||||
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; ///< The directory where JS code is outputted. Will be then copied to the final output directory.
|
||||
private:
|
||||
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; ///< The directory where JS code is outputted. Will
|
||||
///< be then copied to the final output directory.
|
||||
};
|
||||
|
||||
}
|
||||
#endif // EXPORTER_H
|
||||
} // namespace gdjs
|
||||
#endif // EXPORTER_H
|
||||
|
@@ -1,175 +1,235 @@
|
||||
/*
|
||||
* GDevelop JS Platform
|
||||
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
|
||||
* This project is released under the MIT License.
|
||||
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights
|
||||
* reserved. This project is released under the MIT License.
|
||||
*/
|
||||
#ifndef EXPORTER_HELPER_H
|
||||
#define EXPORTER_HELPER_H
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "GDCore/IDE/ProjectExporter.h"
|
||||
namespace gd { class Project; }
|
||||
namespace gd { class Layout; }
|
||||
namespace gd { class ExternalLayout; }
|
||||
namespace gd { class AbstractFileSystem; }
|
||||
namespace gd {
|
||||
class Project;
|
||||
}
|
||||
namespace gd {
|
||||
class Layout;
|
||||
}
|
||||
namespace gd {
|
||||
class ExternalLayout;
|
||||
}
|
||||
namespace gd {
|
||||
class AbstractFileSystem;
|
||||
}
|
||||
class wxProgressDialog;
|
||||
|
||||
namespace gdjs
|
||||
{
|
||||
namespace gdjs {
|
||||
|
||||
/**
|
||||
* \brief Export a project or a layout to a playable HTML5/Javascript based game.
|
||||
* \brief Export a project or a layout to a playable HTML5/Javascript based
|
||||
* game.
|
||||
*/
|
||||
class ExporterHelper
|
||||
{
|
||||
public:
|
||||
ExporterHelper(gd::AbstractFileSystem & fileSystem, gd::String gdjsRoot_, gd::String codeOutputDir);
|
||||
virtual ~ExporterHelper() {};
|
||||
class ExporterHelper {
|
||||
public:
|
||||
ExporterHelper(gd::AbstractFileSystem &fileSystem,
|
||||
gd::String gdjsRoot_,
|
||||
gd::String codeOutputDir);
|
||||
virtual ~ExporterHelper(){};
|
||||
|
||||
/**
|
||||
* \brief Return the error that occurred during the last export.
|
||||
*/
|
||||
const gd::String & GetLastError() const { return lastError; };
|
||||
/**
|
||||
* \brief Return the error that occurred during the last export.
|
||||
*/
|
||||
const gd::String &GetLastError() const { return lastError; };
|
||||
|
||||
#if !defined(GD_NO_WX_GUI)
|
||||
/**
|
||||
* \brief Try to locate the Node.js executable. (Node must be installed in a standard folder).
|
||||
* \return An empty string if not found, a full path to the node executable otherwise.
|
||||
*/
|
||||
static gd::String GetNodeExecutablePath();
|
||||
#endif
|
||||
#if !defined(GD_NO_WX_GUI)
|
||||
/**
|
||||
* \brief Try to locate the Node.js executable. (Node must be installed in a
|
||||
* standard folder). \return An empty string if not found, a full path to the
|
||||
* node executable otherwise.
|
||||
*/
|
||||
static gd::String GetNodeExecutablePath();
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief Export a project to JSON
|
||||
*
|
||||
* \param fs The abstract file system to use to write the file
|
||||
* \param project The project to be exported.
|
||||
* \param filename The filename where export the project
|
||||
* \param wrapIntoVariable If not empty, the resulting json will be wrapped in this javascript
|
||||
* variable allowing to use it as a classical javascript object.
|
||||
* \return Empty string if everthing is ok, description of the error otherwise.
|
||||
*/
|
||||
static gd::String ExportToJSON(gd::AbstractFileSystem &fs, const gd::Project &project, gd::String filename,
|
||||
gd::String wrapIntoVariable);
|
||||
/**
|
||||
* \brief Export a project to JSON
|
||||
*
|
||||
* \param fs The abstract file system to use to write the file
|
||||
* \param project The project to be exported.
|
||||
* \param filename The filename where export the project
|
||||
* \param wrapIntoVariable If not empty, the resulting json will be wrapped in
|
||||
* this javascript variable allowing to use it as a classical javascript
|
||||
* object. \return Empty string if everthing is ok, description of the error
|
||||
* otherwise.
|
||||
*/
|
||||
static gd::String ExportToJSON(gd::AbstractFileSystem &fs,
|
||||
const gd::Project &project,
|
||||
gd::String filename,
|
||||
gd::String wrapIntoVariable);
|
||||
|
||||
/**
|
||||
* \brief Copy all the resources of the project to to the export directory, updating the resources filenames.
|
||||
*
|
||||
* \param fs The abstract file system to use
|
||||
* \param project The project with resources to be exported.
|
||||
* \param exportDir The directory where the preview must be created.
|
||||
* \param progressDlg Optional wxProgressDialog which will be updated with the progress.
|
||||
*/
|
||||
static void ExportResources(gd::AbstractFileSystem & fs, gd::Project & project, gd::String exportDir,
|
||||
wxProgressDialog * progressDlg = NULL);
|
||||
/**
|
||||
* \brief Copy all the resources of the project to to the export directory,
|
||||
* updating the resources filenames.
|
||||
*
|
||||
* \param fs The abstract file system to use
|
||||
* \param project The project with resources to be exported.
|
||||
* \param exportDir The directory where the preview must be created.
|
||||
* \param progressDlg Optional wxProgressDialog which will be updated with the
|
||||
* progress.
|
||||
*/
|
||||
static void ExportResources(gd::AbstractFileSystem &fs,
|
||||
gd::Project &project,
|
||||
gd::String exportDir,
|
||||
wxProgressDialog *progressDlg = NULL);
|
||||
|
||||
/**
|
||||
* \brief Add libraries files from Pixi.js or Cocos2d to the list of includes.
|
||||
*/
|
||||
void AddLibsInclude(bool pixiRenderers, bool cocosRenderers, bool websocketDebuggerClient, std::vector<gd::String> & includesFiles);
|
||||
/**
|
||||
* \brief Add libraries files from Pixi.js or Cocos2d to the list of includes.
|
||||
*/
|
||||
void AddLibsInclude(bool pixiRenderers,
|
||||
bool cocosRenderers,
|
||||
bool websocketDebuggerClient,
|
||||
std::vector<gd::String> &includesFiles);
|
||||
|
||||
/**
|
||||
* \brief Remove include files that are Pixi or Cocos2d renderers.
|
||||
*/
|
||||
void RemoveIncludes(bool pixiRenderers, bool cocosRenderers, std::vector<gd::String> & includesFiles);
|
||||
/**
|
||||
* \brief Remove include files that are Pixi or Cocos2d renderers.
|
||||
*/
|
||||
void RemoveIncludes(bool pixiRenderers,
|
||||
bool cocosRenderers,
|
||||
std::vector<gd::String> &includesFiles);
|
||||
|
||||
/**
|
||||
* \brief Copy all the includes files and the standard libraries files to the export directory.
|
||||
*
|
||||
* The includes files are also modified so as to be relative to the export directory
|
||||
* ( Files with absolute filenames are copied into the export directory and their path are stripped ).
|
||||
*
|
||||
* \param includesFiles A vector with filenames to be copied.
|
||||
* \param exportDir The directory where the preview must be created.
|
||||
* \param minify If true, the includes files must be merged into one file using Google Closure Compiler.
|
||||
* ( includesFiles parameter will be updated with the new filename )
|
||||
*/
|
||||
bool ExportIncludesAndLibs(std::vector<gd::String> & includesFiles, gd::String exportDir, bool minify);
|
||||
/**
|
||||
* \brief Copy all the includes files and the standard libraries files to the
|
||||
* export directory.
|
||||
*
|
||||
* The includes files are also modified so as to be relative to the export
|
||||
* directory ( Files with absolute filenames are copied into the export
|
||||
* directory and their path are stripped ).
|
||||
*
|
||||
* \param includesFiles A vector with filenames to be copied.
|
||||
* \param exportDir The directory where the preview must be created.
|
||||
* \param minify If true, the includes files must be merged into one file
|
||||
* using Google Closure Compiler. ( includesFiles parameter will be updated
|
||||
* with the new filename )
|
||||
*/
|
||||
bool ExportIncludesAndLibs(std::vector<gd::String> &includesFiles,
|
||||
gd::String exportDir,
|
||||
bool minify);
|
||||
|
||||
/**
|
||||
* \brief 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.
|
||||
* \param project The project with resources to be exported.
|
||||
* \param outputDir The directory where the events code must be generated.
|
||||
* \param includesFiles A reference to a vector that will be filled with JS files to be exported along with the project.
|
||||
* ( including "codeX.js" files ).
|
||||
*/
|
||||
bool ExportEventsCode(gd::Project & project, gd::String outputDir, std::vector<gd::String> & includesFiles);
|
||||
/**
|
||||
* \brief 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. \param project The project with resources to be exported. \param
|
||||
* outputDir The directory where the events code must be generated. \param
|
||||
* includesFiles A reference to a vector that will be filled with JS files to
|
||||
* be exported along with the project. ( including "codeX.js" files ).
|
||||
*/
|
||||
bool ExportEventsCode(gd::Project &project,
|
||||
gd::String outputDir,
|
||||
std::vector<gd::String> &includesFiles);
|
||||
|
||||
/**
|
||||
* \brief Copy the external source files used by the game into the export directory, and add them into files
|
||||
* to be included.
|
||||
*
|
||||
* Files are named "ext-codeX.js", X being the index of the external source file in the project.
|
||||
* \param project The project with resources to be exported.
|
||||
* \param outputDir The directory where the events code must be generated.
|
||||
* \param includesFiles A reference to a vector that will be filled with JS files to be exported along with the project.
|
||||
* (including "ext-codeX.js" files).
|
||||
*/
|
||||
bool ExportExternalSourceFiles(gd::Project & project, gd::String outputDir, std::vector<gd::String> & includesFiles);
|
||||
/**
|
||||
* \brief Copy the external source files used by the game into the export
|
||||
* directory, and add them into files to be included.
|
||||
*
|
||||
* Files are named "ext-codeX.js", X being the index of the external source
|
||||
* file in the project. \param project The project with resources to be
|
||||
* exported. \param outputDir The directory where the events code must be
|
||||
* generated. \param includesFiles A reference to a vector that will be filled
|
||||
* with JS files to be exported along with the project. (including
|
||||
* "ext-codeX.js" files).
|
||||
*/
|
||||
bool ExportExternalSourceFiles(gd::Project &project,
|
||||
gd::String outputDir,
|
||||
std::vector<gd::String> &includesFiles);
|
||||
|
||||
/**
|
||||
* \brief Generate the standard index file and save it to the export directory.
|
||||
*
|
||||
* The includes files must be relative to the export directory.
|
||||
*
|
||||
* \param project The project with layouts to be exported.
|
||||
* \param source The file to be used as a template for the final file.
|
||||
* \param exportDir The directory where the preview must be created.
|
||||
* \param includesFiles The JS files to be included in the HTML file. Order is important.
|
||||
* \param additionalSpec JSON string that will be passed to the gdjs.RuntimeGame object.
|
||||
*/
|
||||
bool ExportPixiIndexFile(gd::String source, gd::String exportDir, const std::vector<gd::String> & includesFiles, gd::String additionalSpec = "");
|
||||
/**
|
||||
* \brief Generate the standard index file and save it to the export
|
||||
* directory.
|
||||
*
|
||||
* The includes files must be relative to the export directory.
|
||||
*
|
||||
* \param project The project with layouts to be exported.
|
||||
* \param source The file to be used as a template for the final file.
|
||||
* \param exportDir The directory where the preview must be created.
|
||||
* \param includesFiles The JS files to be included in the HTML file. Order is
|
||||
* important. \param additionalSpec JSON string that will be passed to the
|
||||
* gdjs.RuntimeGame object.
|
||||
*/
|
||||
bool ExportPixiIndexFile(gd::String source,
|
||||
gd::String exportDir,
|
||||
const std::vector<gd::String> &includesFiles,
|
||||
gd::String additionalSpec = "");
|
||||
|
||||
/**
|
||||
* \brief Replace the annotations in a index.html file by the specified content.
|
||||
*
|
||||
* \param indexFileContent The source of the index.html file.
|
||||
* \param customCss "<!-- GDJS_CUSTOM_STYLE -->" will be replaced by the content of the string.
|
||||
* \param customHtml "<!-- GDJS_CUSTOM_HTML -->" will be replaced by the content of the string.
|
||||
* \param exportDir The directory where the project must be generated.
|
||||
* \param codeFilesIncludes "<!-- GDJS_CODE_FILES -->" will be replaced by HTML tags to include the filenames contained inside the vector.
|
||||
* \param additionalSpec The string "GDJS_ADDITIONAL_SPEC" surrounded by comments marks will be replaced by the content of the string.
|
||||
*/
|
||||
bool CompleteIndexFile(gd::String & indexFileContent, gd::String customCss, gd::String customHtml, gd::String exportDir, const std::vector<gd::String> & includesFiles, gd::String additionalSpec);
|
||||
/**
|
||||
* \brief Replace the annotations in a index.html file by the specified
|
||||
* content.
|
||||
*
|
||||
* \param indexFileContent The source of the index.html file.
|
||||
* \param customCss "<!-- GDJS_CUSTOM_STYLE -->" will be replaced by the
|
||||
* content of the string. \param customHtml "<!-- GDJS_CUSTOM_HTML -->" will
|
||||
* be replaced by the content of the string. \param exportDir The directory
|
||||
* where the project must be generated. \param codeFilesIncludes "<!--
|
||||
* GDJS_CODE_FILES -->" will be replaced by HTML tags to include the filenames
|
||||
* contained inside the vector. \param additionalSpec The string
|
||||
* "GDJS_ADDITIONAL_SPEC" surrounded by comments marks will be replaced by the
|
||||
* content of the string.
|
||||
*/
|
||||
bool CompleteIndexFile(gd::String &indexFileContent,
|
||||
gd::String customCss,
|
||||
gd::String customHtml,
|
||||
gd::String exportDir,
|
||||
const std::vector<gd::String> &includesFiles,
|
||||
gd::String additionalSpec);
|
||||
|
||||
/**
|
||||
* \brief Generate the Cordova configuration file and save it to the export directory.
|
||||
*
|
||||
* \param project The project to be used to generate the configuration file.
|
||||
* \param exportDir The directory where the config.xml must be created.
|
||||
*/
|
||||
bool ExportCordovaConfigFile(const gd::Project & project, gd::String exportDir);
|
||||
/**
|
||||
* \brief Generate the Cordova configuration file and save it to the export
|
||||
* directory.
|
||||
*
|
||||
* \param project The project to be used to generate the configuration file.
|
||||
* \param exportDir The directory where the config.xml must be created.
|
||||
*/
|
||||
bool ExportCordovaConfigFile(const gd::Project &project,
|
||||
gd::String exportDir);
|
||||
|
||||
/**
|
||||
* \brief Generate the base Cocos2d files.
|
||||
*/
|
||||
bool ExportCocos2dFiles(const gd::Project & project, gd::String exportDir, bool debugMode, const std::vector<gd::String> & includesFiles);
|
||||
/**
|
||||
* \brief Generate the base Cocos2d files.
|
||||
*/
|
||||
bool ExportCocos2dFiles(const gd::Project &project,
|
||||
gd::String exportDir,
|
||||
bool debugMode,
|
||||
const std::vector<gd::String> &includesFiles);
|
||||
|
||||
/**
|
||||
* \brief Launch all export methods to generate a complete, stand-alone game for previewing.
|
||||
*
|
||||
* \param layout The layout to be previewed.
|
||||
* \param exportDir The directory where the preview must be created.
|
||||
* \param additionalSpec Any additional parameters to be passed to the gdjs.RuntimeGame.
|
||||
* \return true if export was successful.
|
||||
*/
|
||||
bool ExportLayoutForPixiPreview(gd::Project & project, gd::Layout & layout, gd::String exportDir, gd::String additionalSpec);
|
||||
/**
|
||||
* \brief Launch all export methods to generate a complete, stand-alone game
|
||||
* for previewing.
|
||||
*
|
||||
* \param layout The layout to be previewed.
|
||||
* \param exportDir The directory where the preview must be created.
|
||||
* \param additionalSpec Any additional parameters to be passed to the
|
||||
* gdjs.RuntimeGame. \return true if export was successful.
|
||||
*/
|
||||
bool ExportLayoutForPixiPreview(gd::Project &project,
|
||||
gd::Layout &layout,
|
||||
gd::String exportDir,
|
||||
gd::String additionalSpec);
|
||||
|
||||
/**
|
||||
* \brief Change the directory where code files are generated.
|
||||
*
|
||||
* By default, this is set to a temporary directory.
|
||||
*/
|
||||
void SetCodeOutputDirectory(gd::String codeOutputDir_) { codeOutputDir = codeOutputDir_; }
|
||||
/**
|
||||
* \brief Change the directory where code files are generated.
|
||||
*
|
||||
* By default, this is set to a temporary directory.
|
||||
*/
|
||||
void SetCodeOutputDirectory(gd::String codeOutputDir_) {
|
||||
codeOutputDir = codeOutputDir_;
|
||||
}
|
||||
|
||||
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; ///< The directory where JS code is outputted. Will be then copied to the final output directory.
|
||||
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; ///< The directory where JS code is outputted. Will
|
||||
///< be then copied to the final output directory.
|
||||
};
|
||||
|
||||
}
|
||||
#endif // EXPORTER_HELPER_H
|
||||
} // namespace gdjs
|
||||
#endif // EXPORTER_HELPER_H
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* GDevelop JS Platform
|
||||
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
|
||||
* This project is released under the MIT License.
|
||||
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights
|
||||
* reserved. This project is released under the MIT License.
|
||||
*/
|
||||
#if defined(GD_IDE_ONLY) && !defined(GD_NO_WX_GUI)
|
||||
#ifndef HTTPSERVER_H
|
||||
@@ -10,44 +10,42 @@
|
||||
#include "GDCore/String.h"
|
||||
struct mg_context;
|
||||
|
||||
namespace gdjs
|
||||
{
|
||||
namespace gdjs {
|
||||
|
||||
/**
|
||||
* \brief A very simple web server.
|
||||
*
|
||||
* Basically a wrapper around mongoose ( https://github.com/valenok/mongoose ).
|
||||
*/
|
||||
class HttpServer
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* \brief Default constructor doing nothing.
|
||||
*
|
||||
* Run the webserver using HttpServer::Run.
|
||||
*/
|
||||
HttpServer() : ctx(NULL) {};
|
||||
class HttpServer {
|
||||
public:
|
||||
/**
|
||||
* \brief Default constructor doing nothing.
|
||||
*
|
||||
* Run the webserver using HttpServer::Run.
|
||||
*/
|
||||
HttpServer() : ctx(NULL){};
|
||||
|
||||
/**
|
||||
* \brief Destroy the web server, stopping it if it was running.
|
||||
*/
|
||||
virtual ~HttpServer();
|
||||
/**
|
||||
* \brief Destroy the web server, stopping it if it was running.
|
||||
*/
|
||||
virtual ~HttpServer();
|
||||
|
||||
/**
|
||||
* \brief Run a web server, on port 2828, which index is located at \a indexDirectory.
|
||||
* \param indexDirectory The root of the webserver.
|
||||
*/
|
||||
void Run(gd::String indexDirectory);
|
||||
/**
|
||||
* \brief Run a web server, on port 2828, which index is located at \a
|
||||
* indexDirectory. \param indexDirectory The root of the webserver.
|
||||
*/
|
||||
void Run(gd::String indexDirectory);
|
||||
|
||||
/**
|
||||
* \brief Stop the webserver if it was running
|
||||
*/
|
||||
void Stop();
|
||||
/**
|
||||
* \brief Stop the webserver if it was running
|
||||
*/
|
||||
void Stop();
|
||||
|
||||
private:
|
||||
struct mg_context * ctx;
|
||||
private:
|
||||
struct mg_context* ctx;
|
||||
};
|
||||
|
||||
}
|
||||
#endif // HTTPSERVER_H
|
||||
} // namespace gdjs
|
||||
#endif // HTTPSERVER_H
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user