Browse Source

Add support for scoped enums | Add enum class DebugHudElements (#3020)

1vanK 3 years ago
parent
commit
41a1b46a4a

+ 27 - 11
Source/Tools/BindingGenerator/ASEnumBinder.cpp

@@ -49,25 +49,41 @@ static void ProcessEnum(const EnumAnalyzer& analyzer)
 
     string enumTypeName = analyzer.GetTypeName();
     string cppEnumBaseType = analyzer.GetBaseType();
+    string asEnumBaseType = CppPrimitiveTypeToAS(cppEnumBaseType);
 
-    if (cppEnumBaseType == "int") // Enums in AngelScript can be only int
+    if (analyzer.IsClass()) // Scoped enumerations
     {
-        processedEnum.registration_.push_back("engine->RegisterEnum(\"" + enumTypeName + "\");");
+        processedEnum.registration_.push_back("engine->RegisterTypedef(\"" + enumTypeName + "\", \"" + asEnumBaseType + "\");");
+        processedEnum.registration_.push_back("engine->SetDefaultNamespace(\"" + enumTypeName + "\");");
 
         for (const string& value : analyzer.GetEnumerators())
-            processedEnum.registration_.push_back("engine->RegisterEnumValue(\"" + enumTypeName + "\", \"" + value + "\", " + value + ");");
+        {
+            string constName = enumTypeName + "_" + value;
+            processedEnum.glue_.push_back("static const " + cppEnumBaseType + " " + constName + " = static_cast<" + cppEnumBaseType + ">(" + enumTypeName + "::" + value + "); ");
+            processedEnum.registration_.push_back("engine->RegisterGlobalProperty(\"const " + asEnumBaseType + " " + value + "\", (void*)&" + constName + ");");
+        }
+
+        processedEnum.registration_.push_back("engine->SetDefaultNamespace(\"\");");
     }
-    else // If enum is not int then register as typedef. But this type can not be used in switch
+    else // Unscoped enumerations
     {
-        string asEnumBaseType = CppPrimitiveTypeToAS(cppEnumBaseType);
-
-        processedEnum.registration_.push_back("engine->RegisterTypedef(\"" + enumTypeName + "\", \"" + asEnumBaseType + "\");");
+        if (cppEnumBaseType == "int") // Enums in AngelScript can be only int
+        {
+            processedEnum.registration_.push_back("engine->RegisterEnum(\"" + enumTypeName + "\");");
 
-        for (const string& enumerator : analyzer.GetEnumerators())
+            for (const string& value : analyzer.GetEnumerators())
+                processedEnum.registration_.push_back("engine->RegisterEnumValue(\"" + enumTypeName + "\", \"" + value + "\", " + value + ");");
+        }
+        else // If enum is not int then register as typedef. But this type can not be used in switch
         {
-            string constName = enumTypeName + "_" + enumerator;
-            processedEnum.glue_.push_back("static const " + cppEnumBaseType + " " + constName + " = " + enumerator + ";");
-            processedEnum.registration_.push_back("engine->RegisterGlobalProperty(\"const " + asEnumBaseType + " " + enumerator + "\", (void*)&" + constName + ");");
+            processedEnum.registration_.push_back("engine->RegisterTypedef(\"" + enumTypeName + "\", \"" + asEnumBaseType + "\");");
+
+            for (const string& enumerator : analyzer.GetEnumerators())
+            {
+                string constName = enumTypeName + "_" + enumerator;
+                processedEnum.glue_.push_back("static const " + cppEnumBaseType + " " + constName + " = " + enumerator + ";");
+                processedEnum.registration_.push_back("engine->RegisterGlobalProperty(\"const " + asEnumBaseType + " " + enumerator + "\", (void*)&" + constName + ");");
+            }
         }
     }
 

+ 20 - 3
Source/Tools/BindingGenerator/XmlAnalyzer.cpp

@@ -505,10 +505,27 @@ string EnumAnalyzer::GetLocation() const
 {
     string baseType = GetBaseType();
 
-    if (baseType == "int")
-        return "enum " + GetTypeName() + " | File: " + GetHeaderFile();
+    string ret = "enum ";
 
-    return "enum " + GetTypeName() + " : " + baseType + " | File: " + GetHeaderFile();
+    if (IsClass())
+        ret += "class ";
+
+    ret += GetTypeName();
+
+    if (baseType != "int")
+        ret += " : " + baseType;
+
+    ret += " | File: " + GetHeaderFile();
+
+    return ret;
+}
+
+bool EnumAnalyzer::IsClass() const
+{
+    string strong = memberdef_.attribute("strong").value();
+    assert(!strong.empty());
+
+    return strong == "yes";
 }
 
 vector<string> EnumAnalyzer::GetEnumerators() const

+ 1 - 1
Source/Tools/BindingGenerator/XmlAnalyzer.h

@@ -208,12 +208,12 @@ public:
     bool IsInternal() const { return GetHeaderFile().empty(); } // true if declared in .cpp file
     std::string GetBaseType() const;
     std::string GetLocation() const;
+    bool IsClass() const;
 
     // <memberdef kind="enum">
     //     <enumvalue><name>...</name></enumvalue>
     //     <enumvalue><name>...</name></enumvalue>
     std::vector<std::string> GetEnumerators() const;
-
 };
 
 // <compounddef kind="namespace">

