mirror of
https://github.com/Ed94/HandmadeHero.git
synced 2025-07-01 11:21:05 -07:00
Day 34 complete!!!
This commit is contained in:
@ -22,7 +22,7 @@ s32 floor( f32 value )
|
||||
inline
|
||||
s32 round( f32 value )
|
||||
{
|
||||
s32 result = scast(s32, value + 0.5f);
|
||||
s32 result = scast(s32, roundf( value ));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -15,16 +15,7 @@
|
||||
#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 ) \
|
||||
return; \
|
||||
done = true; \
|
||||
} \
|
||||
while(0)
|
||||
#define do_once() for ( local_persist b32 once = true; once; once = false )
|
||||
|
||||
#define do_once_start \
|
||||
do \
|
||||
|
@ -10,9 +10,9 @@
|
||||
|
||||
#if INTELLISENSE_DIRECTIVES
|
||||
// TODO(Ed) : REMOVE THESE WHEN CASEY GETS TO THEM
|
||||
#include <math.h> // TODO : Implement math ourselves
|
||||
#include <stdio.h> // TODO : Implement output logging ourselves
|
||||
|
||||
#include "platform_module.hpp"
|
||||
#include "grime.hpp"
|
||||
#include "macros.hpp"
|
||||
#include "generics.hpp"
|
||||
@ -23,9 +23,6 @@
|
||||
#include "context.hpp"
|
||||
#endif
|
||||
|
||||
#define NS_PLATFORM_BEGIN namespace platform {
|
||||
#define NS_PLATFORM_END }
|
||||
|
||||
NS_PLATFORM_BEGIN
|
||||
|
||||
// On-Demand platform interface.
|
||||
@ -121,6 +118,8 @@ struct ModuleAPI
|
||||
};
|
||||
|
||||
#if Build_Development
|
||||
// TODO(Ed): This can't be done this way, we need a separate interface for other modules to use this.
|
||||
// (At least, we need to hookup the symbols statically or at runtime somehow, and right now the only thing that does is the module api passthrough via the Engine API)
|
||||
void impl_congrats( char const* message );
|
||||
bool impl_ensure( bool condition, char const* message );
|
||||
void impl_fatal( char const* message );
|
||||
|
4
project/platform/platform_module.hpp
Normal file
4
project/platform/platform_module.hpp
Normal file
@ -0,0 +1,4 @@
|
||||
#pragma once
|
||||
|
||||
#define NS_PLATFORM_BEGIN namespace platform {
|
||||
#define NS_PLATFORM_END }
|
@ -79,10 +79,10 @@ static_assert( sizeof( u16 ) == 2, "sizeof(u16) != 2" );
|
||||
static_assert( sizeof( u32 ) == 4, "sizeof(u32) != 4" );
|
||||
static_assert( sizeof( u64 ) == 8, "sizeof(u64) != 8" );
|
||||
|
||||
typedef size_t uw;
|
||||
typedef ptrdiff_t sw;
|
||||
typedef size_t usize;
|
||||
typedef ptrdiff_t ssize;
|
||||
|
||||
static_assert( sizeof( uw ) == sizeof( sw ), "sizeof(uw) != sizeof(sw)" );
|
||||
static_assert( sizeof( usize ) == sizeof( ssize ), "sizeof(usize) != sizeof(ssize)" );
|
||||
|
||||
#if defined( _WIN64 )
|
||||
typedef signed __int64 sptr;
|
||||
|
@ -135,7 +135,6 @@ timing_get_wall_clock()
|
||||
return clock;
|
||||
}
|
||||
#pragma endregion Timing
|
||||
|
||||
NS_PLATFORM_END
|
||||
|
||||
#include "win32_audio.cpp"
|
||||
@ -540,8 +539,8 @@ WinMain( HINSTANCE instance, HINSTANCE prev_instance, LPSTR commandline, int sho
|
||||
void* base_address = 0;
|
||||
#endif
|
||||
|
||||
engine_memory.persistent = VirtualAlloc( base_address, total_size , MEM_Commit_Zeroed | MEM_Reserve, Page_Read_Write );
|
||||
engine_memory.transient = rcast( u8*, engine_memory.persistent ) + engine_memory.persistent_size;
|
||||
engine_memory.persistent = rcast( Byte*, VirtualAlloc( base_address, total_size , MEM_Commit_Zeroed | MEM_Reserve, Page_Read_Write ));
|
||||
engine_memory.transient = rcast( Byte*, engine_memory.persistent ) + engine_memory.persistent_size;
|
||||
|
||||
#if Build_Development
|
||||
// First slot is for restore
|
||||
@ -794,7 +793,7 @@ WinMain( HINSTANCE instance, HINSTANCE prev_instance, LPSTR commandline, int sho
|
||||
}
|
||||
}
|
||||
|
||||
engine_api.startup( & engine_memory, & platform_api );
|
||||
engine_api.startup( rcast(engine::OffscreenBuffer*, & Surface_Back_Buffer.memory), & engine_memory, & platform_api );
|
||||
|
||||
u64 last_frame_clock = timing_get_wall_clock();
|
||||
u64 last_frame_cycle = __rdtsc();
|
||||
|
Reference in New Issue
Block a user