- Began outlining tokenizer.h and priority_queue.h
- Began outlining sdl implementation - Added some helper definitions to various classes - Added contains to string.h and wstring.h
This commit is contained in:
@@ -238,6 +238,8 @@ add_library(fennec STATIC
|
|||||||
|
|
||||||
${FENNEC_EXTRA_SOURCES}
|
${FENNEC_EXTRA_SOURCES}
|
||||||
include/fennec/renderers/interface/gfxresourcepool.h
|
include/fennec/renderers/interface/gfxresourcepool.h
|
||||||
|
include/fennec/langproc/format/tokenizer.h
|
||||||
|
include/fennec/containers/priority_queue.h
|
||||||
)
|
)
|
||||||
|
|
||||||
add_dependencies(fennec metaprogramming fennec-dependencies)
|
add_dependencies(fennec metaprogramming fennec-dependencies)
|
||||||
|
|||||||
66
include/fennec/containers/priority_queue.h
Normal file
66
include/fennec/containers/priority_queue.h
Normal file
@@ -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 <https://www.gnu.org/licenses/>.
|
||||||
|
// =====================================================================================================================
|
||||||
|
|
||||||
|
///
|
||||||
|
/// \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 <fennec/containers/object_pool.h>
|
||||||
|
#include <fennec/lang/compare.h>
|
||||||
|
#include <fennec/lang/types.h>
|
||||||
|
#include <fennec/memory/allocator.h>
|
||||||
|
|
||||||
|
namespace fennec
|
||||||
|
{
|
||||||
|
|
||||||
|
template<typename ValueT, class CompareT = less<ValueT>, class AllocT = allocator<ValueT>>
|
||||||
|
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<node>;
|
||||||
|
|
||||||
|
public:
|
||||||
|
table_t _table;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif // FENNEC_CONTAINERS_PRIORITY_QUEUE_H
|
||||||
96
include/fennec/langproc/compile/tokenizer.h
Normal file
96
include/fennec/langproc/compile/tokenizer.h
Normal file
@@ -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 <https://www.gnu.org/licenses/>.
|
||||||
|
// =====================================================================================================================
|
||||||
|
|
||||||
|
///
|
||||||
|
/// \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 <fennec/containers/list.h>
|
||||||
|
#include <fennec/langproc/strings/string.h>
|
||||||
|
|
||||||
|
//
|
||||||
|
// 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<char, escape_sequence*>;
|
||||||
|
|
||||||
|
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<string, uint8_t>;
|
||||||
|
|
||||||
|
private:
|
||||||
|
list<token> operator()(const string& line) {
|
||||||
|
list<token> res;
|
||||||
|
|
||||||
|
for (size_t i = 0; i < )
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // FENNEC_LANGPROC_FORMAT_TOKENIZER_H
|
||||||
@@ -58,6 +58,7 @@ struct cstring
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static constexpr size_t npos = -1;
|
static constexpr size_t npos = -1;
|
||||||
|
using char_t = char;
|
||||||
|
|
||||||
// Constructors ========================================================================================================
|
// Constructors ========================================================================================================
|
||||||
|
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ struct _string
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static constexpr size_t npos = -1;
|
static constexpr size_t npos = -1;
|
||||||
|
using char_t = char;
|
||||||
using alloc_t = allocation<char, AllocT>;
|
using alloc_t = allocation<char, AllocT>;
|
||||||
|
|
||||||
|
|
||||||
@@ -197,7 +198,7 @@ public:
|
|||||||
if (i >= size()) { // bounds check
|
if (i >= size()) { // bounds check
|
||||||
return -1;
|
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);
|
return ::strncmp(_str + i, str, n);
|
||||||
}
|
}
|
||||||
@@ -216,10 +217,23 @@ public:
|
|||||||
return ::strncmp(_str + i, str.data(), n);
|
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 {
|
constexpr bool operator==(const _string& str) const {
|
||||||
return compare(str) == 0;
|
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
|
/// \brief Finds the index of the first occurrence of `c` in the string
|
||||||
/// \param c the character to find
|
/// \param c the character to find
|
||||||
@@ -242,7 +256,7 @@ public:
|
|||||||
return size();
|
return size();
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* loc = ::strstr(_str, str);
|
const char* loc = ::strstr(_str, str._str);
|
||||||
return loc ? loc - _str : size();
|
return loc ? loc - _str : size();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -325,7 +339,7 @@ public:
|
|||||||
/// \param n the number of characters
|
/// \param n the number of characters
|
||||||
/// \return
|
/// \return
|
||||||
constexpr _string substring(size_t i, size_t n = npos) const {
|
constexpr _string substring(size_t i, size_t n = npos) const {
|
||||||
if (i >= size()) {
|
if (i >= size() || n == 0) {
|
||||||
return _string("");
|
return _string("");
|
||||||
}
|
}
|
||||||
n = fennec::min(n, size() - i);
|
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:
|
private:
|
||||||
alloc_t _str;
|
alloc_t _str;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ struct wcstring
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static constexpr size_t npos = -1;
|
static constexpr size_t npos = -1;
|
||||||
|
using char_t = wchar_t;
|
||||||
|
|
||||||
// Constructors ========================================================================================================
|
// Constructors ========================================================================================================
|
||||||
|
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ struct _wstring
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static constexpr size_t npos = -1;
|
static constexpr size_t npos = -1;
|
||||||
|
using char_t = wchar_t;
|
||||||
using alloc_t = allocation<wchar_t, AllocT>;
|
using alloc_t = allocation<wchar_t, AllocT>;
|
||||||
|
|
||||||
|
|
||||||
@@ -216,10 +217,23 @@ public:
|
|||||||
return ::wcsncmp(_str + i, str.data(), n);
|
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 {
|
constexpr bool operator==(const _wstring& str) const {
|
||||||
return compare(str) == 0;
|
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
|
/// \brief Finds the index of the first occurrence of `c` in the string
|
||||||
/// \param c the wchar_tacter to find
|
/// \param c the wchar_tacter to find
|
||||||
|
|||||||
@@ -306,8 +306,8 @@ public:
|
|||||||
|
|
||||||
// Quaternion Quaternion Arithmetic Operators ==========================================================================
|
// Quaternion Quaternion Arithmetic Operators ==========================================================================
|
||||||
|
|
||||||
constexpr friend quaternion operator+(const quaternion& lhs, const quaternion& rhs) {
|
constexpr friend quat_t operator+(const quat_t& lhs, const quat_t& rhs) {
|
||||||
return quaternion(
|
return quat_t(
|
||||||
lhs.w + rhs.w,
|
lhs.w + rhs.w,
|
||||||
lhs.x + rhs.x,
|
lhs.x + rhs.x,
|
||||||
lhs.y + rhs.y,
|
lhs.y + rhs.y,
|
||||||
@@ -315,8 +315,8 @@ public:
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr friend quaternion operator-(const quaternion& lhs, const quaternion& rhs) {
|
constexpr friend quat_t operator-(const quat_t& lhs, const quat_t& rhs) {
|
||||||
return quaternion(
|
return quat_t(
|
||||||
lhs.w - rhs.w,
|
lhs.w - rhs.w,
|
||||||
lhs.x - rhs.x,
|
lhs.x - rhs.x,
|
||||||
lhs.y - rhs.y,
|
lhs.y - rhs.y,
|
||||||
@@ -324,8 +324,8 @@ public:
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr friend quaternion operator*(const quaternion& lhs, const quaternion& rhs) {
|
constexpr friend quat_t operator*(const quat_t& lhs, const quat_t& rhs) {
|
||||||
return quaternion(
|
return quat_t(
|
||||||
lhs.w*rhs.w - lhs.x*rhs.x - lhs.y*rhs.y - lhs.z * rhs.z,
|
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.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,
|
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 ===============================================================
|
// 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.w += rhs.w;
|
||||||
lhs.x += rhs.x;
|
lhs.x += rhs.x;
|
||||||
lhs.y += rhs.y;
|
lhs.y += rhs.y;
|
||||||
@@ -344,7 +344,7 @@ public:
|
|||||||
return lhs;
|
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.w -= rhs.w;
|
||||||
lhs.x -= rhs.x;
|
lhs.x -= rhs.x;
|
||||||
lhs.y -= rhs.y;
|
lhs.y -= rhs.y;
|
||||||
@@ -352,7 +352,7 @@ public:
|
|||||||
return lhs;
|
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;
|
return lhs = lhs * rhs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -280,7 +280,7 @@ public:
|
|||||||
/// \details This simply acts as a proxy for allocating memory. It does not call any constructors or
|
/// \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
|
/// initialize any values as if they were the provided data type. Any operations present work
|
||||||
/// only on individual bytes.
|
/// only on individual bytes.
|
||||||
template<typename T, class AllocT>
|
template<typename T, class AllocT = allocator<T>>
|
||||||
struct allocation
|
struct allocation
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -33,6 +33,7 @@
|
|||||||
|
|
||||||
#include <fennec/lang/types.h>
|
#include <fennec/lang/types.h>
|
||||||
#include <fennec/langproc/strings/string.h>
|
#include <fennec/langproc/strings/string.h>
|
||||||
|
#include <fennec/renderers/interface/gfxcontext.h>
|
||||||
|
|
||||||
namespace fennec
|
namespace fennec
|
||||||
{
|
{
|
||||||
@@ -115,22 +116,29 @@ public:
|
|||||||
|
|
||||||
// Modifiers ===========================================================================================================
|
// 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_fullscreen(bool) = 0;
|
||||||
virtual void set_borderless(bool) = 0;
|
virtual void set_borderless(bool) = 0;
|
||||||
|
|
||||||
virtual void grab_mouse(bool) = 0;
|
virtual void grab_mouse(bool) = 0;
|
||||||
virtual void grab_keyboard(bool) = 0;
|
virtual void grab_keyboard(bool) = 0;
|
||||||
|
|
||||||
virtual void set_title(const cstring&) = 0;
|
virtual void set_title(const cstring&) = 0;
|
||||||
virtual void set_title(const string&) = 0;
|
virtual void set_title(const string&) = 0;
|
||||||
virtual void vsync(int8_t) = 0;
|
|
||||||
virtual void set_progress(bool, float) = 0;
|
virtual void set_progress(bool, float) = 0;
|
||||||
|
|
||||||
|
virtual void vsync(int8_t) = 0;
|
||||||
|
|
||||||
// Graphics ============================================================================================================
|
// Graphics ============================================================================================================
|
||||||
|
|
||||||
virtual void begin_frame() = 0;
|
virtual void begin_frame() = 0;
|
||||||
virtual void end_frame() = 0;
|
virtual void end_frame() = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
window* _parent;
|
window* _parent;
|
||||||
|
gfxcontext* _context;
|
||||||
config _config;
|
config _config;
|
||||||
|
|
||||||
window(window* parent, const config& cfg)
|
window(window* parent, const config& cfg)
|
||||||
|
|||||||
@@ -38,7 +38,25 @@ namespace fennec
|
|||||||
|
|
||||||
class sdlwindow : public window {
|
class sdlwindow : public window {
|
||||||
public:
|
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:
|
private:
|
||||||
|
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ namespace fennec
|
|||||||
class gfxpass; // Overarching rendering scheme
|
class gfxpass; // Overarching rendering scheme
|
||||||
class gfxcontext; // Globals for an API's context
|
class gfxcontext; // Globals for an API's context
|
||||||
class gfxresourcepool; // Handles resource creation, allocation, and mapping
|
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 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
|
class gfxpipeline; // A user-defined pipeline, e.g. the Vulkan pipeline needed to render the G-Buffer
|
||||||
|
|
||||||
|
|||||||
@@ -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.
|
/// \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
|
/// I.E. This acts as a proxy for creating API objects, but the behaviour of those objects
|
||||||
/// is defined elsewhere.
|
/// is defined elsewhere.
|
||||||
class gfxpass {
|
class gfxpass {
|
||||||
public:
|
public:
|
||||||
|
gfxsubpass* add_subpass();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class gfxsubpass {
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // FENNEC_PLATFORM_INTERFACE_GFXCONTEXT_H
|
#endif // FENNEC_PLATFORM_INTERFACE_GFXCONTEXT_H
|
||||||
@@ -8,6 +8,7 @@ add_executable(fennec-test
|
|||||||
main.cpp
|
main.cpp
|
||||||
tests/containers/performance/test_iterator_visitor.h
|
tests/containers/performance/test_iterator_visitor.h
|
||||||
tests/containers/test_sequence.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}"
|
target_compile_definitions(fennec-test PUBLIC FENNEC_TEST_CWD="${CMAKE_SOURCE_DIR}/bin/${FENNEC_BUILD_NAME}"
|
||||||
|
|||||||
63
test/tests/langproc/test_format.h
Normal file
63
test/tests/langproc/test_format.h
Normal file
@@ -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 <https://www.gnu.org/licenses/>.
|
||||||
|
// =====================================================================================================================
|
||||||
|
|
||||||
|
///
|
||||||
|
/// \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 <fennec/langproc/format/tokenizer.h>
|
||||||
|
|
||||||
|
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
|
||||||
@@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
#include "./langproc/test_strings.h"
|
#include "./langproc/test_strings.h"
|
||||||
#include "./langproc/test_io.h"
|
#include "./langproc/test_io.h"
|
||||||
|
#include "langproc/test_format.h"
|
||||||
|
|
||||||
namespace fennec::test
|
namespace fennec::test
|
||||||
{
|
{
|
||||||
@@ -33,6 +34,11 @@ namespace fennec::test
|
|||||||
fennec_test_langproc_strings();
|
fennec_test_langproc_strings();
|
||||||
fennec_test_spacer(3);
|
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_header("io");
|
||||||
fennec_test_spacer(2);
|
fennec_test_spacer(2);
|
||||||
fennec_test_langproc_io();
|
fennec_test_langproc_io();
|
||||||
|
|||||||
Reference in New Issue
Block a user