Forráskód Böngészése

More code cleanups
Update .clang-format

Signed-off-by: Alexis Maiquez <almamu@almamu.com>

Alexis Maiquez 3 éve
szülő
commit
732c60da46
100 módosított fájl, 459 hozzáadás és 560 törlés
  1. 35 148
      .clang-format
  2. 3 3
      src/Steam/FileSystem/FileSystem.cpp
  3. 25 21
      src/WallpaperEngine/Application/CApplicationContext.cpp
  4. 1 1
      src/WallpaperEngine/Application/CApplicationContext.h
  5. 3 3
      src/WallpaperEngine/Application/CWallpaperApplication.cpp
  6. 1 1
      src/WallpaperEngine/Assets/CAssetLoadException.h
  7. 6 0
      src/WallpaperEngine/Assets/CCombinedContainer.cpp
  8. 3 1
      src/WallpaperEngine/Assets/CCombinedContainer.h
  9. 2 1
      src/WallpaperEngine/Assets/CContainer.cpp
  10. 1 1
      src/WallpaperEngine/Assets/CContainer.h
  11. 2 4
      src/WallpaperEngine/Assets/CDirectory.cpp
  12. 2 2
      src/WallpaperEngine/Assets/CDirectory.h
  13. 1 3
      src/WallpaperEngine/Assets/CPackage.cpp
  14. 1 1
      src/WallpaperEngine/Assets/CPackage.h
  15. 1 1
      src/WallpaperEngine/Assets/CPackageLoadException.h
  16. 47 32
      src/WallpaperEngine/Assets/CTexture.cpp
  17. 3 3
      src/WallpaperEngine/Assets/CTexture.h
  18. 2 2
      src/WallpaperEngine/Assets/CVirtualContainer.h
  19. 2 1
      src/WallpaperEngine/Assets/ITexture.h
  20. 1 1
      src/WallpaperEngine/Audio/CAudioContext.h
  21. 30 43
      src/WallpaperEngine/Audio/CAudioStream.cpp
  22. 3 3
      src/WallpaperEngine/Audio/CAudioStream.h
  23. 6 5
      src/WallpaperEngine/Audio/Drivers/CSDLAudioDriver.cpp
  24. 15 14
      src/WallpaperEngine/Core/CObject.cpp
  25. 3 3
      src/WallpaperEngine/Core/CObject.h
  26. 1 1
      src/WallpaperEngine/Core/CProject.h
  27. 1 1
      src/WallpaperEngine/Core/CScene.h
  28. 2 4
      src/WallpaperEngine/Core/CVideo.h
  29. 5 2
      src/WallpaperEngine/Core/CWallpaper.cpp
  30. 2 2
      src/WallpaperEngine/Core/CWallpaper.h
  31. 3 3
      src/WallpaperEngine/Core/Core.cpp
  32. 1 1
      src/WallpaperEngine/Core/Core.h
  33. 9 11
      src/WallpaperEngine/Core/Objects/CEffect.cpp
  34. 1 1
      src/WallpaperEngine/Core/Objects/CEffect.h
  35. 4 4
      src/WallpaperEngine/Core/Objects/CImage.cpp
  36. 4 4
      src/WallpaperEngine/Core/Objects/CImage.h
  37. 4 2
      src/WallpaperEngine/Core/Objects/CParticle.cpp
  38. 1 1
      src/WallpaperEngine/Core/Objects/CParticle.h
  39. 4 4
      src/WallpaperEngine/Core/Objects/CSound.cpp
  40. 2 2
      src/WallpaperEngine/Core/Objects/CSound.h
  41. 1 1
      src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstant.h
  42. 1 1
      src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantFloat.h
  43. 1 1
      src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantInteger.h
  44. 1 1
      src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantVector2.cpp
  45. 2 1
      src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantVector2.h
  46. 1 1
      src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantVector3.h
  47. 8 7
      src/WallpaperEngine/Core/Objects/Images/CMaterial.cpp
  48. 3 3
      src/WallpaperEngine/Core/Objects/Images/CMaterial.h
  49. 8 19
      src/WallpaperEngine/Core/Objects/Images/Materials/CPass.cpp
  50. 2 2
      src/WallpaperEngine/Core/Objects/Images/Materials/CPass.h
  51. 6 6
      src/WallpaperEngine/Core/Objects/Particles/CControlPoint.cpp
  52. 4 3
      src/WallpaperEngine/Core/Objects/Particles/CControlPoint.h
  53. 4 0
      src/WallpaperEngine/Core/Objects/Particles/CEmitter.cpp
  54. 2 1
      src/WallpaperEngine/Core/Objects/Particles/CEmitter.h
  55. 1 1
      src/WallpaperEngine/Core/Objects/Particles/CInitializer.cpp
  56. 2 2
      src/WallpaperEngine/Core/Objects/Particles/CInitializer.h
  57. 2 2
      src/WallpaperEngine/Core/Objects/Particles/Initializers/CAlphaRandom.cpp
  58. 3 3
      src/WallpaperEngine/Core/Objects/Particles/Initializers/CAlphaRandom.h
  59. 1 1
      src/WallpaperEngine/Core/Objects/Particles/Initializers/CAngularVelocityRandom.h
  60. 1 1
      src/WallpaperEngine/Core/Objects/Particles/Initializers/CColorRandom.h
  61. 2 2
      src/WallpaperEngine/Core/Objects/Particles/Initializers/CLifeTimeRandom.cpp
  62. 3 3
      src/WallpaperEngine/Core/Objects/Particles/Initializers/CLifeTimeRandom.h
  63. 12 12
      src/WallpaperEngine/Core/Objects/Particles/Initializers/CRotationRandom.cpp
  64. 9 9
      src/WallpaperEngine/Core/Objects/Particles/Initializers/CRotationRandom.h
  65. 2 2
      src/WallpaperEngine/Core/Objects/Particles/Initializers/CSizeRandom.cpp
  66. 3 3
      src/WallpaperEngine/Core/Objects/Particles/Initializers/CSizeRandom.h
  67. 1 1
      src/WallpaperEngine/Core/Objects/Particles/Initializers/CTurbulentVelocityRandom.h
  68. 1 1
      src/WallpaperEngine/Core/Objects/Particles/Initializers/CVelocityRandom.h
  69. 3 7
      src/WallpaperEngine/Core/Projects/CPropertyBoolean.cpp
  70. 2 2
      src/WallpaperEngine/Core/Projects/CPropertyBoolean.h
  71. 2 6
      src/WallpaperEngine/Core/Projects/CPropertyColor.cpp
  72. 1 1
      src/WallpaperEngine/Core/Projects/CPropertyColor.h
  73. 8 10
      src/WallpaperEngine/Core/Projects/CPropertyCombo.cpp
  74. 1 1
      src/WallpaperEngine/Core/Projects/CPropertyCombo.h
  75. 3 10
      src/WallpaperEngine/Core/Projects/CPropertySlider.cpp
  76. 1 1
      src/WallpaperEngine/Core/Projects/CPropertySlider.h
  77. 1 1
      src/WallpaperEngine/Core/Projects/CPropertyText.h
  78. 1 1
      src/WallpaperEngine/Core/Scenes/CCamera.h
  79. 6 3
      src/WallpaperEngine/Core/Scenes/CProjection.cpp
  80. 2 2
      src/WallpaperEngine/Core/Scenes/CProjection.h
  81. 7 7
      src/WallpaperEngine/Core/UserSettings/CUserSettingBoolean.cpp
  82. 1 1
      src/WallpaperEngine/Core/UserSettings/CUserSettingBoolean.h
  83. 8 8
      src/WallpaperEngine/Core/UserSettings/CUserSettingFloat.cpp
  84. 1 1
      src/WallpaperEngine/Core/UserSettings/CUserSettingFloat.h
  85. 2 2
      src/WallpaperEngine/Core/UserSettings/CUserSettingValue.h
  86. 5 5
      src/WallpaperEngine/Core/UserSettings/CUserSettingVector3.cpp
  87. 1 1
      src/WallpaperEngine/Core/UserSettings/CUserSettingVector3.h
  88. 1 1
      src/WallpaperEngine/Input/CInputContext.h
  89. 1 1
      src/WallpaperEngine/Input/CMouseInput.cpp
  90. 2 2
      src/WallpaperEngine/Input/CMouseInput.h
  91. 10 5
      src/WallpaperEngine/Render/CCamera.cpp
  92. 2 1
      src/WallpaperEngine/Render/CCamera.h
  93. 8 4
      src/WallpaperEngine/Render/CFBO.cpp
  94. 1 1
      src/WallpaperEngine/Render/CFBO.h
  95. 2 3
      src/WallpaperEngine/Render/CObject.cpp
  96. 1 1
      src/WallpaperEngine/Render/CObject.h
  97. 21 15
      src/WallpaperEngine/Render/CRenderContext.cpp
  98. 12 9
      src/WallpaperEngine/Render/CScene.cpp
  99. 1 2
      src/WallpaperEngine/Render/CTextureCache.cpp
  100. 11 14
      src/WallpaperEngine/Render/CVideo.cpp

+ 35 - 148
.clang-format

@@ -1,179 +1,66 @@
----
-Language:        Cpp
-# BasedOnStyle:  Microsoft
+# Generated from CLion C/C++ Code Style settings
+BasedOnStyle: LLVM
 AccessModifierOffset: -4
 AlignAfterOpenBracket: Align
-AlignArrayOfStructures: None
-AlignConsecutiveMacros: None
 AlignConsecutiveAssignments: None
-AlignConsecutiveBitFields: None
-AlignConsecutiveDeclarations: None
-AlignEscapedNewlines: Right
-AlignOperands:   Align
-AlignTrailingComments: true
-AllowAllArgumentsOnNextLine: true
-AllowAllConstructorInitializersOnNextLine: true
-AllowAllParametersOfDeclarationOnNextLine: true
-AllowShortEnumsOnASingleLine: false
-AllowShortBlocksOnASingleLine: Empty
+AlignOperands: Align
+AllowAllArgumentsOnNextLine: false
+AllowAllConstructorInitializersOnNextLine: false
+AllowAllParametersOfDeclarationOnNextLine: false
+AllowShortBlocksOnASingleLine: Always
 AllowShortCaseLabelsOnASingleLine: true
-AllowShortFunctionsOnASingleLine: Inline
+AllowShortFunctionsOnASingleLine: All
+AllowShortIfStatementsOnASingleLine: Never
 AllowShortLambdasOnASingleLine: All
-AllowShortIfStatementsOnASingleLine: WithoutElse
-AllowShortLoopsOnASingleLine: true
-AlwaysBreakAfterDefinitionReturnType: None
+AllowShortLoopsOnASingleLine: false
 AlwaysBreakAfterReturnType: None
-AlwaysBreakBeforeMultilineStrings: false
-AlwaysBreakTemplateDeclarations: MultiLine
-AttributeMacros:
-  - __capability
-BinPackArguments: false
-BinPackParameters: false
+AlwaysBreakTemplateDeclarations: Yes
+BreakBeforeBraces: Custom
 BraceWrapping:
-  AfterCaseLabel:  false
-  AfterClass:      true
+  AfterCaseLabel: false
+  AfterClass: true
   AfterControlStatement: Always
-  AfterEnum:       true
-  AfterFunction:   true
-  AfterNamespace:  true
-  AfterObjCDeclaration: true
-  AfterStruct:     true
-  AfterUnion:      false
-  AfterExternBlock: true
-  BeforeCatch:     true
-  BeforeElse:      true
-  BeforeLambdaBody: false
-  BeforeWhile:     false
-  IndentBraces:    false
-  SplitEmptyFunction: true
+  AfterEnum: true
+  AfterFunction: true
+  AfterNamespace: true
+  AfterUnion: true
+  BeforeCatch: true
+  BeforeElse: true
+  IndentBraces: false
+  SplitEmptyFunction: false
   SplitEmptyRecord: true
-  SplitEmptyNamespace: true
 BreakBeforeBinaryOperators: None
-BreakBeforeConceptDeclarations: true
-BreakBeforeBraces: Allman
-BreakBeforeInheritanceComma: false
-BreakInheritanceList: BeforeColon
 BreakBeforeTernaryOperators: true
-BreakConstructorInitializersBeforeComma: false
-BreakConstructorInitializers: AfterColon
-PackConstructorInitializers: Never
-BreakAfterJavaFieldAnnotations: false
-BreakStringLiterals: true
-ColumnLimit:     120
-CommentPragmas:  '^ IWYU pragma:'
+BreakConstructorInitializers: BeforeColon
+BreakInheritanceList: BeforeColon
+ColumnLimit: 0
 CompactNamespaces: false
-ConstructorInitializerAllOnOneLineOrOnePerLine: false
-ConstructorInitializerIndentWidth: 4
-ContinuationIndentWidth: 4
-Cpp11BracedListStyle: true
-DeriveLineEnding: true
-DerivePointerAlignment: false
-DisableFormat:   false
-EmptyLineAfterAccessModifier: Never
-EmptyLineBeforeAccessModifier: LogicalBlock
-ExperimentalAutoDetectBinPacking: false
-FixNamespaceComments: true
-ForEachMacros:
-  - foreach
-  - Q_FOREACH
-  - BOOST_FOREACH
-IfMacros:
-  - KJ_IF_MAYBE
-IncludeBlocks:   Preserve
-IncludeCategories:
-  - Regex:           '^"(llvm|llvm-c|clang|clang-c)/'
-    Priority:        2
-    SortPriority:    0
-    CaseSensitive:   false
-  - Regex:           '^(<|"(gtest|gmock|isl|json)/)'
-    Priority:        3
-    SortPriority:    0
-    CaseSensitive:   false
-  - Regex:           '.*'
-    Priority:        1
-    SortPriority:    0
-    CaseSensitive:   false
-IncludeIsMainRegex: '(Test)?$'
-IncludeIsMainSourceRegex: ''
-IndentAccessModifiers: false
+ContinuationIndentWidth: 8
 IndentCaseLabels: true
-IndentCaseBlocks: true
-IndentGotoLabels: true
 IndentPPDirectives: None
-IndentExternBlock: AfterExternBlock
-IndentRequires:  false
-IndentWidth:     4
-IndentWrappedFunctionNames: false
-InsertTrailingCommas: None
-JavaScriptQuotes: Leave
-JavaScriptWrapImports: true
+IndentWidth: 4
 KeepEmptyLinesAtTheStartOfBlocks: true
