Browse Source

Basic CLI chassis

Josh Engebretson 10 years ago
parent
commit
ee0a775854
4 changed files with 78 additions and 29 deletions
  1. 0 27
      Source/AtomicCLI/AtomicCLI.cpp
  2. 45 0
      Source/AtomicCLI/CLI.cpp
  3. 31 0
      Source/AtomicCLI/CLI.h
  4. 2 2
      Source/AtomicCLI/CMakeLists.txt

+ 0 - 27
Source/AtomicCLI/AtomicCLI.cpp

@@ -1,27 +0,0 @@
-
-#include <Atomic/Core/ProcessUtils.h>
-
-using namespace Atomic;
-
-void Run(const Vector<String>& arguments)
-{
-    if (arguments.Size() < 2)
-    {
-
-    }
-
-}
-
-int main(int argc, char** argv)
-{
-    Vector<String> arguments;
-    
-#ifdef ATOMIC_PLATFORM_WINDOWS
-    arguments = ParseArguments(GetCommandLineW());
-#else
-    arguments = ParseArguments(argc, argv);
-#endif
-    
-    Run(arguments);
-    return 0;
-}

+ 45 - 0
Source/AtomicCLI/CLI.cpp

@@ -0,0 +1,45 @@
+
+#include <Atomic/Core/ProcessUtils.h>
+#include <Atomic/Engine/Engine.h>
+
+#include "CLI.h"
+
+DEFINE_APPLICATION_MAIN(AtomicCLI::CLI);
+
+
+namespace AtomicCLI
+{
+
+CLI::CLI(Context* context) :
+    Application(context)
+{
+
+}
+
+CLI::~CLI()
+{
+
+}
+
+void CLI::Setup()
+{
+
+    engineParameters_["Headless"] = true;
+    engineParameters_["ResourcePaths"] = "";
+}
+
+void CLI::Start()
+{
+
+}
+
+void CLI::Stop()
+{
+
+}
+
+
+}
+
+
+

+ 31 - 0
Source/AtomicCLI/CLI.h

@@ -0,0 +1,31 @@
+
+#pragma once
+
+#include <Atomic/Engine/Application.h>
+
+using namespace Atomic;
+
+namespace AtomicCLI
+{
+
+class CLI : public Application
+{
+    OBJECT(CLI);
+
+public:
+
+    CLI(Context* context);
+    virtual ~CLI();
+
+    /// Setup before engine initialization. Verify that a script file has been specified.
+    virtual void Setup();
+    /// Setup after engine initialization. Load the script and execute its start function.
+    virtual void Start();
+    /// Cleanup after the main loop. Run the script's stop function if it exists.
+    virtual void Stop();
+
+private:
+
+};
+
+}

+ 2 - 2
Source/AtomicCLI/CMakeLists.txt

@@ -1,6 +1,6 @@
+set (ATOMIC_CLI_SOURCES CLI.cpp CLI.h)
 
-
-add_executable(atomic-cli AtomicCLI.cpp)
+add_executable(atomic-cli ${ATOMIC_CLI_SOURCES})
 
 target_link_libraries(atomic-cli ${ATOMIC_LINK_LIBRARIES})