commit 63674946ca07f391e134c46b8ad79b14ae378c46 Author: sippeangelo Date: Fri Nov 20 15:01:37 2015 +0100 Initial directory structure diff --git a/.gitignore b/.gitignore new file mode 100755 index 00000000..1774c281 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +# Build Folders +build/ +bin/ +lib/ +# Because apparently nobody has any self control +*.orig diff --git a/include/Engine/Core/.gitkeep b/include/Engine/Core/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/include/Engine/GUI/.gitkeep b/include/Engine/GUI/.gitkeep new file mode 100755 index 00000000..e69de29b diff --git a/include/Engine/Input/.gitkeep b/include/Engine/Input/.gitkeep new file mode 100755 index 00000000..e69de29b diff --git a/include/Engine/Rendering/.gitkeep b/include/Engine/Rendering/.gitkeep new file mode 100755 index 00000000..e69de29b diff --git a/include/Engine/Sound/.gitkeep b/include/Engine/Sound/.gitkeep new file mode 100755 index 00000000..e69de29b diff --git a/include/Game/.gitkeep b/include/Game/.gitkeep new file mode 100755 index 00000000..e69de29b diff --git a/src/Engine/Core/.gitkeep b/src/Engine/Core/.gitkeep new file mode 100755 index 00000000..e69de29b diff --git a/src/Engine/GUI/.gitkeep b/src/Engine/GUI/.gitkeep new file mode 100755 index 00000000..e69de29b diff --git a/src/Engine/Input/.gitkeep b/src/Engine/Input/.gitkeep new file mode 100755 index 00000000..e69de29b diff --git a/src/Engine/Rendering/.gitkeep b/src/Engine/Rendering/.gitkeep new file mode 100755 index 00000000..e69de29b diff --git a/src/Engine/Sound/.gitkeep b/src/Engine/Sound/.gitkeep new file mode 100755 index 00000000..e69de29b diff --git a/src/Game/.gitkeep b/src/Game/.gitkeep new file mode 100755 index 00000000..e69de29b diff --git a/src/Tests/.gitkeep b/src/Tests/.gitkeep new file mode 100755 index 00000000..e69de29b diff --git a/tools/CodeRules.cpp b/tools/CodeRules.cpp new file mode 100755 index 00000000..abb73a7a --- /dev/null +++ b/tools/CodeRules.cpp @@ -0,0 +1,76 @@ +#include "StyleGuide.h" + +namespace OuterNamespace +{ +namespace InnerNamespace +{ + +// Constructor with initializer list +ClassType::ClassType(int arg1) + : BaseClassType(this), + , m_PrivateMember1(arg1) +{ } + +// Destructor +ClassType::~ClassType() +{ + if (m_PrivateMember2 != nullptr) { + delete m_PrivateMember2; + m_PrivateMember2 = nullptr; + } +} + +// Base class virtual override +bool ClassType::PublicVirtualMemberFunction(bool value) +{ + return BaseClassType::PublicVirtualMemberFunction(value); +} + +// Base class pure virtual override +bool ClassName::PublicPureVirtualMemberFunction(bool value) +{ + // Treat parenthesis as curly braces for functions with lots of arguments + manyArgumentFunction( + "abcdefghijklmnopqrstuvwxyz", + "abcdefghijklmnopqrstuvwxyz", + "abcdefghijklmnopqrstuvwxyz" + ); + + // For loops + int sum = 0; + for (int i = 0; i < 5; i++) { + for (int j = 0; j < 5; j++) { + // Math! + // 1. Group multiplication and division operands + // 2. Separate addition and subtraction with space + sum = sum + i*j; + } + } + + // For-each loops + std::vector vec; + for (auto& i : vec) { + if (i == 0) { + return true; + } + } + + return false; +} + +// Private member function +bool ClassName::privateMemberFunction() +{ + switch (m_PrivateMember1) { + case 1: + m_PrivateMember2 = new ClassType(2); + break; + default: + return false; + } + + return false; +} + +} +} diff --git a/tools/CodeRules.h b/tools/CodeRules.h new file mode 100755 index 00000000..f09ae81d --- /dev/null +++ b/tools/CodeRules.h @@ -0,0 +1,98 @@ +#ifndef Namespace_FileName_h__ +#define Namespace_FileName_h__ + +#include + +#include + +// Relative paths preferred +#include "Internal/Header.h" + +namespace OuterNamespace +{ +namespace InnerNamespace +{ + +enum class EnumType +{ + Red, + Green, + Blue +}; + +struct StructType +{ + int PublicMember = 0; +}; + +template +class BaseClassType +{ +public: + BaseClassType(T* child) + : m_Child(child) + { } + + virtual bool PublicVirtualMemberFunction(bool value) { return value; } + virtual bool PublicPureVirtualMemberFunction(bool value) = 0; + +private: + T* m_Child = nullptr; +}; + +class ClassType : public BaseClassType +{ +public: + // Constructor + ClassType(int arg1); + + // Destructor + ~ClassType(); + + // Getter + int PrivateMember1() const { return m_PrivateMember1; } // Prefer copy for fundamental types + const StructType* PrivateMember2() const { return m_PrivateMember2; } + // Setter + void SetPrivateMember1(const int& privateMember1) { m_PrivateMember1 = privateMember1; } + void SetPrivateMember2(StructType* privateMember2) { m_PrivateMember2 = privateMember2; } + + // Public templated member function + template + T* PublicMemberFunction(bool value); + + // Base class virtual override + bool PublicVirtualMemberFunction(bool value) override; + + // Base class pure virtual override + bool PublicPureVirtualMemberFunction(bool value) override; + +private: + // Private members with default values + int m_PrivateMember1 = 1; + StructType* m_PrivateMember2 = nullptr; + + // Private member functions + bool privateMemberFunction(); + void manyArgumentFunction(std::string arg1, std::string arg2, std::string arg3) { } +}; + +// Public templated member function +template +T* ClassType::PublicMemberFunction(bool value) +{ + if (m_PrivateMember2 == nullptr) { + return nullptr; + } + + if (m_PrivateMember2->PublicMember == 1) { + return new T(); + } + else { + return nullptr; + } +} + +} +} + +#endif \ No newline at end of file diff --git a/tools/deploy.bat b/tools/deploy.bat new file mode 100755 index 00000000..2715ad1d --- /dev/null +++ b/tools/deploy.bat @@ -0,0 +1,28 @@ +@ECHO off + +SET DeployLocation=bin\ + +ECHO Deploying resources to %DeployLocation% +:: Asset folders +RMDIR "%DeployLocation%\Models" +RMDIR "%DeployLocation%\Textures" +RMDIR "%DeployLocation%\Sounds" +MKLINK "%DeployLocation%\Models\" "assets\Models" /J +MKLINK "%DeployLocation%\Textures\" "assets\Textures\" /J +MKLINK "%DeployLocation%\Sounds\" "assets\Sounds\" /J +:: Configuration files +MKLINK "%DeployLocation%\DefaultConfig.ini" "assets\DefaultConfig.ini" /H +:: Shaders +RMDIR /S /Q "%DeployLocation%\Shaders" +MKDIR "%DeployLocation%\Shaders" +MKLINK "%DeployLocation%\Shaders\OpenGL\" "src\game\Rendering\OpenGL\Shaders\" /J +MKLINK "%DeployLocation%\Shaders\DirectX\" "src\game\Rendering\DirectX\Shaders\" /J +:: Platform specific binaries +IF "%~1"=="" GOTO :EOF +ECHO Deploying %1 binaries to %DeployLocation% +COPY "deps\bin\%1\x64\*.dll" "%DeployLocation%" +:: Licenses +::COPY "libs\assimp-3.1.1\LICENSE" "%ConfigPath%\Assimp License.txt" +::COPY "libs\glew-1.11.0\LICENSE.txt" "%ConfigPath%\GLEW License.txt" +::COPY "libs\glm-0.9.5.4\copying.txt" "%ConfigPath%\GLM License.txt" +::COPY "libs\assimp-3.1.1\LICENSE" "%ConfigPath%\Assimp License.txt"