-LambdaBodyIndentation: Signature
-MacroBlockBegin: ''
-MacroBlockEnd:   ''
-MaxEmptyLinesToKeep: 1
+MaxEmptyLinesToKeep: 2
 NamespaceIndentation: All
-ObjCBinPackProtocolList: Auto
-ObjCBlockIndentWidth: 2
-ObjCBreakBeforeNestedBlockParam: true
 ObjCSpaceAfterProperty: false
 ObjCSpaceBeforeProtocolList: true
-PenaltyBreakAssignment: 2
-PenaltyBreakBeforeFirstCallParameter: 19
-PenaltyBreakComment: 300
-PenaltyBreakFirstLessLess: 120
-PenaltyBreakString: 1000
-PenaltyBreakTemplateDeclaration: 10
-PenaltyExcessCharacter: 1000000
-PenaltyReturnTypeOnItsOwnLine: 1000
-PenaltyIndentedWhitespace: 0
 PointerAlignment: Left
-PPIndentWidth:   -1
-ReferenceAlignment: Pointer
-ReflowComments:  true
-ShortNamespaceLines: 1
-SortIncludes:    CaseSensitive
-SortJavaStaticImport: Before
-SortUsingDeclarations: true
+ReflowComments: false
 SpaceAfterCStyleCast: true
 SpaceAfterLogicalNot: false
 SpaceAfterTemplateKeyword: true
 SpaceBeforeAssignmentOperators: true
-SpaceBeforeCaseColon: false
-SpaceBeforeCpp11BracedList: false
+SpaceBeforeCpp11BracedList: true
 SpaceBeforeCtorInitializerColon: true
 SpaceBeforeInheritanceColon: true
 SpaceBeforeParens: Always
-SpaceAroundPointerQualifiers: Default
 SpaceBeforeRangeBasedForLoopColon: true
-SpaceInEmptyBlock: false
 SpaceInEmptyParentheses: false
-SpacesBeforeTrailingComments: 1
-SpacesInAngles:  Never
-SpacesInConditionalStatement: false
-SpacesInContainerLiterals: true
+SpacesBeforeTrailingComments: 0
+SpacesInAngles: false
 SpacesInCStyleCastParentheses: false
-SpacesInLineCommentPrefix:
-  Minimum:         1
-  Maximum:         -1
+SpacesInContainerLiterals: false
 SpacesInParentheses: false
 SpacesInSquareBrackets: false
-SpaceBeforeSquareBrackets: true
-BitFieldColonSpacing: Both
-Standard:        Latest
-StatementAttributeLikeMacros:
-  - Q_EMIT
-StatementMacros:
-  - Q_UNUSED
-  - QT_REQUIRE_VERSION
-TabWidth:        4
-UseCRLF:         false
-UseTab:          Never
-WhitespaceSensitiveMacros:
-  - STRINGIZE
-  - PP_STRINGIZE
-  - BOOST_PP_STRINGIZE
-  - NS_SWIFT_NAME
-  - CF_SWIFT_NAME
-...
-
+TabWidth: 4
+UseTab: ForContinuationAndIndentation

+ 3 - 3
src/Steam/FileSystem/FileSystem.cpp

@@ -27,7 +27,7 @@ std::filesystem::path detectHomepath ()
 
     std::filesystem::path path = home;
 
-    if (std::filesystem::is_directory (path) == false)
+    if (!std::filesystem::is_directory (path))
         sLog.exception ("Cannot find home directory for current user, ", home, " is not a directory");
 
     return home;
