Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
5e1c2c4
Initial implementation of an input-action system.
Dandielo Nov 20, 2024
4070750
Integrated InputActions system into the Engine.
Dandielo Nov 22, 2024
03df5f6
[wip] Building layers from a DSL definition.
Dandielo Nov 22, 2024
db5d3fe
[wip] Input action
Dandielo Dec 4, 2024
6a74d7d
[wip] Other changes
Dandielo Dec 4, 2024
0bc8ed3
Missing functions from the previous version of this feature.
Dandielo Jun 24, 2025
b9c824e
Disable vulkan alloc on windows (again?)
Dandielo Jun 24, 2025
3024d7e
Continued work on the InputAction script.
Dandielo Jun 29, 2025
257d4f5
Implemeted modifiers in the script grammar.
Dandielo Jun 30, 2025
af32f97
Added an option to take time-active as the output value for an action.
Dandielo Jul 6, 2025
e930ebc
Allow to check action duration explicitly on the active stack.
Dandielo Jul 6, 2025
4b99291
Cleanup on input action types. [#1]
Dandielo Jul 7, 2025
403ee6d
Continued cleanup of input actions feature.
Dandielo Jul 9, 2025
bce1cef
Little improvements in accessing sub-spans in the input action defini…
Dandielo Jul 9, 2025
e755627
Added support for modifier keys (shift, ctrl, alt, gui*) and more
Dandielo Jul 10, 2025
5f7e367
More documentation and cleanup on input actions.
Dandielo Jul 10, 2025
ce3b1d6
Parial cleanup of action layers.
Dandielo Jul 12, 2025
36d63e1
Refactoring internal logic for updating sources and actions.
Dandielo Jul 13, 2025
f06991a
Fixing remaining compilation issues and bugs.
Dandielo Jul 20, 2025
c757931
Remove priority value from active layers in input stack.
Dandielo Jul 21, 2025
3f30f38
Refactored how InputAction builder objects are defined.
Dandielo Jul 22, 2025
e6765b6
More changes to the InputAction builder API.
Dandielo Jul 31, 2025
035eae8
Started refactor of the InputAction script.
Dandielo Jul 31, 2025
c3a2ba6
Refactored definition of all custom tokens.
Dandielo Aug 1, 2025
2ae48be
Refactoring the input action script grammar.
Dandielo Aug 2, 2025
9fde1d3
Fix compilation on linux targers.
Dandielo Aug 3, 2025
1a8ccab
Finished refactoring the action script grammar.
Dandielo Aug 4, 2025
dbc64c2
Merge branch 'feature-input-actions' of https://github.com/iceshard-e…
Dandielo Aug 4, 2025
69d3d5f
Update to IBT 1.11.1
Dandielo Aug 4, 2025
9217aed
Introduced an initial idea for storing constants across layers, later…
Dandielo Aug 5, 2025
c00001a
Layer scripts can now hold multiple layers definitions.
Dandielo Aug 7, 2025
7bbc903
Finished implementing basic support for constants.
Dandielo Aug 9, 2025
a4d7d0a
Improved module loading
Dandielo Aug 9, 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
7 changes: 7 additions & 0 deletions source/code/core/collections/public/ice/container/array.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ namespace ice::array
requires std::copy_constructible<Type>
inline void push_back(ice::Array<Type, Logic>& arr, ice::Span<Type const> items) noexcept;

template<typename Type, ice::ContainerLogic Logic, typename Source>
requires std::copy_constructible<Type> && (std::is_same_v<Type, Source> == false)
inline void push_back(ice::Array<Type, Logic>& arr, ice::Span<Source const> items, Type(*fn)(Source const&) noexcept) noexcept;

template<typename Type, ice::ContainerLogic Logic>
inline void pop_back(ice::Array<Type, Logic>& arr, ice::ucount count = 1) noexcept;

Expand Down Expand Up @@ -123,6 +127,9 @@ namespace ice::array
template<typename Type>
inline auto memset(ice::Array<Type, ice::ContainerLogic::Trivial>& arr, ice::u8 value) noexcept -> ice::Memory;

template<typename Type, ice::ContainerLogic Logic>
inline auto meminfo(ice::Array<Type, Logic> const& arr) noexcept -> ice::meminfo;

} // namespace ice::array

namespace ice
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,23 @@ namespace ice
arr._count += ice::span::count(items);
}

