diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0fad5e9..161ae90 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -4,9 +4,15 @@ project(fennec)
set(CMAKE_CXX_STANDARD 26)
set(CMAKE_C_STANDARD 26)
+# find dependencies
+find_package(Doxygen)
+
# any necessary include directories
include_directories(include)
+# Metaprogramming is a dependency for generating various type info before compilation of the engine.
+add_subdirectory(metaprogramming)
+
add_library(fennec STATIC
# CORE =================================================================================================================
@@ -74,10 +80,12 @@ add_library(fennec STATIC
include/fennec/lang/lang.h
)
-add_subdirectory(metaprogramming)
-
# add metaprogramming templates as a dependency and also force documentation to be generated when fennec is compiled
-add_dependencies(fennec fennecdocs metaprogramming)
+if(DOXYGEN_FOUND)
+ add_dependencies(fennec fennecdocs metaprogramming)
+else()
+ add_dependencies(fennec metaprogramming)
+endif()
# Compiler Warning Flags
if(MSVC)
@@ -103,8 +111,6 @@ add_subdirectory(test)
file(COPY logo DESTINATION docs/logo)
-find_package(Doxygen)
-
if(DOXYGEN_FOUND)
set(DOXY_OUTPUT_DIR "${PROJECT_SOURCE_DIR}/docs")
get_filename_component(DOXYGEN_PROJECT_NAME ${PROJECT_SOURCE_DIR} NAME) # Set Doxy Project name to the name of the root dir
diff --git a/README.md b/README.md
index 949686e..2b9f76a 100644
--- a/README.md
+++ b/README.md
@@ -11,12 +11,13 @@
## Table of Contents
1. [Introduction](#introduction)
+ 1. [Coding Standards](#coding-standards)
2. [Building from Source](#building-from-source)
1. [Building from Terminal](#building-from-terminal)
2. [Building on Windows](#building-on-windows)
3. [Running the Test Suite](#running-the-test-suite)
- 3. [Usage](#usage)
- 4. [Contribution](#contribution)
+ 4. [Usage](#usage)
+ 5. [Contribution](#contribution)
@@ -26,22 +27,42 @@
## Introduction
fennec is designed to be a general purpose, educational game engine.
+fennec may be used through the provided editor application, or as a standalone
+library to link against your application.
+
+
+
+
+### Coding Standards
Interfacing with the API in C++ follows the [GNU Coding Standards](https://www.gnu.org/prep/standards/html_node/index.html).
-fennec may be used both through the provided editor application, or as a standalone
-library link against your application. Some main areas where the engine strays from
-the GNU standard includes the following:
+Some main areas where the engine strays from the GNU standard includes the following:
-- [Section 4.7, Standards for Graphical Interfaces](https://www.gnu.org/prep/standards/html_node/Graphical-Interfaces.html).
+* [Section 4.7, Standards for Graphical Interfaces](https://www.gnu.org/prep/standards/html_node/Graphical-Interfaces.html).
fennec provides an implementation for X11, however it does not use the GTK toolkit.
- [Section 6.1, GNU Manuals](https://www.gnu.org/prep/standards/html_node/GNU-Manuals.html)
fennec does not use Texinfo and instead uses Doxygen. Otherwise, it follows the other standards of this section.
-- [Section 7, The Release Process](https://www.gnu.org/prep/standards/html_node/Managing-Releases.html)
+* [Section 7, The Release Process](https://www.gnu.org/prep/standards/html_node/Managing-Releases.html)
fennec follows most of the conventions in this section, however the build system used is CMake and not
Makefile. CMake, although overwhelming at first, is much more friendly to those who are learning build systems for the first time.
+fennec Standards:
+
+ * As per the GNU standard, macros should be `SCREAMING_SNAKE_CASE`. Additionally, Macros should be preceded by `_`.
+ Macros that wrap C-Style functions may use normal `snake_case`.
+
+ - Header Guards should be implemented using `#ifndef`, `#define`, and `#endif` for portability.
+ The naming convention for Header Guards is as follows: `___H`.
+ I.E. the engine file `fennec/lang/utility.h` has the Header Guard `FENNEC_LANG_UTILITY_H`.
+
+ * Helper Functions, in the case of classes, should be private.
+ In the case of global functions, helpers should be placed in a similarly named file in a subdirectory and namespace called `detail`.
+ Helper functions should be documented with C-Style comments, however it is not necessary to provide Doxygen documentation.
+
+
+
The C++ stdlib is reimplemented in the fennec engine.
There are a few reasons for this:
@@ -58,9 +79,13 @@ There are a few reasons for this:
## Building from Source
-fennec uses the CMake build system. The CMake build script provides several
+fennec uses the CMake build manager. The CMake build script provides several
targets for building parts of the engine.
+Using an IDE will streamline the build process for you and add additional configuration
+options. Eclipse, Visual Studio, and CLion provide built-in support for CMake. VSCode
+is also a viable IDE but involves some extra setup.
+
| Target | Description |
|------------------------|----------------------------------------------------------------------------------------|
| fennec | The main engine target. |
@@ -69,11 +94,16 @@ targets for building parts of the engine.
| fennecdocs-clean | Cleans the generated html documentation files. |
| fennec-test | Test suite for verifying engine functionality. |
-
+
-Using an IDE will streamline the build process for you and add additional configuration
-options. Eclipse, Visual Studio, and CLion provide built-in support for CMake. VSCode
-is also a viable IDE but involves some extra setup.
+| Dependency | Notes |
+|-------------------|----------------------------------------------------------------------------------------------------------|
+| C/C++ Compiler | GCC/G++ is the compiler that fennec is designed around, however, Clang, MSVC, and MinGW may also be used |
+| CMake | The build manager used by the engine |
+| A build system | Any build system will work, however, `build.sh` uses Ninja by default. |
+| A memory debugger | Any memory debugger will work, however, `test.sh` uses Valgrind by default. |
+| Doxygen | Doxygen is required for building the documentation for fennec. This is an optional dependency |
+| Graphviz | Graphviz is a required dependency for Doxygen |
@@ -84,22 +114,19 @@ is also a viable IDE but involves some extra setup.
for more info.
By default, the CMake generator
-used is Ninja, which requires Ninja to be installed. You can modify the
-build scripts to use another build manager, see the [CMake documentation
-for available generators](https://cmake.org/cmake/help/latest/manual/cmake-generators.7.html).
+used is Ninja, which requires Ninja to be installed.
+You can modify the build scripts to use another build manager, see the [CMake documentation for available generators](https://cmake.org/cmake/help/latest/manual/cmake-generators.7.html).
### Building on Windows
-The bash script can be run natively on Windows when WSL is enabled. You do not
-need to run the script in WSL, simply use the "bash" command in Command Prompt
-or PowerShell. It requires CMake and a C/C++ compiler to be installed and
-configured in the PATH environment variable.
+The bash script can be run natively on Windows when WSL is enabled.
+You do not need to run the script in WSL, simply use the "bash" command in Command Prompt or PowerShell.
+The script will require the build [dependencies](#dependencies) installed and configured to be available on the `PATH` environment variable.
-Fore more details, [see this blog post](https://blogs.windows.com/windows-insider/2016/04/06/announcing-windows-10-insider-preview-build-14316/)
-for Windows Build 14316.
+Fore more details, [see this blog post](https://blogs.windows.com/windows-insider/2016/04/06/announcing-windows-10-insider-preview-build-14316/) for Windows Build 14316.
Otherwise, follow the sequence of commands provided in the bash script.
@@ -159,4 +186,4 @@ whether the information displayed is correct.
There are some principles to keep in mind when contributing to fennec.
1. You must follow the style guide provided by the [GNU Coding Standard](https://www.gnu.org/prep/standards/html_node/Writing-C.html).
-2. Any changes must allow all projects to be forward compatible with newer engine verisons.
\ No newline at end of file
+2. Any changes must allow all projects to be forward compatible with newer engine verisons.
diff --git a/doxy/.Doxyfile.in.swp b/doxy/.Doxyfile.in.swp
deleted file mode 100644
index f5a3136..0000000
Binary files a/doxy/.Doxyfile.in.swp and /dev/null differ
diff --git a/doxy/Doxyfile b/doxy/Doxyfile
index 52d9f29..ed60b2c 100644
--- a/doxy/Doxyfile
+++ b/doxy/Doxyfile
@@ -784,7 +784,7 @@ SHOW_USED_FILES = YES
# (if specified).
# The default value is: YES.
-SHOW_FILES = YES
+SHOW_FILES = NO
# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces
# page. This will remove the Namespaces entry from the Quick Index and from the
@@ -1306,7 +1306,7 @@ CLANG_DATABASE_PATH =
# classes, structs, unions or interfaces.
# The default value is: YES.
-ALPHABETICAL_INDEX = YES
+ALPHABETICAL_INDEX = NO
# The IGNORE_PREFIX tag can be used to specify a prefix (or a list of prefixes)
# that should be ignored while generating the index headers. The IGNORE_PREFIX
diff --git a/doxy/Doxyfile.in b/doxy/Doxyfile.in
index 5cad430..61ad918 100644
--- a/doxy/Doxyfile.in
+++ b/doxy/Doxyfile.in
@@ -784,7 +784,7 @@ SHOW_USED_FILES = YES
# (if specified).
# The default value is: YES.
-SHOW_FILES = YES
+SHOW_FILES = NO
# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces
# page. This will remove the Namespaces entry from the Quick Index and from the
@@ -1306,7 +1306,7 @@ CLANG_DATABASE_PATH =
# classes, structs, unions or interfaces.
# The default value is: YES.
-ALPHABETICAL_INDEX = YES
+ALPHABETICAL_INDEX = NO
# The IGNORE_PREFIX tag can be used to specify a prefix (or a list of prefixes)
# that should be ignored while generating the index headers. The IGNORE_PREFIX
diff --git a/include/fennec/containers/dynarray.h b/include/fennec/containers/dynarray.h
index 3a25a1c..69aca4d 100644
--- a/include/fennec/containers/dynarray.h
+++ b/include/fennec/containers/dynarray.h
@@ -38,21 +38,21 @@
namespace fennec
{
-template
+template
class dynarray
{
public:
- using element_t = T;
+ using element_t = TypeT;
using alloc_t = Alloc;
///
/// \brief Default Constructor, initializes an empty allocation.
- dynarray() : _alloc(), _size(0) {}
+ dynarray() : _alloc(8), _size(0) {}
///
/// \breif Alloc Constructor, initalize empty allocation with allocator instance.
/// \param alloc An allocator object to copy, for instances where the allocator needs to be initialized with some data.
- dynarray(const alloc_t& alloc) : _alloc(alloc), _size(0) {}
+ dynarray(const alloc_t& alloc) : _alloc(8, alloc), _size(0) {}
///
/// \brief Create an allocation with a size of `n` elements. All elements are initialized with the default constructor.
@@ -62,10 +62,16 @@ public:
for(; n > 0; --n, ++addr) { fennec::construct(addr); }
}
+ dynarray(size_t n, const alloc_t& alloc) : _alloc(n, alloc), _size(n)
+ {
+ element_t* addr = _alloc.data();
+ for(; n > 0; --n, ++addr) { fennec::construct(addr); }
+ }
+
///
/// \brief Create an allocation of size `n`, with each element constructed using the copy constructor
/// \brief n the number of elements
- dynarray(size_t n, const element_t& val)
+ dynarray(size_t n, const TypeT& val)
{
element_t* addr = _alloc.data();
for(; n > 0; --n, ++addr) { fennec::construct(addr, val); }
@@ -84,7 +90,73 @@ public:
for(; n > 0; --n, ++addr) { fennec::destruct(addr); }
}
+ size_t size() const { return _size; }
+
+ size_t capacity() const { return _alloc.capacity(); }
+
+ TypeT& operator[](size_t i) { return _alloc.data()[i]; }
+ const TypeT& operator[](size_t i) const { return _alloc.data()[i]; }
+
+ void insert(size_t i, const TypeT& val)
+ {
+ // Grow if the size has reached the capacity of the allocation
+ if(_size == capacity()) _grow();
+
+ // Move the data if we are not inserting at the end of the array
+ if((i = fennec::min(i, _size) < _size) {
+ fennec::memmove(
+ _alloc.data() + i
+ , _alloc.data() + i + 1
+ , (_size - i) * sizeof(TypeT));
+ }
+
+ // Insert the element
+ fennec::construct(_alloc.data() + i, val);
+ }
+
+ void insert(size_t i, TypeT&& val)
+ {
+ // Grow if the size has reached the capacity of the allocation
+ if(_size == capacity()) _grow();
+
+ // Move the data if we are not inserting at the end of the array
+ if((i = fennec::min(i, _size) < _size) {
+ fennec::memmove(
+ _alloc.data() + i
+ , _alloc.data() + i + 1
+ , (_size - i) * sizeof(TypeT));
+ }
+
+ // Insert the element
+ fennec::construct(_alloc.data() + i, fennec::forward(val));
+ }
+
+ template
+ void emplace(size_t i, ArgsT...args)
+ {
+ // Grow if the size has reached the capacity of the allocation
+ if(_size == capacity()) _grow();
+
+ // Move the data if we are not inserting at the end of the array
+ if((i = fennec::min(i, _size) < _size) {
+ fennec::memmove(
+ _alloc.data() + i
+ , _alloc.data() + i + 1
+ , (_size - i) * sizeof(TypeT));
+ }
+
+ // Insert the element
+ fennec::construct(_alloc.data() + i, fennec::forward(args)...);
+ }
+
+ void push_back(const TypeT& val) { insert(_size, val); }
+ void push_back(TypeT&& val) { insert(_size, fennec::forward(val)); }
+
+ template void emplace_back(ArgsT...args) { emplace(_size, fennec::forward(args)...); }
+
private:
+ void _grow() const { _alloc.reallocate(_alloc.capacity() * 2); }
+
allocation _alloc;
size_t _size;
};
diff --git a/include/fennec/core/engine.h b/include/fennec/core/engine.h
index 1fc5790..d8ac073 100644
--- a/include/fennec/core/engine.h
+++ b/include/fennec/core/engine.h
@@ -31,23 +31,30 @@
///
/// \page page_fennec_documentation Documentation
///
-/// \section page_documentation_contents Main Page
+/// \section page_fennec_documentation_pages Pages
/// 1. \ref introduction "Introduction"
-/// 2. \ref introduction "Building from Source"
-/// 1. \ref building-from-source "Building from Source"
-/// 2. \ref building-from-terminal "Building from Terminal"
-/// 3. \ref running-the-test-suite "Running the Test Suite"
-/// 3. \ref usage "Usage"
-/// 4. \ref contribution "Contribution"
-///
-/// \section Libraries
-/// \anchor libraries
-/// - \subpage page_fennec_lang
-/// - \subpage page_fennec_math
+/// 1. \ref coding-standards "Coding Standards"
+/// 2. \ref building-from-source "Building from Source"
+/// 1. \ref building-from-terminal "Building from Terminal"
+/// 2. \ref building-on-windows "Building on Windows"
+/// 3. \ref running-the-test-suite "Running the Test Suite"
+/// 4. \ref usage "Usage"
+/// 5. \ref contribution "Contribution"
+/// 6. \subpage page_fennec_libraries
+/// 1. \ref page_fennec_lang "C++ Language Library"
+/// 2. \ref page_fennec_math "Math Library"
///
/// \copyright Copyright © 2025 Medusa Slockbower ([GPLv3](https://www.gnu.org/licenses/gpl-3.0.en.html))
///
+///
+/// \page page_fennec_libraries Libraries
+///
+/// | Library | Brief |
+/// | :------------------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
+/// | \subpage page_fennec_lang | Implementation for functions and classes related to the C++ Language, including base types, common utility functions, and metaprogramming templates |
+/// | \subpage page_fennec_math | Implementation of math functions according to the [OpenGL 4.6 Shading Language Specification](https://registry.khronos.org/OpenGL/specs/gl/GLSLangSpec.4.60.pdf). Additional extensions are provided for other common math functions. |
+
#ifndef FENNEC_CORE_ENGINE_H
#define FENNEC_CORE_ENGINE_H
diff --git a/include/fennec/lang/conditional_types.h b/include/fennec/lang/conditional_types.h
index 11323eb..47a006b 100644
--- a/include/fennec/lang/conditional_types.h
+++ b/include/fennec/lang/conditional_types.h
@@ -29,8 +29,8 @@
///
-#ifndef CONDITIONAL_TYPES_H
-#define CONDITIONAL_TYPES_H
+#ifndef FENNEC_LANG_CONDITIONAL_TYPES_H
+#define FENNEC_LANG_CONDITIONAL_TYPES_H
#include
#include
@@ -106,4 +106,4 @@ using detect_t
}
-#endif //CONDITIONAL_TYPES_H
+#endif // FENNEC_LANG_CONDITIONAL_TYPES_H
diff --git a/include/fennec/lang/detail/__type_traits.h b/include/fennec/lang/detail/__type_traits.h
index 4c335e5..0cef2fb 100644
--- a/include/fennec/lang/detail/__type_traits.h
+++ b/include/fennec/lang/detail/__type_traits.h
@@ -29,7 +29,6 @@ namespace detail
{
// Nothing interesting to note here
-
template struct __is_void : false_type {};
template<> struct __is_void : true_type {};
diff --git a/include/fennec/lang/float.h b/include/fennec/lang/float.h
index 3f52f74..6cce568 100644
--- a/include/fennec/lang/float.h
+++ b/include/fennec/lang/float.h
@@ -27,6 +27,9 @@
///
///
+#ifndef FENNEC_LANG_FLOAT_H
+#define FENNEC_LANG_FLOAT_H
+
#include
#define FLT_HAS_INFINITY 1
@@ -80,3 +83,5 @@
#define DBL_SIGNALING_NAN fennec::bit_cast(0x7ff4000000000000l)
#define DBL_DENORM_MIN fennec::bit_cast(0x1l)
#define DBL_ROUND_ERR fennec::bit_cast(0x3fe0000000000000l)
+
+#endif // FENNEC_LANG_FLOAT_H
diff --git a/include/fennec/lang/lang.h b/include/fennec/lang/lang.h
index c9c4f6d..4f4e1cd 100644
--- a/include/fennec/lang/lang.h
+++ b/include/fennec/lang/lang.h
@@ -28,8 +28,8 @@
///
///
-#ifndef LANG_H
-#define LANG_H
+#ifndef FENNEC_LANG_H
+#define FENNEC_LANG_H
///
/// \page page_fennec_lang C++ Language Library
@@ -38,4 +38,4 @@
///
///
-#endif //LANG_H
+#endif // FENNEC_LANG_H
diff --git a/include/fennec/lang/utility.h b/include/fennec/lang/utility.h
index af329cb..7aee5b6 100644
--- a/include/fennec/lang/utility.h
+++ b/include/fennec/lang/utility.h
@@ -28,8 +28,8 @@
///
///
-#ifndef UTILITY_H
-#define UTILITY_H
+#ifndef FENNEC_LANG_UTILITY_H
+#define FENNEC_LANG_UTILITY_H
#include
@@ -78,4 +78,4 @@ template constexpr const remove_reference_t& copy(T&& x) noexcept
}
-#endif //UTILITY_H
+#endif // FENNEC_LANG_UTILITY_H
diff --git a/include/fennec/math/detail/__fwd.h b/include/fennec/math/detail/__fwd.h
index d8406a7..5b3e18f 100644
--- a/include/fennec/math/detail/__fwd.h
+++ b/include/fennec/math/detail/__fwd.h
@@ -16,8 +16,8 @@
// along with this program. If not, see .
// =====================================================================================================================
-#ifndef FWD_H
-#define FWD_H
+#ifndef FENNEC_MATH_DETAIL_FWD_H
+#define FENNEC_MATH_DETAIL_FWD_H
#include
@@ -36,4 +36,4 @@ template using mat
}
-#endif //FWD_H
+#endif // FENNEC_MATH_DETAIL_FWD_H
diff --git a/include/fennec/math/matrix.h b/include/fennec/math/matrix.h
index ea06f00..0040bbd 100644
--- a/include/fennec/math/matrix.h
+++ b/include/fennec/math/matrix.h
@@ -37,8 +37,8 @@
///
///
-#ifndef MATRIX_H
-#define MATRIX_H
+#ifndef FENNEC_MATH_MATRIX_H
+#define FENNEC_MATH_MATRIX_H
#include
@@ -378,4 +378,4 @@ private:
}
-#endif //MATRIX_H
+#endif // FENNEC_MATH_MATRIX_H
diff --git a/include/fennec/math/relational.h b/include/fennec/math/relational.h
index 3b5fdd0..3405f0d 100644
--- a/include/fennec/math/relational.h
+++ b/include/fennec/math/relational.h
@@ -30,6 +30,7 @@
#ifndef FENNEC_MATH_RELATIONAL_H
#define FENNEC_MATH_RELATIONAL_H
+
#include
// TODO: Document
diff --git a/include/fennec/math/scalar.h b/include/fennec/math/scalar.h
index df5eeda..373ac10 100644
--- a/include/fennec/math/scalar.h
+++ b/include/fennec/math/scalar.h
@@ -67,4 +67,4 @@ using uint = unsigned int;
}
-#endif //TYPES_H
+#endif // FENNEC_MATH_SCALAR_H
diff --git a/include/fennec/math/swizzle.h b/include/fennec/math/swizzle.h
index 5701581..6b6d0b2 100644
--- a/include/fennec/math/swizzle.h
+++ b/include/fennec/math/swizzle.h
@@ -28,8 +28,8 @@
///
///
-#ifndef SWIZZLE_H
-#define SWIZZLE_H
+#ifndef FENNEC_MATH_SWIZZLE_H
+#define FENNEC_MATH_SWIZZLE_H
#include
#include
@@ -82,4 +82,4 @@ private:
}
-#endif //SWIZZLE_H
+#endif // FENNEC_MATH_SWIZZLE_H
diff --git a/include/fennec/math/swizzle_storage.h b/include/fennec/math/swizzle_storage.h
index bb9ddee..a366337 100644
--- a/include/fennec/math/swizzle_storage.h
+++ b/include/fennec/math/swizzle_storage.h
@@ -17,8 +17,8 @@
// =====================================================================================================================
-#ifndef SWIZZLE_STORAGE_H
-#define SWIZZLE_STORAGE_H
+#ifndef FENNEC_MATH_SWIZZLE_STORAGE_H
+#define FENNEC_MATH_SWIZZLE_STORAGE_H
namespace fennec
{
@@ -54,4 +54,4 @@ struct swizzle_storage
}
-#endif //SWIZZLE_STORAGE_H
+#endif // FENNEC_MATH_SWIZZLE_STORAGE_H
diff --git a/include/fennec/math/vector_base.h b/include/fennec/math/vector_base.h
index 1031d1c..3e51877 100644
--- a/include/fennec/math/vector_base.h
+++ b/include/fennec/math/vector_base.h
@@ -17,8 +17,8 @@
// =====================================================================================================================
-#ifndef VECTOR_BASE_H
-#define VECTOR_BASE_H
+#ifndef FENNEC_MATH_VECTOR_BASE_H
+#define FENNEC_MATH_VECTOR_BASE_H
#include
@@ -95,4 +95,4 @@ using vector_base_type = typename vector_base_type_helper::Stora
}
-#endif //VECTOR_BASE_H
+#endif // FENNEC_MATH_VECTOR_BASE_H
diff --git a/include/fennec/math/vector_storage.h b/include/fennec/math/vector_storage.h
index e12ad9a..fd97034 100644
--- a/include/fennec/math/vector_storage.h
+++ b/include/fennec/math/vector_storage.h
@@ -17,8 +17,8 @@
// =====================================================================================================================
-#ifndef VECTOR_STORAGE_H
-#define VECTOR_STORAGE_H
+#ifndef FENNEC_MATH_VECTOR_STORAGE_H
+#define FENNEC_MATH_VECTOR_STORAGE_H
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
@@ -633,4 +633,4 @@ struct vector_storage<4, SwizzleGenT, DataT>
#pragma GCC diagnostic pop
-#endif //VECTOR_STORAGE_H
+#endif // FENNEC_MATH_VECTOR_STORAGE_H
diff --git a/include/fennec/memory/new.h b/include/fennec/memory/new.h
index c7ccdea..13416ce 100644
--- a/include/fennec/memory/new.h
+++ b/include/fennec/memory/new.h
@@ -40,6 +40,12 @@ struct nothrow_t { explicit nothrow_t() noexcept { } };
template void construct(TypeT* ptr)
{ ptr->TypeT(); }
+template void construct(TypeT* ptr, const TypeT& val)
+ { ptr->TypeT(val); }
+
+template void construct(TypeT* ptr, TypeT&& val)
+ { ptr->TypeT(fennec::forward(val)); }
+
template void construct(TypeT* ptr, ArgsT...args)
{ ptr->TypeT(fennec::forward(args)...); }
diff --git a/include/fennec/memory/pointers.h b/include/fennec/memory/pointers.h
index 50d66e7..5664cb9 100644
--- a/include/fennec/memory/pointers.h
+++ b/include/fennec/memory/pointers.h
@@ -16,8 +16,8 @@
// along with this program. If not, see .
// =====================================================================================================================
-#ifndef FENNEC_LANG_POINTERS_H
-#define FENNEC_LANG_POINTERS_H
+#ifndef FENNEC_MEMORY_POINTERS_H
+#define FENNEC_MEMORY_POINTERS_H
#include
@@ -132,4 +132,4 @@ private:
}
-#endif // FENNEC_LANG_POINTERS_H
+#endif // FENNEC_MEMORY_POINTERS_H
diff --git a/metaprogramming/main.cpp b/metaprogramming/main.cpp
index 6c53b08..2ef5595 100644
--- a/metaprogramming/main.cpp
+++ b/metaprogramming/main.cpp
@@ -55,9 +55,18 @@ int main(int, const char**)
flt << "///" << std::endl;
flt << "" << std::endl;
- flt << "#include " << std::endl;
+
+ flt << "#ifndef FENNEC_LANG_FLOAT_H" << std::endl;
+ flt << "#define FENNEC_LANG_FLOAT_H" << std::endl;
+
flt << "" << std::endl;
+ flt << "#include " << std::endl;
+
+ flt << "" << std::endl;
+
+ // TODO: Fix this to generate info without using the c++stdlib for platforms without this available.
+
flt << "#define FLT_HAS_INFINITY " << std::dec << std::numeric_limits::has_infinity << std::endl;
flt << "#define FLT_HAS_QUIET_NAN " << std::dec << std::numeric_limits::has_quiet_NaN << std::endl;
flt << "#define FLT_HAS_SIGNALING_NAN " << std::dec << std::numeric_limits::has_signaling_NaN << std::endl;
@@ -114,6 +123,10 @@ int main(int, const char**)
flt << "#define DBL_DENORM_MIN " << "fennec::bit_cast(0x" << std::hex << std::bit_cast(std::numeric_limits::denorm_min() ) << "l)" << std::endl;
flt << "#define DBL_ROUND_ERR " << "fennec::bit_cast(0x" << std::hex << std::bit_cast(std::numeric_limits::round_error() ) << "l)" << std::endl;
+ flt << "" << std::endl;
+
+ flt << "#endif // FENNEC_LANG_FLOAT_H" << std::endl;
+
flt.close();
return 0;
diff --git a/test.sh b/test.sh
index 423384e..73dcb37 100755
--- a/test.sh
+++ b/test.sh
@@ -41,7 +41,7 @@ Debug()
cd ./build/debug
cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug -S ../.. -B .
cmake --build . --target fennec-test
- ./test/fennec-test
+ valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes --verbose --log-file=valgrind.txt ./test/fennec-test
cd ../..
}
@@ -51,7 +51,7 @@ Release()
cd ./build/release
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -S ../.. -B .
cmake --build . --target fennec-test
- ./test/fennec-test
+ valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes --verbose --log-file=valgrind.txt ./test/fennec-test
cd ../..
}
@@ -61,7 +61,7 @@ RelWithDebInfo()
cd ./build/relwithdebinfo
cmake -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -S ../.. -B .
cmake --build . --target fennec-test
- ./test/fennec-test
+ valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes --verbose --log-file=valgrind.txt ./test/fennec-test
cd ../..
}
@@ -71,7 +71,7 @@ MinSizeRel()
cd ./build/minsizerel
cmake -G Ninja -DCMAKE_BUILD_TYPE=MinSizeRel -S ../.. -B .
cmake --build . --target fennec-test
- ./test/fennec-test
+ valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes --verbose --log-file=valgrind.txt ./test/fennec-test
cd ../..
}
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 69af200..3ac8e16 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -12,6 +12,7 @@ add_executable(fennec-test main.cpp
tests/test_memory.h
tests/test_math.h
tests/test_lang.h
+ tests/lang/conditional_types.h
)
target_link_libraries(fennec-test PRIVATE
diff --git a/test/main.cpp b/test/main.cpp
index b88a6b0..c2a66f1 100644
--- a/test/main.cpp
+++ b/test/main.cpp
@@ -18,51 +18,23 @@
#include
-#include "tests/test_scalar.h"
-#include "tests/test_vector.h"
-#include "tests/test_geometric.h"
-#include "tests/math/test_matrix.h"
+#include "test.h"
-#include
+#include "tests/test_lang.h"
+#include "tests/test_math.h"
+#include "tests/test_memory.h"
int main(int, char **)
{
- fennec_test_spacer(1);
-
- fennec_test_section("fennec-test, a program to execute unit tests for fennec");
+ fennec_test_header("fennec-test, a program to execute unit tests for fennec");
fennec_test_spacer(2);
- fennec_test_section(scalar tests =================================================================================);
-
+ fennec_test_header("math library");
fennec_test_spacer(2);
-
- fennec::test::fennec_test_scalar();
-
+ fennec::test::fennec_test_math();
fennec_test_spacer(3);
- fennec_test_section(vector tests =================================================================================);
-
- fennec_test_spacer(2);
-
- fennec::test::fennec_test_vector();
-
- fennec_test_spacer(3);
-
- fennec_test_section(geometric tests ==============================================================================);
-
- fennec_test_spacer(2);
-
- fennec::test::fennec_test_geometric();
-
- fennec_test_spacer(3);
-
- fennec_test_section(matrix tests =================================================================================);
-
- fennec_test_spacer(2);
-
- fennec::test::fennec_test_matrix();
-
return 0;
}
diff --git a/test/test.h b/test/test.h
index 94d5d91..722552b 100644
--- a/test/test.h
+++ b/test/test.h
@@ -23,6 +23,7 @@
#include
#include
#include
+
#include
#include
#include
@@ -90,7 +91,14 @@ inline void __fennec_test_run(const std::string& expression, ResultT result, Res
}
#define fennec_test_run(Expression, Expected) __fennec_test_run(#Expression, Expression, Expected)
-#define fennec_test_section(Section) std::cout << #Section << std::endl
+
+#define fennec_test_header(Header) std::cout << std::string(80, '=') << std::endl \
+ << (Header) << std::endl \
+ << std::string(80, '=') << std::endl
+
+#define fennec_test_subheader(Header) std::cout << (Header) << ' ' << std::string(80 - sizeof(Header), '=') << std::endl
+#define fennec_test_section(Section) std::cout << (Section) << ' ' << std::string(80 - sizeof(Section), '-') << std::endl
+
#define fennec_test_spacer(Count) std::cout << std::string(Count, std::cout.widen('\n'))
#endif // FENNEC_TEST_H
diff --git a/test/tests/lang/conditional_types.h b/test/tests/lang/conditional_types.h
new file mode 100644
index 0000000..97b4cf9
--- /dev/null
+++ b/test/tests/lang/conditional_types.h
@@ -0,0 +1,24 @@
+// =====================================================================================================================
+// fennec-test, a program to execute unit tests for fennec
+// Copyright © 2025 Medusa Slockbower
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+// =====================================================================================================================
+
+#ifndef FENNEC_TEST_LANG_CONDITIONAL_TYPES_H
+#define FENNEC_TEST_LANG_CONDITIONAL_TYPES_H
+
+
+
+#endif // FENNEC_TEST_LANG_CONDITIONAL_TYPES_H
diff --git a/test/tests/math/test_geometric.h b/test/tests/math/test_geometric.h
index 60a7274..113500c 100644
--- a/test/tests/math/test_geometric.h
+++ b/test/tests/math/test_geometric.h
@@ -1,6 +1,6 @@
// =====================================================================================================================
-// fennec, a free and open source game engine
-// Copyright (C) 2025 Medusa Slockbower
+// fennec-test, a program to execute unit tests for fennec
+// Copyright © 2025 Medusa Slockbower
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -17,8 +17,8 @@
// =====================================================================================================================
-#ifndef TEST_GEOMETRIC_H
-#define TEST_GEOMETRIC_H
+#ifndef FENNEC_TEST_GEOMETRIC_H
+#define FENNEC_TEST_GEOMETRIC_H
#include
#include
@@ -31,10 +31,8 @@ namespace fennec
namespace test
{
-inline void fennec_test_geometric()
+inline void fennec_test_math_geometric()
{
- fennec_test_section(geometric functions);
-
fennec_test_spacer(1);
fennec_test_run(fennec::dot(vec2(1, 2), vec2(1, 2)), 5.0f);
@@ -77,4 +75,4 @@ inline void fennec_test_geometric()
}
-#endif // TEST_GEOMETRIC_H
+#endif // FENNEC_TEST_GEOMETRIC_H
diff --git a/test/tests/math/test_matrix.h b/test/tests/math/test_matrix.h
index 0cb2f28..5cc47a6 100644
--- a/test/tests/math/test_matrix.h
+++ b/test/tests/math/test_matrix.h
@@ -1,6 +1,6 @@
// =====================================================================================================================
-// fennec, a free and open source game engine
-// Copyright (C) 2025 Medusa Slockbower
+// fennec-test, a program to execute unit tests for fennec
+// Copyright © 2025 Medusa Slockbower
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -32,7 +32,7 @@ namespace fennec
namespace test
{
-inline void fennec_test_matrix()
+inline void fennec_test_math_matrix()
{
diff --git a/test/tests/math/test_scalar.h b/test/tests/math/test_scalar.h
index c349bf2..3da2771 100644
--- a/test/tests/math/test_scalar.h
+++ b/test/tests/math/test_scalar.h
@@ -1,6 +1,6 @@
// =====================================================================================================================
-// fennec, a free and open source game engine
-// Copyright (C) 2025 Medusa Slockbower
+// fennec-test, a program to execute unit tests for fennec
+// Copyright © 2025 Medusa Slockbower
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -17,8 +17,8 @@
// =====================================================================================================================
-#ifndef TEST_SCALAR_H
-#define TEST_SCALAR_H
+#ifndef FENNEC_TEST_SCALAR_H
+#define FENNEC_TEST_SCALAR_H
#include
@@ -30,9 +30,9 @@ namespace fennec
namespace test
{
-inline void fennec_test_scalar()
+inline void fennec_test_math_scalar()
{
- fennec_test_section(component_count);
+ fennec_test_section("component_count");
fennec_test_spacer(1);
@@ -71,4 +71,4 @@ inline void fennec_test_scalar()
}
-#endif //TEST_SCALAR_H
+#endif // FENNEC_TEST_SCALAR_H
diff --git a/test/tests/math/test_vector.h b/test/tests/math/test_vector.h
index 567818c..d80a153 100644
--- a/test/tests/math/test_vector.h
+++ b/test/tests/math/test_vector.h
@@ -1,5 +1,5 @@
// =====================================================================================================================
-// fennec, a free and open source game engine
+// fennec-test, a program to execute unit tests for fennec
// Copyright © 2025 Medusa Slockbower
//
// This program is free software: you can redistribute it and/or modify
@@ -17,8 +17,8 @@
// =====================================================================================================================
-#ifndef TEST_VECTOR_H
-#define TEST_VECTOR_H
+#ifndef FENNEC_TEST_VECTOR_H
+#define FENNEC_TEST_VECTOR_H
#include
@@ -33,9 +33,9 @@ namespace fennec
namespace test
{
-inline void fennec_test_vector()
+inline void fennec_test_math_vector()
{
- fennec_test_section(component_count);
+ fennec_test_section("component_count");
fennec_test_spacer(1);
@@ -146,7 +146,7 @@ inline void fennec_test_vector()
fennec_test_spacer(2);
- fennec_test_section(vec2 constructors);
+ fennec_test_section("vec2 constructors");
fennec_test_spacer(1);
@@ -161,7 +161,7 @@ inline void fennec_test_vector()
fennec_test_spacer(2);
- fennec_test_section(vec2 swizzles);
+ fennec_test_section("vec2 swizzles");
fennec_test_spacer(1);
@@ -172,7 +172,7 @@ inline void fennec_test_vector()
fennec_test_spacer(2);
- fennec_test_section(vec3 constructors);
+ fennec_test_section("vec3 constructors");
fennec_test_spacer(1);
@@ -187,7 +187,7 @@ inline void fennec_test_vector()
fennec_test_spacer(2);
- fennec_test_section(vec3 swizzles);
+ fennec_test_section("vec3 swizzles");
fennec_test_spacer(1);
@@ -233,7 +233,7 @@ inline void fennec_test_vector()
fennec_test_spacer(2);
- fennec_test_section(scalar-vector operations);
+ fennec_test_section("scalar-vector operations");
fennec_test_spacer(1);
@@ -249,7 +249,7 @@ inline void fennec_test_vector()
fennec_test_spacer(2);
- fennec_test_section(vector-vector operations);
+ fennec_test_section("vector-vector operations");
fennec_test_spacer(1);
@@ -288,4 +288,4 @@ inline void fennec_test_vector()
}
-#endif //TEST_VECTOR_H
+#endif // FENNEC_TEST_VECTOR_H
diff --git a/test/tests/test_lang.h b/test/tests/test_lang.h
index edfe5a8..fe74ce5 100644
--- a/test/tests/test_lang.h
+++ b/test/tests/test_lang.h
@@ -1,8 +1,22 @@
+// =====================================================================================================================
+// fennec-test, a program to execute unit tests for fennec
+// Copyright © 2025 Medusa Slockbower
//
-// Created by medusa on 6/8/25.
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+// =====================================================================================================================
-#ifndef TEST_LANG_H
-#define TEST_LANG_H
+#ifndef FENNEC_TEST_LANG_H
+#define FENNEC_TEST_LANG_H
-#endif //TEST_LANG_H
+#endif // FENNEC_TEST_LANG_H
diff --git a/test/tests/test_math.h b/test/tests/test_math.h
index 067aa96..18631fa 100644
--- a/test/tests/test_math.h
+++ b/test/tests/test_math.h
@@ -1,8 +1,62 @@
+// =====================================================================================================================
+// fennec-test, a program to execute unit tests for fennec
+// Copyright © 2025 Medusa Slockbower
//
-// Created by medusa on 6/8/25.
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+// =====================================================================================================================
-#ifndef TEST_MATH_H
-#define TEST_MATH_H
+#ifndef FENNEC_TEST_MATH_H
+#define FENNEC_TEST_MATH_H
-#endif //TEST_MATH_H
+#include "math/test_scalar.h"
+#include "math/test_vector.h"
+#include "math/test_matrix.h"
+#include "math/test_geometric.h"
+
+namespace fennec
+{
+
+namespace test
+{
+
+inline void fennec_test_math()
+{
+
+ fennec_test_subheader("scalar tests");
+ fennec_test_spacer(2);
+ fennec_test_math_scalar();
+ fennec_test_spacer(3);
+
+ fennec_test_subheader("vector tests");
+ fennec_test_spacer(2);
+ fennec_test_math_vector();
+ fennec_test_spacer(3);
+
+ fennec_test_subheader("matrix tests");
+ fennec_test_spacer(2);
+ fennec_test_math_matrix();
+ fennec_test_spacer(3);
+
+
+ fennec_test_subheader("geometric tests");
+ fennec_test_spacer(2);
+ fennec_test_math_geometric();
+ fennec_test_spacer(3);
+}
+
+}
+
+}
+
+#endif // FENNEC_TEST_MATH_H
diff --git a/test/tests/test_memory.h b/test/tests/test_memory.h
index cb8e490..45a1eb6 100644
--- a/test/tests/test_memory.h
+++ b/test/tests/test_memory.h
@@ -1,8 +1,22 @@
+// =====================================================================================================================
+// fennec-test, a program to execute unit tests for fennec
+// Copyright © 2025 Medusa Slockbower
//
-// Created by medusa on 6/8/25.
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+// =====================================================================================================================
-#ifndef TEST_MEMORY_H
-#define TEST_MEMORY_H
+#ifndef FENNEC_TEST_MEMORY_H
+#define FENNEC_TEST_MEMORY_H
-#endif //TEST_MEMORY_H
+#endif // FENNEC_TEST_MEMORY_H