@@ -41,7 +41,7 @@ std::filesystem::path Steam::FileSystem::workshopDirectory (int appID, const std
     {
         auto currentpath = std::filesystem::path (homepath) / *current / std::to_string (appID) / contentID;
 
-        if (std::filesystem::exists (currentpath) == false || std::filesystem::is_directory (currentpath) == false)
+        if (!std::filesystem::exists (currentpath) || !std::filesystem::is_directory (currentpath))
             continue;
 
         return currentpath;
@@ -58,7 +58,7 @@ std::filesystem::path Steam::FileSystem::appDirectory (const std::string& appDir
     {
         auto currentpath = std::filesystem::path (homepath) / *current / appDirectory / path;
 
-        if (std::filesystem::exists (currentpath) == false || std::filesystem::is_directory (currentpath) == false)
+        if (!std::filesystem::exists (currentpath) || !std::filesystem::is_directory (currentpath))
             continue;
 
         return currentpath;

+ 25 - 21
src/WallpaperEngine/Application/CApplicationContext.cpp

@@ -14,23 +14,23 @@
 using namespace WallpaperEngine::Application;
 
 struct option long_options [] = {
-    {"screen-root",     required_argument, 0, 'r'},
-    {"pkg",             required_argument, 0, 'p'},
-    {"dir",             required_argument, 0, 'd'},
-    {"silent",          no_argument,       0, 's'},
-    {"volume",          required_argument, 0, 'v'},
-    {"help",            no_argument,       0, 'h'},
-    {"fps",             required_argument, 0, 'f'},
-    {"assets-dir",      required_argument, 0, 'a'},
-    {"screenshot",      required_argument, 0, 'c'},
-    {"list-properties", no_argument,       0, 'l'},
-    {"set-property",    required_argument, 0, 'o'},
-    {nullptr,                           0, 0,   0}
+    {"screen-root",     required_argument, nullptr, 'r'},
+    {"pkg",             required_argument, nullptr, 'p'},
+    {"dir",             required_argument, nullptr, 'd'},
+    {"silent",          no_argument,       nullptr, 's'},
+    {"volume",          required_argument, nullptr, 'v'},
+    {"help",            no_argument,       nullptr, 'h'},
+    {"fps",             required_argument, nullptr, 'f'},
+    {"assets-dir",      required_argument, nullptr, 'a'},
+    {"screenshot",      required_argument, nullptr, 'c'},
+    {"list-properties", no_argument,       nullptr, 'l'},
+    {"set-property",    required_argument, nullptr, 'o'},
+    {nullptr,                           0, nullptr,   0}
 };
 
 std::string stringPathFixes(const std::string& s)
 {
-    if (s.empty () == true)
+    if (s.empty ())
         return s;
 
     std::string str (s);
@@ -49,7 +49,8 @@ CApplicationContext::CApplicationContext (int argc, char* argv[]) :
     maximumFPS (30),
     audioVolume (128),
     audioEnabled (true),
-    onlyListProperties (false)
+    onlyListProperties (false),
+	screenshotFormat (FIF_UNKNOWN)
 {
     int c;
 
@@ -96,7 +97,7 @@ CApplicationContext::CApplicationContext (int argc, char* argv[]) :
                 break;
 
             case 'f':
-                maximumFPS = atoi (optarg);
+                maximumFPS = strtol (optarg, nullptr, 0);
                 break;
 
             case 'a':
@@ -104,17 +105,20 @@ CApplicationContext::CApplicationContext (int argc, char* argv[]) :
                 break;
 
             case 'v':
-                this->audioVolume = glm::clamp (atoi (optarg), 0, 128);
+                this->audioVolume = glm::clamp ((int) strtol (optarg, nullptr, 0), 0, 128);
                 break;
 
             case 'c':
                 this->takeScreenshot = true;
                 this->screenshot = stringPathFixes (optarg);
                 break;
+
+			default:
+				break;
         }
     }
 
-    if (this->background.empty () == true)
+    if (this->background.empty ())
     {
         if (optind < argc && strlen (argv [optind]) > 0)
         {
@@ -122,7 +126,7 @@ CApplicationContext::CApplicationContext (int argc, char* argv[]) :
         }
         else
         {
-            this->printHelp (argv [0]);
+            CApplicationContext::printHelp (argv [0]);
         }
     }
 
@@ -142,7 +146,7 @@ void CApplicationContext::validatePath ()
 
 void CApplicationContext::validateAssets ()
 {
-    if (this->assets.empty () == false)
+    if (!this->assets.empty ())
     {
         sLog.out ("Using wallpaper engine's assets at ", this->assets, " based on --assets-dir parameter");
         return;
@@ -162,10 +166,10 @@ void CApplicationContext::validateAssets ()
 
 void CApplicationContext::validateScreenshot ()
 {
-    if (this->takeScreenshot == false)
+    if (!this->takeScreenshot)
         return;
 
-    if (this->screenshot.has_extension () == false)
+    if (!this->screenshot.has_extension ())
         sLog.exception ("Cannot determine screenshot format");
 
     std::string extension = this->screenshot.extension ();

+ 1 - 1
src/WallpaperEngine/Application/CApplicationContext.h

@@ -29,6 +29,6 @@ namespace WallpaperEngine::Application
         void validatePath ();
         void validateAssets ();
         void validateScreenshot ();
-        void printHelp (const char* route);
+        static void printHelp (const char* route);
     };
 }

+ 3 - 3
src/WallpaperEngine/Application/CWallpaperApplication.cpp

@@ -139,7 +139,7 @@ void CWallpaperApplication::loadProject ()
     this->m_project = CProject::fromFile ("project.json", this->m_vfs);
     // go to the right folder so the videos will play
     // TODO: stop doing chdir and use full path
-    if (this->m_project->getWallpaper ()->is <WallpaperEngine::Core::CVideo> () == true)
+    if (this->m_project->getWallpaper ()->is <WallpaperEngine::Core::CVideo> ())
         chdir (this->m_context.background.c_str ());
 }
 
@@ -229,7 +229,7 @@ void CWallpaperApplication::show ()
 
     float startTime, endTime, minimumTime = 1.0f / this->m_context.maximumFPS;
 
-    while (videoDriver.closeRequested () == false && g_KeepRunning == true)
+    while (!videoDriver.closeRequested () && g_KeepRunning)
     {
         // update input information
         inputContext.update ();
@@ -248,7 +248,7 @@ void CWallpaperApplication::show ()
         if ((endTime - startTime) < minimumTime)
             usleep ((minimumTime - (endTime - startTime)) * CLOCKS_PER_SEC);
 
-        if (this->m_context.takeScreenshot == true && videoDriver.getFrameCounter () == 5)
+        if (this->m_context.takeScreenshot && videoDriver.getFrameCounter () == 5)
         {
             this->takeScreenshot (context.getWallpaper (), this->m_context.screenshot, this->m_context.screenshotFormat);
             // disable screenshot just in case the counter overflows

+ 1 - 1
src/WallpaperEngine/Assets/CAssetLoadException.h

@@ -14,4 +14,4 @@ namespace WallpaperEngine::Assets
     private:
         std::string m_message;
     };
-};
+}

+ 6 - 0
src/WallpaperEngine/Assets/CCombinedContainer.cpp

@@ -6,6 +6,12 @@
 
 using namespace WallpaperEngine::Assets;
 
+CCombinedContainer::CCombinedContainer () :
+	CContainer (),
+	m_containers ()
+{
+}
+
 void CCombinedContainer::add (CContainer* container)
 {
     this->m_containers.emplace_back (container);

+ 3 - 1
src/WallpaperEngine/Assets/CCombinedContainer.h

@@ -11,6 +11,8 @@ namespace WallpaperEngine::Assets
     class CCombinedContainer : public CContainer
     {
     public:
+		CCombinedContainer ();
+
         /**
          * Adds a container to the list
          *
@@ -19,7 +21,7 @@ namespace WallpaperEngine::Assets
         void add (CContainer* container);
         void addPkg (const std::filesystem::path& path);
 
-        const void* readFile (std::string filename, uint32_t* length) const override;
+        const void* readFile (std::string filename, uint32_t* length = nullptr) const override;
 
     private:
         std::vector<CContainer*> m_containers;

+ 2 - 1
src/WallpaperEngine/Assets/CContainer.cpp

@@ -15,8 +15,9 @@ const ITexture* CContainer::readTexture (std::string filename) const
 
     ITexture* result = new CTexture (textureContents);
 
-    if (DEBUG)
+#if DEBUG
         glObjectLabel (GL_TEXTURE, result->getTextureID (), -1, filename.c_str ());
+#endif /* DEBUG */
 
     return result;
 }

+ 1 - 1
src/WallpaperEngine/Assets/CContainer.h

@@ -17,7 +17,7 @@ namespace WallpaperEngine::Assets
          *
          * @return
          */
-        const virtual void* readFile (std::string filename, uint32_t* length = nullptr) const = 0;
+        virtual const void* readFile (std::string filename, uint32_t* length = nullptr) const = 0;
 
         /**
          * Wrapper for readFile, appends the texture extension at the end of the filename

+ 2 - 4
src/WallpaperEngine/Assets/CDirectory.cpp

@@ -12,7 +12,7 @@ CDirectory::CDirectory (std::filesystem::path  basepath) :
     m_basepath (std::move(basepath))
 {
     // ensure the specified path exists
-    struct stat buffer;
+    struct stat buffer {};
 
     if (stat (this->m_basepath.c_str (), &buffer) != 0)
         sLog.exception ("Cannot find ", this->m_basepath, ". This folder is required for wallpaper engine to work");
@@ -22,9 +22,7 @@ CDirectory::CDirectory (std::filesystem::path  basepath) :
 }
 
 CDirectory::~CDirectory ()
-{
-
-}
+= default;
 
 const void* CDirectory::readFile (std::string filename, uint32_t* length) const
 {

+ 2 - 2
src/WallpaperEngine/Assets/CDirectory.h

@@ -13,7 +13,7 @@ namespace WallpaperEngine::Assets
     class CDirectory : public CContainer
     {
     public:
-        CDirectory (std::filesystem::path  basepath);
+        explicit CDirectory (std::filesystem::path basepath);
         ~CDirectory ();
 
         const void* readFile (std::string filename, uint32_t* length) const override;
@@ -21,4 +21,4 @@ namespace WallpaperEngine::Assets
         std::filesystem::path m_basepath;
         std::map <std::string, CFileEntry> m_cache;
     };
-};
+}

+ 1 - 3
src/WallpaperEngine/Assets/CPackage.cpp

@@ -29,9 +29,7 @@ CPackage::CPackage (std::filesystem::path  path) :
 }
 
 CPackage::~CPackage()
-{
-
-}
+= default;
 
 
 const void* CPackage::readFile (std::string filename, uint32_t* length) const

+ 1 - 1
src/WallpaperEngine/Assets/CPackage.h

@@ -16,7 +16,7 @@ namespace WallpaperEngine::Assets
     class CPackage : public CContainer
     {
     public:
-        CPackage (std::filesystem::path  path);
+        explicit CPackage (std::filesystem::path path);
         ~CPackage ();
 
         const void* readFile (std::string filename, uint32_t* length) const override;

+ 1 - 1
src/WallpaperEngine/Assets/CPackageLoadException.h

@@ -8,7 +8,7 @@ namespace WallpaperEngine::Assets
     class CPackageLoadException : public std::exception
     {
     public:
-        CPackageLoadException(const std::string& message, const std::string& extrainfo = "");
+        explicit CPackageLoadException(const std::string& message, const std::string& extrainfo = "");
         const char* what() const noexcept override;
 
     private:

+ 47 - 32
src/WallpaperEngine/Assets/CTexture.cpp

@@ -7,14 +7,15 @@
 
 using namespace WallpaperEngine::Assets;
 
-CTexture::CTexture (const void* fileData)
+CTexture::CTexture (const void* fileData) :
+	m_resolution ()
 {
     // ensure the header is parsed
-    this->m_header = this->parseHeader (static_cast <const char*> (fileData));
+    this->m_header = parseHeader (static_cast <const char*> (fileData));
 
     GLint internalFormat;
 
-    if (this->isAnimated () == true)
+    if (this->isAnimated ())
     {
         this->m_resolution = {
             this->m_header->textureWidth, this->m_header->textureHeight,
@@ -27,7 +28,7 @@ CTexture::CTexture (const void* fileData)
         {
             // wpengine-texture format always has one mipmap
             // get first image size
-            std::vector<TextureMipmap*>::const_iterator element = this->m_header->images.find (0)->second.begin ();
+            auto element = this->m_header->images.find (0)->second.begin ();
 
             // set the texture resolution
             this->m_resolution = {
@@ -160,14 +161,14 @@ CTexture::CTexture (const void* fileData)
             }
             else
             {
-                if (this->m_header->format == TextureFormat::RG88)
+				if (this->m_header->format == TextureFormat::R8)
+				{
+					// red textures are 1-byte-per-pixel, so it's alignment has to be set manually
+					glPixelStorei (GL_UNPACK_ALIGNMENT, 1);
+					textureFormat = GL_RED;
+				}
+				else if (this->m_header->format == TextureFormat::RG88)
                     textureFormat = GL_RG;
-                else if (this->m_header->format == TextureFormat::R8)
-                {
-                    // red textures are 1-byte-per-pixel, so it's alignment has to be set manually
-                    glPixelStorei (GL_UNPACK_ALIGNMENT, 1);
-                    textureFormat = GL_RED;
-                }
             }
 
             switch (internalFormat)
@@ -242,12 +243,12 @@ const uint32_t CTexture::getTextureHeight (uint32_t imageIndex) const
 
 const uint32_t CTexture::getRealWidth () const
 {
-    return this->isAnimated () == true ? this->getHeader ()->gifWidth : this->getHeader ()->width;
+    return this->isAnimated () ? this->getHeader ()->gifWidth : this->getHeader ()->width;
 }
 
 const uint32_t CTexture::getRealHeight () const
 {
-    return this->isAnimated () == true ? this->getHeader ()->gifHeight : this->getHeader ()->height;
+    return this->isAnimated () ? this->getHeader ()->gifHeight : this->getHeader ()->height;
 }
 
 const ITexture::TextureFormat CTexture::getFormat () const
@@ -281,8 +282,7 @@ const bool CTexture::isAnimated () const
 }
 
 CTexture::TextureMipmap::TextureMipmap ()
-{
-}
+= default;
 
 CTexture::TextureMipmap::~TextureMipmap ()
 {
@@ -308,25 +308,40 @@ void CTexture::TextureMipmap::decompressData ()
     }
 }
 
-CTexture::TextureFrame::TextureFrame ()
+CTexture::TextureFrame::TextureFrame () :
+	frameNumber (0),
+	frametime (0.0f),
+	x (0),
+	y (0),
+	width1 (0),
+	width2 (0),
+	height1 (0),
+	height2 (0)
 {
 }
 
 CTexture::TextureFrame::~TextureFrame ()
-{
-}
-
-CTexture::TextureHeader::TextureHeader ()
+= default;
+
+CTexture::TextureHeader::TextureHeader () :
+	flags (NoFlags),
+	width (0),
+	height (0),
+	textureWidth (0),
+	textureHeight (0),
+	gifWidth (0),
+	gifHeight (0),
+	format (TextureFormat::UNKNOWN),
+	imageCount (0),
+	mipmapCount (0)
 {
 }
 
 CTexture::TextureHeader::~TextureHeader ()
 {
     for (const auto& imgCur : this->images)
-    {
         for (auto cur : imgCur.second)
             delete cur;
-    }
 }
 
 CTexture::TextureHeader* CTexture::parseHeader (const char* fileData)
@@ -342,9 +357,9 @@ CTexture::TextureHeader* CTexture::parseHeader (const char* fileData)
     // jump through the string again
     fileData += 9;
 
-    TextureHeader* header = new TextureHeader;
+    auto* header = new TextureHeader;
 
-    const uint32_t* pointer = reinterpret_cast <const uint32_t*> (fileData);
+    const auto* pointer = reinterpret_cast <const uint32_t*> (fileData);
 
     header->format = static_cast <TextureFormat>(*pointer ++);
     header->flags = static_cast <TextureFlags> (*pointer ++);
@@ -433,7 +448,7 @@ CTexture::TextureHeader* CTexture::parseHeader (const char* fileData)
         while (framecount > 0)
         {
             // add the frame to the list
-            header->frames.push_back (parseAnimation (header, &fileData));
+            header->frames.push_back (parseAnimation (&fileData));
 
             framecount --;
         }
@@ -451,19 +466,19 @@ CTexture::TextureHeader* CTexture::parseHeader (const char* fileData)
     return header;
 }
 
-CTexture::TextureFrame* CTexture::parseAnimation (TextureHeader* header, const char** originalFileData)
+CTexture::TextureFrame* CTexture::parseAnimation (const char** originalFileData)
 {
     const char* fileData = *originalFileData;
     // get back the pointer into integer
-    const uint32_t* pointer = reinterpret_cast <const uint32_t*> (fileData);
+    const auto* pointer = reinterpret_cast <const uint32_t*> (fileData);
 
     // start reading frame information
-    TextureFrame* frame = new TextureFrame();
+    auto* frame = new TextureFrame();
 
     frame->frameNumber = *pointer++;
 
     // reinterpret the pointer into float
-    const float* fPointer = reinterpret_cast <const float*> (pointer);
+    const auto* fPointer = reinterpret_cast <const float*> (pointer);
 
     frame->frametime = *fPointer ++;
     frame->x = *fPointer ++;
@@ -481,13 +496,13 @@ CTexture::TextureFrame* CTexture::parseAnimation (TextureHeader* header, const c
 
 CTexture::TextureMipmap* CTexture::parseMipmap (TextureHeader* header, const char** originalFileData)
 {
-    TextureMipmap* mipmap = new TextureMipmap ();
+    auto* mipmap = new TextureMipmap ();
 
     // get the current position
     const char* fileData = *originalFileData;
 
     // get an integer pointer
-    const uint32_t* pointer = reinterpret_cast <const uint32_t*> (fileData);
+    const auto* pointer = reinterpret_cast <const uint32_t*> (fileData);
 
     mipmap->width = *pointer++;
     mipmap->height = *pointer++;
@@ -536,7 +551,7 @@ CTexture::TextureMipmap* CTexture::parseMipmap (TextureHeader* header, const cha
     return mipmap;
 }
 
-const bool CTexture::TextureHeader::isAnimated () const
+bool CTexture::TextureHeader::isAnimated () const
 {
     return this->flags & TextureFlags::IsGif;
 }

+ 3 - 3
src/WallpaperEngine/Assets/CTexture.h

@@ -18,7 +18,7 @@ namespace WallpaperEngine::Assets
         struct TextureHeader;
 
     public:
-        CTexture (const void* fileData);
+        explicit CTexture (const void* fileData);
         ~CTexture ();
 
         const GLuint getTextureID (uint32_t imageIndex = 0) const override;
@@ -82,7 +82,7 @@ namespace WallpaperEngine::Assets
             TextureHeader ();
             ~TextureHeader ();
 
-            const bool isAnimated () const;
+            bool isAnimated () const;
 
             /** The version of the texture container */
             ContainerVersion containerVersion = ContainerVersion::UNKNOWN;
@@ -117,7 +117,7 @@ namespace WallpaperEngine::Assets
         };
     private:
         static TextureHeader* parseHeader (const char* fileData);
-        static TextureFrame* parseAnimation (TextureHeader* header, const char** originalFileData);
+        static TextureFrame* parseAnimation (const char** originalFileData);
         static TextureMipmap* parseMipmap (TextureHeader* header, const char** fileData);
 
         TextureHeader* m_header;

+ 2 - 2
src/WallpaperEngine/Assets/CVirtualContainer.h

@@ -11,8 +11,8 @@ namespace WallpaperEngine::Assets
     class CVirtualContainer : public CContainer
     {
     public:
-        CVirtualContainer () {}
-        ~CVirtualContainer () {}
+        CVirtualContainer () = default;
+        ~CVirtualContainer () = default;
 
         /**
          * Adds a new file to the virtual container

+ 2 - 1
src/WallpaperEngine/Assets/ITexture.h

@@ -36,6 +36,7 @@ namespace WallpaperEngine::Assets
          */
         enum TextureFormat : uint32_t
         {
+			UNKNOWN = 0xFFFFFFFF,
             ARGB8888 = 0,
             RGB888 = 1,
             RGB565 = 2,
@@ -74,4 +75,4 @@ namespace WallpaperEngine::Assets
         virtual const glm::vec4* getResolution () const = 0;
         virtual const bool isAnimated () const = 0;
     };
-};
+}

+ 1 - 1
src/WallpaperEngine/Audio/CAudioContext.h

@@ -15,7 +15,7 @@ namespace WallpaperEngine::Audio
     class CAudioContext
     {
     public:
-        CAudioContext (Drivers::CAudioDriver& driver);
+        explicit CAudioContext (Drivers::CAudioDriver& driver);
 
         void addStream (CAudioStream* stream);
 

+ 30 - 43
src/WallpaperEngine/Audio/CAudioStream.cpp

@@ -23,7 +23,7 @@ int audio_read_thread (void* arg)
     if (waitMutex == nullptr)
         sLog.exception ("Cannot create mutex for audio playback waiting");
 
-    while (ret >= 0 && g_KeepRunning == true)
+    while (ret >= 0 && g_KeepRunning)
     {
         // give the cpu some time to play the queued frames if there's enough info there
         if (
@@ -47,7 +47,7 @@ int audio_read_thread (void* arg)
             avcodec_flush_buffers (stream->getContext ());
 
             // ensure the thread is not killed if audio has to be looped
-            if (stream->isRepeat() == true)
+            if (stream->isRepeat())
                 ret = 0;
 
             continue;
@@ -59,7 +59,7 @@ int audio_read_thread (void* arg)
         else
             av_packet_unref (packet);
 
-        if (stream->isInitialized () == false)
+        if (!stream->isInitialized ())
             break;
     }
 
@@ -165,8 +165,8 @@ CAudioStream::~CAudioStream()
 
 void CAudioStream::loadCustomContent (const char* filename)
 {
-    const AVCodec* aCodec = nullptr;
-    AVCodecContext* avCodecContext = nullptr;
+    const AVCodec* aCodec;
+    AVCodecContext* avCodecContext;
 
     if (avformat_open_input (&this->m_formatContext, filename, nullptr, nullptr) != 0)
         sLog.exception ("Cannot open audio file: ", filename);
@@ -287,7 +287,7 @@ void CAudioStream::queuePacket(AVPacket *pkt)
     bool gotQueued = this->doQueue (clone);
     SDL_UnlockMutex (this->m_queue->mutex);
 
-    if (gotQueued == false)
+    if (!gotQueued)
         av_packet_free (&pkt);
 }
 
@@ -324,11 +324,12 @@ void CAudioStream::dequeuePacket (AVPacket* output)
 
     while (g_KeepRunning)
     {
-        int ret = -1;
 
 #if FF_API_FIFO_OLD_API
-        ret = av_fifo_read (this->m_queue->packetList, &entry, 1);
+        int ret = av_fifo_read (this->m_queue->packetList, &entry, 1);
 #else
+		int ret = -1;
+
         if (av_fifo_size (this->m_queue->packetList) >= sizeof (entry))
             ret = av_fifo_generic_read (this->m_queue->packetList, &entry, sizeof (entry), nullptr);
 #endif
@@ -440,29 +441,23 @@ SDL_mutex* CAudioStream::getMutex ()
 
 void CAudioStream::stop ()
 {
-    if (this->isInitialized () == false)
+    if (!this->isInitialized ())
         return;
 
     // stop the threads running
     this->m_initialized = false;
 }
 
-int CAudioStream::resampleAudio (
-    AVFrame * decoded_audio_frame,
-    enum AVSampleFormat out_sample_fmt,
-    int out_channels,
-    int out_sample_rate,
-    uint8_t * out_buf
-)
+int CAudioStream::resampleAudio (AVFrame * decoded_audio_frame, uint8_t * out_buf)
 {
-    int ret = 0;
-    int out_nb_channels = 0;
-    int out_linesize = 0;
-    int in_nb_samples = 0;
-    int out_nb_samples = 0;
-    int max_out_nb_samples = 0;
-    uint8_t ** resampled_data = NULL;
-    int resampled_data_size = 0;
+	int out_linesize = 0;
+    int ret;
+    int out_nb_channels;
+    int in_nb_samples;
+    int out_nb_samples;
+    int max_out_nb_samples;
+    uint8_t** resampled_data = nullptr;
+    int resampled_data_size;
 
     // retrieve number of audio samples (per channel)
     in_nb_samples = decoded_audio_frame->nb_samples;
@@ -474,7 +469,7 @@ int CAudioStream::resampleAudio (
 
     max_out_nb_samples = out_nb_samples = av_rescale_rnd(
         in_nb_samples,
-        out_sample_rate,
+        this->m_audioContext.getSampleRate (),
         this->getContext ()->sample_rate,
         AV_ROUND_UP
     );
@@ -507,7 +502,7 @@ int CAudioStream::resampleAudio (
         &out_linesize,
         out_nb_channels,
         out_nb_samples,
-        out_sample_fmt,
+        this->m_audioContext.getFormat (),
         0
     );
 
@@ -520,7 +515,7 @@ int CAudioStream::resampleAudio (
     // retrieve output samples number taking into account the progressive delay
     out_nb_samples = av_rescale_rnd(
         swr_get_delay(this->m_swrctx, this->getContext ()->sample_rate) + in_nb_samples,
-        out_sample_rate,
+		this->m_audioContext.getSampleRate (),
         this->getContext ()->sample_rate,
         AV_ROUND_UP
     );
@@ -543,7 +538,7 @@ int CAudioStream::resampleAudio (
             &out_linesize,
             out_nb_channels,
             out_nb_samples,
-            out_sample_fmt,
+            this->m_audioContext.getFormat (),
             1
         );
 
@@ -561,7 +556,7 @@ int CAudioStream::resampleAudio (
     ret = swr_convert(
         this->m_swrctx,
         resampled_data,
-        out_nb_samples,
+        max_out_nb_samples,
         (const uint8_t **) decoded_audio_frame->data,
         decoded_audio_frame->nb_samples
     );
@@ -578,7 +573,7 @@ int CAudioStream::resampleAudio (
         &out_linesize,
         out_nb_channels,
         ret,
-        out_sample_fmt,
+        this->m_audioContext.getFormat (),
         1
     );
 
@@ -613,7 +608,7 @@ int CAudioStream::decodeFrame (uint8_t* audioBuffer, int bufferSize)
     static uint8_t *audio_pkt_data = NULL;
     static int audio_pkt_size = 0;
 
-    int len1, data_size = 0;
+    int len1, data_size;
 
     // allocate a new frame, used to decode audio packets
     static AVFrame * avFrame = NULL;
@@ -636,12 +631,10 @@ int CAudioStream::decodeFrame (uint8_t* audioBuffer, int bufferSize)
                 ret = 0;
             if (ret == 0)
                 ret = avcodec_send_packet(this->getContext (), pkt);
-            if (ret == AVERROR(EAGAIN))
-                ret = 0;
-            else if (ret < 0)
+            if (ret < 0 && ret != AVERROR (EAGAIN))
                 return -1;
-            else
-                len1 = pkt->size;
+
+			len1 = pkt->size;
 
             if (len1 < 0)
             {
@@ -656,13 +649,7 @@ int CAudioStream::decodeFrame (uint8_t* audioBuffer, int bufferSize)
 
             if (got_frame) {
                 // audio resampling
-                data_size = this->resampleAudio (
-                    avFrame,
-                    this->m_audioContext.getFormat (),
-                    this->m_audioContext.getChannels (),
-                    this->m_audioContext.getSampleRate (),
-                    audioBuffer
-                );
+                data_size = this->resampleAudio (avFrame, audioBuffer);
                 assert(data_size <= bufferSize);
             }
             if (data_size <= 0) {

+ 3 - 3
src/WallpaperEngine/Audio/CAudioStream.h

@@ -10,7 +10,7 @@ extern "C"
     #include <libswscale/swscale.h>
     #include <libswresample/swresample.h>
     #include <libavutil/opt.h>
-};
+}
 
 #include <SDL.h>
 #include <SDL_thread.h>
@@ -61,7 +61,7 @@ namespace WallpaperEngine::Audio
 
     private:
         void loadCustomContent (const char* filename = nullptr);
-        int resampleAudio (AVFrame * decoded_audio_frame, enum AVSampleFormat out_sample_fmt, int out_channels, int out_sample_rate, uint8_t* out_buf);
+        int resampleAudio (AVFrame * decoded_audio_frame, uint8_t* out_buf);
         bool doQueue (AVPacket* pkt);
         void initialize ();
 
@@ -100,4 +100,4 @@ namespace WallpaperEngine::Audio
             SDL_cond *cond;
         } *m_queue;
     };
-};
+}

+ 6 - 5
src/WallpaperEngine/Audio/Drivers/CSDLAudioDriver.cpp

@@ -24,11 +24,11 @@ void audio_callback (void* userdata, uint8_t* streamData, int length)
 
         // sound is not initialized or stopped and is not in loop mode
         // ignore mixing it in
-        if (buffer->stream->isInitialized () == false)
+        if (!buffer->stream->isInitialized ())
             continue;
 
-        // check if thread is empty and signal the read thread
-        if (buffer->stream->isQueueEmpty () == true)
+        // check if queue is empty and signal the read thread
+        if (buffer->stream->isQueueEmpty ())
         {
             SDL_CondSignal (buffer->stream->getWaitCondition ());
             continue;
@@ -74,7 +74,8 @@ void audio_callback (void* userdata, uint8_t* streamData, int length)
 }
 
 CSDLAudioDriver::CSDLAudioDriver () :
-    m_initialized (false)
+    m_initialized (false),
+	m_audioSpec ()
 {
     if (SDL_InitSubSystem (SDL_INIT_AUDIO) < 0)
     {
@@ -110,7 +111,7 @@ CSDLAudioDriver::CSDLAudioDriver () :
 
 CSDLAudioDriver::~CSDLAudioDriver ()
 {
-    if (this->m_initialized == false)
+    if (!this->m_initialized)
         return;
 
     SDL_CloseAudioDevice (this->m_deviceID);

+ 15 - 14
src/WallpaperEngine/Core/CObject.cpp

@@ -54,9 +54,9 @@ CObject* CObject::fromJSON (json data, CScene* scene, const CContainer& containe
     auto text_it = data.find ("text");
     auto light_it = data.find ("light");
 
-    CObject* object = nullptr;
+    CObject* object;
 
-    if (image_it != data.end () && (*image_it).is_null () == false)
+    if (image_it != data.end () && !(*image_it).is_null ())
     {
         object = Objects::CImage::fromJSON (
                 scene,
@@ -70,7 +70,7 @@ CObject* CObject::fromJSON (json data, CScene* scene, const CContainer& containe
                 WallpaperEngine::Core::aToVector3 (angles_val)
         );
     }
-    else if (sound_it != data.end () && (*sound_it).is_null () == false)
+    else if (sound_it != data.end () && !(*sound_it).is_null ())
     {
         object = Objects::CSound::fromJSON (
                 scene,
@@ -83,7 +83,7 @@ CObject* CObject::fromJSON (json data, CScene* scene, const CContainer& containe
                 WallpaperEngine::Core::aToVector3 (angles_val)
         );
     }
-    else if (particle_it != data.end () && (*particle_it).is_null () == false)
+    else if (particle_it != data.end () && !(*particle_it).is_null ())
     {
         /// TODO: XXXHACK -- TO REMOVE WHEN PARTICLE SUPPORT IS PROPERLY IMPLEMENTED
         try
@@ -99,17 +99,17 @@ CObject* CObject::fromJSON (json data, CScene* scene, const CContainer& containe
                 scale
             );
         }
-        catch (std::runtime_error ex)
+        catch (std::runtime_error& ex)
         {
             return nullptr;
         }
     }
-    else if (text_it != data.end () && (*text_it).is_null () == false)
+    else if (text_it != data.end () && !(*text_it).is_null ())
     {
         /// TODO: XXXHACK -- TO REMOVE WHEN TEXT SUPPORT IS IMPLEMENTED
         return nullptr;
     }
-    else if (light_it != data.end () && (*light_it).is_null () == false)
+    else if (light_it != data.end () && !(*light_it).is_null ())
     {
         /// TODO: XXXHACK -- TO REMOVE WHEN LIGHT SUPPORT IS IMPLEMENTED
         return nullptr;
@@ -119,23 +119,24 @@ CObject* CObject::fromJSON (json data, CScene* scene, const CContainer& containe
         sLog.exception ("Unknown object type detected: ", *name_it);
     }
 
-    if (effects_it != data.end () && (*effects_it).is_array () == true)
+    if (effects_it != data.end () && (*effects_it).is_array ())
     {
         for (const auto& cur : *effects_it)
         {
             auto effectVisible = jsonFindUserConfig <CUserSettingBoolean> (data, "visible", true);
-            
+
+			if (!effectVisible->processValue (scene->getProject ()->getProperties ()))
+				continue;
+
             object->insertEffect (
                 Objects::CEffect::fromJSON (cur, effectVisible, object, container)
             );
         }
     }
 
-    if (dependencies_it != data.end () && (*dependencies_it).is_array () == true)
-    {
+    if (dependencies_it != data.end () && (*dependencies_it).is_array ())
         for (const auto& cur : *dependencies_it)
             object->insertDependency (cur);
-    }
 
     return object;
 }
@@ -170,7 +171,7 @@ const std::vector<uint32_t>& CObject::getDependencies () const
     return this->m_dependencies;
 }
 
-const bool CObject::isVisible () const
+bool CObject::isVisible () const
 {
     // TODO: cache this
     return this->m_visible->processValue (this->getScene ()->getProject ()->getProperties ());
@@ -181,7 +182,7 @@ CScene* CObject::getScene () const
     return this->m_scene;
 }
 
-const int CObject::getId () const
+int CObject::getId () const
 {
     return this->m_id;
 }

+ 3 - 3
src/WallpaperEngine/Core/CObject.h

@@ -42,14 +42,14 @@ namespace WallpaperEngine::Core
 
         const std::vector<Objects::CEffect*>& getEffects () const;
         const std::vector<uint32_t>& getDependencies () const;
-        const int getId () const;
+        int getId () const;
 
         glm::vec3 getOrigin () const;
         glm::vec3 getScale () const;
         const glm::vec3& getAngles () const;
         const std::string& getName () const;
 
-        const bool isVisible () const;
+        bool isVisible () const;
         CScene* getScene () const;
     protected:
         CObject (
@@ -80,4 +80,4 @@ namespace WallpaperEngine::Core
 
         CScene* m_scene;
     };
-};
+}

+ 1 - 1
src/WallpaperEngine/Core/CProject.h

@@ -38,4 +38,4 @@ namespace WallpaperEngine::Core
         CWallpaper* m_wallpaper;
         CContainer& m_container;
     };
-};
+}

+ 1 - 1
src/WallpaperEngine/Core/CScene.h

@@ -97,4 +97,4 @@ namespace WallpaperEngine::Core
         std::map<uint32_t, CObject*> m_objects;
         std::vector<CObject*> m_objectsByRenderOrder;
     };
-};
+}

+ 2 - 4
src/WallpaperEngine/Core/CVideo.h

@@ -16,9 +16,7 @@ namespace WallpaperEngine::Core
     class CVideo : public CWallpaper
     {
     public:
-        CVideo (
-                std::string  filename
-        );
+        explicit CVideo (std::string filename);
 
         const std::string& getFilename ();
 
@@ -31,4 +29,4 @@ namespace WallpaperEngine::Core
 
     private:
     };
-};
+}

