|
|
@@ -45,8 +45,13 @@
|
|
|
|
|
|
#include <AtomicJS/Javascript/Javascript.h>
|
|
|
|
|
|
+#include <ToolCore/ToolSystem.h>
|
|
|
+#include <ToolCore/ToolEnvironment.h>
|
|
|
+
|
|
|
DEFINE_APPLICATION_MAIN(AtomicEditor::AEApplication);
|
|
|
|
|
|
+using namespace ToolCore;
|
|
|
+
|
|
|
namespace AtomicEditor
|
|
|
{
|
|
|
|
|
|
@@ -61,6 +66,9 @@ void AEApplication::Start()
|
|
|
// refactor this
|
|
|
RegisterEnvironmentLibrary(context_);
|
|
|
|
|
|
+ ToolSystem* tsystem = new ToolSystem(context_);
|
|
|
+ context_->RegisterSubsystem(tsystem);
|
|
|
+
|
|
|
Engine* engine = GetSubsystem<Engine>();
|
|
|
engine->SetAutoExit(false);
|
|
|
|
|
|
@@ -68,16 +76,21 @@ void AEApplication::Start()
|
|
|
ResourceCache* cache = GetSubsystem<ResourceCache>();
|
|
|
cache->SetAutoReloadResources(true);
|
|
|
|
|
|
+#ifndef ATOMIC_DEV_BUILD
|
|
|
+
|
|
|
FileSystem* fileSystem = GetSubsystem<FileSystem>();
|
|
|
|
|
|
#ifdef __APPLE__
|
|
|
String editorResources = fileSystem->GetAppBundleResourceFolder() + "EditorData.pak";
|
|
|
#else
|
|
|
String editorResources = fileSystem->GetProgramDir() + "EditorData.pak";
|
|
|
-#endif
|
|
|
+#endif
|
|
|
+
|
|
|
assert(fileSystem->FileExists(editorResources));
|
|
|
cache->AddPackageFile(editorResources);
|
|
|
|
|
|
+#endif
|
|
|
+
|
|
|
// initialize after EditorResources set
|
|
|
UI* tbui = GetSubsystem<UI>();
|
|
|
tbui->Initialize();
|
|
|
@@ -141,6 +154,20 @@ void AEApplication::Setup()
|
|
|
{
|
|
|
FileSystem* filesystem = GetSubsystem<FileSystem>();
|
|
|
|
|
|
+ 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;
|
|
|
+ }
|
|
|
+
|
|
|
+#endif
|
|
|
+
|
|
|
+
|
|
|
const Vector<String>& arguments = GetArguments();
|
|
|
|
|
|
for (unsigned i = 0; i < arguments.Size(); ++i)
|
|
|
@@ -190,55 +217,6 @@ void AEApplication::Setup()
|
|
|
|
|
|
engineParameters_["LogName"] = filesystem->GetAppPreferencesDir("AtomicEditor", "Logs") + "AtomicEditor.log";
|
|
|
|
|
|
- // Show usage if not found
|
|
|
- if (false)//scriptFileName_.Empty())
|
|
|
- {
|
|
|
- ErrorExit("Usage: AtomicEditor <scriptfile> [options]\n\n"
|
|
|
- "The script file should implement the function void Start() for initializing the "
|
|
|
- "application and subscribing to all necessary events, such as the frame update.\n"
|
|
|
- #ifndef WIN32
|
|
|
- "\nCommand line options:\n"
|
|
|
- "-x <res> Horizontal resolution\n"
|
|
|
- "-y <res> Vertical resolution\n"
|
|
|
- "-m <level> Enable hardware multisampling\n"
|
|
|
- "-v Enable vertical sync\n"
|
|
|
- "-t Enable triple buffering\n"
|
|
|
- "-w Start in windowed mode\n"
|
|
|
- "-s Enable resizing when in windowed mode\n"
|
|
|
- "-q Enable quiet mode which does not log to standard output stream\n"
|
|
|
- "-b <length> Sound buffer length in milliseconds\n"
|
|
|
- "-r <freq> Sound mixing frequency in Hz\n"
|
|
|
- "-p <paths> Resource path(s) to use, separated by semicolons\n"
|
|
|
- "-ap <paths> Autoload resource path(s) to use, seperated by semicolons\n"
|
|
|
- "-log <level> Change the log level, valid 'level' values are 'debug', 'info', 'warning', 'error'\n"
|
|
|
- "-ds <file> Dump used shader variations to a file for precaching\n"
|
|
|
- "-mq <level> Material quality level, default 2 (high)\n"
|
|
|
- "-tq <level> Texture quality level, default 2 (high)\n"
|
|
|
- "-tf <level> Texture filter mode, default 2 (trilinear)\n"
|
|
|
- "-af <level> Texture anisotropy level, default 4. Also sets anisotropic filter mode\n"
|
|
|
- "-flushgpu Flush GPU command queue each frame. Effective only on Direct3D9\n"
|
|
|
- "-borderless Borderless window mode\n"
|
|
|
- "-headless Headless mode. No application window will be created\n"
|
|
|
- "-landscape Use landscape orientations (iOS only, default)\n"
|
|
|
- "-portrait Use portrait orientations (iOS only)\n"
|
|
|
- "-prepass Use light pre-pass rendering\n"
|
|
|
- "-deferred Use deferred rendering\n"
|
|
|
- "-lqshadows Use low-quality (1-sample) shadow filtering\n"
|
|
|
- "-noshadows Disable shadow rendering\n"
|
|
|
- "-nolimit Disable frame limiter\n"
|
|
|
- "-nothreads Disable worker threads\n"
|
|
|
- "-nosound Disable sound output\n"
|
|
|
- "-noip Disable sound mixing interpolation\n"
|
|
|
- "-sm2 Force SM2.0 rendering\n"
|
|
|
- "-touch Touch emulation on desktop platform\n"
|
|
|
- #endif
|
|
|
- );
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- // Use the script file name as the base name for the log file
|
|
|
-
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
void AEApplication::Stop()
|