Browse Source

Renamed the Urho3D executable's application class to Urho3D.

Lasse Öörni 12 years ago
parent
commit
1d57f729a9
2 changed files with 26 additions and 20 deletions
  1. 17 11
      Urho3D/Urho3D.cpp
  2. 9 9
      Urho3D/Urho3D.h

+ 17 - 11
Urho3D/Urho3D.cpp

@@ -37,14 +37,18 @@
 
 
 #include "DebugNew.h"
 #include "DebugNew.h"
 
 
-DEFINE_APPLICATION_MAIN(Urho);
+// Resolve ambiguity as namespace and class have the same name
+DEFINE_APPLICATION_MAIN(::Urho3D::Urho3D);
 
 
-Urho::Urho(Context* context) :
+namespace Urho3D
+{
+
+Urho3D::Urho3D(Context* context) :
     Application(context)
     Application(context)
 {
 {
 }
 }
 
 
-void Urho::Setup()
+void Urho3D::Setup()
 {
 {
     // Check for script file name
     // Check for script file name
     const Vector<String>& arguments = GetArguments();
     const Vector<String>& arguments = GetArguments();
@@ -97,7 +101,7 @@ void Urho::Setup()
     }
     }
 }
 }
 
 
-void Urho::Start()
+void Urho3D::Start()
 {
 {
 #ifdef ENABLE_LUA
 #ifdef ENABLE_LUA
     String extension = GetExtension(scriptFileName_).ToLower();
     String extension = GetExtension(scriptFileName_).ToLower();
@@ -114,9 +118,9 @@ void Urho::Start()
         if (scriptFile_ && scriptFile_->Execute("void Start()"))
         if (scriptFile_ && scriptFile_->Execute("void Start()"))
         {
         {
             // Subscribe to script's reload event to allow live-reload of the application
             // Subscribe to script's reload event to allow live-reload of the application
-            SubscribeToEvent(scriptFile_, E_RELOADSTARTED, HANDLER(Urho, HandleScriptReloadStarted));
-            SubscribeToEvent(scriptFile_, E_RELOADFINISHED, HANDLER(Urho, HandleScriptReloadFinished));
-            SubscribeToEvent(scriptFile_, E_RELOADFAILED, HANDLER(Urho, HandleScriptReloadFailed));
+            SubscribeToEvent(scriptFile_, E_RELOADSTARTED, HANDLER(Urho3D, HandleScriptReloadStarted));
+            SubscribeToEvent(scriptFile_, E_RELOADFINISHED, HANDLER(Urho3D, HandleScriptReloadFinished));
+            SubscribeToEvent(scriptFile_, E_RELOADFAILED, HANDLER(Urho3D, HandleScriptReloadFailed));
             return;
             return;
         }
         }
 #ifdef ENABLE_LUA
 #ifdef ENABLE_LUA
@@ -140,7 +144,7 @@ void Urho::Start()
     ErrorExit();
     ErrorExit();
 }
 }
 
 
-void Urho::Stop()
+void Urho3D::Stop()
 {
 {
     if (scriptFile_)
     if (scriptFile_)
     {
     {
@@ -158,13 +162,13 @@ void Urho::Stop()
 #endif
 #endif
 }
 }
 
 
-void Urho::HandleScriptReloadStarted(StringHash eventType, VariantMap& eventData)
+void Urho3D::HandleScriptReloadStarted(StringHash eventType, VariantMap& eventData)
 {
 {
     if (scriptFile_->GetFunction("void Stop()"))
     if (scriptFile_->GetFunction("void Stop()"))
         scriptFile_->Execute("void Stop()");
         scriptFile_->Execute("void Stop()");
 }
 }
 
 
-void Urho::HandleScriptReloadFinished(StringHash eventType, VariantMap& eventData)
+void Urho3D::HandleScriptReloadFinished(StringHash eventType, VariantMap& eventData)
 {
 {
     // Restart the script application after reload
     // Restart the script application after reload
     if (!scriptFile_->Execute("void Start()"))
     if (!scriptFile_->Execute("void Start()"))
@@ -174,9 +178,11 @@ void Urho::HandleScriptReloadFinished(StringHash eventType, VariantMap& eventDat
     }
     }
 }
 }
 
 
-void Urho::HandleScriptReloadFailed(StringHash eventType, VariantMap& eventData)
+void Urho3D::HandleScriptReloadFailed(StringHash eventType, VariantMap& eventData)
 {
 {
     scriptFile_.Reset();
     scriptFile_.Reset();
     ErrorExit();
     ErrorExit();
 }
 }
 
 
+}
+

+ 9 - 9
Urho3D/Urho3D.h

@@ -24,25 +24,23 @@
 
 
 #include "Application.h"
 #include "Application.h"
 
 
-using namespace Urho3D;
-
 namespace Urho3D
 namespace Urho3D
 {
 {
-    class ScriptFile;
-}
+
+class ScriptFile;
 
 
 /// Urho3D script shell application, which runs a script specified on the command line.
 /// Urho3D script shell application, which runs a script specified on the command line.
-class Urho : public Application
+class Urho3D : public Application
 {
 {
-    OBJECT(Urho);
+    OBJECT(Urho3D);
     
     
 public:
 public:
     /// Construct.
     /// Construct.
-    Urho(Context* context);
+    Urho3D(Context* context);
     
     
     /// Setup before engine initialization. Verify that a script file has been specified.
     /// Setup before engine initialization. Verify that a script file has been specified.
     virtual void Setup();
     virtual void Setup();
-    /// Startup after engine initialization. Load the script and execute its start function.
+    /// Setup after engine initialization. Load the script and execute its start function.
     virtual void Start();
     virtual void Start();
     /// Cleanup after the main loop. Run the script's stop function if it exists.
     /// Cleanup after the main loop. Run the script's stop function if it exists.
     virtual void Stop();
     virtual void Stop();
@@ -59,4 +57,6 @@ private:
     String scriptFileName_;
     String scriptFileName_;
     /// Script file.
     /// Script file.
     SharedPtr<ScriptFile> scriptFile_;
     SharedPtr<ScriptFile> scriptFile_;
-};
+};
+
+}