+ 5 - 2
src/WallpaperEngine/Core/CWallpaper.cpp

@@ -1,9 +1,12 @@
 #include "CWallpaper.h"
 
+#include <utility>
+
 using namespace WallpaperEngine::Core;
 
-CWallpaper::CWallpaper (std::string type) :
-    m_type (type)
+CWallpaper::CWallpaper (std::string  type) :
+    m_type (std::move(type)),
+	m_project (nullptr)
 {
 }
 

+ 2 - 2
src/WallpaperEngine/Core/CWallpaper.h

@@ -1,6 +1,6 @@
 #pragma once
 
-#include <assert.h>
+#include <cassert>
 
 #include "CProject.h"
 
@@ -16,7 +16,7 @@ namespace WallpaperEngine::Core
 
         template<class T> bool is () { return this->m_type == T::Type; }
 
-        CWallpaper (std::string type);
+        CWallpaper (std::string  type);
 
         CProject* getProject () const;
 

+ 3 - 3
src/WallpaperEngine/Core/Core.cpp

@@ -67,9 +67,9 @@ glm::vec3 Core::aToColorf (const std::string& str)
 
 glm::ivec3 Core::aToColori (const char* str)
 {
-    uint8_t r = static_cast <uint8_t> (strtol (str, const_cast<char **>(&str), 10)); while (*str == ' ') str ++;
-    uint8_t g = static_cast <uint8_t> (strtol (str, const_cast<char **>(&str), 10)); while (*str == ' ') str ++;
-    uint8_t b = static_cast <uint8_t> (strtol (str, const_cast<char **>(&str), 10));
+    auto r = static_cast <uint8_t> (strtol (str, const_cast<char **>(&str), 10)); while (*str == ' ') str ++;
+    auto g = static_cast <uint8_t> (strtol (str, const_cast<char **>(&str), 10)); while (*str == ' ') str ++;
+    auto b = static_cast <uint8_t> (strtol (str, const_cast<char **>(&str), 10));
 
     return {r, g, b};
 }

+ 1 - 1
src/WallpaperEngine/Core/Core.h

@@ -26,4 +26,4 @@ namespace WallpaperEngine::Core
     nlohmann::json::iterator jsonFindRequired (nlohmann::json::iterator& data, const char *key, const char *notFoundMsg);
     template <typename T> T jsonFindDefault (nlohmann::json& data, const char *key, T defaultValue);
     template <typename T> T* jsonFindUserConfig (nlohmann::json& data, const char *key, typename T::data_type defaultValue);
-};
+}

+ 9 - 11
src/WallpaperEngine/Core/Objects/CEffect.cpp

