diff --git a/compile_linux.sh b/compile_linux.sh
new file mode 100755
index 0000000..238e5a5
--- /dev/null
+++ b/compile_linux.sh
@@ -0,0 +1,14 @@
+
+
+#clang++ main.cpp -Wall -o3 -o ./bin/game -Ilibs/SDL2-linux/include -Llibs/SDL2-linux/lib -lSDL2 -lSDL2main
+
+#g++ main.cpp -Wall -o3 -o ./bin/game -Ilibs/SDL2-linux/include -Llibs/SDL2-linux/lib -lSDL2 -lSDL2main
+
+#g++ main.cpp shader.cpp material.cpp mesh.cpp mesh_instance.cpp mesh_utils.cpp texture.cpp camera.cpp application.cpp scene.cpp game_scene.cpp object_2d.cpp tile_map.cpp sprite.cpp \
+# -g -Wall -o3 -o ./bin/game $(pkg-config --cflags --libs sdl2 glew)
+
+#g++ -Wall -fexceptions -I/usr/include/SDL2 -D_REENTRANT -g -Isfw -c sfw/aabb.cpp -o sfw/aabb.o
+
+g++ -Wall -D_REENTRANT -g -Isfw -c sfw/aabb.cpp -o sfw/aabb.o
+
+
diff --git a/sdl_linux.cbp b/sdl_linux.cbp
index c285f64..51b7a14 100644
--- a/sdl_linux.cbp
+++ b/sdl_linux.cbp
@@ -32,11 +32,84 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sfw/aabb.cpp b/sfw/aabb.cpp
index b11ff30..3b84bb4 100644
--- a/sfw/aabb.cpp
+++ b/sfw/aabb.cpp
@@ -31,9 +31,6 @@
#include "aabb.h"
-#include "core/string/print_string.h"
-#include "core/variant/variant.h"
-
real_t AABB::get_volume() const {
return size.x * size.y * size.z;
}
diff --git a/sfw/basis.cpp b/sfw/basis.cpp
index e78b717..af26f76 100644
--- a/sfw/basis.cpp
+++ b/sfw/basis.cpp
@@ -31,8 +31,7 @@
#include "basis.h"
-#include "core/math/math_funcs.h"
-#include "core/string/print_string.h"
+#include "math_funcs.h"
#define cofac(row1, col1, row2, col2) \
(rows[row1][col1] * rows[row2][col2] - rows[row1][col2] * rows[row2][col1])
diff --git a/sfw/char_range.inc b/sfw/char_range.inc
index c0be901..c159431 100644
--- a/sfw/char_range.inc
+++ b/sfw/char_range.inc
@@ -31,7 +31,7 @@
#ifndef CHAR_RANGE_INC
#define CHAR_RANGE_INC
-#include "core/typedefs.h"
+#include "typedefs.h"
struct CharRange {
char32_t start;
diff --git a/sfw/char_utils.h b/sfw/char_utils.h
index ff4dc0e..8485fa5 100644
--- a/sfw/char_utils.h
+++ b/sfw/char_utils.h
@@ -32,7 +32,7 @@
#ifndef CHAR_UTILS_H
#define CHAR_UTILS_H
-#include "core/typedefs.h"
+#include "typedefs.h"
#include "char_range.inc"
diff --git a/sfw/color.cpp b/sfw/color.cpp
index ad88556..a50fc5a 100644
--- a/sfw/color.cpp
+++ b/sfw/color.cpp
@@ -31,10 +31,9 @@
#include "color.h"
-#include "core/containers/rb_map.h"
-#include "core/math/color_names.inc"
-#include "core/math/math_funcs.h"
-#include "core/string/print_string.h"
+#include "rb_map.h"
+#include "math_funcs.h"
+
uint32_t Color::to_argb32() const {
uint32_t c = (uint8_t)Math::round(a * 255);
diff --git a/sfw/color.h b/sfw/color.h
index 61f7aec..9d27938 100644
--- a/sfw/color.h
+++ b/sfw/color.h
@@ -32,8 +32,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "core/math/math_funcs.h"
-#include "core/string/ustring.h"
+#include "math_funcs.h"
+#include "ustring.h"
struct _NO_DISCARD_CLASS_ Color {
union {
diff --git a/sfw/core/containers/cowdata.h b/sfw/cowdata.h
similarity index 98%
rename from sfw/core/containers/cowdata.h
rename to sfw/cowdata.h
index 0525d12..aaf26f6 100644
--- a/sfw/core/containers/cowdata.h
+++ b/sfw/cowdata.h
@@ -34,9 +34,9 @@
#include
-#include "core/error/error_macros.h"
-#include "core/os/memory.h"
-#include "core/os/safe_refcount.h"
+#include "error_macros.h"
+#include "memory.h"
+#include "safe_refcount.h"
template
class Vector;
diff --git a/sfw/face3.cpp b/sfw/face3.cpp
index 65e3efd..c697d6f 100644
--- a/sfw/face3.cpp
+++ b/sfw/face3.cpp
@@ -31,8 +31,6 @@
#include "face3.h"
-#include "core/math/geometry.h"
-
int Face3::split_by_plane(const Plane &p_plane, Face3 p_res[3], bool p_is_point_over[3]) const {
ERR_FAIL_COND_V(is_degenerate(), 0);
diff --git a/sfw/face3.h b/sfw/face3.h
index 9db61d2..8492a64 100644
--- a/sfw/face3.h
+++ b/sfw/face3.h
@@ -32,10 +32,10 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "core/math/aabb.h"
-#include "core/math/plane.h"
-#include "core/math/transform.h"
-#include "core/math/vector3.h"
+#include "aabb.h"
+#include "plane.h"
+#include "transform.h"
+#include "vector3.h"
struct _NO_DISCARD_CLASS_ Face3 {
enum Side {
diff --git a/sfw/core/containers/hash_map.h b/sfw/hash_map.h
similarity index 99%
rename from sfw/core/containers/hash_map.h
rename to sfw/hash_map.h
index 43d81a0..674634e 100644
--- a/sfw/core/containers/hash_map.h
+++ b/sfw/hash_map.h
@@ -32,11 +32,11 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "core/containers/hashfuncs.h"
-#include "core/containers/paged_allocator.h"
-#include "core/containers/pair.h"
+#include "hashfuncs.h"
+#include "paged_allocator.h"
+#include "pair.h"
#include "core/math/math_funcs.h"
-#include "core/os/memory.h"
+#include "memory.h"
/**
* A HashMap implementation that uses open addressing with Robin Hood hashing.
diff --git a/sfw/core/containers/hash_set.h b/sfw/hash_set.h
similarity index 99%
rename from sfw/core/containers/hash_set.h
rename to sfw/hash_set.h
index 197f6e2..8cc5f97 100644
--- a/sfw/core/containers/hash_set.h
+++ b/sfw/hash_set.h
@@ -32,10 +32,10 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "core/containers/hash_map.h"
-#include "core/containers/hashfuncs.h"
+#include "hash_map.h"
+#include "hashfuncs.h"
#include "core/math/math_funcs.h"
-#include "core/os/memory.h"
+#include "memory.h"
/**
* Implementation of Set using a bidi indexed hash map.
diff --git a/sfw/core/containers/hashfuncs.h b/sfw/hashfuncs.h
similarity index 99%
rename from sfw/core/containers/hashfuncs.h
rename to sfw/hashfuncs.h
index 97dc808..00cef3a 100644
--- a/sfw/core/containers/hashfuncs.h
+++ b/sfw/hashfuncs.h
@@ -32,7 +32,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "core/containers/rid.h"
+#include "rid.h"
#include "core/math/aabb.h"
#include "core/math/math_defs.h"
#include "core/math/math_funcs.h"
diff --git a/sfw/core/containers/list.h b/sfw/list.h
similarity index 99%
rename from sfw/core/containers/list.h
rename to sfw/list.h
index aeb21e3..3510cb7 100644
--- a/sfw/core/containers/list.h
+++ b/sfw/list.h
@@ -32,9 +32,9 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "core/containers/sort_array.h"
-#include "core/error/error_macros.h"
-#include "core/os/memory.h"
+#include "sort_array.h"
+#include "error_macros.h"
+#include "memory.h"
/**
* Generic Templatized Linked List Implementation.
diff --git a/sfw/core/containers/local_vector.h b/sfw/local_vector.h
similarity index 97%
rename from sfw/core/containers/local_vector.h
rename to sfw/local_vector.h
index 16f891b..bf052ee 100644
--- a/sfw/core/containers/local_vector.h
+++ b/sfw/local_vector.h
@@ -32,11 +32,11 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "core/containers/pool_vector.h"
-#include "core/containers/sort_array.h"
-#include "core/containers/vector.h"
-#include "core/error/error_macros.h"
-#include "core/os/memory.h"
+#include "pool_vector.h"
+#include "sort_array.h"
+#include "vector.h"
+#include "error_macros.h"
+#include "memory.h"
template
class LocalVector {
diff --git a/sfw/logger.cpp b/sfw/logger.cpp
index d9149be..4454b93 100644
--- a/sfw/logger.cpp
+++ b/sfw/logger.cpp
@@ -1,7 +1,7 @@
#include "logger.h"
-#include "core/string.h"
+#include "ustring.h"
#include
#include "logger.h"
diff --git a/sfw/math_funcs.cpp b/sfw/math_funcs.cpp
index fa3e852..b18c6fc 100644
--- a/sfw/math_funcs.cpp
+++ b/sfw/math_funcs.cpp
@@ -31,7 +31,7 @@
#include "math_funcs.h"
-#include "core/error/error_macros.h"
+#include "error_macros.h"
RandomPCG Math::default_rand(RandomPCG::DEFAULT_SEED, RandomPCG::DEFAULT_INC);
diff --git a/sfw/core/memory.h b/sfw/memory.h
similarity index 100%
rename from sfw/core/memory.h
rename to sfw/memory.h
diff --git a/sfw/core/containers/paged_allocator.h b/sfw/paged_allocator.h
similarity index 98%
rename from sfw/core/containers/paged_allocator.h
rename to sfw/paged_allocator.h
index ec8f27f..89fc4bd 100644
--- a/sfw/core/containers/paged_allocator.h
+++ b/sfw/paged_allocator.h
@@ -32,8 +32,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "core/os/memory.h"
-#include "core/os/spin_lock.h"
+#include "memory.h"
+#include "spin_lock.h"
#include "core/typedefs.h"
template
diff --git a/sfw/core/containers/pair.h b/sfw/pair.h
similarity index 99%
rename from sfw/core/containers/pair.h
rename to sfw/pair.h
index 1404c14..90ac300 100644
--- a/sfw/core/containers/pair.h
+++ b/sfw/pair.h
@@ -32,7 +32,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "core/containers/hashfuncs.h"
+#include "hashfuncs.h"
#include "core/typedefs.h"
template
diff --git a/sfw/pcg.h b/sfw/pcg.h
index 0faab73..a3cfe2f 100644
--- a/sfw/pcg.h
+++ b/sfw/pcg.h
@@ -4,7 +4,7 @@
#ifndef RANDOM_H
#define RANDOM_H
-#include "core/typedefs.h"
+#include "typedefs.h"
#define PCG_DEFAULT_INC_64 1442695040888963407ULL
diff --git a/sfw/plane.cpp b/sfw/plane.cpp
index b97cdb4..f6bf3d2 100644
--- a/sfw/plane.cpp
+++ b/sfw/plane.cpp
@@ -31,8 +31,8 @@
#include "plane.h"
-#include "core/math/math_funcs.h"
-#include "core/variant/variant.h"
+#include "math_funcs.h"
+#include "variant/variant.h"
void Plane::set_normal(const Vector3 &p_normal) {
normal = p_normal;
diff --git a/sfw/projection.cpp b/sfw/projection.cpp
index 454b7c6..e50a2eb 100644
--- a/sfw/projection.cpp
+++ b/sfw/projection.cpp
@@ -31,14 +31,14 @@
#include "projection.h"
-#include "core/math/aabb.h"
-#include "core/math/math_funcs.h"
-#include "core/math/plane.h"
-#include "core/math/rect2.h"
-#include "core/math/transform.h"
-#include "core/string/print_string.h"
-#include "core/variant/array.h"
-#include "core/variant/variant.h"
+#include "aabb.h"
+#include "math_funcs.h"
+#include "plane.h"
+#include "rect2.h"
+#include "transform.h"
+#include "string/print_string.h"
+#include "variant/array.h"
+#include "variant/variant.h"
float Projection::determinant() const {
return matrix[0][3] * matrix[1][2] * matrix[2][1] * matrix[3][0] - matrix[0][2] * matrix[1][3] * matrix[2][1] * matrix[3][0] -
diff --git a/sfw/projection.h b/sfw/projection.h
index ece792d..a64f13d 100644
--- a/sfw/projection.h
+++ b/sfw/projection.h
@@ -32,10 +32,10 @@
#ifndef PROJECTION_H
#define PROJECTION_H
-#include "core/containers/vector.h"
-#include "core/math/math_defs.h"
-#include "core/math/vector3.h"
-#include "core/math/vector4.h"
+#include "vector.h"
+#include "math_defs.h"
+#include "vector3.h"
+#include "vector4.h"
class Array;
struct AABB;
diff --git a/sfw/quaternion.cpp b/sfw/quaternion.cpp
index 904ecdf..dfaeea7 100644
--- a/sfw/quaternion.cpp
+++ b/sfw/quaternion.cpp
@@ -31,8 +31,8 @@
#include "quaternion.h"
-#include "core/math/basis.h"
-#include "core/string/print_string.h"
+#include "basis.h"
+#include "string/print_string.h"
real_t Quaternion::angle_to(const Quaternion &p_to) const {
real_t d = dot(p_to);
diff --git a/sfw/core/containers/queue.h b/sfw/queue.h
similarity index 100%
rename from sfw/core/containers/queue.h
rename to sfw/queue.h
diff --git a/sfw/random_pcg.cpp b/sfw/random_pcg.cpp
index 5db1293..a69be74 100644
--- a/sfw/random_pcg.cpp
+++ b/sfw/random_pcg.cpp
@@ -31,7 +31,7 @@
#include "random_pcg.h"
-#include "core/os/os.h"
+#include "os/os.h"
RandomPCG::RandomPCG(uint64_t p_seed, uint64_t p_inc) :
pcg(),
diff --git a/sfw/random_pcg.h b/sfw/random_pcg.h
index ba53533..4eec7af 100644
--- a/sfw/random_pcg.h
+++ b/sfw/random_pcg.h
@@ -34,9 +34,9 @@
#include
-#include "core/math/math_defs.h"
+#include "math_defs.h"
-#include "thirdparty/misc/pcg.h"
+#include "pcg.h"
#if defined(__GNUC__) || (_llvm_has_builtin(__builtin_clz))
#define CLZ32(x) __builtin_clz(x)
diff --git a/sfw/core/containers/rb_map.h b/sfw/rb_map.h
similarity index 99%
rename from sfw/core/containers/rb_map.h
rename to sfw/rb_map.h
index c324d78..3640600 100644
--- a/sfw/core/containers/rb_map.h
+++ b/sfw/rb_map.h
@@ -32,8 +32,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "core/error/error_macros.h"
-#include "core/os/memory.h"
+#include "error_macros.h"
+#include "memory.h"
// based on the very nice implementation of rb-trees by:
// https://web.archive.org/web/20120507164830/http://web.mit.edu/~emin/www/source_code/red_black_tree/index.html
diff --git a/sfw/core/containers/rb_set.h b/sfw/rb_set.h
similarity index 99%
rename from sfw/core/containers/rb_set.h
rename to sfw/rb_set.h
index bc351df..5e8c217 100644
--- a/sfw/core/containers/rb_set.h
+++ b/sfw/rb_set.h
@@ -32,7 +32,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "core/os/memory.h"
+#include "memory.h"
#include "core/typedefs.h"
// based on the very nice implementation of rb-trees by:
diff --git a/sfw/rect2.cpp b/sfw/rect2.cpp
index e898186..f5ac33f 100644
--- a/sfw/rect2.cpp
+++ b/sfw/rect2.cpp
@@ -29,9 +29,9 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "core/math/transform_2d.h" // Includes rect2.h but Rect2 needs Transform2D
+#include "transform_2d.h" // Includes rect2.h but Rect2 needs Transform2D
-#include "core/math/rect2i.h"
+#include "rect2i.h"
bool Rect2::is_equal_approx(const Rect2 &p_rect) const {
return position.is_equal_approx(p_rect.position) && size.is_equal_approx(p_rect.size);
diff --git a/sfw/rect2.h b/sfw/rect2.h
index b1be56f..fb4e6c2 100644
--- a/sfw/rect2.h
+++ b/sfw/rect2.h
@@ -32,8 +32,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "core/math/vector2.h" // also includes math_funcs and ustring
-#include "core/math/vector2i.h"
+#include "vector2.h" // also includes math_funcs and ustring
+#include "vector2i.h"
struct Transform2D;
struct Rect2i;
diff --git a/sfw/rect2i.cpp b/sfw/rect2i.cpp
index f93c55b..fef02be 100644
--- a/sfw/rect2i.cpp
+++ b/sfw/rect2i.cpp
@@ -29,7 +29,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "core/math/transform_2d.h" // Includes rect2.h but Rect2 needs Transform2D
+#include "transform_2d.h" // Includes rect2.h but Rect2 needs Transform2D
Rect2i::operator String() const {
return "[P: " + position.operator String() + ", S: " + size + "]";
diff --git a/sfw/rect2i.h b/sfw/rect2i.h
index 538c1d1..29e142e 100644
--- a/sfw/rect2i.h
+++ b/sfw/rect2i.h
@@ -32,7 +32,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "core/math/vector2i.h" // also includes math_funcs and ustring
+#include "vector2i.h" // also includes math_funcs and ustring
struct _NO_DISCARD_CLASS_ Rect2i {
Point2i position;
diff --git a/sfw/core/containers/ring_buffer.h b/sfw/ring_buffer.h
similarity index 99%
rename from sfw/core/containers/ring_buffer.h
rename to sfw/ring_buffer.h
index 358bad0..1924bf8 100644
--- a/sfw/core/containers/ring_buffer.h
+++ b/sfw/ring_buffer.h
@@ -32,7 +32,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "core/containers/vector.h"
+#include "vector.h"
template
class RingBuffer {
diff --git a/sfw/core/containers/rvector.h b/sfw/rvector.h
similarity index 100%
rename from sfw/core/containers/rvector.h
rename to sfw/rvector.h
diff --git a/sfw/safe_refcount.cpp b/sfw/safe_refcount.cpp
new file mode 100644
index 0000000..bedbf0e
--- /dev/null
+++ b/sfw/safe_refcount.cpp
@@ -0,0 +1,46 @@
+/*************************************************************************/
+/* safe_refcount.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* PANDEMONIUM ENGINE */
+/* https://github.com/Relintai/pandemonium_engine */
+/*************************************************************************/
+/* Copyright (c) 2022-present Péter Magyar. */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#if defined(DEBUG_ENABLED) && !defined(NO_THREADS)
+
+#include "safe_refcount.h"
+
+#include "core/error/error_macros.h"
+
+// On C++14 we don't have std::atomic::is_always_lockfree, so this is the best we can do
+void check_lockless_atomics() {
+ // Doing the check for the types we actually care about
+ if (!std::atomic{}.is_lock_free() || !std::atomic{}.is_lock_free() || !std::atomic_bool{}.is_lock_free()) {
+ WARN_PRINT("Your compiler doesn't seem to support lockless atomics. Performance will be degraded. Please consider upgrading to a different or newer compiler.");
+ }
+}
+
+#endif
diff --git a/sfw/safe_refcount.h b/sfw/safe_refcount.h
new file mode 100644
index 0000000..05aeeed
--- /dev/null
+++ b/sfw/safe_refcount.h
@@ -0,0 +1,334 @@
+#ifndef SAFE_REFCOUNT_H
+#define SAFE_REFCOUNT_H
+
+/*************************************************************************/
+/* safe_refcount.h */
+/*************************************************************************/
+/* This file is part of: */
+/* PANDEMONIUM ENGINE */
+/* https://github.com/Relintai/pandemonium_engine */
+/*************************************************************************/
+/* Copyright (c) 2022-present Péter Magyar. */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#include "core/typedefs.h"
+
+#if !defined(NO_THREADS)
+
+#include
+#include
+
+// Design goals for these classes:
+// - No automatic conversions or arithmetic operators,
+// to keep explicit the use of atomics everywhere.
+// - Using acquire-release semantics, even to set the first value.
+// The first value may be set relaxedly in many cases, but adding the distinction
+// between relaxed and unrelaxed operation to the interface would make it needlessly
+// flexible. There's negligible waste in having release semantics for the initial
+// value and, as an important benefit, you can be sure the value is properly synchronized
+// even with threads that are already running.
+
+// This is used in very specific areas of the engine where it's critical that these guarantees are held
+#define SAFE_NUMERIC_TYPE_PUN_GUARANTEES(m_type) \
+ static_assert(sizeof(SafeNumeric) == sizeof(m_type), ""); \
+ static_assert(alignof(SafeNumeric) == alignof(m_type), ""); \
+ static_assert(std::is_trivially_destructible>::value, "");
+
+#if defined(DEBUG_ENABLED)
+void check_lockless_atomics();
+#endif
+
+template
+class SafeNumeric {
+ std::atomic value;
+
+public:
+ _ALWAYS_INLINE_ void set(T p_value) {
+ value.store(p_value, std::memory_order_release);
+ }
+
+ _ALWAYS_INLINE_ T get() const {
+ return value.load(std::memory_order_acquire);
+ }
+
+ _ALWAYS_INLINE_ T increment() {
+ return value.fetch_add(1, std::memory_order_acq_rel) + 1;
+ }
+
+ // Returns the original value instead of the new one
+ _ALWAYS_INLINE_ T postincrement() {
+ return value.fetch_add(1, std::memory_order_acq_rel);
+ }
+
+ _ALWAYS_INLINE_ T decrement() {
+ return value.fetch_sub(1, std::memory_order_acq_rel) - 1;
+ }
+
+ // Returns the original value instead of the new one
+ _ALWAYS_INLINE_ T postdecrement() {
+ return value.fetch_sub(1, std::memory_order_acq_rel);
+ }
+
+ _ALWAYS_INLINE_ T add(T p_value) {
+ return value.fetch_add(p_value, std::memory_order_acq_rel) + p_value;
+ }
+
+ // Returns the original value instead of the new one
+ _ALWAYS_INLINE_ T postadd(T p_value) {
+ return value.fetch_add(p_value, std::memory_order_acq_rel);
+ }
+
+ _ALWAYS_INLINE_ T sub(T p_value) {
+ return value.fetch_sub(p_value, std::memory_order_acq_rel) - p_value;
+ }
+
+ // Returns the original value instead of the new one
+ _ALWAYS_INLINE_ T postsub(T p_value) {
+ return value.fetch_sub(p_value, std::memory_order_acq_rel);
+ }
+
+ _ALWAYS_INLINE_ T exchange_if_greater(T p_value) {
+ while (true) {
+ T tmp = value.load(std::memory_order_acquire);
+ if (tmp >= p_value) {
+ return tmp; // already greater, or equal
+ }
+ if (value.compare_exchange_weak(tmp, p_value, std::memory_order_acq_rel)) {
+ return p_value;
+ }
+ }
+ }
+
+ _ALWAYS_INLINE_ T conditional_increment() {
+ while (true) {
+ T c = value.load(std::memory_order_acquire);
+ if (c == 0) {
+ return 0;
+ }
+ if (value.compare_exchange_weak(c, c + 1, std::memory_order_acq_rel)) {
+ return c + 1;
+ }
+ }
+ }
+
+ _ALWAYS_INLINE_ explicit SafeNumeric(T p_value = static_cast(0)) {
+ set(p_value);
+ }
+};
+
+class SafeFlag {
+ std::atomic_bool flag;
+
+public:
+ _ALWAYS_INLINE_ bool is_set() const {
+ return flag.load(std::memory_order_acquire);
+ }
+
+ _ALWAYS_INLINE_ void set() {
+ flag.store(true, std::memory_order_release);
+ }
+
+ _ALWAYS_INLINE_ void clear() {
+ flag.store(false, std::memory_order_release);
+ }
+
+ _ALWAYS_INLINE_ void set_to(bool p_value) {
+ flag.store(p_value, std::memory_order_release);
+ }
+
+ _ALWAYS_INLINE_ explicit SafeFlag(bool p_value = false) {
+ set_to(p_value);
+ }
+};
+
+class SafeRefCount {
+ SafeNumeric count;
+
+public:
+ _ALWAYS_INLINE_ bool ref() { // true on success
+ return count.conditional_increment() != 0;
+ }
+
+ _ALWAYS_INLINE_ uint32_t refval() { // none-zero on success
+ return count.conditional_increment();
+ }
+
+ _ALWAYS_INLINE_ bool unref() { // true if must be disposed of
+ return count.decrement() == 0;
+ }
+
+ _ALWAYS_INLINE_ uint32_t unrefval() { // 0 if must be disposed of
+ return count.decrement();
+ }
+
+ _ALWAYS_INLINE_ uint32_t get() const {
+ return count.get();
+ }
+
+ _ALWAYS_INLINE_ void init(uint32_t p_value = 1) {
+ count.set(p_value);
+ }
+};
+
+#else
+
+template
+class SafeNumeric {
+protected:
+ T value;
+
+public:
+ _ALWAYS_INLINE_ void set(T p_value) {
+ value = p_value;
+ }
+
+ _ALWAYS_INLINE_ T get() const {
+ return value;
+ }
+
+ _ALWAYS_INLINE_ T increment() {
+ return ++value;
+ }
+
+ _ALWAYS_INLINE_ T postincrement() {
+ return value++;
+ }
+
+ _ALWAYS_INLINE_ T decrement() {
+ return --value;
+ }
+
+ _ALWAYS_INLINE_ T postdecrement() {
+ return value--;
+ }
+
+ _ALWAYS_INLINE_ T add(T p_value) {
+ return value += p_value;
+ }
+
+ _ALWAYS_INLINE_ T postadd(T p_value) {
+ T old = value;
+ value += p_value;
+ return old;
+ }
+
+ _ALWAYS_INLINE_ T sub(T p_value) {
+ return value -= p_value;
+ }
+
+ _ALWAYS_INLINE_ T postsub(T p_value) {
+ T old = value;
+ value -= p_value;
+ return old;
+ }
+
+ _ALWAYS_INLINE_ T exchange_if_greater(T p_value) {
+ if (value < p_value) {
+ value = p_value;
+ }
+ return value;
+ }
+
+ _ALWAYS_INLINE_ T conditional_increment() {
+ if (value == 0) {
+ return 0;
+ } else {
+ return ++value;
+ }
+ }
+
+ _ALWAYS_INLINE_ explicit SafeNumeric(T p_value = static_cast(0)) :
+ value(p_value) {
+ }
+};
+
+class SafeFlag {
+protected:
+ bool flag;
+
+public:
+ _ALWAYS_INLINE_ bool is_set() const {
+ return flag;
+ }
+
+ _ALWAYS_INLINE_ void set() {
+ flag = true;
+ }
+
+ _ALWAYS_INLINE_ void clear() {
+ flag = false;
+ }
+
+ _ALWAYS_INLINE_ void set_to(bool p_value) {
+ flag = p_value;
+ }
+
+ _ALWAYS_INLINE_ explicit SafeFlag(bool p_value = false) :
+ flag(p_value) {}
+};
+
+class SafeRefCount {
+ uint32_t count;
+
+public:
+ _ALWAYS_INLINE_ bool ref() { // true on success
+ if (count != 0) {
+ ++count;
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ _ALWAYS_INLINE_ uint32_t refval() { // none-zero on success
+ if (count != 0) {
+ return ++count;
+ } else {
+ return 0;
+ }
+ }
+
+ _ALWAYS_INLINE_ bool unref() { // true if must be disposed of
+ return --count == 0;
+ }
+
+ _ALWAYS_INLINE_ uint32_t unrefval() { // 0 if must be disposed of
+ return --count;
+ }
+
+ _ALWAYS_INLINE_ uint32_t get() const {
+ return count;
+ }
+
+ _ALWAYS_INLINE_ void init(uint32_t p_value = 1) {
+ count = p_value;
+ }
+
+ SafeRefCount() :
+ count(0) {}
+};
+
+#endif
+
+#endif // SAFE_REFCOUNT_H
diff --git a/sfw/sort_array.h b/sfw/sort_array.h
new file mode 100644
index 0000000..3c6b9b8
--- /dev/null
+++ b/sfw/sort_array.h
@@ -0,0 +1,322 @@
+#ifndef SORT_ARRAY_H
+#define SORT_ARRAY_H
+
+/*************************************************************************/
+/* sort_array.h */
+/*************************************************************************/
+/* This file is part of: */
+/* PANDEMONIUM ENGINE */
+/* https://github.com/Relintai/pandemonium_engine */
+/*************************************************************************/
+/* Copyright (c) 2022-present Péter Magyar. */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#include "error_macros.h"
+#include "typedefs.h"
+
+#define ERR_BAD_COMPARE(cond) \
+ if (unlikely(cond)) { \
+ ERR_PRINT("bad comparison function; sorting will be broken"); \
+ break; \
+ }
+
+template
+struct _DefaultComparator {
+ _FORCE_INLINE_ bool operator()(const T &a, const T &b) const { return (a < b); }
+};
+
+#ifdef DEBUG_ENABLED
+#define SORT_ARRAY_VALIDATE_ENABLED true
+#else
+#define SORT_ARRAY_VALIDATE_ENABLED false
+#endif
+
+template , bool Validate = SORT_ARRAY_VALIDATE_ENABLED>
+class SortArray {
+ enum {
+
+ INTROSORT_THRESHOLD = 16
+ };
+
+public:
+ Comparator compare;
+
+ inline const T &median_of_3(const T &a, const T &b, const T &c) const {
+ if (compare(a, b)) {
+ if (compare(b, c)) {
+ return b;
+ } else if (compare(a, c)) {
+ return c;
+ } else {
+ return a;
+ }
+ } else if (compare(a, c)) {
+ return a;
+ } else if (compare(b, c)) {
+ return c;
+ } else {
+ return b;
+ }
+ }
+
+ inline int bitlog(int n) const {
+ int k;
+ for (k = 0; n != 1; n >>= 1) {
+ ++k;
+ }
+ return k;
+ }
+
+ /* Heap / Heapsort functions */
+
+ inline void push_heap(int p_first, int p_hole_idx, int p_top_index, T p_value, T *p_array) const {
+ int parent = (p_hole_idx - 1) / 2;
+ while (p_hole_idx > p_top_index && compare(p_array[p_first + parent], p_value)) {
+ p_array[p_first + p_hole_idx] = p_array[p_first + parent];
+ p_hole_idx = parent;
+ parent = (p_hole_idx - 1) / 2;
+ }
+ p_array[p_first + p_hole_idx] = p_value;
+ }
+
+ inline void pop_heap(int p_first, int p_last, int p_result, T p_value, T *p_array) const {
+ p_array[p_result] = p_array[p_first];
+ adjust_heap(p_first, 0, p_last - p_first, p_value, p_array);
+ }
+ inline void pop_heap(int p_first, int p_last, T *p_array) const {
+ pop_heap(p_first, p_last - 1, p_last - 1, p_array[p_last - 1], p_array);
+ }
+
+ inline void adjust_heap(int p_first, int p_hole_idx, int p_len, T p_value, T *p_array) const {
+ int top_index = p_hole_idx;
+ int second_child = 2 * p_hole_idx + 2;
+
+ while (second_child < p_len) {
+ if (compare(p_array[p_first + second_child], p_array[p_first + (second_child - 1)])) {
+ second_child--;
+ }
+
+ p_array[p_first + p_hole_idx] = p_array[p_first + second_child];
+ p_hole_idx = second_child;
+ second_child = 2 * (second_child + 1);
+ }
+
+ if (second_child == p_len) {
+ p_array[p_first + p_hole_idx] = p_array[p_first + (second_child - 1)];
+ p_hole_idx = second_child - 1;
+ }
+ push_heap(p_first, p_hole_idx, top_index, p_value, p_array);
+ }
+
+ inline void sort_heap(int p_first, int p_last, T *p_array) const {
+ while (p_last - p_first > 1) {
+ pop_heap(p_first, p_last--, p_array);
+ }
+ }
+
+ inline void make_heap(int p_first, int p_last, T *p_array) const {
+ if (p_last - p_first < 2) {
+ return;
+ }
+ int len = p_last - p_first;
+ int parent = (len - 2) / 2;
+
+ while (true) {
+ adjust_heap(p_first, parent, len, p_array[p_first + parent], p_array);
+ if (parent == 0) {
+ return;
+ }
+ parent--;
+ }
+ }
+
+ inline void partial_sort(int p_first, int p_last, int p_middle, T *p_array) const {
+ make_heap(p_first, p_middle, p_array);
+ for (int i = p_middle; i < p_last; i++) {
+ if (compare(p_array[i], p_array[p_first])) {
+ pop_heap(p_first, p_middle, i, p_array[i], p_array);
+ }
+ }
+ sort_heap(p_first, p_middle, p_array);
+ }
+
+ inline void partial_select(int p_first, int p_last, int p_middle, T *p_array) const {
+ make_heap(p_first, p_middle, p_array);
+ for (int i = p_middle; i < p_last; i++) {
+ if (compare(p_array[i], p_array[p_first])) {
+ pop_heap(p_first, p_middle, i, p_array[i], p_array);
+ }
+ }
+ }
+
+ inline int partitioner(int p_first, int p_last, T p_pivot, T *p_array) const {
+ const int unmodified_first = p_first;
+ const int unmodified_last = p_last;
+
+ while (true) {
+ while (compare(p_array[p_first], p_pivot)) {
+ if (Validate) {
+ ERR_BAD_COMPARE(p_first == unmodified_last - 1);
+ }
+ p_first++;
+ }
+ p_last--;
+ while (compare(p_pivot, p_array[p_last])) {
+ if (Validate) {
+ ERR_BAD_COMPARE(p_last == unmodified_first);
+ }
+ p_last--;
+ }
+
+ if (!(p_first < p_last)) {
+ return p_first;
+ }
+
+ SWAP(p_array[p_first], p_array[p_last]);
+ p_first++;
+ }
+ }
+
+ inline void introsort(int p_first, int p_last, T *p_array, int p_max_depth) const {
+ while (p_last - p_first > INTROSORT_THRESHOLD) {
+ if (p_max_depth == 0) {
+ partial_sort(p_first, p_last, p_last, p_array);
+ return;
+ }
+
+ p_max_depth--;
+
+ int cut = partitioner(
+ p_first,
+ p_last,
+ median_of_3(
+ p_array[p_first],
+ p_array[p_first + (p_last - p_first) / 2],
+ p_array[p_last - 1]),
+ p_array);
+
+ introsort(cut, p_last, p_array, p_max_depth);
+ p_last = cut;
+ }
+ }
+
+ inline void introselect(int p_first, int p_nth, int p_last, T *p_array, int p_max_depth) const {
+ while (p_last - p_first > 3) {
+ if (p_max_depth == 0) {
+ partial_select(p_first, p_nth + 1, p_last, p_array);
+ SWAP(p_first, p_nth);
+ return;
+ }
+
+ p_max_depth--;
+
+ int cut = partitioner(
+ p_first,
+ p_last,
+ median_of_3(
+ p_array[p_first],
+ p_array[p_first + (p_last - p_first) / 2],
+ p_array[p_last - 1]),
+ p_array);
+
+ if (cut <= p_nth) {
+ p_first = cut;
+ } else {
+ p_last = cut;
+ }
+ }
+
+ insertion_sort(p_first, p_last, p_array);
+ }
+
+ inline void unguarded_linear_insert(int p_last, T p_value, T *p_array) const {
+ int next = p_last - 1;
+ while (compare(p_value, p_array[next])) {
+ if (Validate) {
+ ERR_BAD_COMPARE(next == 0);
+ }
+ p_array[p_last] = p_array[next];
+ p_last = next;
+ next--;
+ }
+ p_array[p_last] = p_value;
+ }
+
+ inline void linear_insert(int p_first, int p_last, T *p_array) const {
+ T val = p_array[p_last];
+ if (compare(val, p_array[p_first])) {
+ for (int i = p_last; i > p_first; i--) {
+ p_array[i] = p_array[i - 1];
+ }
+
+ p_array[p_first] = val;
+ } else {
+ unguarded_linear_insert(p_last, val, p_array);
+ }
+ }
+
+ inline void insertion_sort(int p_first, int p_last, T *p_array) const {
+ if (p_first == p_last) {
+ return;
+ }
+ for (int i = p_first + 1; i != p_last; i++) {
+ linear_insert(p_first, i, p_array);
+ }
+ }
+
+ inline void unguarded_insertion_sort(int p_first, int p_last, T *p_array) const {
+ for (int i = p_first; i != p_last; i++) {
+ unguarded_linear_insert(i, p_array[i], p_array);
+ }
+ }
+
+ inline void final_insertion_sort(int p_first, int p_last, T *p_array) const {
+ if (p_last - p_first > INTROSORT_THRESHOLD) {
+ insertion_sort(p_first, p_first + INTROSORT_THRESHOLD, p_array);
+ unguarded_insertion_sort(p_first + INTROSORT_THRESHOLD, p_last, p_array);
+ } else {
+ insertion_sort(p_first, p_last, p_array);
+ }
+ }
+
+ inline void sort_range(int p_first, int p_last, T *p_array) const {
+ if (p_first != p_last) {
+ introsort(p_first, p_last, p_array, bitlog(p_last - p_first) * 2);
+ final_insertion_sort(p_first, p_last, p_array);
+ }
+ }
+
+ inline void sort(T *p_array, int p_len) const {
+ sort_range(0, p_len, p_array);
+ }
+
+ inline void nth_element(int p_first, int p_last, int p_nth, T *p_array) const {
+ if (p_first == p_last || p_nth == p_last) {
+ return;
+ }
+ introselect(p_first, p_nth, p_last, p_array, bitlog(p_last - p_first) * 2);
+ }
+};
+
+#endif // SORT_ARRAY_H
diff --git a/sfw/core/containers/tight_local_vector.h b/sfw/tight_local_vector.h
similarity index 97%
rename from sfw/core/containers/tight_local_vector.h
rename to sfw/tight_local_vector.h
index 13ee006..47a503a 100644
--- a/sfw/core/containers/tight_local_vector.h
+++ b/sfw/tight_local_vector.h
@@ -32,11 +32,11 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "core/containers/pool_vector.h"
-#include "core/containers/sort_array.h"
-#include "core/containers/vector.h"
-#include "core/error/error_macros.h"
-#include "core/os/memory.h"
+#include "pool_vector.h"
+#include "sort_array.h"
+#include "vector.h"
+#include "error_macros.h"
+#include "memory.h"
// It grows strictly as much as needed. (The vanilla LocalVector is what you want in most cases).
template
diff --git a/sfw/transform.cpp b/sfw/transform.cpp
index 2820101..9ea17e3 100644
--- a/sfw/transform.cpp
+++ b/sfw/transform.cpp
@@ -31,8 +31,8 @@
#include "transform.h"
-#include "core/math/math_funcs.h"
-#include "core/string/print_string.h"
+#include "math_funcs.h"
+#include "string/print_string.h"
void Transform::invert() {
basis.transpose();
diff --git a/sfw/transform.h b/sfw/transform.h
index 135b207..aa9810f 100644
--- a/sfw/transform.h
+++ b/sfw/transform.h
@@ -32,11 +32,10 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "core/containers/pool_vector.h"
-#include "core/math/aabb.h"
-#include "core/math/basis.h"
-#include "core/math/plane.h"
-#include "core/math/vector3i.h"
+#include "aabb.h"
+#include "basis.h"
+#include "plane.h"
+#include "vector3i.h"
struct _NO_DISCARD_CLASS_ Transform {
Basis basis;
diff --git a/sfw/transform_2d.h b/sfw/transform_2d.h
index a961d1b..280cc5e 100644
--- a/sfw/transform_2d.h
+++ b/sfw/transform_2d.h
@@ -32,9 +32,9 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "core/containers/pool_vector.h"
-#include "core/math/rect2.h" // also includes vector2, math_funcs, and ustring
-#include "core/math/rect2i.h" // also includes vector2i, math_funcs, and ustring
+#include "pool_vector.h"
+#include "rect2.h" // also includes vector2, math_funcs, and ustring
+#include "rect2i.h" // also includes vector2i, math_funcs, and ustring
struct _NO_DISCARD_CLASS_ Transform2D {
// Warning #1: basis of Transform2D is stored differently from Basis. In terms of columns array, the basis matrix looks like "on paper":
diff --git a/sfw/typedefs.h b/sfw/typedefs.h
index f712d43..06f0936 100644
--- a/sfw/typedefs.h
+++ b/sfw/typedefs.h
@@ -107,7 +107,7 @@ T *_nullptr() {
#include "int_types.h"
-//#include "core/error_list.h"
+//#include "error_list.h"
/** Generic ABS function, for math uses please use Math::abs */
diff --git a/sfw/ustring.cpp b/sfw/ustring.cpp
index 4c439c9..41584c8 100644
--- a/sfw/ustring.cpp
+++ b/sfw/ustring.cpp
@@ -35,15 +35,15 @@
#include "ustring.h"
-#include "core/crypto/crypto_core.h"
-#include "core/math/color.h"
-#include "core/math/math_funcs.h"
-#include "core/os/memory.h"
-#include "core/string/print_string.h"
-#include "core/string/translation.h"
-#include "core/string/ucaps.h"
-#include "core/variant/variant.h"
-#include "core/version_generated.gen.h"
+#include "crypto/crypto_core.h"
+#include "color.h"
+#include "math_funcs.h"
+#include "os/memory.h"
+#include "string/print_string.h"
+#include "string/translation.h"
+#include "string/ucaps.h"
+#include "variant/variant.h"
+#include "version_generated.gen.h"
#include
#include
diff --git a/sfw/ustring.h b/sfw/ustring.h
index c404fc5..57a9d56 100644
--- a/sfw/ustring.h
+++ b/sfw/ustring.h
@@ -32,11 +32,10 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "core/containers/cowdata.h"
-#include "core/containers/vector.h"
-#include "core/string/char_utils.h"
-#include "core/typedefs.h"
-#include "core/variant/array.h"
+#include "cowdata.h"
+#include "vector.h"
+#include "char_utils.h"
+#include "typedefs.h"
/*************************************************************************/
/* CharProxy */
diff --git a/sfw/core/containers/vector.h b/sfw/vector.h
similarity index 97%
rename from sfw/core/containers/vector.h
rename to sfw/vector.h
index a05361e..44e0021 100644
--- a/sfw/core/containers/vector.h
+++ b/sfw/vector.h
@@ -38,10 +38,10 @@
* Vector container. Regular Vector Container. Use with care and for smaller arrays when possible. Use PoolVector for large arrays.
*/
-#include "core/containers/cowdata.h"
-#include "core/containers/sort_array.h"
-#include "core/error/error_macros.h"
-#include "core/os/memory.h"
+#include "cowdata.h"
+#include "sort_array.h"
+#include "error_macros.h"
+#include "memory.h"
template
class VectorWriteProxy {
diff --git a/sfw/vector2.cpp b/sfw/vector2.cpp
index d8ad63a..cad3978 100644
--- a/sfw/vector2.cpp
+++ b/sfw/vector2.cpp
@@ -31,7 +31,7 @@
#include "vector2.h"
-#include "core/string/ustring.h"
+#include "string/ustring.h"
real_t Vector2::angle() const {
return Math::atan2(y, x);
@@ -173,4 +173,4 @@ bool Vector2::is_equal_approx(const Vector2 &p_v) const {
Vector2::operator String() const {
return "(" + String::num_real(x) + ", " + String::num_real(y) + ")";
-}
\ No newline at end of file
+}
diff --git a/sfw/vector2.h b/sfw/vector2.h
index 903eb55..9e64316 100644
--- a/sfw/vector2.h
+++ b/sfw/vector2.h
@@ -32,9 +32,9 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "core/math/math_funcs.h"
+#include "math_funcs.h"
-#include "core/error/error_macros.h"
+#include "error/error_macros.h"
class String;
diff --git a/sfw/vector2i.cpp b/sfw/vector2i.cpp
index 9a89dfa..270b331 100644
--- a/sfw/vector2i.cpp
+++ b/sfw/vector2i.cpp
@@ -31,7 +31,7 @@
#include "vector2i.h"
-#include "core/string/ustring.h"
+#include "string/ustring.h"
Vector2i Vector2i::clamp(const Vector2i &p_min, const Vector2i &p_max) const {
return Vector2i(
diff --git a/sfw/vector2i.h b/sfw/vector2i.h
index 6393df5..55efec5 100644
--- a/sfw/vector2i.h
+++ b/sfw/vector2i.h
@@ -32,8 +32,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "core/error/error_macros.h"
-#include "core/math/math_funcs.h"
+#include "error/error_macros.h"
+#include "math_funcs.h"
#include "vector2.h"
diff --git a/sfw/vector3.cpp b/sfw/vector3.cpp
index b7d6396..72f2cb1 100644
--- a/sfw/vector3.cpp
+++ b/sfw/vector3.cpp
@@ -31,7 +31,7 @@
#include "vector3.h"
-#include "core/math/basis.h"
+#include "basis.h"
void Vector3::rotate(const Vector3 &p_axis, real_t p_phi) {
*this = Basis(p_axis, p_phi).xform(*this);
diff --git a/sfw/vector3i.cpp b/sfw/vector3i.cpp
index 53f55a1..ab18433 100644
--- a/sfw/vector3i.cpp
+++ b/sfw/vector3i.cpp
@@ -31,8 +31,8 @@
#include "vector3i.h"
-#include "core/math/vector3.h"
-#include "core/string/ustring.h"
+#include "vector3.h"
+#include "string/ustring.h"
void Vector3i::set_axis(const int p_axis, const int32_t p_value) {
ERR_FAIL_INDEX(p_axis, 3);
diff --git a/sfw/vector3i.h b/sfw/vector3i.h
index 0375e5b..cb6490f 100644
--- a/sfw/vector3i.h
+++ b/sfw/vector3i.h
@@ -32,8 +32,8 @@
#ifndef VECTOR3I_H
#define VECTOR3I_H
-#include "core/error/error_macros.h"
-#include "core/math/math_funcs.h"
+#include "error_macros.h"
+#include "math_funcs.h"
class String;
struct Vector3;
diff --git a/sfw/vector4.cpp b/sfw/vector4.cpp
index db870e8..972454f 100644
--- a/sfw/vector4.cpp
+++ b/sfw/vector4.cpp
@@ -31,8 +31,8 @@
#include "vector4.h"
-#include "core/math/basis.h"
-#include "core/string/print_string.h"
+#include "basis.h"
+#include "string/print_string.h"
void Vector4::set_axis(const int p_axis, const real_t p_value) {
ERR_FAIL_INDEX(p_axis, 4);
diff --git a/sfw/vector4.h b/sfw/vector4.h
index f7d7614..1444aa1 100644
--- a/sfw/vector4.h
+++ b/sfw/vector4.h
@@ -32,9 +32,9 @@
#ifndef VECTOR4_H
#define VECTOR4_H
-#include "core/math/math_defs.h"
-#include "core/math/math_funcs.h"
-#include "core/string/ustring.h"
+#include "math_defs.h"
+#include "math_funcs.h"
+#include "string/ustring.h"
struct _NO_DISCARD_CLASS_ Vector4 {
enum Axis {
diff --git a/sfw/vector4i.cpp b/sfw/vector4i.cpp
index 049d9a6..9125074 100644
--- a/sfw/vector4i.cpp
+++ b/sfw/vector4i.cpp
@@ -31,8 +31,8 @@
#include "vector4i.h"
-#include "core/math/vector4.h"
-#include "core/string/ustring.h"
+#include "vector4.h"
+#include "string/ustring.h"
void Vector4i::set_axis(const int p_axis, const int32_t p_value) {
ERR_FAIL_INDEX(p_axis, 4);
diff --git a/sfw/vector4i.h b/sfw/vector4i.h
index 61b0a4e..e032b09 100644
--- a/sfw/vector4i.h
+++ b/sfw/vector4i.h
@@ -32,8 +32,8 @@
#ifndef VECTOR4I_H
#define VECTOR4I_H
-#include "core/error/error_macros.h"
-#include "core/math/math_funcs.h"
+#include "error/error_macros.h"
+#include "math_funcs.h"
class String;
struct Vector4;
diff --git a/sfw/core/containers/vmap.h b/sfw/vmap.h
similarity index 99%
rename from sfw/core/containers/vmap.h
rename to sfw/vmap.h
index c1351a4..9678003 100644
--- a/sfw/core/containers/vmap.h
+++ b/sfw/vmap.h
@@ -32,7 +32,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "core/containers/cowdata.h"
+#include "cowdata.h"
#include "core/typedefs.h"
template
diff --git a/sfw/core/containers/vset.h b/sfw/vset.h
similarity index 99%
rename from sfw/core/containers/vset.h
rename to sfw/vset.h
index d75013c..d10d88a 100644
--- a/sfw/core/containers/vset.h
+++ b/sfw/vset.h
@@ -32,7 +32,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "core/containers/vector.h"
+#include "vector.h"
#include "core/typedefs.h"
template