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