@@ -51,7 +51,7 @@ CEffect* CEffect::fromJSON (json data, CUserSettingBoolean* visible, Core::CObje
     auto dependencies_it = jsonFindRequired (content, "dependencies", "");
     auto fbos_it = content.find ("fbos");
 
-    CEffect* effect = new CEffect (
+    auto* effect = new CEffect (
         *name_it,
         description,
         *group_it,
@@ -64,9 +64,7 @@ CEffect* CEffect::fromJSON (json data, CUserSettingBoolean* visible, Core::CObje
     CEffect::dependencyFromJSON (dependencies_it, effect);
 
     if (fbos_it != content.end ())
-    {
         CEffect::fbosFromJSON (fbos_it, effect);
-    }
 
     if (effectpasses_it != data.end ())
     {
@@ -94,11 +92,11 @@ CEffect* CEffect::fromJSON (json data, CUserSettingBoolean* visible, Core::CObje
                     {
                         std::string texture;
 
-                        if (texturesCur.is_null () == true)
+                        if (texturesCur.is_null ())
                         {
                             if (textureNumber == 0)
                             {
-                                CImage* image = object->as <CImage> ();
+                                auto* image = object->as <CImage> ();
 
                                 texture = (*(*image->getMaterial ()->getPasses ().begin ())->getTextures ().begin ());
                             }
@@ -151,13 +149,13 @@ void CEffect::constantsFromJSON (json::const_iterator constants_it, Core::Object
     {
         auto val = cur.value ();
 
-        Effects::Constants::CShaderConstant* constant = nullptr;
+        Effects::Constants::CShaderConstant* constant;
 
         // if the constant is an object, that means the constant has some extra information
         // for the UI, take the value, which is what we need
 
         // TODO: SUPPORT USER SETTINGS HERE
-        if (cur.value ().is_object () == true)
+        if (cur.value ().is_object ())
         {
             auto it = cur.value ().find ("value");
 
@@ -170,15 +168,15 @@ void CEffect::constantsFromJSON (json::const_iterator constants_it, Core::Object
             val = it.value ();
         }
 
-        if (val.is_number_float () == true)
+        if (val.is_number_float ())
         {
             constant = new Effects::Constants::CShaderConstantFloat (val.get <float> ());
         }
-        else if (val.is_number_integer () == true)
+        else if (val.is_number_integer ())
         {
             constant = new Effects::Constants::CShaderConstantInteger (val.get <int> ());
         }
-        else if (val.is_string () == true)
+        else if (val.is_string ())
         {
             // try a vector 4 first, then a vector3 and then a vector 2
             constant = new Effects::Constants::CShaderConstantVector4 (WallpaperEngine::Core::aToVector4 (val));
@@ -215,7 +213,7 @@ void CEffect::materialsFromJSON (json::const_iterator passes_it, CEffect* effect
         if (materialfile == cur.end ())
             sLog.exception ("Found an effect ", effect->m_name, " without material");
 
-        Images::CMaterial* material = nullptr;
+        Images::CMaterial* material;
 
         if (target == cur.end ())
             material = Images::CMaterial::fromFile ((*materialfile).get <std::string> (), container);

+ 1 - 1
src/WallpaperEngine/Core/Objects/CEffect.h

@@ -10,7 +10,7 @@
 namespace WallpaperEngine::Core
 {
     class CObject;
-};
+}
 
 namespace WallpaperEngine::Core::UserSettings
 {

+ 4 - 4
src/WallpaperEngine/Core/Objects/CImage.cpp

@@ -70,7 +70,7 @@ WallpaperEngine::Core::CObject* CImage::fromJSON (
         Images::CMaterial::fromFile ((*material_it).get <std::string> (), container),
         visible,
         id,
-        name,
+        std::move(name),
         origin,
         scale,
         angles,
@@ -99,7 +99,7 @@ const std::string& CImage::getAlignment () const
     return this->m_alignment;
 }
 
-const float CImage::getAlpha () const
+float CImage::getAlpha () const
 {
     return this->m_alpha->processValue (this->getScene ()->getProject ()->getProperties ());
 }
@@ -109,12 +109,12 @@ glm::vec3 CImage::getColor () const
     return this->m_color->processValue (this->getScene ()->getProject ()->getProperties ());
 }
 
-const float CImage::getBrightness () const
+float CImage::getBrightness () const
 {
     return this->m_brightness;
 }
 
-const uint32_t CImage::getColorBlendMode () const
+uint32_t CImage::getColorBlendMode () const
 {
     return this->m_colorBlendMode;
 }

+ 4 - 4
src/WallpaperEngine/Core/Objects/CImage.h

@@ -41,10 +41,10 @@ namespace WallpaperEngine::Core::Objects
         const Images::CMaterial* getMaterial () const;
         const glm::vec2& getSize () const;
         const std::string& getAlignment () const;
-        const float getAlpha () const;
+        float getAlpha () const;
         glm::vec3 getColor () const;
-        const float getBrightness () const;
-        const uint32_t getColorBlendMode () const;
+        float getBrightness () const;
+        uint32_t getColorBlendMode () const;
         const glm::vec2& getParallaxDepth () const;
 
     protected:
@@ -78,4 +78,4 @@ namespace WallpaperEngine::Core::Objects
         CUserSettingVector3* m_color;
         uint32_t m_colorBlendMode;
     };
-};
+}

+ 4 - 2
src/WallpaperEngine/Core/Objects/CParticle.cpp

@@ -1,4 +1,6 @@
 #include "CParticle.h"
+
+#include <utility>
 #include "WallpaperEngine/FileSystem/FileSystem.h"
 
 using namespace WallpaperEngine::Core::Objects;
@@ -20,13 +22,13 @@ CParticle* CParticle::fromFile (
     auto emitter_it = jsonFindRequired (data, "emitter", "Particles must have emitters");
     auto initializer_it = jsonFindRequired (data, "initializer", "Particles must have initializers");
 
-    CParticle* particle = new CParticle (
+    auto* particle = new CParticle (
         scene,
         *starttime_it,
         *maxcount_it,
         visible,
         id,
-        name,
+        std::move(name),
         origin,
         scale
     );

+ 1 - 1
src/WallpaperEngine/Core/Objects/CParticle.h

@@ -54,4 +54,4 @@ namespace WallpaperEngine::Core::Objects
         std::vector<Particles::CEmitter*> m_emitters;
         std::vector<Particles::CInitializer*> m_initializers;
     };
-};
+}

+ 4 - 4
src/WallpaperEngine/Core/Objects/CSound.cpp

@@ -24,7 +24,7 @@ WallpaperEngine::Core::CObject* CSound::fromJSON (
         json data,
         CUserSettingBoolean* visible,
         uint32_t id,
-        std::string name,
+        const std::string& name,
         CUserSettingVector3* origin,
         CUserSettingVector3* scale,
         const glm::vec3& angles)
@@ -37,10 +37,10 @@ WallpaperEngine::Core::CObject* CSound::fromJSON (
     if (playbackmode == "loop")
         repeat = true;
 
-    if ((*sound_it).is_array () == false)
+    if (!(*sound_it).is_array ())
         sLog.exception ("Expected sound list on element ", name);
 
-    CSound* sound = new CSound (
+    auto* sound = new CSound (
         scene,
         visible,
         id,
@@ -57,7 +57,7 @@ WallpaperEngine::Core::CObject* CSound::fromJSON (
     return sound;
 }
 
-void CSound::insertSound (std::string filename)
+void CSound::insertSound (const std::string& filename)
 {
     this->m_sounds.push_back (filename);
 }

+ 2 - 2
src/WallpaperEngine/Core/Objects/CSound.h

@@ -19,13 +19,13 @@ namespace WallpaperEngine::Core::Objects
             json data,
             CUserSettingBoolean* visible,
             uint32_t id,
-            std::string name,
+            const std::string& name,
             CUserSettingVector3* origin,
             CUserSettingVector3* scale,
             const glm::vec3& angles
         );
 
-        void insertSound (std::string filename);
+        void insertSound (const std::string& filename);
         const std::vector<std::string>& getSounds () const;
         bool isRepeat () const;
 

+ 1 - 1
src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstant.h

@@ -7,7 +7,7 @@ namespace WallpaperEngine::Core::Objects::Effects::Constants
     class CShaderConstant
     {
     public:
-        CShaderConstant (std::string  type);
+        explicit CShaderConstant (std::string type);
 
         template<class T> const T* as () const { assert (is <T> ()); return (const T*) this; }
         template<class T> T* as () { assert (is <T> ()); return (T*) this; }

+ 1 - 1
src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantFloat.h

@@ -9,7 +9,7 @@ namespace WallpaperEngine::Core::Objects::Effects::Constants
     class CShaderConstantFloat : public CShaderConstant
     {
     public:
-        CShaderConstantFloat (float value);
+        explicit CShaderConstantFloat (float value);
 
         float* getValue ();
 

+ 1 - 1
src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantInteger.h

@@ -9,7 +9,7 @@ namespace WallpaperEngine::Core::Objects::Effects::Constants
     class CShaderConstantInteger : public CShaderConstant
     {
     public:
-        CShaderConstantInteger (int32_t value);
+        explicit CShaderConstantInteger (int32_t value);
 
         int32_t* getValue ();
 

+ 1 - 1
src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantVector2.cpp

@@ -14,4 +14,4 @@ glm::vec2* CShaderConstantVector2::getValue ()
     return &this->m_value;
 }
 
-const std::string CShaderConstantVector3::Type = "vec2";
+const std::string CShaderConstantVector2::Type = "vec2";

+ 2 - 1
src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantVector2.h

@@ -3,6 +3,7 @@
 #include "CShaderConstant.h"
 
 #include <string>
+#include <glm/vec2.hpp>
 #include <glm/vec3.hpp>
 
 namespace WallpaperEngine::Core::Objects::Effects::Constants
@@ -10,7 +11,7 @@ namespace WallpaperEngine::Core::Objects::Effects::Constants
     class CShaderConstantVector2 : public CShaderConstant
     {
     public:
-        CShaderConstantVector2 (glm::vec2 value);
+        explicit CShaderConstantVector2 (glm::vec2 value);
 
         glm::vec2* getValue ();
 

+ 1 - 1
src/WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstantVector3.h

@@ -10,7 +10,7 @@ namespace WallpaperEngine::Core::Objects::Effects::Constants
     class CShaderConstantVector3 : public CShaderConstant
     {
     public:
-        CShaderConstantVector3 (glm::vec3 value);
+        explicit CShaderConstantVector3 (glm::vec3 value);
 
         glm::vec3* getValue ();
 

+ 8 - 7
src/WallpaperEngine/Core/Objects/Images/CMaterial.cpp

@@ -1,6 +1,7 @@
 #include "CMaterial.h"
 
 #include <nlohmann/json.hpp>
+#include <utility>
 
 #include "WallpaperEngine/FileSystem/FileSystem.h"
 
@@ -9,9 +10,9 @@ using namespace WallpaperEngine::Assets;
 using namespace WallpaperEngine::Core::Objects;
 using namespace WallpaperEngine::Core::Objects::Images;
 
-CMaterial::CMaterial (const std::string& name) :
-    m_target (""),
-    m_name (name)
+CMaterial::CMaterial (std::string  name) :
+    m_target (),
+    m_name (std::move(name))
 {
 }
 
@@ -30,7 +31,7 @@ CMaterial* CMaterial::fromFile (const std::string& filename, const std::string&
 
 CMaterial* CMaterial::fromJSON (const std::string& name, json data, const std::string& target)
 {
-    CMaterial* material = fromJSON (name, data);
+    CMaterial* material = fromJSON (name, std::move(data));
 
     material->setTarget (target);
 
@@ -41,7 +42,7 @@ CMaterial* CMaterial::fromJSON (const std::string& name, json data)
 {
     auto passes_it = jsonFindRequired (data, "passes", "Material must have at least one pass");
 
-    CMaterial* material = new CMaterial (name);
+    auto* material = new CMaterial (name);
 
     for (const auto& cur : (*passes_it))
         material->insertPass (Materials::CPass::fromJSON (cur));
@@ -83,7 +84,7 @@ const std::string& CMaterial::getName () const
     return this->m_name;
 }
 
-const bool CMaterial::hasTarget () const
+bool CMaterial::hasTarget () const
 {
-    return this->m_target.empty () == false;
+    return !this->m_target.empty ();
 }

+ 3 - 3
src/WallpaperEngine/Core/Objects/Images/CMaterial.h

@@ -25,10 +25,10 @@ namespace WallpaperEngine::Core::Objects::Images
         const std::vector <Materials::CPass*>& getPasses () const;
         const std::map <int, Effects::CBind*>& getTextureBinds () const;
         const std::string& getTarget () const;
-        const bool hasTarget () const;
+        bool hasTarget () const;
         const std::string& getName () const;
     protected:
-        CMaterial (const std::string& name);
+        explicit CMaterial (std::string  name);
 
         void setTarget (const std::string& target);
     private:
@@ -37,4 +37,4 @@ namespace WallpaperEngine::Core::Objects::Images
         std::string m_target;
         std::string m_name;
     };
-};
+}

+ 8 - 19
src/WallpaperEngine/Core/Objects/Images/Materials/CPass.cpp

@@ -1,6 +1,8 @@
 #include "common.h"
 #include "CPass.h"
 
+#include <utility>
+
 using namespace WallpaperEngine::Core::Objects::Effects::Constants;
 using namespace WallpaperEngine::Core::Objects::Images::Materials;
 
@@ -27,11 +29,11 @@ CPass* CPass::fromJSON (json data)
     if (textures_it != data.end ())
     {
         // TODO: FETCH THIS FROM CImage TO MAKE IT COMPATIBLE WITH OLDER WALLPAPERS
-        if ((*textures_it).is_array () == false)
+        if (!(*textures_it).is_array ())
             sLog.exception ("Material's textures must be a list");
     }
 
-    CPass* pass = new CPass (
+    auto* pass = new CPass (
         blending,
         cullmode,
         *depthtest_it,
@@ -40,28 +42,15 @@ CPass* CPass::fromJSON (json data)
     );
 
     if (textures_it != data.end ())
-    {
         for (const auto& cur : (*textures_it))
-        {
-            if (cur.is_null () == true)
-            {
-                pass->insertTexture ("");
-            }
-            else
-            {
-                pass->insertTexture (cur);
-            }
-        }
-    }
+			pass->insertTexture (cur.is_null () ? "" : cur);
 
     if (combos_it != data.end ())
     {
         for (const auto& cur : (*combos_it).items ())
         {
-            std::string name = cur.key ();
-
-            if (cur.value ().is_number_integer () == true)
-                pass->insertCombo (name, cur.value ());
+            if (cur.value ().is_number_integer ())
+                pass->insertCombo (cur.key (), cur.value ());
             else
                 sLog.exception ("unexpected non-integer combo on pass");
         }
@@ -128,7 +117,7 @@ const std::string& CPass::getDepthWrite ()const
     return this->m_depthwrite;
 }
 
-void CPass::setBlendingMode (std::string mode)
+void CPass::setBlendingMode (const std::string& mode)
 {
     this->m_blending = mode;
 }

+ 2 - 2
src/WallpaperEngine/Core/Objects/Images/Materials/CPass.h

@@ -7,7 +7,7 @@
 namespace WallpaperEngine::Core::Objects
 {
     class CEffect;
-};
+}
 
 namespace WallpaperEngine::Core::Objects::Images::Materials
 {
@@ -28,7 +28,7 @@ namespace WallpaperEngine::Core::Objects::Images::Materials
         const std::string& getCullingMode () const;
         const std::string& getDepthTest () const;
         const std::string& getDepthWrite () const;
-        void setBlendingMode (std::string mode);
+        void setBlendingMode (const std::string& mode);
 
         void insertCombo (const std::string& name, int value);
         void insertConstant (const std::string& name, Effects::Constants::CShaderConstant* constant);

+ 6 - 6
src/WallpaperEngine/Core/Objects/Particles/CControlPoint.cpp

@@ -8,17 +8,13 @@ CControlPoint* CControlPoint::fromJSON (json data)
     auto id_it = jsonFindRequired (data, "id", "Particle's control point must have id");
     auto offset_it = data.find ("offset");
 
-    CControlPoint* controlpoint = new CControlPoint (*id_it, 0);
+    auto* controlpoint = new CControlPoint (*id_it, 0);
 
     if (offset_it != data.end ())
-    {
         controlpoint->setOffset (WallpaperEngine::Core::aToVector3 (*offset_it));
-    }
 
     if (flags_it != data.end ())
-    {
         controlpoint->setFlags (*flags_it);
-    }
 
     return controlpoint;
 }
@@ -39,13 +35,17 @@ void CControlPoint::setFlags (uint32_t flags)
 {
     this->m_flags = flags;
 }
+uint32_t CControlPoint::getId () const
+{
+	return this->m_id;
+}
 
 const glm::vec3& CControlPoint::getOffset () const
 {
     return this->m_offset;
 }
 
-const uint32_t CControlPoint::getFlags () const
+uint32_t CControlPoint::getFlags () const
 {
     return this->m_flags;
 }

+ 4 - 3
src/WallpaperEngine/Core/Objects/Particles/CControlPoint.h

@@ -11,10 +11,11 @@ namespace WallpaperEngine::Core::Objects::Particles
     public:
         static CControlPoint* fromJSON (json data);
 
+		uint32_t getId () const;
         const glm::vec3& getOffset () const;
-        const uint32_t getFlags () const;
+        uint32_t getFlags () const;
     protected:
-        CControlPoint (uint32_t id, uint32_t flags = 0);
+        explicit CControlPoint (uint32_t id, uint32_t flags = 0);
 
         void setOffset (const glm::vec3& offset);
         void setFlags (uint32_t flags);
@@ -23,4 +24,4 @@ namespace WallpaperEngine::Core::Objects::Particles
         uint32_t m_flags;
         glm::vec3 m_offset;
     };
-};
+}

+ 4 - 0
src/WallpaperEngine/Core/Objects/Particles/CEmitter.cpp

@@ -41,6 +41,10 @@ CEmitter::CEmitter (
 {
 }
 
+uint32_t CEmitter::getId () const
+{
+	return this->m_id;
+}
 
 const std::string& CEmitter::getName () const
 {

+ 2 - 1
src/WallpaperEngine/Core/Objects/Particles/CEmitter.h

@@ -11,6 +11,7 @@ namespace WallpaperEngine::Core::Objects::Particles
     public:
         static CEmitter* fromJSON (json data);
 
+		uint32_t getId () const;
         const std::string& getName () const;
         const uint32_t getDistanceMax () const;
         const uint32_t getDistanceMin () const;
@@ -36,4 +37,4 @@ namespace WallpaperEngine::Core::Objects::Particles
         glm::vec3 m_origin;
         double m_rate;
     };
-};
+}

+ 1 - 1
src/WallpaperEngine/Core/Objects/Particles/CInitializer.cpp

@@ -69,7 +69,7 @@ const std::string& CInitializer::getName () const
     return this->m_name;
 }
 
-const uint32_t CInitializer::getId () const
+uint32_t CInitializer::getId () const
 {
     return this->m_id;
 }

+ 2 - 2
src/WallpaperEngine/Core/Objects/Particles/CInitializer.h

@@ -12,11 +12,11 @@ namespace WallpaperEngine::Core::Objects::Particles
         static CInitializer* fromJSON (json data);
 
         const std::string& getName () const;
-        const uint32_t getId () const;
+        uint32_t getId () const;
     protected:
         CInitializer (uint32_t id, std::string name);
     private:
         uint32_t m_id;
         std::string m_name;
     };
-};
+}

+ 2 - 2
src/WallpaperEngine/Core/Objects/Particles/Initializers/CAlphaRandom.cpp

@@ -17,12 +17,12 @@ CAlphaRandom::CAlphaRandom (uint32_t id, double min, double max) :
 {
 }
 
-const double CAlphaRandom::getMinimum () const
+double CAlphaRandom::getMinimum () const
 {
     return this->m_min;
 }
 
-const double CAlphaRandom::getMaximum () const
+double CAlphaRandom::getMaximum () const
 {
     return this->m_max;
 }

+ 3 - 3
src/WallpaperEngine/Core/Objects/Particles/Initializers/CAlphaRandom.h

@@ -9,8 +9,8 @@ namespace WallpaperEngine::Core::Objects::Particles::Initializers
     class CAlphaRandom : CInitializer
     {
     public:
-        const double getMinimum () const;
-        const double getMaximum () const;
+        double getMinimum () const;
+        double getMaximum () const;
     protected:
         friend class CInitializer;
 
@@ -21,4 +21,4 @@ namespace WallpaperEngine::Core::Objects::Particles::Initializers
         double m_max;
         double m_min;
     };
-};
+}

+ 1 - 1
src/WallpaperEngine/Core/Objects/Particles/Initializers/CAngularVelocityRandom.h

@@ -21,4 +21,4 @@ namespace WallpaperEngine::Core::Objects::Particles::Initializers
         glm::vec3 m_max;
         glm::vec3 m_min;
     };
-};
+}