+ 21 - 0
Source/Urho3D/AngelScript/Generated_Enums.cpp

@@ -51,6 +51,15 @@ static const unsigned ControllerButton_CONTROLLER_BUTTON_DPAD_DOWN = CONTROLLER_
 static const unsigned ControllerButton_CONTROLLER_BUTTON_DPAD_LEFT = CONTROLLER_BUTTON_DPAD_LEFT;
 static const unsigned ControllerButton_CONTROLLER_BUTTON_DPAD_RIGHT = CONTROLLER_BUTTON_DPAD_RIGHT;
 
+// enum class DebugHudElements | File: ../Engine/DebugHud.h
+static const int DebugHudElements_None = static_cast<int>(DebugHudElements::None); 
+static const int DebugHudElements_Stats = static_cast<int>(DebugHudElements::Stats); 
+static const int DebugHudElements_Mode = static_cast<int>(DebugHudElements::Mode); 
+static const int DebugHudElements_Profiler = static_cast<int>(DebugHudElements::Profiler); 
+static const int DebugHudElements_Memory = static_cast<int>(DebugHudElements::Memory); 
+static const int DebugHudElements_EventProfiler = static_cast<int>(DebugHudElements::EventProfiler); 
+static const int DebugHudElements_All = static_cast<int>(DebugHudElements::All); 
+
 // enum DragAndDropMode : unsigned | File: ../UI/UIElement.h
 static const unsigned DragAndDropMode_DD_DISABLED = DD_DISABLED;
 static const unsigned DragAndDropMode_DD_SOURCE = DD_SOURCE;
@@ -794,6 +803,18 @@ void ASRegisterGeneratedEnums(asIScriptEngine* engine)
     engine->RegisterEnumValue("CursorShape", "CS_BUSY_ARROW", CS_BUSY_ARROW);
     engine->RegisterEnumValue("CursorShape", "CS_MAX_SHAPES", CS_MAX_SHAPES);
 
+    // enum class DebugHudElements | File: ../Engine/DebugHud.h
+    engine->RegisterTypedef("DebugHudElements", "int");
+    engine->SetDefaultNamespace("DebugHudElements");
+    engine->RegisterGlobalProperty("const int None", (void*)&DebugHudElements_None);
+    engine->RegisterGlobalProperty("const int Stats", (void*)&DebugHudElements_Stats);
+    engine->RegisterGlobalProperty("const int Mode", (void*)&DebugHudElements_Mode);
+    engine->RegisterGlobalProperty("const int Profiler", (void*)&DebugHudElements_Profiler);
+    engine->RegisterGlobalProperty("const int Memory", (void*)&DebugHudElements_Memory);
+    engine->RegisterGlobalProperty("const int EventProfiler", (void*)&DebugHudElements_EventProfiler);
+    engine->RegisterGlobalProperty("const int All", (void*)&DebugHudElements_All);
+    engine->SetDefaultNamespace("");
+
     // enum DeferredLightPSVariation | File: ../Graphics/Renderer.h
     engine->RegisterEnum("DeferredLightPSVariation");
     engine->RegisterEnumValue("DeferredLightPSVariation", "DLPS_NONE", DLPS_NONE);

+ 0 - 21
Source/Urho3D/AngelScript/Generated_GlobalVariables.cpp

@@ -25,27 +25,6 @@ void ASRegisterGeneratedGlobalVariables(asIScriptEngine* engine)
     // static const int CONVERSION_BUFFER_LENGTH | File: ../Container/Str.h
     engine->RegisterGlobalProperty("const int CONVERSION_BUFFER_LENGTH", (void*)&CONVERSION_BUFFER_LENGTH);
 
