Day 25 Part 1

I'm splitting this implementation into parts since so much already happened...

I fully updated the code the the latest convention I want to use for the project.
Engine & Game replay should work.
This commit is contained in:
2023-09-30 10:05:37 -04:00
parent 465339743a
commit dc43db117c
13 changed files with 881 additions and 589 deletions

View File

@ -11,6 +11,7 @@
#pragma warning( disable: 4820 ) // Support auto-adding padding to structs
#pragma warning( disable: 4711 ) // Support automatic inline expansion
#pragma warning( disable: 4710 ) // Support automatic inline expansion
#pragma warning( disable: 4805 ) // Support comparisons of s32 to bool.
#endif
#ifdef __clang__

View File

@ -10,19 +10,19 @@
// Casting
#define ccast( Type, Value ) ( const_cast< Type >( (Value) ) )
#define pcast( Type, Value ) ( * reinterpret_cast< Type* >( & ( Value ) ) )
#define rcast( Type, Value ) reinterpret_cast< Type >( Value )
#define scast( Type, Value ) static_cast< Type >( Value )
#define ccast( type, value ) ( const_cast< type >( (value) ) )
#define pcast( type, value ) ( * reinterpret_cast< type* >( & ( value ) ) )
#define rcast( type, value ) reinterpret_cast< type >( value )
#define scast( type, value ) static_cast< type >( value )
#define do_once() \
do \
{ \
local_persist \
bool Done = false; \
if ( Done ) \
bool done = false; \
if ( done ) \
return; \
Done = true; \
done = true; \
} \
while(0)
@ -30,10 +30,10 @@
do \
{ \
local_persist \
bool Done = false; \
if ( Done ) \
bool done = false; \
if ( done ) \
break; \
Done = true;
done = true;
#define do_once_end \
} \

View File

@ -34,10 +34,10 @@ using DebugSetPauseRenderingFn = void (b32 value);
struct File
{
void* OpaqueHandle;
Str Path;
void* Data;
u32 Size;
void* opaque_handle;
Str path;
void* data;
u32 size;
};
#pragma region Settings Exposure
@ -57,7 +57,7 @@ using SetEngineFrameTargetFn = void ( u32 rate_in_hz );
struct BinaryModule
{
void* OpaqueHandle;
void* opaque_handle;
};
using LoadBinaryModuleFn = BinaryModule ( char const* module_path );
@ -78,6 +78,8 @@ using FileWriteContentFn = u32 ( File* file, u32 content_size, void* content_mem
using FileWriteStreamFn = u32 ( File* file, u32 content_size, void* content_memory );
using FileRewindFn = void ( File* file );
using MemoryCopyFn = void( void* dest, u64 src_size, void* src );
struct ModuleAPI
{
Str path_root;
@ -106,6 +108,8 @@ struct ModuleAPI
FileRewindFn* file_rewind; // Rewinds the file stream to the beginning
FileWriteContentFn* file_write_content; // Writes content to file (overwrites)
FileWriteStreamFn* file_write_stream; // Appends content to file
MemoryCopyFn* memory_copy;
};
#pragma endregion Settings Exposure

View File

@ -12,32 +12,32 @@ u32 str_length( char const* str );
// Length tracked raw strings.
struct Str
{
u32 Len;
char* Data;
u32 len;
char* ptr;
void append( u32 src_len, char const* src ) {
str_append( Len, Data, src_len, src );
str_append( len, ptr, src_len, src );
}
void append( Str const src ) {
str_append( Len, Data, src.Len, src.Data );
str_append( len, ptr, src.len, src.ptr );
}
void concat( u32 dest_size, Str* dest, Str const str_a, Str const str_b )
{
str_concat( dest_size, dest->Data
, str_a.Len, str_a.Data
, str_b.Len, str_b.Data );
dest->Len = str_a.Len + str_b.Len;
str_concat( dest_size, dest->ptr
, str_a.len, str_a.ptr
, str_b.len, str_b.ptr );
dest->len = str_a.len + str_b.len;
}
operator char*() const {
return Data;
return ptr;
}
char& operator []( u32 idx ) {
return Data[idx];
return ptr[idx];
}
char const& operator []( u32 idx ) const {
return Data[idx];
return ptr[idx];
}
};
@ -47,35 +47,35 @@ struct StrFixed
{
constexpr static u32 Capacity = capacity;
u32 Len;
char Data[capacity];
u32 len;
char ptr[capacity];
void append( u32 src_len, char const* src ) {
str_append( Len, Data, src_len, src );
str_append( len, data, src_len, src );
}
void append( Str const src ) {
str_append( Len, Data, src.Len, src.Data );
str_append( len, data, src.Len, src.data );
}
void concat( Str const str_a, Str const str_b )
{
str_concat( Capacity, Data
, str_a.Len, str_a.Data
, str_b.Len, str_b.Data );
Len = str_a.Len + str_b.Len;
str_concat( Capacity, ptr
, str_a.len, str_a.ptr
, str_b.len, str_b.ptr );
len = str_a.len + str_b.len;
}
operator char*() { return Data;}
operator char const*() { return Data; }
operator Str() { return { Len, Data }; }
operator Str const() const { return { Len, Data }; }
operator char*() { return ptr;}
operator char const*() { return ptr; }
operator Str() { return { len, ptr }; }
operator Str const() const { return { len, ptr }; }
char& operator []( u32 idx ) {
assert( idx < Capacity );
return Data[idx];
return ptr[idx];
}
char const& operator []( u32 idx ) const {
assert( idx < Capacity );
return Data[idx];
return ptr[idx];
}
};

File diff suppressed because it is too large Load Diff