+ 1 - 1
src/WallpaperEngine/Core/Objects/Particles/Initializers/CColorRandom.h

@@ -21,4 +21,4 @@ namespace WallpaperEngine::Core::Objects::Particles::Initializers
         glm::ivec3 m_max;
         glm::ivec3 m_min;
     };
-};
+}

+ 2 - 2
src/WallpaperEngine/Core/Objects/Particles/Initializers/CLifeTimeRandom.cpp

@@ -18,12 +18,12 @@ CLifeTimeRandom::CLifeTimeRandom (uint32_t id, uint32_t min, uint32_t max) :
 {
 }
 
-const uint32_t CLifeTimeRandom::getMinimum () const
+uint32_t CLifeTimeRandom::getMinimum () const
 {
     return this->m_min;
 }
 
-const uint32_t CLifeTimeRandom::getMaximum () const
+uint32_t CLifeTimeRandom::getMaximum () const
 {
     return this->m_max;
 }

+ 3 - 3
src/WallpaperEngine/Core/Objects/Particles/Initializers/CLifeTimeRandom.h

@@ -9,8 +9,8 @@ namespace WallpaperEngine::Core::Objects::Particles::Initializers
     class CLifeTimeRandom : CInitializer
     {
     public:
-        const uint32_t getMinimum () const;
-        const uint32_t getMaximum () const;
+        uint32_t getMinimum () const;
+        uint32_t getMaximum () const;
     protected:
         friend class CInitializer;
 
@@ -21,4 +21,4 @@ namespace WallpaperEngine::Core::Objects::Particles::Initializers
         uint32_t m_max;
         uint32_t m_min;
     };
-};
+}

+ 12 - 12
src/WallpaperEngine/Core/Objects/Particles/Initializers/CRotationRandom.cpp

@@ -60,42 +60,42 @@ CRotationRandom::CRotationRandom (
 {
 }
 
-const glm::vec3 CRotationRandom::getMinimumVector () const
+glm::vec3 CRotationRandom::getMinimumVector () const
 {
     return this->m_minVector;
 }
 
-const glm::vec3 CRotationRandom::getMaximumVector () const
+glm::vec3 CRotationRandom::getMaximumVector () const
 {
     return this->m_maxVector;
 }
 
-const double CRotationRandom::getMinimumNumber () const
+double CRotationRandom::getMinimumNumber () const
 {
     return this->m_minNumber;
 }
 
-const double CRotationRandom::getMaximumNumber () const
+double CRotationRandom::getMaximumNumber () const
 {
     return this->m_maxNumber;
 }
 
-const bool CRotationRandom::isMinimumVector () const
+bool CRotationRandom::isMinimumVector () const
 {
-    return this->m_isMinimumVector == true;
+    return this->m_isMinimumVector;
 }
 
-const bool CRotationRandom::isMinimumNumber () const
+bool CRotationRandom::isMinimumNumber () const
 {
-    return this->m_isMinimumVector == false;
+    return !this->m_isMinimumVector;
 }
 
-const bool CRotationRandom::isMaximumVector () const
+bool CRotationRandom::isMaximumVector () const
 {
-    return this->m_isMaximumVector == true;
+    return this->m_isMaximumVector;
 }
 
-const bool CRotationRandom::isMaximumNumber () const
+bool CRotationRandom::isMaximumNumber () const
 {
-    return this->m_isMaximumVector == false;
+    return !this->m_isMaximumVector;
 }

+ 9 - 9
src/WallpaperEngine/Core/Objects/Particles/Initializers/CRotationRandom.h

@@ -9,15 +9,15 @@ namespace WallpaperEngine::Core::Objects::Particles::Initializers
     class CRotationRandom : CInitializer
     {
     public:
-        const glm::vec3 getMinimumVector () const;
-        const glm::vec3 getMaximumVector () const;
-        const double             getMinimumNumber () const;
-        const double             getMaximumNumber () const;
+        glm::vec3 getMinimumVector () const;
+        glm::vec3 getMaximumVector () const;
+        double             getMinimumNumber () const;
+        double             getMaximumNumber () const;
 
-        const bool isMinimumVector () const;
-        const bool isMinimumNumber () const;
-        const bool isMaximumVector () const;
-        const bool isMaximumNumber () const;
+        bool isMinimumVector () const;
+        bool isMinimumNumber () const;
+        bool isMaximumVector () const;
+        bool isMaximumNumber () const;
 
     protected:
         friend class CInitializer;
@@ -42,4 +42,4 @@ namespace WallpaperEngine::Core::Objects::Particles::Initializers
         bool m_isMinimumVector;
         bool m_isMaximumVector;
     };
-};
+}

+ 2 - 2
src/WallpaperEngine/Core/Objects/Particles/Initializers/CSizeRandom.cpp

@@ -17,12 +17,12 @@ CSizeRandom::CSizeRandom (uint32_t id, uint32_t min, uint32_t max) :
 {
 }
 
-const uint32_t CSizeRandom::getMinimum () const
+uint32_t CSizeRandom::getMinimum () const
 {
     return this->m_min;
 }
 
-const uint32_t CSizeRandom::getMaximum () const
+uint32_t CSizeRandom::getMaximum () const
 {
     return this->m_max;
 }

+ 3 - 3
src/WallpaperEngine/Core/Objects/Particles/Initializers/CSizeRandom.h

@@ -9,8 +9,8 @@ namespace WallpaperEngine::Core::Objects::Particles::Initializers
     class CSizeRandom : CInitializer
     {
     public:
-        const uint32_t getMinimum () const;
-        const uint32_t getMaximum () const;
+        uint32_t getMinimum () const;
+        uint32_t getMaximum () const;
     protected:
         friend class CInitializer;
 
@@ -21,4 +21,4 @@ namespace WallpaperEngine::Core::Objects::Particles::Initializers
         uint32_t m_max;
         uint32_t m_min;
     };
-};
+}

+ 1 - 1
src/WallpaperEngine/Core/Objects/Particles/Initializers/CTurbulentVelocityRandom.h

@@ -29,4 +29,4 @@ namespace WallpaperEngine::Core::Objects::Particles::Initializers
         uint32_t m_speedmin;
         uint32_t m_speedmax;
     };
-};
+}

+ 1 - 1
src/WallpaperEngine/Core/Objects/Particles/Initializers/CVelocityRandom.h

@@ -21,4 +21,4 @@ namespace WallpaperEngine::Core::Objects::Particles::Initializers
         glm::vec3 m_max;
         glm::vec3 m_min;
     };
-};
+}

+ 3 - 7
src/WallpaperEngine/Core/Projects/CPropertyBoolean.cpp

@@ -8,16 +8,12 @@ using namespace WallpaperEngine::Core::Projects;
 CPropertyBoolean* CPropertyBoolean::fromJSON (json data, const std::string& name)
 {
     json::const_iterator value = data.find ("value");
-    std::string text = jsonFindDefault <std::string> (data, "text", "");
+    auto text = jsonFindDefault <std::string> (data, "text", "");
 
-    return new CPropertyBoolean (
-        *value,
-        name,
-        text
-    );
+    return new CPropertyBoolean (*value, name, text);
 }
 
-bool CPropertyBoolean::getValue ()
+bool CPropertyBoolean::getValue () const
 {
     return this->m_value;
 }

+ 2 - 2
src/WallpaperEngine/Core/Projects/CPropertyBoolean.h

@@ -11,7 +11,7 @@ namespace WallpaperEngine::Core::Projects
     public:
         static CPropertyBoolean* fromJSON (json data, const std::string& name);
 
-        bool getValue ();
+        bool getValue () const;
         std::string dump () const override;
         void update (const std::string& value) override;
 
@@ -22,4 +22,4 @@ namespace WallpaperEngine::Core::Projects
 
         bool m_value;
     };
-};
+}

+ 2 - 6
src/WallpaperEngine/Core/Projects/CPropertyColor.cpp

@@ -29,13 +29,9 @@ glm::vec3 ParseColor (std::string value)
 CPropertyColor* CPropertyColor::fromJSON (json data, const std::string& name)
 {
     std::string value = *jsonFindRequired (data, "value", "Color property must have a value");
-    std::string text = jsonFindDefault <std::string> (data, "text", "");
+    auto text = jsonFindDefault <std::string> (data, "text", "");
 
-    return new CPropertyColor (
-        ParseColor (value),
-        name,
-        text
-    );
+    return new CPropertyColor (ParseColor (value), name, text);
 }
 
 const glm::vec3& CPropertyColor::getValue () const