-    // static const unsigned DEBUGHUD_SHOW_ALL | File: ../Engine/DebugHud.h
-    engine->RegisterGlobalProperty("const uint DEBUGHUD_SHOW_ALL", (void*)&DEBUGHUD_SHOW_ALL);
-
-    // static const unsigned DEBUGHUD_SHOW_EVENTPROFILER | File: ../Engine/DebugHud.h
-    engine->RegisterGlobalProperty("const uint DEBUGHUD_SHOW_EVENTPROFILER", (void*)&DEBUGHUD_SHOW_EVENTPROFILER);
-
-    // static const unsigned DEBUGHUD_SHOW_MEMORY | File: ../Engine/DebugHud.h
-    engine->RegisterGlobalProperty("const uint DEBUGHUD_SHOW_MEMORY", (void*)&DEBUGHUD_SHOW_MEMORY);
-
-    // static const unsigned DEBUGHUD_SHOW_MODE | File: ../Engine/DebugHud.h
-    engine->RegisterGlobalProperty("const uint DEBUGHUD_SHOW_MODE", (void*)&DEBUGHUD_SHOW_MODE);
-
-    // static const unsigned DEBUGHUD_SHOW_NONE | File: ../Engine/DebugHud.h
-    engine->RegisterGlobalProperty("const uint DEBUGHUD_SHOW_NONE", (void*)&DEBUGHUD_SHOW_NONE);
-
-    // static const unsigned DEBUGHUD_SHOW_PROFILER | File: ../Engine/DebugHud.h
-    engine->RegisterGlobalProperty("const uint DEBUGHUD_SHOW_PROFILER", (void*)&DEBUGHUD_SHOW_PROFILER);
-
-    // static const unsigned DEBUGHUD_SHOW_STATS | File: ../Engine/DebugHud.h
-    engine->RegisterGlobalProperty("const uint DEBUGHUD_SHOW_STATS", (void*)&DEBUGHUD_SHOW_STATS);
-
     // static const float DEFAULT_CAMERA_FOV | File: ../Graphics/Camera.h
     engine->RegisterGlobalProperty("const float DEFAULT_CAMERA_FOV", (void*)&DEFAULT_CAMERA_FOV);
 

+ 8 - 8
Source/Urho3D/AngelScript/Generated_Members.h

