Engine: Change include guards to #pragma once

This commit is contained in:
Riyyi
2022-09-26 13:00:00 +02:00
parent 4af037a7fb
commit 722bdd82b1
48 changed files with 80 additions and 227 deletions
+1 -4
View File
@@ -1,5 +1,4 @@
#ifndef INFERNO_H #pragma once
#define INFERNO_H
// For use by the game // For use by the game
@@ -12,5 +11,3 @@
#include "inferno/io/log.h" #include "inferno/io/log.h"
// ----------------------------------------- // -----------------------------------------
#endif // INFERNO_H
+1 -4
View File
@@ -1,5 +1,4 @@
#ifndef APPLICATION_H #pragma once
#define APPLICATION_H
#include <memory> // std::unique_ptr, std::shared_ptr #include <memory> // std::unique_ptr, std::shared_ptr
@@ -50,8 +49,6 @@ namespace Inferno {
} // namespace Inferno } // namespace Inferno
#endif // APPLICATION_H
// C++17 features used: // C++17 features used:
// - std::string_view -> log.h // - std::string_view -> log.h
// - std::shared_ptr array management -> renderer.h // - std::shared_ptr array management -> renderer.h
+1 -4
View File
@@ -1,5 +1,4 @@
#ifndef ASSERT_H #pragma once
#define ASSERT_H
#include <csignal> // raise #include <csignal> // raise
#include <cstdint> // uint32_t #include <cstdint> // uint32_t
@@ -111,6 +110,4 @@ inline void __crash()
} }
#endif // ASSERT_H
// https://github.com/scottt/debugbreak // https://github.com/scottt/debugbreak
+2 -5
View File
@@ -1,5 +1,4 @@
#ifndef CAMERA_COMPONENT_H #pragma once
#define CAMERA_COMPONENT_H
#include "glm/ext/matrix_float4x4.hpp" // glm::mat4 #include "glm/ext/matrix_float4x4.hpp" // glm::mat4
#include "glm/ext/vector_float3.hpp" // glm::vec3 #include "glm/ext/vector_float3.hpp" // glm::vec3
@@ -27,6 +26,4 @@ namespace Inferno {
glm::mat4 projection { 1.0f }; // Identity matrix glm::mat4 projection { 1.0f }; // Identity matrix
}; };
} } // namespace Inferno
#endif // CAMERA_COMPONENT_H
+2 -5
View File
@@ -1,5 +1,4 @@
#ifndef LUA_SCRIPT_COMPONENT_H #pragma once
#define LUA_SCRIPT_COMPONENT_H
#include <string> // std::string #include <string> // std::string
#include <utility> // std::move #include <utility> // std::move
@@ -17,6 +16,4 @@ namespace Inferno {
LuaScriptComponent(const std::string& path) LuaScriptComponent(const std::string& path)
: path(std::move(path)) {} : path(std::move(path)) {}
}; };
} } // namespace Inferno
#endif // LUA_SCRIPT_COMPONENT_H
@@ -1,5 +1,4 @@
#ifndef NATIVE_SCRIPT_COMPONENT_H #pragma once
#define NATIVE_SCRIPT_COMPONENT_H
#include "inferno/assert.h" #include "inferno/assert.h"
#include "inferno/script/nativescript.h" #include "inferno/script/nativescript.h"
@@ -28,6 +27,4 @@ namespace Inferno {
} }
}; };
} } // namespace Inferno
#endif // NATIVE_SCRIPT_COMPONENT_H
+2 -5
View File
@@ -1,5 +1,4 @@
#ifndef SPRITE_COMPONENT_H #pragma once
#define SPRITE_COMPONENT_H
#include <memory> // std::shared_ptr #include <memory> // std::shared_ptr
@@ -14,6 +13,4 @@ namespace Inferno {
std::shared_ptr<Texture> texture; std::shared_ptr<Texture> texture;
}; };
} } // namespace Inferno
#endif // SPRITE_COMPONENT_H
+2 -5
View File
@@ -1,5 +1,4 @@
#ifndef TAG_COMPONENT_H #pragma once
#define TAG_COMPONENT_H
#include <string> // std::string #include <string> // std::string
#include <utility> // std::move #include <utility> // std::move
@@ -16,6 +15,4 @@ namespace Inferno {
operator const std::string&() const { return tag; } operator const std::string&() const { return tag; }
}; };
} } // namespace Inferno
#endif // TAG_COMPONENT_H
+2 -5
View File
@@ -1,5 +1,4 @@
#ifndef TEXTAREA_COMPONENT_H #pragma once
#define TEXTAREA_COMPONENT_H
#include <cstdint> // uint32_t #include <cstdint> // uint32_t
#include <string> // std::string #include <string> // std::string
@@ -27,6 +26,4 @@ namespace Inferno {
// float dropShadow { 0.0f }; // float dropShadow { 0.0f };
}; };
} } // namespace Inferno
#endif // TEXTAREA_COMPONENT_H
+2 -5
View File
@@ -1,5 +1,4 @@
#ifndef TRANSFORM_COMPONENT_H #pragma once
#define TRANSFORM_COMPONENT_H
#include "glm/ext/matrix_float4x4.hpp" // glm::mat4 #include "glm/ext/matrix_float4x4.hpp" // glm::mat4
#include "glm/ext/vector_float3.hpp" // glm::vec3 #include "glm/ext/vector_float3.hpp" // glm::vec3
@@ -22,6 +21,4 @@ namespace Inferno {
const LogStream& operator<<(const LogStream& stream, const glm::vec4& value); const LogStream& operator<<(const LogStream& stream, const glm::vec4& value);
const LogStream& operator<<(const LogStream& stream, const glm::mat4& value); const LogStream& operator<<(const LogStream& stream, const glm::mat4& value);
const LogStream& operator<<(const LogStream& stream, const TransformComponent& value); const LogStream& operator<<(const LogStream& stream, const TransformComponent& value);
} } // namespace Inferno
#endif // TRANSFORM_COMPONENT_H
+1 -4
View File
@@ -1,5 +1,4 @@
#ifndef CORE_H #pragma once
#define CORE_H
#include <functional> // std::bind, std::placeholders #include <functional> // std::bind, std::placeholders
@@ -20,5 +19,3 @@
#elif defined(_MSC_VER) #elif defined(_MSC_VER)
#define MSVC #define MSVC
#endif #endif
#endif // CORE_H
+1 -4
View File
@@ -4,8 +4,7 @@
* `g_` for global variables. * `g_` for global variables.
*/ */
#ifndef ENTRYPOINT_H #pragma once
#define ENTRYPOINT_H
#include "inferno/application.h" #include "inferno/application.h"
@@ -23,5 +22,3 @@ int main(int argc, char* argv[])
return status; return status;
} }
#endif // ENTRYPOINT_H
+2 -5
View File
@@ -1,5 +1,4 @@
#ifndef APPLICATIONEVENT_H #pragma once
#define APPLICATIONEVENT_H
#include <sstream> // std::stringstream #include <sstream> // std::stringstream
@@ -37,6 +36,4 @@ namespace Inferno {
int m_width; int m_width;
int m_height; int m_height;
}; };
} } // namespace Inferno
#endif // APPLICATIONEVENT_H
+1 -4
View File
@@ -1,5 +1,4 @@
#ifndef EVENT_H #pragma once
#define EVENT_H
#include <ostream> // std::ostream #include <ostream> // std::ostream
@@ -110,5 +109,3 @@ inline std::ostream& operator<<(std::ostream& os, const Event& e)
} }
} // namespace Inferno } // namespace Inferno
#endif // EVENT_H
+2 -5
View File
@@ -1,5 +1,4 @@
#ifndef JOYSTICKEVENT_H #pragma once
#define JOYSTICKEVENT_H
#include <sstream> // std::stringstream #include <sstream> // std::stringstream
@@ -51,6 +50,4 @@ namespace Inferno {
EVENT_CLASS_TYPE(JoystickDisconnected) EVENT_CLASS_TYPE(JoystickDisconnected)
}; };
} } // namespace Inferno
#endif // JOYSTICKEVENT_H
+2 -5
View File
@@ -1,5 +1,4 @@
#ifndef KEYEVENT_H #pragma once
#define KEYEVENT_H
#include <sstream> // std::stringstream #include <sstream> // std::stringstream
@@ -66,6 +65,4 @@ namespace Inferno {
EVENT_CLASS_TYPE(KeyPress) EVENT_CLASS_TYPE(KeyPress)
}; };
} } // namespace Inferno
#endif // KEYEVENT_H
+2 -5
View File
@@ -1,5 +1,4 @@
#ifndef MOUSEEVENT_H #pragma once
#define MOUSEEVENT_H
#include <sstream> // std::stringstream #include <sstream> // std::stringstream
@@ -101,6 +100,4 @@ namespace Inferno {
float m_yOffset; float m_yOffset;
}; };
} } // namespace Inferno
#endif // MOUSEEVENT_H
+2 -5
View File
@@ -1,5 +1,4 @@
#ifndef FILE_H #pragma once
#define FILE_H
#include <fstream> // std::ifstream, std::ofstream #include <fstream> // std::ifstream, std::ofstream
#include <iomanip> // std::setfill, std::setw #include <iomanip> // std::setfill, std::setw
@@ -60,6 +59,4 @@ namespace Inferno {
} }
}; };
} } // namespace Inferno
#endif // FILE_H
+1 -4
View File
@@ -1,5 +1,4 @@
#ifndef GLTF_FILE_H #pragma once
#define GLTF_FILE_H
#include <cstdint> // uint32_t #include <cstdint> // uint32_t
#include <memory> // std::shared_ptr #include <memory> // std::shared_ptr
@@ -18,5 +17,3 @@ namespace Inferno {
}; };
} // namespace Inferno } // namespace Inferno
#endif // GLTF_FILE_H
+2 -5
View File
@@ -1,5 +1,4 @@
#ifndef INPUT_H #pragma once
#define INPUT_H
#include <utility> // std::pair #include <utility> // std::pair
@@ -34,6 +33,4 @@ namespace Inferno {
static float m_yOffset; static float m_yOffset;
}; };
} } // namespace Inferno
#endif // INPUT_H
+2 -5
View File
@@ -1,5 +1,4 @@
#ifndef LOG_H #pragma once
#define LOG_H
#include <cstddef> // size_t #include <cstddef> // size_t
#include <cstring> // memcpy #include <cstring> // memcpy
@@ -222,6 +221,4 @@ namespace Inferno {
StringLogStream str(std::string* fill); StringLogStream str(std::string* fill);
} } // namespace Inferno
#endif // LOG_H
+1 -4
View File
@@ -1,5 +1,4 @@
#ifndef INPUTCODES_H #pragma once
#define INPUTCODES_H
#define MAP_KEY(key) #key, key #define MAP_KEY(key) #key, key
@@ -8,5 +7,3 @@ namespace Inferno {
int keyCode(const char* name); int keyCode(const char* name);
} }
#endif // INPUTCODES_H
+2 -5
View File
@@ -1,5 +1,4 @@
#ifndef BUFFER_H #pragma once
#define BUFFER_H
#include <cstddef> // size_t #include <cstddef> // size_t
#include <cstdint> // int32_t, uint32_t #include <cstdint> // int32_t, uint32_t
@@ -143,6 +142,4 @@ namespace Inferno {
std::vector<std::shared_ptr<VertexBuffer>> m_vertexBuffers; std::vector<std::shared_ptr<VertexBuffer>> m_vertexBuffers;
std::shared_ptr<IndexBuffer> m_indexBuffer; std::shared_ptr<IndexBuffer> m_indexBuffer;
}; };
} } // namespace Inferno
#endif // BUFFER_H
+2 -6
View File
@@ -1,5 +1,4 @@
#ifndef CONTEXT_H #pragma once
#define CONTEXT_H
struct GLFWwindow; struct GLFWwindow;
@@ -19,7 +18,4 @@ namespace Inferno {
GLFWwindow* m_window { nullptr }; GLFWwindow* m_window { nullptr };
}; };
} } // namespace Inferno
#endif // CONTEXT_H
+1 -4
View File
@@ -1,5 +1,4 @@
#ifndef FONT_H #pragma once
#define FONT_H
#include <cstdint> // uint32_t #include <cstdint> // uint32_t
#include <memory> // std::shared_ptr #include <memory> // std::shared_ptr
@@ -75,8 +74,6 @@ namespace Inferno {
} // namespace Inferno } // namespace Inferno
#endif // FONT_H
// FontManager fm; // FontManager fm;
// Font f = fm.load("path/to/font"); // Font f = fm.load("path/to/font");
// Font f2("path/to/font"); // Font f2("path/to/font");
+1 -4
View File
@@ -1,5 +1,4 @@
#ifndef FRAMEBUFFER_H #pragma once
#define FRAMEBUFFER_H
namespace Inferno { namespace Inferno {
@@ -10,5 +9,3 @@ public:
}; };
} // namespace Inferno } // namespace Inferno
#endif // FRAMEBUFFER_H
+1 -4
View File
@@ -1,5 +1,4 @@
#ifndef GLTF_H #pragma once
#define GLTF_H
#if 0 #if 0
#include <cstdint> // uint32_t #include <cstdint> // uint32_t
@@ -169,5 +168,3 @@ namespace Inferno {
} // namespace Inferno } // namespace Inferno
#endif #endif
#endif // GLTF_H
+1 -4
View File
@@ -1,5 +1,4 @@
#ifndef RENDERER_H #pragma once
#define RENDERER_H
#include <cstdint> // int32_t, uint32_t #include <cstdint> // int32_t, uint32_t
#include <memory> // std::shared_ptr, std::unique_ptr, std::make_shared, std::make_unique #include <memory> // std::shared_ptr, std::unique_ptr, std::make_shared, std::make_unique
@@ -161,5 +160,3 @@ namespace Inferno {
}; };
} // namespace Inferno } // namespace Inferno
#endif // RENDERER_H
+1 -4
View File
@@ -19,8 +19,7 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
#ifndef RENDERER_3D_H #pragma once
#define RENDERER_3D_H
namespace Inferno { namespace Inferno {
@@ -32,8 +31,6 @@ public:
} // namespace Inferno } // namespace Inferno
#endif // RENDERER_3D_H
// - what data do you need? // - what data do you need?
// - gltf // - gltf
// - how are we going to batch // - how are we going to batch
+1 -4
View File
@@ -1,5 +1,4 @@
#ifndef SHADER_H #pragma once
#define SHADER_H
#include <cstdint> // int32_t, uint32_t #include <cstdint> // int32_t, uint32_t
#include <memory> // std::shared_ptr #include <memory> // std::shared_ptr
@@ -70,5 +69,3 @@ namespace Inferno {
}; };
} // namespace Inferno } // namespace Inferno
#endif // SHADER_H
+1 -4
View File
@@ -1,5 +1,4 @@
#ifndef TEXTURE_H #pragma once
#define TEXTURE_H
#include <cstdint> // uint32_t #include <cstdint> // uint32_t
#include <memory> // std::shared_ptr #include <memory> // std::shared_ptr
@@ -57,5 +56,3 @@ namespace Inferno {
}; };
} // namespace Inferno } // namespace Inferno
#endif // TEXTURE_H
+2 -5
View File
@@ -1,5 +1,4 @@
#ifndef SCENE_H #pragma once
#define SCENE_H
#include <cstdint> // uint32_t #include <cstdint> // uint32_t
#include <memory> // std::shared_ptr #include <memory> // std::shared_ptr
@@ -79,9 +78,7 @@ namespace Inferno {
const LogStream& operator<<(const LogStream& stream, entt::entity handle); const LogStream& operator<<(const LogStream& stream, entt::entity handle);
} } // namespace Inferno
#endif // SCENE_H
// @Todo // @Todo
// - Convert registry to stack variable // - Convert registry to stack variable
+2 -6
View File
@@ -1,5 +1,4 @@
#ifndef CAMERA_CONTROLLER_H #pragma once
#define CAMERA_CONTROLLER_H
#include "inferno/component/cameracomponent.h" #include "inferno/component/cameracomponent.h"
#include "inferno/script/nativescript.h" #include "inferno/script/nativescript.h"
@@ -15,7 +14,6 @@ namespace Inferno {
class CameraController final : public NativeScript { class CameraController final : public NativeScript {
public: public:
virtual void update(float deltaTime) override virtual void update(float deltaTime) override
{ {
m_camera = &getComponent<CameraComponent>(); m_camera = &getComponent<CameraComponent>();
@@ -35,6 +33,4 @@ namespace Inferno {
CameraComponent* m_camera { nullptr }; CameraComponent* m_camera { nullptr };
}; };
} } // namespace Inferno
#endif // CAMERA_CONTROLLER_H
+2 -5
View File
@@ -1,5 +1,4 @@
#ifndef LUA_SCRIPT_H #pragma once
#define LUA_SCRIPT_H
#include <cstdint> // uint32_t #include <cstdint> // uint32_t
#include <string> // std::string #include <string> // std::string
@@ -52,6 +51,4 @@ namespace Inferno {
friend class ScriptSystem; friend class ScriptSystem;
}; };
} } // namespace Inferno
#endif // LUA_SCRIPT_H
+2 -5
View File
@@ -1,5 +1,4 @@
#ifndef NATIVE_SCRIPT_H #pragma once
#define NATIVE_SCRIPT_H
#include "inferno/scene/scene.h" #include "inferno/scene/scene.h"
@@ -31,6 +30,4 @@ namespace Inferno {
friend class ScriptSystem; friend class ScriptSystem;
}; };
} } // namespace Inferno
#endif // NATIVE_SCRIPT_H
+2 -5
View File
@@ -1,5 +1,4 @@
#ifndef REGISTRATION_H #pragma once
#define REGISTRATION_H
#include "sol/overload.hpp" // sol::overload #include "sol/overload.hpp" // sol::overload
#include "sol/state_view.hpp" // sol::state_view #include "sol/state_view.hpp" // sol::state_view
@@ -66,6 +65,4 @@ namespace Inferno {
} }
}; };
} } // namespace Inferno
#endif // REGISTRATION_H
+1 -4
View File
@@ -1,5 +1,4 @@
#ifndef SETTINGS_H #pragma once
#define SETTINGS_H
#include "ruc/json/json.h" #include "ruc/json/json.h"
@@ -37,5 +36,3 @@ namespace Inferno {
void fromJson(const ruc::Json& object, WindowProperties& window); void fromJson(const ruc::Json& object, WindowProperties& window);
} // namespace Inferno } // namespace Inferno
#endif // SETTINGS_H
+1 -5
View File
@@ -1,5 +1,4 @@
#ifndef SINGLETON_H #pragma once
#define SINGLETON_H
#include "inferno/assert.h" #include "inferno/assert.h"
@@ -50,6 +49,3 @@ namespace Inferno {
T* Singleton<T>::s_instance = nullptr; T* Singleton<T>::s_instance = nullptr;
} // namespace Inferno } // namespace Inferno
#endif // SINGLETON_H
+1 -4
View File
@@ -1,5 +1,4 @@
#ifndef CAMERA_SYSTEM_H #pragma once
#define CAMERA_SYSTEM_H
#include <memory> //std::shared_ptr #include <memory> //std::shared_ptr
@@ -34,5 +33,3 @@ namespace Inferno {
}; };
} // namespace Inferno } // namespace Inferno
#endif // CAMERA_SYSTEM_H
+1 -4
View File
@@ -1,5 +1,4 @@
#ifndef RENDER_SYSTEM_H #pragma once
#define RENDER_SYSTEM_H
#include <memory> //std::shared_ptr #include <memory> //std::shared_ptr
@@ -24,5 +23,3 @@ namespace Inferno {
}; };
} // namespace Inferno } // namespace Inferno
#endif // RENDER_SYSTEM_H
+1 -4
View File
@@ -1,5 +1,4 @@
#ifndef SCRIPT_SYSTEM_H #pragma once
#define SCRIPT_SYSTEM_H
#include <cstdint> // uint32_t #include <cstdint> // uint32_t
@@ -30,5 +29,3 @@ namespace Inferno {
}; };
} // namespace Inferno } // namespace Inferno
#endif // SCRIPT_SYSTEM_H
+1 -4
View File
@@ -1,5 +1,4 @@
#ifndef TEXTAREA_H #pragma once
#define TEXTAREA_H
#include <cstdint> // std::uint32_t #include <cstdint> // std::uint32_t
#include <memory> // std::shared_ptr #include <memory> // std::shared_ptr
@@ -34,5 +33,3 @@ namespace Inferno {
}; };
} // namespace Inferno } // namespace Inferno
#endif // TEXTAREA_H
+1 -4
View File
@@ -1,5 +1,4 @@
#ifndef TRANSFORM_SYSTEM_H #pragma once
#define TRANSFORM_SYSTEM_H
#include <memory> // std::shared_ptr #include <memory> // std::shared_ptr
@@ -22,5 +21,3 @@ namespace Inferno {
}; };
} // namespace Inferno } // namespace Inferno
#endif // TRANSFORM_SYSTEM_H
+2 -5
View File
@@ -1,5 +1,4 @@
#ifndef TIME_H #pragma once
#define TIME_H
namespace Inferno { namespace Inferno {
@@ -8,6 +7,4 @@ namespace Inferno {
static float time(); static float time();
}; };
} } // namespace Inferno
#endif // TIME_H
+1 -4
View File
@@ -1,5 +1,4 @@
#ifndef INTEGER_UTIL_H #pragma once
#define INTEGER_UTIL_H
#include <limits> // std::numeric_limits #include <limits> // std::numeric_limits
#include <string> // std::string, std::stoul #include <string> // std::string, std::stoul
@@ -23,5 +22,3 @@ namespace std {
} }
} // namespace std } // namespace std
#endif // INTEGER_UTIL_H
+1 -4
View File
@@ -1,5 +1,4 @@
#ifndef JSON_UTIL_H #pragma once
#define JSON_UTIL_H
#if 0 #if 0
#include <cstdint> // int32_t, uint32_t #include <cstdint> // int32_t, uint32_t
@@ -249,8 +248,6 @@ namespace Inferno {
} // namespace Inferno } // namespace Inferno
#endif #endif
#endif // JSON_UTIL_H
// JSON syntax: // JSON syntax:
// [ ] = std::map, array (ordered) // [ ] = std::map, array (ordered)
// { } = std::vector, object (unordered) // { } = std::vector, object (unordered)
+1 -4
View File
@@ -1,5 +1,4 @@
#ifndef STRING_UTIL_H #pragma once
#define STRING_UTIL_H
#include <iomanip> // std::setfill, std::setw #include <iomanip> // std::setfill, std::setw
#include <sstream> // std::stringstream #include <sstream> // std::stringstream
@@ -18,5 +17,3 @@ namespace Inferno {
} }
} // namespace Inferno } // namespace Inferno
#endif // STRING_UTIL_H
+2 -5
View File
@@ -1,5 +1,4 @@
#ifndef WINDOW_H #pragma once
#define WINDOW_H
#include <cstdint> // uint32_t #include <cstdint> // uint32_t
#include <functional> // std::function #include <functional> // std::function
@@ -61,6 +60,4 @@ namespace Inferno {
static unsigned char s_windowCount; static unsigned char s_windowCount;
}; };
} } // namespace Inferno
#endif // WINDOW_H