template<typename Type, ice::ContainerLogic Logic, typename Source>
requires std::copy_constructible<Type> && (std::is_same_v<Type, Source> == false)
inline void push_back(ice::Array<Type, Logic>& arr, ice::Span<Source const> items, Type(*fn)(Source const&) noexcept) noexcept
{
ice::ucount const required_capacity = arr._count + ice::span::count(items);
if (required_capacity > arr._capacity)
{
ice::array::grow(arr, required_capacity);
}

ice::ucount const missing_items = required_capacity - arr._count;
for (ice::u32 src_idx = 0; src_idx < missing_items; ++src_idx)
{
ice::array::push_back(arr, fn(items[src_idx]));
}
}

template<typename Type, ice::ContainerLogic Logic>
inline void pop_back(ice::Array<Type, Logic>& arr, ice::ucount count /*= 1*/) noexcept
{
Expand Down Expand Up @@ -466,9 +483,15 @@ namespace ice
}

template<typename Type, ice::ContainerLogic Logic>
inline auto slice(ice::Array<Type, Logic> const& arr, ice::ucount from_idx, ice::ucount to) noexcept -> ice::Span<Type const>
inline auto slice(ice::Array<Type, Logic> const& arr, ice::ucount from_idx, ice::ucount count) noexcept -> ice::Span<Type const>
{
return ice::span::subspan<Type const>(arr, from_idx, count);
}

template<typename Type, ice::ContainerLogic Logic>
inline auto slice(ice::Array<Type, Logic> const& arr, ice::ref32 ref) noexcept -> ice::Span<Type const>
{
return ice::span::subspan<Type const>(arr, from_idx, to);
return ice::span::subspan<Type const>(arr, ref);
}

template<typename Type, ice::ContainerLogic Logic>
Expand Down Expand Up @@ -539,6 +562,12 @@ namespace ice
return mem;
}

template<typename Type, ice::ContainerLogic Logic>
inline auto meminfo(ice::Array<Type, Logic> const& arr) noexcept -> ice::meminfo
{
return ice::meminfo_of<Type> * ice::array::count(arr);
}

} // namespace array

} // namespace ice
31 changes: 27 additions & 4 deletions source/code/core/collections/public/ice/span.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ namespace ice
template<typename Type>
constexpr auto subspan(ice::Span<Type> span, ice::ucount from_idx, ice::ucount count = ice::ucount_max) noexcept -> ice::Span<Type>;

template<typename Type>
constexpr auto subspan(ice::Span<Type> span, ice::ref32 ref) noexcept -> ice::Span<Type>;

template<typename Type>
constexpr auto begin(ice::Span<Type> span) noexcept -> typename ice::Span<Type>::Iterator;

Expand Down Expand Up @@ -257,6 +260,12 @@ namespace ice
return { span._data + from_start, new_count };
}

template<typename Type>
constexpr auto subspan(ice::Span<Type> span, ice::ref32 ref) noexcept -> ice::Span<Type>
{
return ice::span::subspan(span, ref.offset, ref.size);
}

template<typename Type>
constexpr auto begin(ice::Span<Type> span) noexcept -> typename ice::Span<Type>::Iterator
{
Expand Down Expand Up @@ -330,12 +339,26 @@ namespace ice
}

template<typename Type>
constexpr auto from_memory(ice::Memory const& mem, ice::meminfo meminfo, ice::usize offset) noexcept
constexpr auto from_memory(ice::Memory const& mem, ice::ucount count, ice::usize offset) noexcept -> ice::Span<Type>
{
static ice::meminfo minfo = ice::meminfo_of<Type>;

void* const ptr = ice::ptr_add(mem.location, offset);
ICE_ASSERT_CORE(ice::is_aligned(ptr, meminfo.alignment));
ICE_ASSERT_CORE(ice::ptr_add(mem.location, mem.size) >= ice::ptr_add(ptr, meminfo.size));
return ice::Span<Type>{ reinterpret_cast<Type*>(ptr), ice::ucount((meminfo.size / ice::size_of<Type>).value) };
ICE_ASSERT_CORE(ice::is_aligned(ptr, minfo.alignment));
ICE_ASSERT_CORE(ice::ptr_add(mem.location, mem.size) >= ice::ptr_add(ptr, minfo.size * count));
return ice::Span<Type>{ reinterpret_cast<Type*>(ptr), count };
}