+ 1 - 1
src/WallpaperEngine/Core/Projects/CPropertyColor.h

@@ -24,4 +24,4 @@ namespace WallpaperEngine::Core::Projects
 
         glm::vec3 m_color;
     };
-};
+}

+ 8 - 10
src/WallpaperEngine/Core/Projects/CPropertyCombo.cpp

@@ -11,29 +11,29 @@ using namespace WallpaperEngine::Core::Projects;
 CPropertyCombo* CPropertyCombo::fromJSON (json data, const std::string& name)
 {
     auto value = data.find ("value");
-    std::string text = jsonFindDefault <std::string> (data, "text", "");
+    auto text = jsonFindDefault <std::string> (data, "text", "");
     auto options = jsonFindRequired (data, "options", "Options for a property combo is required");
 
-    CPropertyCombo* combo = new CPropertyCombo (
+    auto* combo = new CPropertyCombo (
         name,
         text,
         *value
     );
 
-    if (options->is_array () == false)
+    if (!options->is_array ())
         sLog.exception ("Property combo options should be an array");
 
     for (auto& cur : (*options))
     {
         // TODO: PROPERLY REPORT THESE ISSUES
-        if (cur.is_object () == false)
+        if (!cur.is_object ())
             continue;
 
         // check for label and value to ensure they're there
         auto label = jsonFindRequired (cur, "label", "Label is required for a property combo option");
-        auto value = jsonFindRequired (cur, "value", "Value is required for a property combo option");
+        auto propertyValue = jsonFindRequired (cur, "value", "Value is required for a property combo option");
 
-        combo->addValue (*label, *value);
+        combo->addValue (*label, *propertyValue);
     }
 
     return combo;
@@ -61,9 +61,7 @@ std::string CPropertyCombo::dump () const
         << "\t\t" << "Posible values:" << std::endl;
 
     for (auto cur : this->m_values)
-    {
         ss << "\t\t" << cur->label << " -> " << cur->value << std::endl;
-    }
 
     return ss.str();
 }
@@ -81,7 +79,7 @@ void CPropertyCombo::update (const std::string& value)
         found = true;
     }
 
-    if (found == false)
+    if (!found)
         sLog.exception ("Assigning invalid value to property ", this->m_name);
 
     this->m_defaultValue = value;
@@ -90,7 +88,7 @@ void CPropertyCombo::update (const std::string& value)
 
 void CPropertyCombo::addValue (std::string label, std::string value)
 {
-    CPropertyComboValue* prop = new CPropertyComboValue;
+    auto* prop = new CPropertyComboValue;
 
     prop->label = std::move (label);
     prop->value = std::move (value);

+ 1 - 1
src/WallpaperEngine/Core/Projects/CPropertyCombo.h

@@ -32,4 +32,4 @@ namespace WallpaperEngine::Core::Projects
         std::vector <CPropertyComboValue*> m_values;
         std::string m_defaultValue;
     };
-};
+}

+ 3 - 10
src/WallpaperEngine/Core/Projects/CPropertySlider.cpp

@@ -7,19 +7,12 @@ using namespace WallpaperEngine::Core::Projects;
 CPropertySlider* CPropertySlider::fromJSON (json data, const std::string& name)
 {
     auto value = data.find ("value");
-    std::string text = jsonFindDefault <std::string> (data, "text", "");
+    auto text = jsonFindDefault <std::string> (data, "text", "");
     auto min = jsonFindDefault(data, "min", 0.0);
     auto max = jsonFindDefault (data, "max", 0.0);
     auto step = jsonFindDefault (data, "step", 0.0);
 
-    return new CPropertySlider (
-        *value,
-        name,
-        text,
-        min,
-        max,
-        step
-    );
+    return new CPropertySlider (*value, name, text, min, max, step);
 }
 
 const double& CPropertySlider::getValue () const
@@ -59,7 +52,7 @@ std::string CPropertySlider::dump () const
 
 void CPropertySlider::update (const std::string& value)
 {
-    double newValue = atof (value.c_str ());
+    double newValue = strtod (value.c_str (), nullptr);
 
     if (newValue < this->m_min || newValue > this->m_max)
         sLog.exception ("Slider value (", newValue, ") is out of range (", this->m_min, ",", this->m_max, ")");

+ 1 - 1
src/WallpaperEngine/Core/Projects/CPropertySlider.h

@@ -30,4 +30,4 @@ namespace WallpaperEngine::Core::Projects
         double m_max;
         double m_step;
     };
-};
+}

+ 1 - 1
src/WallpaperEngine/Core/Projects/CPropertyText.h

@@ -18,4 +18,4 @@ namespace WallpaperEngine::Core::Projects
     private:
         CPropertyText (const std::string& name, const std::string& text);
     };
-};
+}

+ 1 - 1
src/WallpaperEngine/Core/Scenes/CCamera.h

@@ -21,4 +21,4 @@ namespace WallpaperEngine::Core::Scenes
         glm::vec3 m_eye;
         glm::vec3 m_up;
     };
-};
+}

+ 6 - 3
src/WallpaperEngine/Core/Scenes/CProjection.cpp

@@ -3,13 +3,16 @@
 using namespace WallpaperEngine::Core::Scenes;
 
 CProjection::CProjection (uint32_t width, uint32_t height) :
+	m_isAuto (false),
     m_width (width),
     m_height (height)
 {
 }
 
 CProjection::CProjection (bool isAuto) :
-    m_isAuto (isAuto)
+    m_isAuto (isAuto),
+	m_width (0),
+	m_height (0)
 {
 }
 
@@ -23,7 +26,7 @@ const uint32_t& CProjection::getHeight () const
     return this->m_height;
 }
 
-const bool CProjection::isAuto () const
+bool CProjection::isAuto () const
 {
     return this->m_isAuto;
 }
@@ -46,7 +49,7 @@ CProjection* CProjection::fromJSON (json data)
     auto height_it = jsonFindRequired (data, "height", "Projection must have height");
 
     // TODO: PROPERLY SUPPORT AUTO-DETECTING SIZE
-    if (auto_it == true)
+    if (auto_it)
         return new CProjection (true);
     else
         return new CProjection (

+ 2 - 2
src/WallpaperEngine/Core/Scenes/CProjection.h

@@ -13,7 +13,7 @@ namespace WallpaperEngine::Core::Scenes
 
         const uint32_t& getWidth () const;
         const uint32_t& getHeight () const;
-        const bool isAuto () const;
+        bool isAuto () const;
 
         void setWidth (uint32_t width);
         void setHeight (uint32_t height);
@@ -26,4 +26,4 @@ namespace WallpaperEngine::Core::Scenes
         uint32_t m_height;
         bool m_isAuto;
     };
-};
+}

+ 7 - 7
src/WallpaperEngine/Core/UserSettings/CUserSettingBoolean.cpp