@@ -9332,9 +9332,9 @@ template <class T> void RegisterMembers_DebugHud(asIScriptEngine* engine, const
     engine->RegisterObjectMethod(className, "Text@+ GetMemoryText() const", AS_METHODPR(T, GetMemoryText, () const, Text*), AS_CALL_THISCALL);
     engine->RegisterObjectMethod(className, "Text@+ get_memoryText() const", AS_METHODPR(T, GetMemoryText, () const, Text*), AS_CALL_THISCALL);
 
-    // unsigned DebugHud::GetMode() const
-    engine->RegisterObjectMethod(className, "uint GetMode() const", AS_METHODPR(T, GetMode, () const, unsigned), AS_CALL_THISCALL);
-    engine->RegisterObjectMethod(className, "uint get_mode() const", AS_METHODPR(T, GetMode, () const, unsigned), AS_CALL_THISCALL);
+    // DebugHudElements DebugHud::GetMode() const
+    engine->RegisterObjectMethod(className, "DebugHudElements GetMode() const", AS_METHODPR(T, GetMode, () const, DebugHudElements), AS_CALL_THISCALL);
+    engine->RegisterObjectMethod(className, "DebugHudElements get_mode() const", AS_METHODPR(T, GetMode, () const, DebugHudElements), AS_CALL_THISCALL);
 
     // Text* DebugHud::GetModeText() const
     engine->RegisterObjectMethod(className, "Text@+ GetModeText() const", AS_METHODPR(T, GetModeText, () const, Text*), AS_CALL_THISCALL);
@@ -9373,9 +9373,9 @@ template <class T> void RegisterMembers_DebugHud(asIScriptEngine* engine, const
     engine->RegisterObjectMethod(className, "void SetDefaultStyle(XMLFile@+)", AS_METHODPR(T, SetDefaultStyle, (XMLFile*), void), AS_CALL_THISCALL);
     engine->RegisterObjectMethod(className, "void set_defaultStyle(XMLFile@+)", AS_METHODPR(T, SetDefaultStyle, (XMLFile*), void), AS_CALL_THISCALL);
 
-    // void DebugHud::SetMode(unsigned mode)
-    engine->RegisterObjectMethod(className, "void SetMode(uint)", AS_METHODPR(T, SetMode, (unsigned), void), AS_CALL_THISCALL);
-    engine->RegisterObjectMethod(className, "void set_mode(uint)", AS_METHODPR(T, SetMode, (unsigned), void), AS_CALL_THISCALL);
+    // void DebugHud::SetMode(DebugHudElements mode)
+    engine->RegisterObjectMethod(className, "void SetMode(DebugHudElements)", AS_METHODPR(T, SetMode, (DebugHudElements), void), AS_CALL_THISCALL);
+    engine->RegisterObjectMethod(className, "void set_mode(DebugHudElements)", AS_METHODPR(T, SetMode, (DebugHudElements), void), AS_CALL_THISCALL);
 
     // void DebugHud::SetProfilerInterval(float interval)
     engine->RegisterObjectMethod(className, "void SetProfilerInterval(float)", AS_METHODPR(T, SetProfilerInterval, (float), void), AS_CALL_THISCALL);
@@ -9389,8 +9389,8 @@ template <class T> void RegisterMembers_DebugHud(asIScriptEngine* engine, const
     engine->RegisterObjectMethod(className, "void SetUseRendererStats(bool)", AS_METHODPR(T, SetUseRendererStats, (bool), void), AS_CALL_THISCALL);
     engine->RegisterObjectMethod(className, "void set_useRendererStats(bool)", AS_METHODPR(T, SetUseRendererStats, (bool), void), AS_CALL_THISCALL);
 
-    // void DebugHud::Toggle(unsigned mode)
-    engine->RegisterObjectMethod(className, "void Toggle(uint)", AS_METHODPR(T, Toggle, (unsigned), void), AS_CALL_THISCALL);
+    // void DebugHud::Toggle(DebugHudElements mode)
+    engine->RegisterObjectMethod(className, "void Toggle(DebugHudElements)", AS_METHODPR(T, Toggle, (DebugHudElements), void), AS_CALL_THISCALL);
 
     // void DebugHud::ToggleAll()
     engine->RegisterObjectMethod(className, "void ToggleAll()", AS_METHODPR(T, ToggleAll, (), void), AS_CALL_THISCALL);

+ 65 - 2
Source/Urho3D/Container/FlagSet.h

@@ -3,13 +3,76 @@
 
 #pragma once
 
-
 #include <type_traits>
 
-
 namespace Urho3D
 {
 
+#define URHO3D_FLAGS(EnumClass) \
+    inline EnumClass operator |(const EnumClass lhs, const EnumClass rhs) \
+    { \
+        using UT = std::underlying_type_t<EnumClass>; \
+        return static_cast<EnumClass>(static_cast<UT>(lhs) | static_cast<UT>(rhs)); \
+    } \
+    inline EnumClass& operator |=(EnumClass& lhs, const EnumClass rhs) \
+    { \
+        using UT = std::underlying_type_t<EnumClass>; \
+        lhs = static_cast<EnumClass>(static_cast<UT>(lhs) | static_cast<UT>(rhs)); \
+        return lhs; \
+    } \
+    inline EnumClass operator &(const EnumClass lhs, const EnumClass rhs) \
+    { \
+        using UT = std::underlying_type_t<EnumClass>; \
+        return static_cast<EnumClass>(static_cast<UT>(lhs) & static_cast<UT>(rhs)); \
+    } \
+    inline EnumClass& operator &=(EnumClass& lhs, const EnumClass rhs) \
+    { \
+        using UT = std::underlying_type_t<EnumClass>; \
+        lhs = static_cast<EnumClass>(static_cast<UT>(lhs) & static_cast<UT>(rhs)); \
+        return lhs; \
+    } \
+    inline EnumClass operator ^(const EnumClass lhs, const EnumClass rhs) \
+    { \
+        using UT = std::underlying_type_t<EnumClass>; \
+        return static_cast<EnumClass>(static_cast<UT>(lhs) ^ static_cast<UT>(rhs)); \
+    } \
+    inline EnumClass& operator ^=(EnumClass& lhs, const EnumClass rhs) \
+    { \
+        using UT = std::underlying_type_t<EnumClass>; \
+        lhs = static_cast<EnumClass>(static_cast<UT>(lhs) ^ static_cast<UT>(rhs)); \
+        return lhs; \
+    } \
+    inline EnumClass operator ~(const EnumClass rhs) \
+    { \
+        using UT = std::underlying_type_t<EnumClass>; \
+        return static_cast<EnumClass>(~static_cast<UT>(rhs)); \
+    } \
+    inline bool operator ==(const EnumClass lhs, const std::underlying_type_t<EnumClass> rhs) \
+    { \
+        using UT = std::underlying_type_t<EnumClass>; \
+        return static_cast<UT>(lhs) == rhs; \
+    } \
+    inline bool operator ==(const std::underlying_type_t<EnumClass> lhs, const EnumClass rhs) \
+    { \
+        using UT = std::underlying_type_t<EnumClass>; \
+        return lhs == static_cast<UT>(rhs); \
+    } \
+    inline bool operator !=(const EnumClass lhs, const std::underlying_type_t<EnumClass> rhs) \
+    { \
+        using UT = std::underlying_type_t<EnumClass>; \
+        return static_cast<UT>(lhs) != rhs; \
+    } \
+    inline bool operator !=(const std::underlying_type_t<EnumClass> lhs, const EnumClass rhs) \
+    { \
+        using UT = std::underlying_type_t<EnumClass>; \
+        return lhs != static_cast<UT>(rhs); \
+    } \
+    inline bool operator !(const EnumClass rhs) \
+    { \
+        using UT = std::underlying_type_t<EnumClass>; \
+        return static_cast<UT>(rhs) == 0; \
+    }
+
 /// Make bitwise operators (| & ^ ~) automatically construct FlagSet from Enum.
 #define URHO3D_AUTOMATIC_FLAGSET(Enum) \
     inline Urho3D::FlagSet<Enum> operator | (const Enum lhs, const Enum rhs) { return Urho3D::FlagSet<Enum>(lhs) | rhs; } \

+ 10 - 10
Source/Urho3D/Engine/DebugHud.cpp

@@ -45,7 +45,7 @@ DebugHud::DebugHud(Context* context) :
     profilerMaxDepth_(M_MAX_UNSIGNED),
     profilerInterval_(1000),
     useRendererStats_(false),
-    mode_(DEBUGHUD_SHOW_NONE)
+    mode_(DebugHudElements::None)
 {
     auto* ui = GetSubsystem<UI>();
     UIElement* uiRoot = ui->GetRoot();
@@ -203,13 +203,13 @@ void DebugHud::SetDefaultStyle(XMLFile* style)
     eventProfilerText_->SetStyle("DebugHudText");
 }
 
-void DebugHud::SetMode(unsigned mode)
+void DebugHud::SetMode(DebugHudElements mode)
 {
-    statsText_->SetVisible((mode & DEBUGHUD_SHOW_STATS) != 0);
-    modeText_->SetVisible((mode & DEBUGHUD_SHOW_MODE) != 0);
-    profilerText_->SetVisible((mode & DEBUGHUD_SHOW_PROFILER) != 0);
-    memoryText_->SetVisible((mode & DEBUGHUD_SHOW_MEMORY) != 0);
-    eventProfilerText_->SetVisible((mode & DEBUGHUD_SHOW_EVENTPROFILER) != 0);
+    statsText_->SetVisible(!!(mode & DebugHudElements::Stats));
+    modeText_->SetVisible(!!(mode & DebugHudElements::Mode));
+    profilerText_->SetVisible(!!(mode & DebugHudElements::Profiler));
+    memoryText_->SetVisible(!!(mode & DebugHudElements::Memory));
+    eventProfilerText_->SetVisible(!!(mode & DebugHudElements::EventProfiler));
 
     memoryText_->SetPosition(0, modeText_->IsVisible() ? modeText_->GetHeight() * -2 : 0);
 
@@ -217,7 +217,7 @@ void DebugHud::SetMode(unsigned mode)
     // Event profiler is created on engine initialization if "EventProfiler" parameter is set
     auto* eventProfiler = GetSubsystem<EventProfiler>();
     if (eventProfiler)
-        EventProfiler::SetActive((mode & DEBUGHUD_SHOW_EVENTPROFILER) != 0);
+        EventProfiler::SetActive(!!(mode & DebugHudElements::EventProfiler));
 #endif
 
     mode_ = mode;
@@ -238,14 +238,14 @@ void DebugHud::SetUseRendererStats(bool enable)
     useRendererStats_ = enable;
 }
 
-void DebugHud::Toggle(unsigned mode)
+void DebugHud::Toggle(DebugHudElements mode)
 {
     SetMode(GetMode() ^ mode);
 }
 
 void DebugHud::ToggleAll()
 {
-    Toggle(DEBUGHUD_SHOW_ALL);
+    Toggle(DebugHudElements::All);
 }
 
 XMLFile* DebugHud::GetDefaultStyle() const

+ 20 - 11
Source/Urho3D/Engine/DebugHud.h

@@ -14,13 +14,17 @@ class Font;
 class Text;
 class XMLFile;
 
-static const unsigned DEBUGHUD_SHOW_NONE = 0x0;
-static const unsigned DEBUGHUD_SHOW_STATS = 0x1;
-static const unsigned DEBUGHUD_SHOW_MODE = 0x2;
-static const unsigned DEBUGHUD_SHOW_PROFILER = 0x4;
-static const unsigned DEBUGHUD_SHOW_MEMORY = 0x8;
-static const unsigned DEBUGHUD_SHOW_EVENTPROFILER = 0x10;
-static const unsigned DEBUGHUD_SHOW_ALL = DEBUGHUD_SHOW_STATS | DEBUGHUD_SHOW_MODE | DEBUGHUD_SHOW_PROFILER | DEBUGHUD_SHOW_MEMORY;
+enum class DebugHudElements
+{
+    None          = 0,
+    Stats         = 1 << 0,
+    Mode          = 1 << 1,
+    Profiler      = 1 << 2,
+    Memory        = 1 << 3,
+    EventProfiler = 1 << 4,
+    All           = Stats | Mode | Profiler | Memory
+};
+URHO3D_FLAGS(DebugHudElements);
 
 /// Displays rendering stats and profiling information.
 class URHO3D_API DebugHud : public Object
@@ -38,9 +42,11 @@ public:
     /// Set UI elements' style from an XML file.
     /// @property
     void SetDefaultStyle(XMLFile* style);
+
     /// Set elements to show.
     /// @property
-    void SetMode(unsigned mode);
+    void SetMode(DebugHudElements mode);
+
     /// Set maximum profiler block depth, default unlimited.
     /// @property
     void SetProfilerMaxDepth(unsigned depth);
@@ -50,8 +56,10 @@ public:
     /// Set whether to show 3D geometry primitive/batch count only. Default false.
     /// @property
     void SetUseRendererStats(bool enable);
+
     /// Toggle elements.
-    void Toggle(unsigned mode);
+    void Toggle(DebugHudElements mode);
+
     /// Toggle all elements.
     void ToggleAll();
 
@@ -77,7 +85,7 @@ public:
 
     /// Return currently shown elements.
     /// @property
-    unsigned GetMode() const { return mode_; }
+    DebugHudElements GetMode() const { return mode_; }
 
     /// Return maximum profiler block depth.
     /// @property
@@ -124,8 +132,9 @@ private:
     unsigned profilerInterval_;
     /// Show 3D geometry primitive/batch count flag.
     bool useRendererStats_;
+
     /// Current shown-element mode.
-    unsigned mode_;
+    DebugHudElements mode_;
 };
 
 }

+ 1 - 1
bin/Data/Scripts/Editor/EditorUI.as

@@ -1116,7 +1116,7 @@ void CreateDebugHud()
 {
     engine.CreateDebugHud();
     debugHud.defaultStyle = uiStyle;
-    debugHud.mode = DEBUGHUD_SHOW_NONE;
+    debugHud.mode = DebugHudElements::None;
 }
 
 void CenterDialog(UIElement@ element)

+ 2 - 2
bin/Data/Scripts/NinjaSnowWar.as

@@ -416,7 +416,7 @@ void HandleUpdate(StringHash eventType, VariantMap& eventData)
     }
     else
     {
-        if (debugHud.mode != DEBUGHUD_SHOW_NONE)
+        if (debugHud.mode != DebugHudElements::None)
         {
             Node@ playerNode = FindOwnNode();
             if (playerNode !is null)
@@ -488,7 +488,7 @@ void HandleKeyDown(StringHash eventType, VariantMap& eventData)
         drawOctreeDebug = !drawOctreeDebug;
 
     if (key == KEY_F5)
-        debugHud.Toggle(DEBUGHUD_SHOW_EVENTPROFILER);
+        debugHud.Toggle(DebugHudElements::EventProfiler);
 
     // Take screenshot
     if (key == KEY_F6)