mirror of
https://github.com/Ed94/HandmadeHero.git
synced 2025-07-01 11:21:05 -07:00
Fixed error with debug builds, fixed some errors with intellisense for vs solution (VS2022/JetBrains Rider)
This commit is contained in:
@ -1,6 +1,5 @@
|
||||
#include "platform/compiler_ignores.hpp"
|
||||
|
||||
#if GEN_TIME
|
||||
#define GEN_DEFINE_LIBRARY_CODE_CONSTANTS
|
||||
#define GEN_IMPLEMENTATION
|
||||
#define GEN_BENCHMARK
|
||||
@ -25,6 +24,7 @@ using namespace gen;
|
||||
constexpr StrC fname_vec_header = txt("vectors.hpp");
|
||||
|
||||
#pragma push_macro("scast")
|
||||
#pragma push_macro("Zero")
|
||||
#undef scast
|
||||
constexpr char const* vec2f_ops = stringize(
|
||||
template<>
|
||||
@ -254,6 +254,7 @@ constexpr char const* vec2i_ops = stringize(
|
||||
}
|
||||
);
|
||||
#pragma pop_macro("scast")
|
||||
#pragma pop_macro("Zero")
|
||||
|
||||
#define gen_vec2f( vec_name, type ) gen__vec2f( txt( stringize(vec_name) ), txt( stringize(type) ) )
|
||||
CodeBody gen__vec2f( StrC vec_name, StrC type )
|
||||
@ -296,7 +297,7 @@ CodeBody gen__vec2i( StrC vec_name, StrC type )
|
||||
};
|
||||
};
|
||||
)));
|
||||
|
||||
|
||||
CodeBody vec_ops = parse_global_body( token_fmt( "type", vec_name, "unit_type", type, vec2i_ops) );
|
||||
CodeBody vec_def = def_global_body( args(
|
||||
vec_struct,
|
||||
@ -481,6 +482,8 @@ Code gen__phys2( StrC type )
|
||||
return result;
|
||||
}
|
||||
)));
|
||||
#pragma pop_macro("rcast")
|
||||
#pragma pop_macro("pcast")
|
||||
|
||||
CodeBody result = def_global_body( args(
|
||||
pos_struct,
|
||||
@ -494,8 +497,6 @@ Code gen__phys2( StrC type )
|
||||
ops
|
||||
));
|
||||
return result;
|
||||
#pragma pop_macro("rcast")
|
||||
#pragma pop_macro("pcast")
|
||||
}
|
||||
|
||||
int gen_main()
|
||||
@ -558,4 +559,3 @@ int gen_main()
|
||||
// gen::deinit();
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
@ -17,8 +17,10 @@ struct EngineState
|
||||
|
||||
MemoryArena world_arena;
|
||||
|
||||
#if Build_Development
|
||||
f32 auto_snapshot_interval;
|
||||
f32 auto_snapshot_timer;
|
||||
#endif
|
||||
|
||||
s32 wave_tone_hz;
|
||||
s32 tone_volume;
|
||||
@ -93,7 +95,9 @@ void input_poll_engine_actions( InputState* input, EngineActions* actions )
|
||||
actions->move_up = (mouse->vertical_wheel.end > 0.f) * 10;
|
||||
actions->move_down = (mouse->vertical_wheel.end < 0.f) * 10;
|
||||
|
||||
#if Build_Development
|
||||
actions->load_auto_snapshot |= pressed( keyboard->L ) && keyboard->right_alt.ended_down;
|
||||
#endif
|
||||
}
|
||||
|
||||
internal
|
||||
@ -390,7 +394,9 @@ void startup( OffscreenBuffer* back_buffer, Memory* memory, platform::ModuleAPI*
|
||||
|
||||
Engine_Context = & state->context;
|
||||
|
||||
#if Build_Development
|
||||
state->auto_snapshot_interval = 60.f;
|
||||
#endif
|
||||
|
||||
state->tone_volume = 1000;
|
||||
|
||||
@ -712,6 +718,7 @@ void update_and_render( f32 delta_time, InputState* input, OffscreenBuffer* back
|
||||
state->context.delta_time = delta_time;
|
||||
|
||||
// Engine auto_snapshot
|
||||
#if Build_Development
|
||||
{
|
||||
state->auto_snapshot_timer += delta_time;
|
||||
if ( state->auto_snapshot_timer >= state->auto_snapshot_interval )
|
||||
@ -726,6 +733,7 @@ void update_and_render( f32 delta_time, InputState* input, OffscreenBuffer* back
|
||||
state->auto_snapshot_timer = 0.f;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
ControllerState* controller = & input->controllers[0];
|
||||
|
||||
@ -734,6 +742,7 @@ void update_and_render( f32 delta_time, InputState* input, OffscreenBuffer* back
|
||||
|
||||
input_poll_engine_actions( input, & engine_actions );
|
||||
|
||||
#if Build_Development
|
||||
if ( engine_actions.load_auto_snapshot )
|
||||
{
|
||||
s32 current_slot = memory->active_snapshot_slot;
|
||||
@ -742,7 +751,6 @@ void update_and_render( f32 delta_time, InputState* input, OffscreenBuffer* back
|
||||
memory->active_snapshot_slot = current_slot;
|
||||
}
|
||||
|
||||
#if Build_Development
|
||||
// Ease of use: Allow user to press L key without shift if engine loop recording is active.
|
||||
engine_actions.loop_mode_engine |= engine_actions.loop_mode_game && memory->engine_loop_active;
|
||||
|
||||
@ -800,13 +808,13 @@ void update_and_render( f32 delta_time, InputState* input, OffscreenBuffer* back
|
||||
state->sample_wave_switch ^= true;
|
||||
}
|
||||
|
||||
#if Build_Development
|
||||
if ( engine_actions.loop_mode_game && ! memory->engine_loop_active )
|
||||
{
|
||||
process_loop_mode( & take_game_snapshot, & load_game_snapshot, memory, state, input, platform_api );
|
||||
memory->game_loop_active = memory->replay_mode > ReplayMode_Off;
|
||||
}
|
||||
|
||||
#if Build_Development
|
||||
if ( engine_actions.pause_renderer )
|
||||
{
|
||||
if ( state->renderer_paused )
|
||||
@ -1181,6 +1189,7 @@ void update_and_render( f32 delta_time, InputState* input, OffscreenBuffer* back
|
||||
, & hero_bitmaps->head );
|
||||
#endif
|
||||
|
||||
#if Build_Development
|
||||
// Auto-Snapshot percent bar
|
||||
if (1)
|
||||
{
|
||||
@ -1191,7 +1200,6 @@ void update_and_render( f32 delta_time, InputState* input, OffscreenBuffer* back
|
||||
, 0.f, 0.15f, 0.35f );
|
||||
}
|
||||
|
||||
#if Build_Development
|
||||
if ( memory->replay_mode == ReplayMode_Record )
|
||||
{
|
||||
// TODO(Ed) : We're prob going to need a better indicator for recording...
|
||||
|
@ -6,7 +6,6 @@
|
||||
|
||||
#if INTELLISENSE_DIRECTIVES
|
||||
#include "platform/platform.hpp"
|
||||
#include "gen/vectors.hpp"
|
||||
#include "engine_module.hpp"
|
||||
#include "tile_map.hpp"
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
#pragma once
|
||||
#if INTELLISENSE_DIRECTIVES
|
||||
#include "engine_module.hpp"
|
||||
#include "input.hpp"
|
||||
#endif
|
||||
|
||||
NS_ENGINE_BEGIN
|
||||
|
@ -64,6 +64,6 @@
|
||||
# define fatal( message ) platform::impl_fatal( message )
|
||||
#else
|
||||
# define congrats( message )
|
||||
# define ensure( condition, message )
|
||||
# define ensure( condition, message ) true
|
||||
# define fatal( message )
|
||||
#endif
|
||||
|
@ -1,3 +1,7 @@
|
||||
#if INTELLISENSE_DIRECTIVES
|
||||
#include "grime.hpp"
|
||||
#endif
|
||||
|
||||
#pragma once
|
||||
|
||||
#pragma region Basic Types
|
||||
|
@ -1,7 +1,24 @@
|
||||
#if INTELLISENSE_DIRECTIVES
|
||||
#include "platform.hpp"
|
||||
#include "engine/engine.hpp"
|
||||
#include "engine/engine_to_platform_api.hpp"
|
||||
#include "win32.hpp"
|
||||
|
||||
// This is the "backbuffer" data related to the windowing surface provided by the operating system.
|
||||
struct OffscreenBuffer
|
||||
{
|
||||
BITMAPINFO info;
|
||||
char _PAD_[4];
|
||||
void* memory; // Lets use directly mess with the "pixel's memory buffer"
|
||||
s32 width;
|
||||
s32 height;
|
||||
s32 pitch;
|
||||
s32 bytes_per_pixel;
|
||||
};
|
||||
|
||||
extern OffscreenBuffer Surface_Back_Buffer;
|
||||
extern f32 Engine_Frame_Target_MS;
|
||||
extern u32 Engine_Refresh_Hz;
|
||||
#endif
|
||||
|
||||
NS_PLATFORM_BEGIN
|
||||
|
@ -1081,6 +1081,7 @@ WinMain( HINSTANCE instance, HINSTANCE prev_instance, LPSTR commandline, int sho
|
||||
|
||||
engine_api.shutdown( & engine_memory, & platform_api );
|
||||
|
||||
#if Build_Development
|
||||
for ( s32 slot = 0; slot < engine_memory.Num_Snapshot_Slots; ++slot )
|
||||
{
|
||||
engine::MemorySnapshot& snapshot = engine_memory.snapshots[ slot ];
|
||||
@ -1089,6 +1090,7 @@ WinMain( HINSTANCE instance, HINSTANCE prev_instance, LPSTR commandline, int sho
|
||||
CloseHandle( snapshot.opaque_handle_2 );
|
||||
CloseHandle( snapshot.opaque_handle );
|
||||
}
|
||||
#endif
|
||||
|
||||
unload_engine_module_api( & engine_api );
|
||||
DeleteFileA( Path_Engine_DLL_InUse );
|
||||
|
Reference in New Issue
Block a user