// TODO: Move to another location or rename? Not sure this is properly named
template<typename Type>
constexpr auto from_data(ice::Data const& mem, ice::ucount count, ice::usize offset) noexcept -> ice::Span<Type const>
{
static ice::meminfo constexpr minfo = ice::meminfo_of<Type>;

void const* const ptr = ice::ptr_add(mem.location, offset);
ICE_ASSERT_CORE(ice::is_aligned(ptr, minfo.alignment));
ICE_ASSERT_CORE(ice::ptr_add(mem.location, mem.size) >= ice::ptr_add(ptr, minfo.size * count));
return { reinterpret_cast<Type const*>(ptr), count };
}

} // namespace span
Expand Down
18 changes: 16 additions & 2 deletions source/code/core/collections/public/ice/string/impl/string.inl
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,15 @@ namespace ice
}

template<typename CharType>
constexpr auto starts_with(ice::BasicString<CharType> str, ice::BasicString<CharType> prefix) noexcept
constexpr auto substr(ice::BasicString<CharType> str, ice::ref32 ref) noexcept -> ice::BasicString<CharType>
{
return ice::string::substr(str, 0, ice::string::size(prefix)) == prefix;
return ice::string::substr(str, ref.offset, ref.size);
}

template<typename CharType>
constexpr auto starts_with(ice::BasicString<CharType> str, ice::concepts::StringType<CharType> auto prefix) noexcept
{
return ice::string::substr(str, 0, prefix._size) == prefix;
}


Expand Down Expand Up @@ -384,6 +390,14 @@ namespace ice
};
}

template<typename CharType>
constexpr auto meminfo(ice::BasicString<CharType> str) noexcept -> ice::meminfo
{
return ice::meminfo{
ice::meminfo_of<CharType> * ice::string::size(str)
};
}

} // namespace string

} // namespace ice
8 changes: 7 additions & 1 deletion source/code/core/collections/public/ice/string/string.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ namespace ice::string
constexpr auto substr(ice::BasicString<CharType> str, ice::ucount pos, ice::ucount len = ice::String_NPos) noexcept -> ice::BasicString<CharType>;

template<typename CharType>
constexpr auto starts_with(ice::BasicString<CharType> str, ice::BasicString<CharType> prefix) noexcept;
constexpr auto substr(ice::BasicString<CharType> str, ice::ref32 ref) noexcept -> ice::BasicString<CharType>;

template<typename CharType>
constexpr auto starts_with(ice::BasicString<CharType> str, ice::concepts::StringType<CharType> auto prefix) noexcept;

template<typename CharType>
constexpr auto find_first_of(
Expand Down Expand Up @@ -109,6 +112,9 @@ namespace ice::string
template<typename CharType>
constexpr auto data_view(ice::BasicString<CharType> str) noexcept -> typename ice::Data;

template<typename CharType>
constexpr auto meminfo(ice::BasicString<CharType> str) noexcept -> ice::meminfo;

} // namespace ice::string

namespace ice
Expand Down
12 changes: 12 additions & 0 deletions source/code/core/collections/public/ice/string_types.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -222,3 +222,15 @@ namespace ice
}

} // namespace ice

namespace ice::concepts
{

template<typename Type, typename CharType>
concept StringType = std::is_same_v<ice::BasicString<CharType>, Type>
|| std::is_same_v<ice::HeapString<CharType>, Type>
&& requires(Type t) {
{ t._size } -> std::convertible_to<ice::ucount>;
};

} // namespace ice::concepts
54 changes: 54 additions & 0 deletions source/code/core/core/public/ice/concept/pimpl_type.hxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#pragma once
#include <ice/concept/enum_flags.hxx>

namespace ice::concepts
{

enum class PimplFlags : ice::u8
{
None = 0x0,
Default = None,

NoMoveSemantics = 0x01,
NoCopySemantics = 0x02,
NoMoveCopySemantics = NoMoveSemantics | NoCopySemantics,
};

class PimplType
{
protected:
template<typename T>
struct Internal;

public:
template<typename T>
PimplType(Internal<T>* data) noexcept;

// TODO: Move this somewhere else!
PimplType(PimplType&& other) noexcept = delete;
auto operator=(PimplType&& other) noexcept -> PimplType& = delete;
PimplType(PimplType const& other) noexcept = delete;
auto operator=(PimplType const& other) noexcept -> PimplType& = delete;

protected:
template<typename Self>
auto internal(this Self& self) noexcept -> Internal<Self>&;

private:
void* _internal;
};


template<typename Self>
inline PimplType::PimplType(Internal<Self>* data) noexcept
: _internal{ data }
{
}

template<typename Self>
auto PimplType::internal(this Self& self) noexcept -> Internal<Self>&
{
return *reinterpret_cast<Internal<Self>*>(self._internal);
}

} // namespace ice::concepts
12 changes: 12 additions & 0 deletions source/code/core/core/public/ice/constants.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,16 @@ namespace ice
constexpr ice::f32 const f32_nan = std::numeric_limits<ice::f32>::signaling_NaN();
constexpr ice::f64 const f64_nan = std::numeric_limits<ice::f64>::signaling_NaN();

