Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
afff671
Begin some setup and renamed a couple of hpps to hs
Dec 3, 2025
a403f5e
A lot of container and other changes. Need to implement register clas…
Dec 3, 2025
f66dc61
Created reflection macros and added some early validation.
Dec 3, 2025
1c245ed
Add validation for a bind method function
Dec 4, 2025
a9ccb0b
Got most of the framework working but got to figure out the any cast …
Dec 4, 2025
3b7da2a
A lot of improvements on the reflection logic. Using a base class and…
Dec 5, 2025
a1025bc
Start adding code for property access
Dec 5, 2025
08d7831
Successfully implemented logic for members (getter and setter logic s…
MartinDew Dec 6, 2025
4d0b16f
Some improvements
MartinDew Dec 7, 2025
3ebec89
Weird static_string.hpp fix for linux
MartinDew Dec 8, 2025
c9cf334
Some changes allowing to show available renderers in the help menu. M…
MartinDew Dec 8, 2025
f2a57e8
Rename get_class_name to get_class_static
MartinDew Dec 8, 2025
6b07e42
Add a temporary keybind for fullscreen
MartinDew Dec 8, 2025
6d0ff4a
Update cmake preset to have debug build declared first
Dec 10, 2025
c6c5d02
Create callable class
Dec 10, 2025
866e075
Got a compiling callable and bind_method method
Dec 10, 2025
19a6a26
Cleanup call calls
Dec 10, 2025
aeceb5d
Manage to finish callable objects
Dec 11, 2025
1852b59
Reverted exemple call in rendering server to use native call. Removed…
Dec 11, 2025
6ceec36
Macos fix
Dec 11, 2025
1884243
Completely remove android from ci code
Dec 11, 2025
44eb5fe
Extract class info in its own file to prevent cyclic inclusion and vo…
Dec 11, 2025
c1617b9
Add back commented validation for callable constructor templates
Dec 11, 2025
e45cb54
Removed erroneous todo
Dec 11, 2025
9d9eec9
Remove commented out code
Dec 11, 2025
0e3c225
Remove callable cpp file
Dec 16, 2025
cdd77a5
Added source compiled resources instead of copying shader folder
Dec 16, 2025
0802104
PR fixes
Dec 17, 2025
a9403c9
MR fixes
MartinDew Dec 18, 2025
5d0578f
MR fixes
MartinDew Dec 18, 2025
b2c1fb5
Some more mr fixes
MartinDew Dec 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ AlignOperands: DontAlign
AlignTrailingComments: false
# AllowAllArgumentsOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: false
# AllowShortEnumsOnASingleLine: true
AllowShortEnumsOnASingleLine: false
# AllowShortBlocksOnASingleLine: Never
# AllowShortCaseLabelsOnASingleLine: false
# AllowShortFunctionsOnASingleLine: All
Expand Down
79 changes: 0 additions & 79 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -211,85 +211,6 @@ jobs:
build/*/bin/*
retention-days: 7

# build-android:
# name: Android Build (${{ matrix.config }}, ${{ matrix.abi }})
# runs-on: ubuntu-latest
# strategy:
# fail-fast: false
# matrix:
# config: [ Debug, Release, Development ]
# abi: [ arm64-v8a, armeabi-v7a, x86_64 ]

# steps:
# - name: Checkout code
# uses: actions/checkout@v4

# - name: Setup Java
# uses: actions/setup-java@v4
# with:
# distribution: 'temurin'
# java-version: '17'

# - name: Setup Android NDK
# uses: nttld/setup-ndk@v1
# id: setup-ndk
# with:
# ndk-version: r27
# add-to-path: true

# - name: Install dependencies
# run: |
# sudo apt-get update
# sudo apt-get install -y ninja-build

# - name: Setup cmake
# uses: jwlawson/actions-setup-cmake@v2
# with:
# cmake-version: '4.1.x'

# - name: Setup Vulkan SDK
# uses: humbletim/setup-vulkan-sdk@v1.2.1
# with:
# vulkan-use-cache: true
# vulkan-query-version: latest

# - name: Cache CMake configuration
# uses: actions/cache@v4
# with:
# path: |
# build/android-${{ matrix.abi }}/CMakeCache.txt
# build/android-${{ matrix.abi }}/CMakeFiles
# build/android-${{ matrix.abi }}/*.cmake
# key: android-cmake-${{ matrix.abi }}-${{ matrix.config }}-${{ hashFiles('**/CMakeLists.txt', 'cmake/**') }}
# restore-keys: |
# android-cmake-${{ matrix.abi }}-${{ matrix.config }}-

# - name: Configure CMake for Android
# env:
# ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}
# run: |
# cmake --version
# cmake -B build/android-${{ matrix.abi }} \
# -G Ninja \
# -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_HOME/build/cmake/android.toolchain.cmake \
# -DANDROID_ABI=${{ matrix.abi }} \
# -DANDROID_PLATFORM=android-24 \
# -DCMAKE_BUILD_TYPE=${{ matrix.config }} \
# -DCMAKE_ANDROID_NDK=$ANDROID_NDK_HOME

# - name: Build Standalone
# run: |
# cmake --build build/android-${{ matrix.abi }} --config ${{ matrix.config }} --target Standalone

# - name: Upload artifacts
# uses: actions/upload-artifact@v4
# with:
# name: android-${{ matrix.abi }}-${{ matrix.config }}-binaries
# path: |
# build/android-${{ matrix.abi }}/bin/*
# build/android-${{ matrix.abi }}/lib/*
# retention-days: 7

build-summary:
name: Build Summary
runs-on: ubuntu-latest
Expand Down
54 changes: 27 additions & 27 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,29 @@ set(PROJECT_HEADERS
core/main/window.h
core/main/engine.h
core/main/engine_settings.h
core/main/class_db.h
core/main/class_db.inl

# Math
core/math/transform.h
core/math/math_defs.h
core/main/notification.h

#Framework
core/framework/assert.hpp
core/framework/assert.h
core/framework/callable.h
core/framework/static_string.hpp
core/framework/delegate.h
core/framework/containers.h
core/framework/container_utils.h
core/framework/static_indexed_array.h
core/framework/functions.h
core/framework/cow_vector.h
core/framework/variant.h
core/framework/high_level_array.h
core/framework/macro_utils.h
core/framework/reflected.h
core/framework/reflection_macros.h
core/framework/reflection_utils.h

#Rendering
core/rendering/rendering_server.h
Expand All @@ -63,17 +73,21 @@ set(PROJECT_SOURCES
core/main/window.cpp
core/main/engine.cpp
core/main/engine_settings.cpp
core/main/class_db.cpp
# Math
core/math/transform.cpp
core/math/math_defs.cpp
# Rendering
core/rendering/renderer.cpp
core/rendering/rendering_server.cpp
core/rendering/triangle_mesh.cpp
# Framework
core/framework/reflected.cpp
core/framework/variant.cpp
)

# Editor target
add_executable(Editor ${PROJECT_SOURCES} ${PROJECT_HEADERS} )
add_executable(Editor ${PROJECT_SOURCES} ${PROJECT_HEADERS})

set_target_properties(Editor PROPERTIES OUTPUT_NAME ${PROJECT_NAME}.editor)
# set_target_properties(Editor PROPERTIES ENABLE_EXPORTS ON)
Expand All @@ -92,7 +106,7 @@ target_compile_options(Editor PRIVATE
)

# Standalone target
add_executable(Standalone ${PROJECT_SOURCES} ${PROJECT_HEADERS} )
add_executable(Standalone ${PROJECT_SOURCES} ${PROJECT_HEADERS})
target_include_directories(Standalone PUBLIC core ${CMAKE_SOURCE_DIR})

set_target_properties(Standalone PROPERTIES OUTPUT_NAME ${PROJECT_NAME}.standalone)
Expand Down Expand Up @@ -135,38 +149,24 @@ if (MSVC)
target_compile_definitions(Standalone PRIVATE NOMINMAX WIN32_LEAN_AND_MEAN)

# embed raw_resources folder
# target_compile_options(Editor PUBLIC "\/clang:--embed-dir=${CMAKE_SOURCE_DIR}/raw_resources")
# target_compile_options(Standalone PUBLIC "\/clang:--embed-dir=${CMAKE_SOURCE_DIR}/raw_resources")
# target_compile_options(Editor PUBLIC "\/clang:--embed-dir=${CMAKE_SOURCE_DIR}/raw_resources")
# target_compile_options(Standalone PUBLIC "\/clang:--embed-dir=${CMAKE_SOURCE_DIR}/raw_resources")

else ()
target_compile_options(Editor PRIVATE -Wall -Wextra -pedantic -Wno-unused-parameter)
target_compile_options(Standalone PRIVATE -Wall -Wextra -pedantic -Wno-unused-parameter)
# embed raw_resources folder
# target_compile_options(Editor PUBLIC "--embed-dir=${CMAKE_SOURCE_DIR}/raw_resources")
# target_compile_options(Standalone PUBLIC "--embed-dir=${CMAKE_SOURCE_DIR}/raw_resources")

# target_compile_options(Editor PUBLIC "--embed-dir=${CMAKE_SOURCE_DIR}/raw_resources")
# target_compile_options(Standalone PUBLIC "--embed-dir=${CMAKE_SOURCE_DIR}/raw_resources")
endif ()

add_subdirectory(modules)

if (${enable_vex_renderer})
vex_setup_runtime(Editor)
vex_setup_runtime(Standalone)
endif()

add_custom_command(
TARGET Editor POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/raw_resources/shaders $<TARGET_FILE_DIR:Editor>/shaders
COMMENT "Copying shaders" VERBATIM
)

add_custom_command(
TARGET Standalone POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/raw_resources/shaders $<TARGET_FILE_DIR:Standalone>/shaders
COMMENT "Copying shaders" VERBATIM
)
vex_setup_runtime(Editor)
vex_setup_runtime(Standalone)
endif ()

# Print build configuration
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
Expand Down
17 changes: 10 additions & 7 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,10 @@
"description": "Multi config build",
"inherits": "default",
"generator": "Ninja Multi-Config",
"toolchainFile": "${sourceDir}/tools/toolchain-llvm.cmake"
"toolchainFile": "${sourceDir}/tools/toolchain-llvm.cmake",
"cacheVariables": {
"LLVM_USE_LIBCXX": "ON"
}
}
],
"buildPresets": [
Expand Down Expand Up @@ -112,18 +115,18 @@
"configurePreset": "multi",
"configuration": "Release"
},
{
"name": "llvm-multi-development",
"displayName": "Development Build",
"configurePreset": "multi-llvm",
"configuration": "Development"
},
{
"name": "llvm-multi-debug",
"displayName": "Debug Build",
"configurePreset": "multi-llvm",
"configuration": "Debug"
},
{
"name": "llvm-multi-development",
"displayName": "Development Build",
"configurePreset": "multi-llvm",
"configuration": "Development"
},
{
"name": "llvm-multi-release",
"displayName": "Release Build",
Expand Down
8 changes: 2 additions & 6 deletions core/framework/assert.hpp → core/framework/assert.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,9 @@
#include <source_location>
#include <stdexcept>

template <class... T>
void fassert(bool condition, const char* message, const T&... args,
std::source_location loc = std::source_location::current()) {
inline void fassert(bool condition, std::string message, std::source_location loc = std::source_location::current()) {
if (!condition) {
auto formatted_message = std::vformat(message, std::make_format_args(args...));
throw std::runtime_error(
std::format("Assertion failed ({}:{}) : {}", loc.file_name(), loc.line(), formatted_message));
throw std::runtime_error(std::format("Assertion failed ({}:{}) : {}", loc.file_name(), loc.line(), message));
}
}

Expand Down
57 changes: 57 additions & 0 deletions core/framework/callable.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#pragma once

#include "variant.h"

#include "assert.h"

#include <cstdint>
#include <functional>
#include <span>
#include <tuple>
#include <type_traits>

namespace feather {

class Callable {
std::function<Variant(std::span<Variant>)> _internal_func;

// A function will likely not have more thant 255 params
uint8_t _param_amount;

public:
template <class TRet, class... TArgs>
requires(VariantCompatible<TRet>) && ((VariantCompatible<TArgs>) && ...)
Callable(std::function<TRet(TArgs...)> func)
: _internal_func { [func](std::span<Variant> params) {
size_t i = 0;
std::tuple<TArgs...> converted_args = { params[i++].as<TArgs>().value()... };
if constexpr (std::is_void_v<TRet>) {
std::apply(func, converted_args);
return Variant();
}
else {
TRet result = std::apply(func, converted_args);
return Variant(std::move(result));
}
} }
, _param_amount { sizeof...(TArgs) } {}

Callable(Callable&&) = default;
Callable(const Callable&) = default;
Callable& operator=(const Callable&) = default;
Callable& operator=(Callable&&) = default;

Variant call(std::span<Variant> params) {
if (params.size() != _param_amount) {
fassert(false, "Callable called with incorrect number of parameters");
}
return _internal_func(params);
}

Variant call(auto&&... args) {
Variant params[] = { args... };
return call(std::span<Variant>(params, sizeof...(args)));
}
};

} //namespace feather
40 changes: 40 additions & 0 deletions core/framework/class_info.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#pragma once

#include "callable.h"
#include "static_string.hpp"
#include "variant.h"

#include <functional>
#include <vector>

namespace feather {

struct ClassInfo {
StaticString name = ""_ss;
StaticString parent = ""_ss;
std::vector<const ClassInfo*> children;
struct Property {
StaticString name;
// variant type to convert to
VariantType type;
size_t member_offset;
size_t member_size;

// Function pointers for get/set
std::function<Variant(void*)> getter; // Takes object pointer, returns Variant
std::function<void(void*, Variant)> setter; // Takes object pointer and value
};
std::vector<Property> properties;

struct Method {
StaticString name;
// Possibly need to store param names later
Callable callable;
};

std::vector<Method> methods;

std::function<Variant()> object_create_func;
};

} //namespace feather
File renamed without changes.
Loading
Loading