@@ -26,15 +26,15 @@ CUserSettingBoolean* CUserSettingBoolean::fromJSON (nlohmann::json& data)
 {
     bool hasCondition = false;
     bool hasSource = false;
-    bool defaultValue = false;
+    bool defaultValue;
     std::string source;
     std::string expectedValue;
 
-    if (data.is_object () == true)
+    if (data.is_object ())
     {
         hasSource = true;
         auto userIt = data.find ("user");
-        defaultValue = jsonFindDefault (data, "value", false); // is this default value right?
+        defaultValue = jsonFindDefault (data, "value", true); // is this default value right?
 
         if (userIt != data.end ())
         {
@@ -56,7 +56,7 @@ CUserSettingBoolean* CUserSettingBoolean::fromJSON (nlohmann::json& data)
     }
     else
     {
-        if (data.is_boolean () == false)
+        if (!data.is_boolean ())
             sLog.error ("Expected boolean value on user setting");
 
         defaultValue = data.get<bool> ();
@@ -70,14 +70,14 @@ CUserSettingBoolean* CUserSettingBoolean::fromScalar (bool value)
     return new CUserSettingBoolean (false, false, value, "", "");
 }
 
-bool CUserSettingBoolean::getDefaultValue ()
+bool CUserSettingBoolean::getDefaultValue () const
 {
     return this->m_default;
 }
 
 bool CUserSettingBoolean::processValue (const std::vector<Projects::CProperty*>& properties)
 {
-    if (this->m_hasSource == false && this->m_hasCondition == false)
+    if (!this->m_hasSource && !this->m_hasCondition)
         return this->getDefaultValue ();
 
     for (auto cur : properties)
@@ -85,7 +85,7 @@ bool CUserSettingBoolean::processValue (const std::vector<Projects::CProperty*>&
         if (cur->getName () != this->m_source)
             continue;
 
-        if (this->m_hasCondition == false)
+        if (!this->m_hasCondition)
         {
             if (cur->is <CPropertyBoolean> ())
                 return cur->as <CPropertyBoolean> ()->getValue ();

+ 1 - 1
src/WallpaperEngine/Core/UserSettings/CUserSettingBoolean.h

@@ -19,7 +19,7 @@ namespace WallpaperEngine::Core::UserSettings
         static std::string Type;
 
         bool processValue (const std::vector<Projects::CProperty*>& properties);
-        bool getDefaultValue ();
+        bool getDefaultValue () const;
 
     private:
         CUserSettingBoolean (bool hasCondition, bool hasSource, bool defaultValue, std::string source, std::string expectedValue);

+ 8 - 8
src/WallpaperEngine/Core/UserSettings/CUserSettingFloat.cpp

@@ -21,13 +21,13 @@ CUserSettingFloat::CUserSettingFloat (bool hasCondition, bool hasSource, double
 
 CUserSettingFloat* CUserSettingFloat::fromJSON (nlohmann::json& data)
 {
-    bool hasCondition = false;
-    bool hasSource = false;
-    double defaultValue = false;
+    double defaultValue;
     std::string source;
     std::string expectedValue;
+	bool hasCondition = false;
+	bool hasSource = false;
 
-    if (data.is_object () == true)
+    if (data.is_object ())
     {
         hasSource = true;
         auto userIt = data.find ("user");
@@ -53,7 +53,7 @@ CUserSettingFloat* CUserSettingFloat::fromJSON (nlohmann::json& data)
     }
     else
     {
-        if (data.is_number () == false)
+        if (!data.is_number ())
             sLog.exception ("Expected numeric value on user settings");
 
         defaultValue = data.get<double> ();
@@ -67,14 +67,14 @@ CUserSettingFloat* CUserSettingFloat::fromScalar (double value)
     return new CUserSettingFloat (false, false, value, "", "");
 }
 
-double CUserSettingFloat::getDefaultValue ()
+double CUserSettingFloat::getDefaultValue () const
 {
     return this->m_default;
 }
 
 double CUserSettingFloat::processValue (const std::vector<Projects::CProperty*>& properties)
 {
-    if (this->m_hasSource == false && this->m_hasCondition == false)
+    if (!this->m_hasSource && !this->m_hasCondition)
         return this->getDefaultValue ();
 
     for (auto cur : properties)
@@ -82,7 +82,7 @@ double CUserSettingFloat::processValue (const std::vector<Projects::CProperty*>&
         if (cur->getName () != this->m_source)
             continue;
 
-        if (this->m_hasCondition == false)
+        if (!this->m_hasCondition)
         {
             if (cur->is <CPropertySlider> ())
                 return cur->as <CPropertySlider> ()->getValue ();

+ 1 - 1
src/WallpaperEngine/Core/UserSettings/CUserSettingFloat.h

@@ -19,7 +19,7 @@ namespace WallpaperEngine::Core::UserSettings
         static std::string Type;
 
         double processValue (const std::vector<Projects::CProperty*>& properties);
-        double getDefaultValue ();
+        double getDefaultValue () const;
 
     private:
         CUserSettingFloat (bool hasCondition, bool hasSource, double defaultValue, std::string source, std::string expectedValue);

+ 2 - 2
src/WallpaperEngine/Core/UserSettings/CUserSettingValue.h

@@ -13,9 +13,9 @@ namespace WallpaperEngine::Core::UserSettings
         template<class T> bool is () { return this->m_type == T::Type; }
 
     protected:
-        CUserSettingValue (std::string type);
+        explicit CUserSettingValue (std::string type);
 
     private:
         std::string m_type;
     };
-};
+}

+ 5 - 5
src/WallpaperEngine/Core/UserSettings/CUserSettingVector3.cpp

@@ -28,7 +28,7 @@ CUserSettingVector3* CUserSettingVector3::fromJSON (nlohmann::json& data)
     std::string source;
     std::string expectedValue;
 
-    if (data.is_object () == true)
+    if (data.is_object ())
     {
         hasSource = true;
         auto userIt = data.find ("user");
@@ -54,7 +54,7 @@ CUserSettingVector3* CUserSettingVector3::fromJSON (nlohmann::json& data)
     }
     else
     {
-        if (data.is_string () == false)
+        if (!data.is_string ())
             sLog.exception ("Expected vector value on user settings");
 
         defaultValue = WallpaperEngine::Core::aToColorf (data.get <std::string> ().c_str ());
@@ -68,14 +68,14 @@ CUserSettingVector3* CUserSettingVector3::fromScalar (glm::vec3 value)
     return new CUserSettingVector3 (false, false, value, "", "");
 }
 
-glm::vec3 CUserSettingVector3::getDefaultValue ()
+glm::vec3 CUserSettingVector3::getDefaultValue () const
 {
     return this->m_default;
 }
 
 glm::vec3 CUserSettingVector3::processValue (const std::vector<Projects::CProperty*>& properties)
 {
-    if (this->m_hasSource == false && this->m_hasCondition == false)
+    if (!this->m_hasSource && !this->m_hasCondition)
         return this->getDefaultValue ();
 
     for (auto cur : properties)
@@ -83,7 +83,7 @@ glm::vec3 CUserSettingVector3::processValue (const std::vector<Projects::CProper
         if (cur->getName () != this->m_source)
             continue;
 
-        if (this->m_hasCondition == false)
+        if (!this->m_hasCondition)
         {
             if (cur->is <CPropertyColor> ())
                 return cur->as <CPropertyColor> ()->getValue ();

+ 1 - 1
src/WallpaperEngine/Core/UserSettings/CUserSettingVector3.h

@@ -21,7 +21,7 @@ namespace WallpaperEngine::Core::UserSettings
         static std::string Type;
 
         glm::vec3 processValue (const std::vector<Projects::CProperty*>& properties);
-        glm::vec3 getDefaultValue ();
+        glm::vec3 getDefaultValue () const;
 
     private:
         CUserSettingVector3 (bool hasCondition, bool hasSource, glm::vec3 defaultValue, std::string source, std::string expectedValue);

+ 1 - 1
src/WallpaperEngine/Input/CInputContext.h

@@ -13,7 +13,7 @@ namespace WallpaperEngine::Input
     class CInputContext
     {
     public:
-        CInputContext (Render::Drivers::COpenGLDriver& videoDriver);
+        explicit CInputContext (Render::Drivers::COpenGLDriver& videoDriver);
         void update ();
 
         const CMouseInput& getMouseInput () const;

+ 1 - 1
src/WallpaperEngine/Input/CMouseInput.cpp

@@ -3,7 +3,7 @@
 
 using namespace WallpaperEngine::Input;
 
-CMouseInput::CMouseInput (GLFWwindow* window) : position(0, 0), m_window (window) {}
+CMouseInput::CMouseInput (GLFWwindow* window) : position (), m_mousePosition (), m_window (window) {}
 
 void CMouseInput::update ()
 {

+ 2 - 2
src/WallpaperEngine/Input/CMouseInput.h

@@ -11,7 +11,7 @@ namespace WallpaperEngine::Input
     class CMouseInput
     {
     public:
-        CMouseInput(GLFWwindow* window);
+        explicit CMouseInput(GLFWwindow* window);
 
         /**
          * Takes current mouse position and updates it
@@ -33,5 +33,5 @@ namespace WallpaperEngine::Input
          */
         glm::dvec2 m_mousePosition;
     };
-};
+}
 

+ 10 - 5
src/WallpaperEngine/Render/CCamera.cpp

@@ -9,7 +9,9 @@ using namespace WallpaperEngine::Render;
 CCamera::CCamera (CScene* scene, const Core::Scenes::CCamera* camera) :
     m_camera (camera),
     m_scene (scene),
-    m_isOrthogonal (false)
+    m_isOrthogonal (false),
+	m_projection (),
+	m_lookat ()
 {
     // get the lookat position
     // TODO: ENSURE THIS IS ONLY USED WHEN NOT DOING AN ORTOGRAPHIC CAMERA AS IT THROWS OFF POINTS
@@ -17,9 +19,7 @@ CCamera::CCamera (CScene* scene, const Core::Scenes::CCamera* camera) :
 }
 
 CCamera::~CCamera ()
-{
-
-}
+= default;
 
 const glm::vec3& CCamera::getCenter () const
 {
@@ -46,11 +46,16 @@ const glm::mat4& CCamera::getLookAt () const
     return this->m_lookat;
 }
 
-const bool CCamera::isOrthogonal () const
+bool CCamera::isOrthogonal () const
 {
     return this->m_isOrthogonal;
 }
 
+CScene* CCamera::getScene () const
+{
+	return this->m_scene;
+}
+
 void CCamera::setOrthogonalProjection (float width, float height)
 {
     // TODO: GET THE ZNEAR AND ZFAR FROM THE BACKGROUND (IF AVAILABLE)

+ 2 - 1
src/WallpaperEngine/Render/CCamera.h

@@ -24,7 +24,8 @@ namespace WallpaperEngine::Render
         const glm::vec3& getUp () const;
         const glm::mat4& getProjection () const;
         const glm::mat4& getLookAt () const;
-        const bool isOrthogonal () const;
+		CScene* getScene () const;
+        bool isOrthogonal () const;
 
     private:
         bool m_isOrthogonal;

+ 8 - 4
src/WallpaperEngine/Render/CFBO.cpp

@@ -14,7 +14,11 @@ CFBO::CFBO (
     m_name (std::move (name)),
     m_format (format),
     m_scale (scale),
-    m_flags (flags)
+    m_flags (flags),
+	m_framebuffer (GL_NONE),
+	m_depthbuffer (GL_NONE),
+	m_texture (GL_NONE),
+	m_resolution ()
 {
     // create an empty texture that'll be free'd so the FBO is transparent
     GLenum drawBuffers [1] = {GL_COLOR_ATTACHMENT0};
@@ -28,9 +32,9 @@ CFBO::CFBO (
     // give OpenGL an empty image
     glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA8, textureWidth, textureHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
     // label stuff for debugging
-    if (DEBUG)
+#if DEBUG
         glObjectLabel (GL_TEXTURE, this->m_texture, -1, this->m_name.c_str ());
-
+#endif /* DEBUG */
     // set filtering parameters, otherwise the texture is not rendered
     if (flags & TextureFlags::ClampUVs)
     {
@@ -74,7 +78,7 @@ CFBO::CFBO (
     };
 
     // create the textureframe entries
-    TextureFrame* frame = new TextureFrame;
+    auto* frame = new TextureFrame;
 
     frame->frameNumber = 0;
     frame->frametime = 0;

+ 1 - 1
src/WallpaperEngine/Render/CFBO.h

@@ -41,4 +41,4 @@ namespace WallpaperEngine::Render
         /** Placeholder for frames, FBOs only have ONE */
         std::vector<TextureFrame*> m_frames;
     };
-};
+}

+ 2 - 3
src/WallpaperEngine/Render/CObject.cpp

@@ -13,8 +13,7 @@ CObject::CObject(CScene* scene, std::string type, Core::CObject *object) :
 }
 
 CObject::~CObject ()
-{
-}
+= default;
 
 CScene* CObject::getScene () const
 {
@@ -26,7 +25,7 @@ const CContainer& CObject::getContainer () const
     return this->getScene ()->getContainer ();
 }
 
-const int CObject::getId () const
+int CObject::getId () const
 {
     return this->m_object->getId ();
 }

+ 1 - 1
src/WallpaperEngine/Render/CObject.h

@@ -22,7 +22,7 @@ namespace WallpaperEngine::Render
 
         CScene* getScene () const;
         const CContainer& getContainer () const;
-        const int getId () const;
+        int getId () const;
 
     protected:
         CObject (CScene* scene, std::string type, Core::CObject *object);

+ 21 - 15
src/WallpaperEngine/Render/CRenderContext.cpp

@@ -59,14 +59,20 @@ CRenderContext::CRenderContext (std::vector <std::string> screens, CVideoDriver&
     m_container (container),
     m_app (app),
     m_input (input),
-    m_textureCache (new CTextureCache (*this))
+    m_textureCache (new CTextureCache (*this)),
+	m_display (nullptr),
+	m_pixmap (0),
+	m_gc (nullptr),
+	m_image (nullptr),
+	m_imageData (nullptr),
+	m_fbo (nullptr)
 {
     this->initialize ();
 }
 
 void CRenderContext::initialize ()
 {
-    if (this->m_screens.empty () == true)
+    if (this->m_screens.empty ())
         this->setupWindow ();
     else
         this->setupScreens ();
@@ -162,7 +168,7 @@ void CRenderContext::setupScreens ()
 
 CRenderContext::~CRenderContext ()
 {
-    if (this->m_screens.empty () == false)
+    if (!this->m_screens.empty ())
     {
         // free any used resource
         XDestroyImage (this->m_image);
@@ -182,12 +188,11 @@ void CRenderContext::renderScreens ()
 
     for (const auto& cur : this->m_viewports)
     {
-        if (DEBUG)
-        {
-            std::string str = "Rendering to screen " + cur.name;
+#if DEBUG
+		std::string str = "Rendering to screen " + cur.name;
 
-            glPushDebugGroup (GL_DEBUG_SOURCE_APPLICATION, 0, -1, str.c_str ());
-        }
+		glPushDebugGroup (GL_DEBUG_SOURCE_APPLICATION, 0, -1, str.c_str ());
+#endif /* DEBUG */
 
         // render the background
         this->m_wallpaper->render (cur.viewport, false, renderFrame, firstFrame);
@@ -196,8 +201,9 @@ void CRenderContext::renderScreens ()
         firstFrame = false;
         renderFrame = !this->m_wallpaper->is <CVideo> ();
 
-        if (DEBUG)
-            glPopDebugGroup ();
+#if DEBUG
+		glPopDebugGroup ();
+#endif /* DEBUG */
     }
 
     // read the full texture into the image
@@ -229,10 +235,10 @@ void CRenderContext::render ()
     if (this->m_wallpaper == nullptr)
         return;
 
-    if (this->m_viewports.empty () == false)
-        this->renderScreens ();
-    else
-        this->renderWindow ();
+	if (this->m_viewports.empty ())
+		this->renderWindow ();
+	else
+		this->renderScreens ();
 
     this->m_driver.swapBuffers ();
 }
@@ -242,7 +248,7 @@ void CRenderContext::setWallpaper (CWallpaper* wallpaper)
     this->m_wallpaper = wallpaper;
 
     // update the wallpaper's texcoords based on the mode we're running
-    if (this->m_screens.empty () == false)
+    if (!this->m_screens.empty ())
     {
         GLfloat texCoords [] = {
             0.0f, 1.0f,

+ 12 - 9
src/WallpaperEngine/Render/CScene.cpp

@@ -15,18 +15,21 @@ using namespace WallpaperEngine;
 using namespace WallpaperEngine::Render;
 
 CScene::CScene (Core::CScene* scene, CRenderContext& context, CAudioContext& audioContext) :
-    CWallpaper (scene, Type, context, audioContext)
+    CWallpaper (scene, Type, context, audioContext),
+	m_mousePosition (),
+	m_mousePositionLast (),
+	m_parallaxDisplacement ()
 {
     // setup the scene camera
     this->m_camera = new CCamera (this, scene->getCamera ());
 
     // detect size if the orthogonal project is auto
-    if (scene->getOrthogonalProjection ()->isAuto () == true)
+    if (scene->getOrthogonalProjection ()->isAuto ())
     {
         // calculate the size of the projection based on the size of everything
         for (const auto& cur : scene->getObjects ())
         {
-            if (cur.second->is<Core::Objects::CImage> () == false)
+            if (!cur.second->is <Core::Objects::CImage> ())
                 continue;
 
             glm::vec2 size = cur.second->as <Core::Objects::CImage> ()->getSize ();
@@ -149,7 +152,7 @@ CScene::CScene (Core::CScene* scene, CRenderContext& context, CAudioContext& aud
     auto json = nlohmann::json::parse (imagejson);
 
     // create image for bloom passes
-    if (this->getScene ()->isBloom () == true)
+    if (this->getScene ()->isBloom ())
     {
         this->m_bloomObject = this->createObject (
             WallpaperEngine::Core::CObject::fromJSON (
@@ -184,15 +187,15 @@ Render::CObject* CScene::createObject (Core::CObject* object)
             this->createObject ((*dep).second);
     }
 
-    if (object->is<Core::Objects::CImage>() == true)
+    if (object->is <Core::Objects::CImage> ())
     {
-        Objects::CImage* image = new Objects::CImage (this, object->as<Core::Objects::CImage>());
+        auto* image = new Objects::CImage (this, object->as<Core::Objects::CImage>());
 
         try
         {
             image->setup ();
         }
-        catch (std::runtime_error ex)
+        catch (std::runtime_error& ex)
         {
             // this error message is already printed, so just show extra info about it
             sLog.error ("Cannot setup image ", image->getImage ()->getName ());
@@ -200,7 +203,7 @@ Render::CObject* CScene::createObject (Core::CObject* object)
 
         renderObject = image;
     }
-    else if (object->is<Core::Objects::CSound>() == true)
+    else if (object->is <Core::Objects::CSound> ())
     {
         renderObject = new Objects::CSound (this, object->as<Core::Objects::CSound>());
     }
@@ -222,7 +225,7 @@ void CScene::renderFrame (glm::ivec4 viewport)
     this->updateMouse (viewport);
 
     // update the parallax position if required
-    if (this->getScene ()->isCameraParallax () == true)
+    if (this->getScene ()->isCameraParallax ())
     {
         float influence = this->getScene ()->getCameraParallaxMouseInfluence ();
         float amount = this->getScene ()->getCameraParallaxAmount ();

+ 1 - 2
src/WallpaperEngine/Render/CTextureCache.cpp

@@ -8,8 +8,7 @@ CTextureCache::CTextureCache (CRenderContext& context) :
 }
 
 CTextureCache::~CTextureCache ()
-{
-}
+ = default;
 
 const ITexture* CTextureCache::resolve (const std::string& filename)
 {

+ 11 - 14
src/WallpaperEngine/Render/CVideo.cpp

@@ -18,7 +18,8 @@ void* get_proc_address (void* ctx, const char* name)
 CVideo::CVideo (Core::CVideo* video, CRenderContext& context, CAudioContext& audioContext) :
     CWallpaper (video, Type, context, audioContext),
     m_width (16),
-    m_height (16)
+    m_height (16),
+	m_mpvGl (nullptr)
 {
     double volume = g_AudioVolume * 100.0 / 128.0;
 
@@ -60,7 +61,7 @@ CVideo::CVideo (Core::CVideo* video, CRenderContext& context, CAudioContext& aud
     if (mpv_command (this->m_mpv, command) < 0)
         sLog.exception ("Cannot load video to play");
 
-    if (g_AudioEnabled == false)
+    if (!g_AudioEnabled)
     {
         const char* mutecommand [] = {
             "set", "mute", "yes", nullptr
@@ -98,18 +99,14 @@ void CVideo::renderFrame (glm::ivec4 viewport)
             break;
 
         // we do not care about any of the events
-        switch (event->event_id)
-        {
-            case MPV_EVENT_VIDEO_RECONFIG:
-                {
-                    int64_t width, height;
-
-                    if (mpv_get_property (this->m_mpv, "dwidth", MPV_FORMAT_INT64, &width) >= 0 &&
-                        mpv_get_property (this->m_mpv, "dheight", MPV_FORMAT_INT64, &height) >= 0)
-                        this->setSize (width, height);
-                }
-                break;
-        }
+		if (event->event_id == MPV_EVENT_VIDEO_RECONFIG)
+		{
+			int64_t width, height;
+
+			if (mpv_get_property (this->m_mpv, "dwidth", MPV_FORMAT_INT64, &width) >= 0 &&
+				mpv_get_property (this->m_mpv, "dheight", MPV_FORMAT_INT64, &height) >= 0)
+				this->setSize (width, height);
+		}
     }
 
     // render the next

Nem az összes módosított fájl került megjelenítésre, mert túl sok fájl változott