// Typed zero values
constexpr ice::f32 const f32_0 = ice::f32(0.0f);
constexpr ice::f64 const f64_0 = ice::f64(0.0);
constexpr ice::i8 const i8_0 = ice::i8(0);
constexpr ice::i16 const i16_0 = ice::i16(0);
constexpr ice::i32 const i32_0 = ice::i32(0);
constexpr ice::i64 const i64_0 = ice::i64(0);
constexpr ice::u8 const u8_0 = ice::u8(0);
constexpr ice::u16 const u16_0 = ice::u16(0);
constexpr ice::u32 const u32_0 = ice::u32(0);
constexpr ice::u64 const u64_0 = ice::u64(0);

} // namespace ice
3 changes: 3 additions & 0 deletions source/code/core/core/public/ice/error_codes.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ namespace ice
static constexpr ice::ErrorCode E_InvalidArgument{ "E.0002:General:Invalid argument provided" };
static constexpr ice::ErrorCode E_OutOfRange{ "E.0003:General:Accessing value out of range" };
static constexpr ice::ErrorCode E_NotImplemented{ "E.0004:General:Function or method is not implemented" };
static constexpr ice::ErrorCode E_NullPointer{ "E.0005:General:Passed '{nullptr}' to function expecting valid pointer." };
static constexpr ice::ErrorCode E_NullPointerData{ "E.0006:General:Passed 'Data{nullptr}' object to function expecting valid data." };
static constexpr ice::ErrorCode E_NullPointerMemory{ "E.0007:General:Passed 'Memory{nullptr}' object to function expecting valid memory." };
static constexpr ice::ErrorCode E_TaskCanceled{ "E.1001:Tasks:Task canceled" };

// Aliases are comparable
Expand Down
24 changes: 24 additions & 0 deletions source/code/core/core/public/ice/types.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,30 @@ namespace ice

using uptr = std::uintptr_t;

// Declaration of ref types

//! \brief Holds 'offset' and 'size' fields (u32) to access data stored in a buffer-like object.
using ref32 = struct { ice::u32 offset; ice::u32 size; };

//! \brief Holds 'offset' and 'size' fields (u16) to access data stored in a buffer-like object.
struct ref16
{
ice::u16 offset;
ice::u16 size;

constexpr operator ice::ref32() const noexcept { return ref32{ offset, size }; }
};

//! \brief Holds 'offset' and 'size' fields (u8) to access data stored in a buffer-like object.
struct ref8
{
ice::u8 offset;
ice::u8 size;

constexpr operator ice::ref16() const noexcept { return ref16{ offset, size }; }
constexpr operator ice::ref32() const noexcept { return ref32{ offset, size }; }
};

// Forward declaration of time-types
struct Ts;
struct Tms;
Expand Down
3 changes: 3 additions & 0 deletions source/code/core/math/public/ice/math.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,7 @@ namespace ice
template<>
constexpr inline ShardPayloadID Constant_ShardPayloadID<ice::vec2i> = ice::shard_payloadid("ice::vec2i");

template<>
constexpr inline ShardPayloadID Constant_ShardPayloadID<ice::vec2f> = ice::shard_payloadid("ice::vec2f");

} // namespace ice
1 change: 1 addition & 0 deletions source/code/core/memsys/private/mem_allocator.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ namespace ice

AllocatorBase<true>::~AllocatorBase() noexcept
{
// TODO: Introduce low-level logger just for debug and dev builds.
ICE_ASSERT_CORE(allocation_count() == 0);
}

Expand Down
5 changes: 5 additions & 0 deletions source/code/core/modules/private/module_negotiator.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
namespace ice
{

bool ModuleNegotiatorBase::from_app() const noexcept
{
return negotiator_api->fn_is_app_context(negotiator_context);
}

bool ModuleNegotiatorBase::query_apis(
ice::StringID_Arg api_name,
ice::u32 api_version,
Expand Down
Loading
Loading