本文整理汇总了C++中ToolEnvironment类的典型用法代码示例。如果您正苦于以下问题:C++ ToolEnvironment类的具体用法?C++ ToolEnvironment怎么用?C++ ToolEnvironment使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ToolEnvironment类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RunADBInstall
void BuildAndroid::RunADBInstall()
{
ToolEnvironment* tenv = GetSubsystem<ToolEnvironment>();
ToolPrefs* prefs = tenv->GetToolPrefs();
SubprocessSystem* subs = GetSubsystem<SubprocessSystem>();
String adbCommand = platformAndroid_->GetADBCommand();
Vector<String> args;
if ( prefs->GetReleaseCheck() > 2 ) // install release apk
args = String("install -r ./bin/Atomic-release.apk").Split(' ');
else
args = String("install -r ./bin/Atomic-debug.apk").Split(' ');
currentBuildPhase_ = ADBInstall;
Subprocess* subprocess = subs->Launch(adbCommand, args, buildPath_);
if (!subprocess)
{
FailBuild("APK Device Installation operation did not launch successfully.");
return;
}
VariantMap buildOutput;
buildOutput[BuildOutput::P_TEXT] = "\n\n<color #D4FB79>Installing on Android Device</color>\n\n";
SendEvent(E_BUILDOUTPUT, buildOutput);
SubscribeToEvent(subprocess, E_SUBPROCESSCOMPLETE, ATOMIC_HANDLER(BuildAndroid, HandleRunADBInstallComplete));
SubscribeToEvent(subprocess, E_SUBPROCESSOUTPUT, ATOMIC_HANDLER(BuildBase, HandleSubprocessOutputEvent));
}
示例2: GenerateLocalProperties
bool AndroidProjectGenerator::GenerateLocalProperties()
{
ToolEnvironment* tenv = GetSubsystem<ToolEnvironment>();
ToolPrefs* prefs = tenv->GetToolPrefs();
String sdkPath = prefs->GetAndroidSDKPath();
if (!sdkPath.Length())
{
errorText_ = "Invalid Android SDK Path";
return false;
}
String props;
props.AppendWithFormat("sdk.dir=%s", sdkPath.CString());
File file(context_, buildPath_ + "/local.properties", FILE_WRITE);
if (!file.IsOpen())
return false;
file.Write(props.CString(), props.Length());
return true;
}
示例3: LOGINFOF
void PlayCmd::Run()
{
LOGINFOF("Playing project");
ToolSystem* tsystem = GetSubsystem<ToolSystem>();
ToolEnvironment* env = GetSubsystem<ToolCore::ToolEnvironment>();
Project* project = tsystem->GetProject();
const String& editorBinary = env->GetEditorBinary();
Vector<String> paths;
paths.Push(env->GetCoreDataDir());
paths.Push(env->GetPlayerDataDir());
paths.Push(project->GetResourcePath());
// fixme: this is for loading from cache
paths.Push(project->GetProjectPath());
paths.Push(project->GetProjectPath() + "Cache");
String resourcePaths;
resourcePaths.Join(paths, "!");
Vector<String> vargs;
String args = ToString("--player --project \"%s\"", AddTrailingSlash(project->GetProjectPath()).CString());
vargs = args.Split(' ');
//vargs.Insert(0, "--player");
// TODO: use IPC (maybe before this set log location/access the log and output it, we need access to errors)
LaunchPlayerProcess(editorBinary, vargs, "");
Finished();
}
示例4: ToolSystem
void AtomicGlowApp::Setup()
{
IPCClientApp::Setup();
// AtomicGlow is always headless
engineParameters_["Headless"] = true;
FileSystem* filesystem = GetSubsystem<FileSystem>();
engineParameters_.InsertNew("LogName", filesystem->GetAppPreferencesDir("AtomicEditor", "Logs") + "AtomicGlow.log");
ToolSystem* tsystem = new ToolSystem(context_);
context_->RegisterSubsystem(tsystem);
ToolEnvironment* env = new ToolEnvironment(context_);
context_->RegisterSubsystem(env);
String projectPath;
for (unsigned i = 0; i < arguments_.Size(); ++i)
{
if (arguments_[i].Length() > 1)
{
String argument = arguments_[i].ToLower();
String value = i + 1 < arguments_.Size() ? arguments_[i + 1] : String::EMPTY;
if (argument == "--project" && value.Length())
{
if (GetExtension(value) == ".atomic")
{
value = GetPath(value);
}
if (filesystem->DirExists(value))
{
}
else
{
ErrorExit(ToString("%s project path does not exist", value.CString()));
}
projectPath = AddTrailingSlash(value);
}
}
}
if (!env->Initialize())
{
ErrorExit("Unable to initialize tool environment from %s");
return;
}
engineParameters_["ResourcePrefixPaths"] = env->GetRootSourceDir() + "/Resources/";
engineParameters_["ResourcePaths"] = ToString("CoreData;EditorData;%sResources;%sCache", projectPath.CString(), projectPath.CString());
}
示例5: GetDefaultResourcePaths
void BuildBase::GetDefaultResourcePaths(Vector<String>& paths)
{
paths.Clear();
ToolEnvironment* tenv = GetSubsystem<ToolEnvironment>();
paths.Push(AddTrailingSlash(tenv->GetCoreDataDir()));
paths.Push(AddTrailingSlash(tenv->GetPlayerDataDir()));
}
示例6: PlayProject
bool EditorMode::PlayProject(String addArgs, bool debug)
{
ToolEnvironment* env = GetSubsystem<ToolEnvironment>();
ToolSystem* tsystem = GetSubsystem<ToolSystem>();
const String& editorBinary = env->GetEditorBinary();
Project* project = tsystem->GetProject();
if (!project)
return false;
Vector<String> paths;
paths.Push(env->GetCoreDataDir());
paths.Push(env->GetPlayerDataDir());
paths.Push(project->GetResourcePath());
// fixme: this is for loading from cache
paths.Push(project->GetProjectPath());
paths.Push(project->GetProjectPath() + "Cache");
String resourcePaths;
resourcePaths.Join(paths, "!");
Vector<String> vargs;
String args = ToString("--player --project \"%s\"", AddTrailingSlash(project->GetProjectPath()).CString());
vargs = args.Split(' ');
if (debug)
vargs.Insert(0, "--debug");
if (addArgs.Length() > 0)
vargs.Insert(0, addArgs.Split(' '));
String dump;
dump.Join(vargs, " ");
LOGINFOF("Launching Broker %s %s", editorBinary.CString(), dump.CString());
IPC* ipc = GetSubsystem<IPC>();
playerBroker_ = ipc->SpawnWorker(editorBinary, vargs);
if (playerBroker_)
{
SubscribeToEvent(playerBroker_, E_IPCJSERROR, HANDLER(EditorMode, HandleIPCJSError));
SubscribeToEvent(playerBroker_, E_IPCWORKEREXIT, HANDLER(EditorMode, HandleIPCWorkerExit));
SubscribeToEvent(playerBroker_, E_IPCWORKERLOG, HANDLER(EditorMode, HandleIPCWorkerLog));
}
return playerBroker_.NotNull();
}
示例7: GenerateLocalProperties
bool AndroidProjectGenerator::GenerateLocalProperties( )
{
ToolEnvironment* tenv = GetSubsystem<ToolEnvironment>();
ToolPrefs* prefs = tenv->GetToolPrefs();
String sdkPath = prefs->GetAndroidSDKPath();
if (!sdkPath.Length())
{
errorText_ = "Invalid Android SDK Path, select the path in Build Settings.";
return false;
}
String props;
props.AppendWithFormat("sdk.dir=%s", sdkPath.CString());
File file(context_, buildPath_ + "/local.properties", FILE_WRITE);
if (!file.IsOpen())
{
errorText_ = "Project generator unable to open file " + buildPath_ + "/local.properties ";
return false;
}
file.Write(props.CString(), props.Length());
if ( prefs->GetReleaseCheck() > 2 ) // if release index is set ...
{
FileSystem* fileSystem = GetSubsystem<FileSystem>();
String Reldir = prefs->GetReleasePath();
if (!fileSystem->DirExists(Reldir))
{
errorText_ = "Invalid Release Path, select the path in Build Settings.";
return false;
}
String antname = Reldir + "/ant.properties";
if ( !fileSystem->FileExists ( antname) )
{
errorText_ = "The file ant.properties not found in " + Reldir + ", unable to generate Release APK.";
return false;
}
if ( !buildBase_->BuildCopyFile ( antname, buildPath_ + "/ant.properties" ))
return false;
}
return true;
}
示例8: BuildLog
void BuildWindows::BuildNative(const String& buildPath)
{
BuildLog("Building Native Application");
ToolEnvironment* tenv = GetSubsystem<ToolEnvironment>();
String playerBinary = tenv->GetPlayerBinary();
String d3d9dll = GetPath(playerBinary) + "/D3DCompiler_47.dll";
if (!BuildCopyFile(playerBinary, buildPath_ + "/AtomicPlayer.exe"))
return;
if (!BuildCopyFile(d3d9dll, buildPath_ + "/D3DCompiler_47.dll"))
return;
}
示例9: Build
void BuildWindows::Build(const String& buildPath)
{
ToolEnvironment* tenv = GetSubsystem<ToolEnvironment>();
buildPath_ = AddTrailingSlash(buildPath) + GetBuildSubfolder();
BuildLog("Starting Windows Deployment");
Initialize();
if (!BuildClean(buildPath_))
return;
BuildSystem* buildSystem = GetSubsystem<BuildSystem>();
FileSystem* fileSystem = GetSubsystem<FileSystem>();
String rootSourceDir = tenv->GetRootSourceDir();
String playerBinary = tenv->GetPlayerBinary();
String d3d9dll = GetPath(playerBinary) + "/D3DCompiler_47.dll";
if (!BuildCreateDirectory(buildPath_))
return;
if (!BuildCreateDirectory(buildPath_ + "/AtomicPlayer_Resources"))
return;
String resourcePackagePath = buildPath_ + "/AtomicPlayer_Resources/AtomicResources" + PAK_EXTENSION;
GenerateResourcePackage(resourcePackagePath);
if (buildFailed_)
return;
if (!BuildCopyFile(playerBinary, buildPath_ + "/AtomicPlayer.exe"))
return;
if (!BuildCopyFile(d3d9dll, buildPath_ + "/D3DCompiler_47.dll"))
return;
BuildAtomicNET();
BuildLog("Windows Deployment Complete");
buildSystem->BuildComplete(PLATFORMID_WINDOWS, buildPath_);
}
示例10: CopyDebugGdbserver
bool AndroidProjectGenerator::CopyDebugGdbserver()
{
ToolEnvironment* tenv = GetSubsystem<ToolEnvironment>();
ToolPrefs* prefs = tenv->GetToolPrefs();
// include gdbserver in APK
if ( prefs->GetReleaseCheck() == 1 || prefs->GetReleaseCheck() == 2 )
{
String ndkPath = prefs->GetNdkPath();
if (ndkPath.Empty())
{
errorText_ = "NDK path not entered, this is required to add gdbserver to APK";
return false;
}
FileSystem* fileSystem = GetSubsystem<FileSystem>();
if (!fileSystem->DirExists(ndkPath))
{
errorText_ = "Invalid NDK Path, can not add gdbserver to APK.";
return false;
}
// copy gdbserver file
String gsstring = ndkPath + "/prebuilt/android-arm/gdbserver/gdbserver"; // assume arm type abi
String destDir = buildPath_ + "/libs/armeabi-v7a"; // assume armeabi-v7a abi type
if ( !fileSystem->FileExists (gsstring) )
{
errorText_ = "gdbserver not found as " + gsstring;
return false;
}
if ( prefs->GetReleaseCheck() == 1 ) // Debug Source with gdbserver
{
if ( !buildBase_->BuildCopyFile ( gsstring, destDir + "/gdbserver"))
return false;
}
else if ( prefs->GetReleaseCheck() == 2 ) // Debug Source with libgdbserver.so
{
if ( !buildBase_->BuildCopyFile ( gsstring, destDir + "/libgdbserver.so"))
return false;
}
}
return true;
}
示例11: ResourceEditor
JSResourceEditor ::JSResourceEditor(Context* context, const String &fullpath, UITabContainer *container) :
ResourceEditor(context, fullpath, container)
{
TBLayout* layout = new TBLayout();
layout->SetLayoutSize(LAYOUT_SIZE_GRAVITY);
layout->SetGravity(WIDGET_GRAVITY_ALL);
layout->SetLayoutDistribution(LAYOUT_DISTRIBUTION_GRAVITY);
rootContentWidget_->GetInternalWidget()->AddChild(layout);
TBContainer* c = new TBContainer();
c->SetGravity(WIDGET_GRAVITY_ALL);
layout->AddChild(c);
ToolEnvironment* tenv = GetSubsystem<ToolEnvironment>();
String codeEditorDir = tenv->GetToolDataDir();
codeEditorDir += "CodeEditor/Editor.html";
#ifdef ATOMIC_PLATFORM_OSX
String url = "file://" + codeEditorDir;
#else
String url = "file:///" + codeEditorDir;
#endif
webView_ = new UIWebView(context_, url);
webClient_ = webView_->GetWebClient();
messageHandler_ = new WebMessageHandler(context_);
webClient_->AddMessageHandler(messageHandler_);
webView_->GetWebTexture2D()->SetClearColor(Color(.23f, .23f, .23f, 1));
SubscribeToEvent(webClient_, E_WEBVIEWLOADEND, HANDLER(JSResourceEditor, HandleWebViewLoadEnd));
SubscribeToEvent(messageHandler_, E_WEBMESSAGE, HANDLER(JSResourceEditor, HandleWebMessage));
SubscribeToEvent(E_RENAMERESOURCENOTIFICATION, HANDLER(JSResourceEditor, HandleRenameResourceNotification));
SubscribeToEvent(E_DELETERESOURCENOTIFICATION, HANDLER(JSResourceEditor, HandleDeleteResourceNotification));
SubscribeToEvent(E_PROJECTUNLOADEDNOTIFICATION, HANDLER(JSResourceEditor, HandleProjectUnloadedNotification));
c->AddChild(webView_->GetInternalWidget());
}
示例12: Setup
void AEEditorApp::Setup()
{
context_->SetEditorContext(true);
AEEditorCommon::Setup();
ToolEnvironment* env = GetSubsystem<ToolEnvironment>();
engineParameters_["WindowTitle"] = "AtomicEditor";
engineParameters_["WindowResizable"] = true;
engineParameters_["FullScreen"] = false;
engineParameters_["LogLevel"] = LOG_DEBUG;
FileSystem* filesystem = GetSubsystem<FileSystem>();
engineParameters_["LogName"] = filesystem->GetAppPreferencesDir("AtomicEditor", "Logs") + "AtomicEditor.log";
#ifdef ATOMIC_PLATFORM_OSX
engineParameters_["WindowIcon"] = "Images/AtomicLogo32.png";
#endif
#ifdef ATOMIC_DEV_BUILD
engineParameters_["ResourcePrefixPath"] = "";
String resourcePaths = env->GetCoreDataDir() + ";" + env->GetEditorDataDir();
// for dev builds, add the compile editor scripts from artifacts
resourcePaths += ";" + env->GetRootSourceDir() + "Artifacts/Build/Resources/EditorData/";
engineParameters_["ResourcePaths"] = resourcePaths;
#else
#ifdef ATOMIC_PLATFORM_OSX
engineParameters_["ResourcePrefixPath"] = "../Resources";
#else
engineParameters_["ResourcePrefixPath"] = filesystem->GetProgramDir() + "Resources";
#endif
engineParameters_["ResourcePaths"] = "CoreData;EditorData";
#endif // ATOMIC_DEV_BUILD
ReadPreferences();
}
示例13: ToolEnvironment
void AEEditorApp::Setup()
{
context_->SetEditorContext(true);
ToolEnvironment* env = new ToolEnvironment(context_);
context_->RegisterSubsystem(env);
ToolSystem* system = new ToolSystem(context_);
context_->RegisterSubsystem(system);
#ifdef ATOMIC_DEV_BUILD
if (!env->InitFromJSON())
{
ErrorExit(ToString("Unable to initialize tool environment from %s", env->GetDevConfigFilename().CString()));
return;
}
#else
env->InitFromPackage();
#endif
engineParameters_["WindowTitle"] = "AtomicEditor";
engineParameters_["WindowResizable"] = true;
engineParameters_["FullScreen"] = false;
engineParameters_["LogLevel"] = LOG_DEBUG;
FileSystem* filesystem = GetSubsystem<FileSystem>();
engineParameters_["LogName"] = filesystem->GetAppPreferencesDir("AtomicEditor", "Logs") + "AtomicEditor.log";
#ifdef ATOMIC_PLATFORM_OSX
engineParameters_["WindowIcon"] = "Images/AtomicLogo32.png";
#endif
#ifdef ATOMIC_DEV_BUILD
engineParameters_["ResourcePrefixPath"] = "";
String ScriptPath = env->GetRootSourceDir() + "Script";
String resourcePaths = env->GetCoreDataDir() + ";" + env->GetEditorDataDir() + ";" + ScriptPath;
engineParameters_["ResourcePaths"] = resourcePaths;
#else
#ifdef ATOMIC_PLATFORM_OSX
engineParameters_["ResourcePrefixPath"] = "../Resources";
#else
engineParameters_["ResourcePrefixPath"] = filesystem->GetProgramDir() + "Resources";
#endif
engineParameters_["ResourcePaths"] = "CoreData;EditorData;Script";
#endif // ATOMIC_DEV_BUILD
}
示例14: SubscribeToEvent
void AtomicTool::Start()
{
// Subscribe to events
SubscribeToEvent(E_COMMANDERROR, HANDLER(AtomicTool, HandleCommandError));
SubscribeToEvent(E_COMMANDFINISHED, HANDLER(AtomicTool, HandleCommandFinished));
SubscribeToEvent(E_LICENSE_EULAREQUIRED, HANDLER(AtomicTool, HandleLicenseEulaRequired));
SubscribeToEvent(E_LICENSE_ACTIVATIONREQUIRED, HANDLER(AtomicTool, HandleLicenseActivationRequired));
SubscribeToEvent(E_LICENSE_ERROR, HANDLER(AtomicTool, HandleLicenseError));
SubscribeToEvent(E_LICENSE_SUCCESS, HANDLER(AtomicTool, HandleLicenseSuccess));
const Vector<String>& arguments = GetArguments();
ToolSystem* tsystem = new ToolSystem(context_);
context_->RegisterSubsystem(tsystem);
ToolEnvironment* env = new ToolEnvironment(context_);
context_->RegisterSubsystem(env);
//#ifdef ATOMIC_DEV_BUILD
if (!env->InitFromJSON())
{
ErrorExit(ToString("Unable to initialize tool environment from %s", env->GetDevConfigFilename().CString()));
return;
}
if (!cliDataPath_.Length())
{
cliDataPath_ = env->GetRootSourceDir() + "/Resources/";
}
//#endif
tsystem->SetCLI();
tsystem->SetDataPath(cliDataPath_);
if (activationKey_.Length())
{
DoActivation();
return;
} else if (deactivate_)
{
DoDeactivation();
return;
}
BuildSystem* buildSystem = GetSubsystem<BuildSystem>();
SharedPtr<CommandParser> parser(new CommandParser(context_));
SharedPtr<Command> cmd(parser->Parse(arguments));
if (!cmd)
{
String error = "No command found";
if (parser->GetErrorMessage().Length())
error = parser->GetErrorMessage();
ErrorExit(error);
return;
}
if (cmd->RequiresProjectLoad())
{
FileSystem* fileSystem = GetSubsystem<FileSystem>();
String projectDirectory = fileSystem->GetCurrentDir();
Vector<String> projectFiles;
fileSystem->ScanDir(projectFiles, projectDirectory, "*.atomic", SCAN_FILES, false);
if (!projectFiles.Size())
{
ErrorExit(ToString("No .atomic project file in %s", projectDirectory.CString()));
return;
}
else if (projectFiles.Size() > 1)
{
ErrorExit(ToString("Multiple .atomic project files found in %s", projectDirectory.CString()));
return;
}
String projectFile = projectDirectory + "/" + projectFiles[0];
if (!tsystem->LoadProject(projectFile))
{
//ErrorExit(ToString("Failed to load project: %s", projectFile.CString()));
//return;
}
// Set the build path
String buildFolder = projectDirectory + "/" + "Build";
buildSystem->SetBuildPath(buildFolder);
if (!fileSystem->DirExists(buildFolder))
{
fileSystem->CreateDir(buildFolder);
if (!fileSystem->DirExists(buildFolder))
//.........这里部分代码省略.........
示例15: BuildAtomicNET
void BuildWindows::BuildAtomicNET()
{
// AtomicNET
FileSystem* fileSystem = GetSubsystem<FileSystem>();
ToolEnvironment* tenv = GetSubsystem<ToolEnvironment>();
ToolSystem* tsystem = GetSubsystem<ToolSystem>();
Project* project = tsystem->GetProject();
String projectResources = project->GetResourcePath();
String assembliesPath = projectResources + "Assemblies/";
// if no assemblies path, no need to install AtomicNET
if (!fileSystem->DirExists(assembliesPath))
return;
Vector<String> results;
fileSystem->ScanDir(results, assembliesPath, "*.dll", SCAN_FILES, true);
// if no assembiles in Assemblies path, no need to install AtomicNET
if (!results.Size())
return;
BuildLog("Building AtomicNET");
fileSystem->CreateDir(buildPath_ + "/AtomicPlayer_Resources/AtomicNET");
fileSystem->CreateDir(buildPath_ + "/AtomicPlayer_Resources/AtomicNET/Atomic");
fileSystem->CreateDir(buildPath_ + "/AtomicPlayer_Resources/AtomicNET/Atomic/Assemblies");
fileSystem->CopyDir(tenv->GetNETCoreCLRAbsPath(), buildPath_ + "/AtomicPlayer_Resources/AtomicNET/CoreCLR");
fileSystem->CopyDir(tenv->GetNETTPAPaths(), buildPath_ + "/AtomicPlayer_Resources/AtomicNET/Atomic/TPA");
// Atomic Assemblies
const String& assemblyLoadPaths = tenv->GetNETAssemblyLoadPaths();
Vector<String> paths = assemblyLoadPaths.Split(';');
for (unsigned i = 0; i < paths.Size(); i++)
{
Vector<String> loadResults;
fileSystem->ScanDir(loadResults, paths[i], "*.dll", SCAN_FILES, true);
for (unsigned j = 0; j < loadResults.Size(); j++)
{
String pathName, fileName, ext;
SplitPath(loadResults[j], pathName, fileName, ext);
if (fileName != "AtomicNETEngine")
continue;
fileSystem->Copy(paths[i] + "/" + loadResults[j], ToString("%s/AtomicPlayer_Resources/AtomicNET/Atomic/Assemblies/%s.dll", buildPath_.CString(), fileName.CString()));
}
}
// Project assemblied
for (unsigned i = 0; i < results.Size(); i++)
{
String pathName, fileName, ext;
SplitPath(results[i], pathName, fileName, ext);
fileSystem->Copy(assembliesPath + results[i], ToString("%s/AtomicPlayer_Resources/AtomicNET/Atomic/Assemblies/%s.dll", buildPath_.CString(), fileName.CString()));
}
}