diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7df0e9c..2e1f0e9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -238,6 +238,8 @@ add_library(fennec STATIC
${FENNEC_EXTRA_SOURCES}
include/fennec/renderers/interface/gfxresourcepool.h
+ include/fennec/langproc/format/tokenizer.h
+ include/fennec/containers/priority_queue.h
)
add_dependencies(fennec metaprogramming fennec-dependencies)
diff --git a/include/fennec/containers/priority_queue.h b/include/fennec/containers/priority_queue.h
new file mode 100644
index 0000000..c3f4422
--- /dev/null
+++ b/include/fennec/containers/priority_queue.h
@@ -0,0 +1,66 @@
+// =====================================================================================================================
+// fennec, a free and open source game engine
+// 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 .
+// =====================================================================================================================
+
+///
+/// \file priority_queue.h
+/// \brief
+///
+///
+/// \details
+/// \author Medusa Slockbower
+///
+/// \copyright Copyright © 2025 Medusa Slockbower ([GPLv3](https://www.gnu.org/licenses/gpl-3.0.en.html))
+///
+///
+
+#ifndef FENNEC_CONTAINERS_PRIORITY_QUEUE_H
+#define FENNEC_CONTAINERS_PRIORITY_QUEUE_H
+
+#include
+#include
+#include
+#include
+
+namespace fennec
+{
+
+template, class AllocT = allocator>
+struct priority_queue {
+public:
+ using value_t = ValueT;
+ using compare_t = CompareT;
+ using alloc_t = AllocT;
+
+private:
+ struct node {
+ size_t parent, child;
+ size_t left, right;
+ int degree;
+ value_t key;
+ };
+
+ using table_t = object_pool;
+
+public:
+ table_t _table;
+};
+
+}
+
+
+#endif // FENNEC_CONTAINERS_PRIORITY_QUEUE_H
\ No newline at end of file
diff --git a/include/fennec/langproc/compile/tokenizer.h b/include/fennec/langproc/compile/tokenizer.h
new file mode 100644
index 0000000..50c223a
--- /dev/null
+++ b/include/fennec/langproc/compile/tokenizer.h
@@ -0,0 +1,96 @@
+// =====================================================================================================================
+// fennec, a free and open source game engine
+// 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 .
+// =====================================================================================================================
+
+///
+/// \file tokenizer.h
+/// \brief
+///
+///
+/// \details
+/// \author Medusa Slockbower
+///
+/// \copyright Copyright © 2025 Medusa Slockbower ([GPLv3](https://www.gnu.org/licenses/gpl-3.0.en.html))
+///
+///
+
+#ifndef FENNEC_LANGPROC_FORMAT_TOKENIZER_H
+#define FENNEC_LANGPROC_FORMAT_TOKENIZER_H
+
+#include
+#include
+
+//
+// escape sequences are tricky, sometimes they must be separated by white space,
+// other times they don't. Requiring a list of all possible escape sequences is unrealistic.
+// We need to allow the user of this struct to specify rules for escape sequences. Here are some basic rules:
+//
+// An escape sequence is marked by an escape character, e.g. %, \, {{
+// Multiple escape characters may be used in a single tokenizer and will have different rules
+// Escape characters may also be operators, brackets, or quotes
+// Escape sequences may contain operators, brackets, or quotes
+//
+// Here are a few examples of escape sequences from various formats and languages
+// C: \\, \n, \0, \u200b
+// PrintF: %s, %2.2f
+// Python FMT: {{, }}
+// SPSS: ''
+//
+
+namespace fennec
+{
+
+struct escape_sequence {
+ virtual size_t operator[](const std::string& str, size_t i) = 0;
+};
+
+struct tokenizer {
+ using escseq = escape_sequence*;
+ using escmap = map;
+
+ string delimiter; // markers that separate tokens
+ string operators; // operators are treated as individual tokens
+ string brackets; // characters that mark brackets
+ string quotes; // characters that mark a string sequence, entire string sequence is treated as one token
+ escmap escapes; // characters that mark the start of an escape sequence and validate them
+
+ enum token_ : uint8_t {
+ token_string = 0,
+ token_newline = 1,
+ token_escaped = 2,
+ token_operator = 3,
+ token_bracket = 4,
+ token_quoted = 5,
+ };
+
+ using token = pair;
+
+private:
+ list operator()(const string& line) {
+ list res;
+
+ for (size_t i = 0; i < )
+
+ return res;
+ }
+
+private:
+};
+
+}
+
+#endif // FENNEC_LANGPROC_FORMAT_TOKENIZER_H
\ No newline at end of file
diff --git a/include/fennec/langproc/strings/cstring.h b/include/fennec/langproc/strings/cstring.h
index b26feb5..2f34022 100644
--- a/include/fennec/langproc/strings/cstring.h
+++ b/include/fennec/langproc/strings/cstring.h
@@ -58,6 +58,7 @@ struct cstring
{
public:
static constexpr size_t npos = -1;
+ using char_t = char;
// Constructors ========================================================================================================
diff --git a/include/fennec/langproc/strings/string.h b/include/fennec/langproc/strings/string.h
index 46cd7fe..884b0ca 100644
--- a/include/fennec/langproc/strings/string.h
+++ b/include/fennec/langproc/strings/string.h
@@ -47,6 +47,7 @@ struct _string
{
public:
static constexpr size_t npos = -1;
+ using char_t = char;
using alloc_t = allocation;
@@ -197,7 +198,7 @@ public:
if (i >= size()) { // bounds check
return -1;
}
- n = fennec::min(n, fennec::max(_str, str.size()) + 1);
+ n = fennec::min(n, fennec::max(size(), str.size()) + 1);
return ::strncmp(_str + i, str, n);
}
@@ -216,10 +217,23 @@ public:
return ::strncmp(_str + i, str.data(), n);
}
+ constexpr bool operator==(const cstring& str) const {
+ return compare(str) == 0;
+ }
+
constexpr bool operator==(const _string& str) const {
return compare(str) == 0;
}
+ ///
+ /// \brief Check if the string contains a character
+ /// \param c
+ /// \param i
+ /// \return
+ constexpr bool contains(char c, size_t i = 0) const {
+ return find(c, i) != size();
+ }
+
///
/// \brief Finds the index of the first occurrence of `c` in the string
/// \param c the character to find
@@ -242,7 +256,7 @@ public:
return size();
}
- const char* loc = ::strstr(_str, str);
+ const char* loc = ::strstr(_str, str._str);
return loc ? loc - _str : size();
}
@@ -325,7 +339,7 @@ public:
/// \param n the number of characters
/// \return
constexpr _string substring(size_t i, size_t n = npos) const {
- if (i >= size()) {
+ if (i >= size() || n == 0) {
return _string("");
}
n = fennec::min(n, size() - i);
@@ -420,6 +434,25 @@ public:
}
+// Iteration ===========================================================================================================
+
+ constexpr char* begin() {
+ return _str.data();
+ }
+
+ constexpr const char* begin() const {
+ return _str.data();
+ }
+
+ constexpr char* end() {
+ return _str.data() + _str.capacity();
+ }
+
+ constexpr const char* end() const {
+ return _str.data() + _str.capacity();
+ }
+
+
private:
alloc_t _str;
};
diff --git a/include/fennec/langproc/strings/wcstring.h b/include/fennec/langproc/strings/wcstring.h
index 35d9e9d..bece5ba 100644
--- a/include/fennec/langproc/strings/wcstring.h
+++ b/include/fennec/langproc/strings/wcstring.h
@@ -60,6 +60,7 @@ struct wcstring
{
public:
static constexpr size_t npos = -1;
+ using char_t = wchar_t;
// Constructors ========================================================================================================
diff --git a/include/fennec/langproc/strings/wstring.h b/include/fennec/langproc/strings/wstring.h
index 8436650..fc41c6f 100644
--- a/include/fennec/langproc/strings/wstring.h
+++ b/include/fennec/langproc/strings/wstring.h
@@ -47,6 +47,7 @@ struct _wstring
{
public:
static constexpr size_t npos = -1;
+ using char_t = wchar_t;
using alloc_t = allocation;
@@ -216,10 +217,23 @@ public:
return ::wcsncmp(_str + i, str.data(), n);
}
+ constexpr bool operator==(const wcstring& str) const {
+ return compare(str) == 0;
+ }
+
constexpr bool operator==(const _wstring& str) const {
return compare(str) == 0;
}
+ ///
+ /// \brief Check if the string contains a character
+ /// \param c
+ /// \param i
+ /// \return
+ constexpr bool contains(char c, size_t i = 0) const {
+ return find(c, i) != size();
+ }
+
///
/// \brief Finds the index of the first occurrence of `c` in the string
/// \param c the wchar_tacter to find
diff --git a/include/fennec/math/ext/quaternion.h b/include/fennec/math/ext/quaternion.h
index 1042c51..5d275aa 100644
--- a/include/fennec/math/ext/quaternion.h
+++ b/include/fennec/math/ext/quaternion.h
@@ -306,8 +306,8 @@ public:
// Quaternion Quaternion Arithmetic Operators ==========================================================================
- constexpr friend quaternion operator+(const quaternion& lhs, const quaternion& rhs) {
- return quaternion(
+ constexpr friend quat_t operator+(const quat_t& lhs, const quat_t& rhs) {
+ return quat_t(
lhs.w + rhs.w,
lhs.x + rhs.x,
lhs.y + rhs.y,
@@ -315,8 +315,8 @@ public:
);
}
- constexpr friend quaternion operator-(const quaternion& lhs, const quaternion& rhs) {
- return quaternion(
+ constexpr friend quat_t operator-(const quat_t& lhs, const quat_t& rhs) {
+ return quat_t(
lhs.w - rhs.w,
lhs.x - rhs.x,
lhs.y - rhs.y,
@@ -324,8 +324,8 @@ public:
);
}
- constexpr friend quaternion operator*(const quaternion& lhs, const quaternion& rhs) {
- return quaternion(
+ constexpr friend quat_t operator*(const quat_t& lhs, const quat_t& rhs) {
+ return quat_t(
lhs.w*rhs.w - lhs.x*rhs.x - lhs.y*rhs.y - lhs.z * rhs.z,
lhs.w*rhs.x + lhs.x*rhs.w + lhs.y*rhs.z - lhs.z * rhs.y,
lhs.w*rhs.y - lhs.x*rhs.z + lhs.y*rhs.w + lhs.z * rhs.x,
@@ -336,7 +336,7 @@ public:
// Quaternion Quaternion Arithmetic Assignment Operators ===============================================================
- constexpr friend quaternion& operator+=(quaternion& lhs, const quaternion& rhs) {
+ constexpr friend quat_t& operator+=(quat_t& lhs, const quat_t& rhs) {
lhs.w += rhs.w;
lhs.x += rhs.x;
lhs.y += rhs.y;
@@ -344,7 +344,7 @@ public:
return lhs;
}
- constexpr friend quaternion& operator-=(quaternion& lhs, const quaternion& rhs) {
+ constexpr friend quat_t& operator-=(quat_t& lhs, const quat_t& rhs) {
lhs.w -= rhs.w;
lhs.x -= rhs.x;
lhs.y -= rhs.y;
@@ -352,7 +352,7 @@ public:
return lhs;
}
- constexpr friend quaternion& operator*=(quaternion& lhs, const quaternion& rhs) {
+ constexpr friend quat_t& operator*=(quat_t& lhs, const quat_t& rhs) {
return lhs = lhs * rhs;
}
diff --git a/include/fennec/memory/allocator.h b/include/fennec/memory/allocator.h
index debb736..3a7dea8 100644
--- a/include/fennec/memory/allocator.h
+++ b/include/fennec/memory/allocator.h
@@ -280,7 +280,7 @@ public:
/// \details This simply acts as a proxy for allocating memory. It does not call any constructors or
/// initialize any values as if they were the provided data type. Any operations present work
/// only on individual bytes.
-template
+template>
struct allocation
{
public:
diff --git a/include/fennec/platform/interface/window.h b/include/fennec/platform/interface/window.h
index 54ef937..745683f 100644
--- a/include/fennec/platform/interface/window.h
+++ b/include/fennec/platform/interface/window.h
@@ -33,6 +33,7 @@
#include
#include
+#include
namespace fennec
{
@@ -115,22 +116,29 @@ public:
// Modifiers ===========================================================================================================
+ virtual void resize(size_t, size_t) = 0;
+ virtual void position(size_t, size_t) = 0;
+
virtual void set_fullscreen(bool) = 0;
virtual void set_borderless(bool) = 0;
+
virtual void grab_mouse(bool) = 0;
virtual void grab_keyboard(bool) = 0;
+
virtual void set_title(const cstring&) = 0;
virtual void set_title(const string&) = 0;
- virtual void vsync(int8_t) = 0;
virtual void set_progress(bool, float) = 0;
+ virtual void vsync(int8_t) = 0;
+
// Graphics ============================================================================================================
virtual void begin_frame() = 0;
virtual void end_frame() = 0;
protected:
- window* _parent;
+ window* _parent;
+ gfxcontext* _context;
config _config;
window(window* parent, const config& cfg)
diff --git a/include/fennec/platform/sdl/sdlwindow.h b/include/fennec/platform/sdl/sdlwindow.h
index 603e2fb..a7685e9 100644
--- a/include/fennec/platform/sdl/sdlwindow.h
+++ b/include/fennec/platform/sdl/sdlwindow.h
@@ -38,7 +38,25 @@ namespace fennec
class sdlwindow : public window {
public:
+ sdlwindow(window* parent, const config& cfg);
+ bool running() override;
+
+ void set_fullscreen(bool) override;
+ void set_borderless(bool) override;
+
+ void grab_mouse(bool) override;
+ void grab_keyboard(bool) override;
+
+ void set_title(const cstring&) override;
+ void set_title(const string&) override;
+ void set_progress(bool, float) override;
+
+ void vsync(int8_t) override;
+
+
+ void begin_frame() override;
+ void end_frame() override;
private:
diff --git a/include/fennec/renderers/interface/forward.h b/include/fennec/renderers/interface/forward.h
index e8367af..c888e43 100644
--- a/include/fennec/renderers/interface/forward.h
+++ b/include/fennec/renderers/interface/forward.h
@@ -37,6 +37,7 @@ namespace fennec
class gfxpass; // Overarching rendering scheme
class gfxcontext; // Globals for an API's context
class gfxresourcepool; // Handles resource creation, allocation, and mapping
+class gfxpass; // A pass of the renderer, holds a set of subpasses with one coherent objective
class gfxsubpass; // A subpass of the renderer, implements, for example, the steps of composing and lighting a deferred renderer
class gfxpipeline; // A user-defined pipeline, e.g. the Vulkan pipeline needed to render the G-Buffer
diff --git a/include/fennec/renderers/interface/gfxpass.h b/include/fennec/renderers/interface/gfxpass.h
index 8f50ccd..7cc0577 100644
--- a/include/fennec/renderers/interface/gfxpass.h
+++ b/include/fennec/renderers/interface/gfxpass.h
@@ -39,17 +39,22 @@ namespace fennec
{
///
-/// \brief Defines a renderer interface to implement different graphics APIs, e.g. OpenGL Vulkan
+/// \brief Defines an interface that holds a series of passes with one coherent objective
/// \details This represents the overarching renderer, and not any platform specific behaviour.
/// I.E. This acts as a proxy for creating API objects, but the behaviour of those objects
/// is defined elsewhere.
class gfxpass {
public:
+ gfxsubpass* add_subpass();
private:
};
+class gfxsubpass {
+
+};
+
}
#endif // FENNEC_PLATFORM_INTERFACE_GFXCONTEXT_H
\ No newline at end of file
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index ea13eb6..8c633a3 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -8,6 +8,7 @@ add_executable(fennec-test
main.cpp
tests/containers/performance/test_iterator_visitor.h
tests/containers/test_sequence.h
+ tests/langproc/test_format.h
)
target_compile_definitions(fennec-test PUBLIC FENNEC_TEST_CWD="${CMAKE_SOURCE_DIR}/bin/${FENNEC_BUILD_NAME}"
diff --git a/test/tests/langproc/test_format.h b/test/tests/langproc/test_format.h
new file mode 100644
index 0000000..cf4d964
--- /dev/null
+++ b/test/tests/langproc/test_format.h
@@ -0,0 +1,63 @@
+// =====================================================================================================================
+// fennec, a free and open source game engine
+// 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 .
+// =====================================================================================================================
+
+///
+/// \file test_format.h
+/// \brief
+///
+///
+/// \details
+/// \author Medusa Slockbower
+///
+/// \copyright Copyright © 2025 Medusa Slockbower ([GPLv3](https://www.gnu.org/licenses/gpl-3.0.en.html))
+///
+///
+
+#ifndef FENNEC_TEST_LANGPROC_FORMAT_H
+#define FENNEC_TEST_LANGPROC_FORMAT_H
+#include
+
+namespace fennec
+{
+
+namespace test
+{
+
+inline void fennec_test_langproc_format() {
+
+ tokenizer math = {
+ .delimiter { " " },
+ .operators {"+-/*="},
+ .braces { "()" },
+ .escapes { "" },
+ .terminator { "" },
+ };
+
+ const auto res = math.parse("1 + 2 = 3");
+ fennec_test_run(res.size(), size_t(5));
+
+ for (const auto& token : res) {
+ std::cout << token.second << ", ";
+ }
+}
+
+}
+
+}
+
+#endif // FENNEC_TEST_LANGPROC_FORMAT_H
\ No newline at end of file
diff --git a/test/tests/test_langproc.h b/test/tests/test_langproc.h
index 912b36d..7278f89 100644
--- a/test/tests/test_langproc.h
+++ b/test/tests/test_langproc.h
@@ -23,6 +23,7 @@
#include "./langproc/test_strings.h"
#include "./langproc/test_io.h"
+#include "langproc/test_format.h"
namespace fennec::test
{
@@ -33,6 +34,11 @@ namespace fennec::test
fennec_test_langproc_strings();
fennec_test_spacer(3);
+ fennec_test_header("format");
+ fennec_test_spacer(2);
+ fennec_test_langproc_format();
+ fennec_test_spacer(3);
+
fennec_test_header("io");
fennec_test_spacer(2);
fennec_test_langproc_io();