Fixed error with debug builds, fixed some errors with intellisense for vs solution (VS2022/JetBrains Rider)

This commit is contained in:
Edward R. Gonzalez 2023-12-29 12:29:22 -05:00
parent bcfbb94df7
commit 577ee6b208
9 changed files with 63 additions and 17 deletions

View File

@ -15,40 +15,55 @@
</ProjectConfiguration> </ProjectConfiguration>
</ItemGroup> </ItemGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Development|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Development|x64'">
<IncludePath>$(ProjectDir)project;$(ProjectDir)project\engine;$(ProjectDir)project\platform;$(IncludePath)</IncludePath> <IncludePath>$(ProjectDir)project;$(ProjectDir)project\engine;$(ProjectDir)project\platform;$(IncludePath);$(VC_IncludePath);$(WindowsSDK_IncludePath);$(UniversalCRT_IncludePath);C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\ucrt;C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um;C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\winrt;C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared;C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\cppwinrt;C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.38.33130\include</IncludePath>
<LibraryPath>$(ProjectDir)data;$(windir)System32;$(LibraryPath)</LibraryPath> <LibraryPath>$(ProjectDir)data;$(windir)System32;$(LibraryPath)</LibraryPath>
<NMakeBuildCommandLine>pwsh -ExecutionPolicy Bypass -NoProfile -NonInteractive -File $(ProjectDir)scripts\build.ps1 msvc dev engine</NMakeBuildCommandLine> <NMakeBuildCommandLine>pwsh -ExecutionPolicy Bypass -NoProfile -NonInteractive -File $(ProjectDir)scripts\build.ps1 msvc dev engine</NMakeBuildCommandLine>
<NMakeCleanCommandLine>pwsh ExecutionPolicy Bypass -NoProfile -NonInteractive -File $(ProjectDir)scripts\clean.ps1</NMakeCleanCommandLine> <NMakeCleanCommandLine>pwsh -ExecutionPolicy Bypass -NoProfile -NonInteractive -File $(ProjectDir)scripts\clean.ps1</NMakeCleanCommandLine>
<NMakePreprocessorDefinitions>GEN_TIME;INTELLISENSE_DIRECTIVES;Build_Development;Build_Debug;$(NMakePreprocessorDefinitions)</NMakePreprocessorDefinitions> <NMakePreprocessorDefinitions>GEN_TIME;INTELLISENSE_DIRECTIVES;Build_Development;Build_Debug;$(NMakePreprocessorDefinitions)</NMakePreprocessorDefinitions>
<ExternalIncludePath>$(VC_IncludePath);$(WindowsSDK_IncludePath);$(UniversalCRT_IncludePath);C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\ucrt;C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um;C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\winrt;C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared;C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\cppwinrt;C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.37.32822\include</ExternalIncludePath> <ExternalIncludePath>$(VC_IncludePath);$(WindowsSDK_IncludePath);$(UniversalCRT_IncludePath);C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\ucrt;C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um;C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\winrt;C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared;C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\cppwinrt;C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.38.33130\include</ExternalIncludePath>
<NMakeReBuildCommandLine> <NMakeReBuildCommandLine>
</NMakeReBuildCommandLine> </NMakeReBuildCommandLine>
<AllProjectIncludesArePublic>true</AllProjectIncludesArePublic>
<AllProjectBMIsArePublic>true</AllProjectBMIsArePublic>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="project\dependencies\gen.hpp" /> <ClInclude Include="project\dependencies\gen.hpp" />
<ClInclude Include="project\engine\engine.hpp" /> <ClInclude Include="project\engine\engine.hpp" />
<ClInclude Include="project\engine\engine_game_api.hpp" /> <ClInclude Include="project\engine\engine_module.hpp" />
<ClInclude Include="project\engine\engine_to_platform_api.hpp" /> <ClInclude Include="project\engine\engine_to_platform_api.hpp" />
<ClInclude Include="project\gen\engine_symbol_table.hpp" /> <ClInclude Include="project\engine\gen\engine_symbols.gen.hpp" />
<ClInclude Include="project\engine\gen\physics.hpp" />
<ClInclude Include="project\engine\gen\vectors.hpp" />
<ClInclude Include="project\engine\input.hpp" />
<ClInclude Include="project\engine\state_and_replay.hpp" />
<ClInclude Include="project\engine\tile_map.hpp" />
<ClInclude Include="project\handmade.hpp" /> <ClInclude Include="project\handmade.hpp" />
<ClInclude Include="project\platform\compiler_ignores.hpp" /> <ClInclude Include="project\platform\compiler_ignores.hpp" />
<ClInclude Include="project\platform\context.hpp" /> <ClInclude Include="project\platform\context.hpp" />
<ClInclude Include="project\platform\float_ops.hpp" />
<ClInclude Include="project\platform\generics.hpp" /> <ClInclude Include="project\platform\generics.hpp" />
<ClInclude Include="project\platform\gen\context.gen.hpp" /> <ClInclude Include="project\platform\gen\context.gen.hpp" />
<ClInclude Include="project\platform\grime.hpp" /> <ClInclude Include="project\platform\grime.hpp" />
<ClInclude Include="project\platform\intrinsics.hpp" />
<ClInclude Include="project\platform\jsl.hpp" /> <ClInclude Include="project\platform\jsl.hpp" />
<ClInclude Include="project\platform\macros.hpp" /> <ClInclude Include="project\platform\macros.hpp" />
<ClInclude Include="project\platform\math_constants.hpp" /> <ClInclude Include="project\platform\math_constants.hpp" />
<ClInclude Include="project\platform\platform.hpp" /> <ClInclude Include="project\platform\platform.hpp" />
<ClInclude Include="project\platform\platform_module.hpp" />
<ClInclude Include="project\platform\strings.hpp" /> <ClInclude Include="project\platform\strings.hpp" />
<ClInclude Include="project\platform\types.hpp" /> <ClInclude Include="project\platform\types.hpp" />
<ClInclude Include="project\platform\win32\win32.hpp" /> <ClInclude Include="project\platform\win32\win32.hpp" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="project\codegen\engine_gen.cpp" />
<ClCompile Include="project\codegen\engine_postbuild_gen.cpp" /> <ClCompile Include="project\codegen\engine_postbuild_gen.cpp" />
<ClCompile Include="project\codegen\platform_gen.cpp" /> <ClCompile Include="project\codegen\platform_gen.cpp" />
<ClCompile Include="project\engine\engine.cpp" /> <ClCompile Include="project\engine\engine.cpp" />
<ClCompile Include="project\engine\input.cpp" />
<ClCompile Include="project\engine\random.cpp" />
<ClCompile Include="project\engine\state_and_replay.cpp" />
<ClCompile Include="project\engine\test_samples.cpp" /> <ClCompile Include="project\engine\test_samples.cpp" />
<ClCompile Include="project\engine\tile_map.cpp" />
<ClCompile Include="project\handmade.cpp" /> <ClCompile Include="project\handmade.cpp" />
<ClCompile Include="project\handmade_engine.cpp" /> <ClCompile Include="project\handmade_engine.cpp" />
<ClCompile Include="project\handmade_win32.cpp" /> <ClCompile Include="project\handmade_win32.cpp" />
@ -84,7 +99,6 @@
<None Include="scripts\clean.ps1" /> <None Include="scripts\clean.ps1" />
<None Include="scripts\genccp.natstepfilter" /> <None Include="scripts\genccp.natstepfilter" />
<None Include="scripts\handmade.natstepfilter" /> <None Include="scripts\handmade.natstepfilter" />
<None Include="scripts\helpers\configure_toolchain.ps1" />
<None Include="scripts\helpers\devshell.ps1" /> <None Include="scripts\helpers\devshell.ps1" />
<None Include="scripts\helpers\format_cpp.psm1" /> <None Include="scripts\helpers\format_cpp.psm1" />
<None Include="scripts\helpers\target_arch.psm1" /> <None Include="scripts\helpers\target_arch.psm1" />
@ -93,7 +107,8 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="project\codegen\Readme.md" /> <Content Include="project\codegen\Readme.md" />
<Content Include="project\gen\Readme.md" /> <Content Include="scripts\helpers\incremental_checks.ps1" />
<Content Include="scripts\helpers\vendor_toolchain.ps1" />
<Content Include="scripts\rebuild.ps1" /> <Content Include="scripts\rebuild.ps1" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -1,6 +1,5 @@
#include "platform/compiler_ignores.hpp" #include "platform/compiler_ignores.hpp"
#if GEN_TIME
#define GEN_DEFINE_LIBRARY_CODE_CONSTANTS #define GEN_DEFINE_LIBRARY_CODE_CONSTANTS
#define GEN_IMPLEMENTATION #define GEN_IMPLEMENTATION
#define GEN_BENCHMARK #define GEN_BENCHMARK
@ -25,6 +24,7 @@ using namespace gen;
constexpr StrC fname_vec_header = txt("vectors.hpp"); constexpr StrC fname_vec_header = txt("vectors.hpp");
#pragma push_macro("scast") #pragma push_macro("scast")
#pragma push_macro("Zero")
#undef scast #undef scast
constexpr char const* vec2f_ops = stringize( constexpr char const* vec2f_ops = stringize(
template<> template<>
@ -254,6 +254,7 @@ constexpr char const* vec2i_ops = stringize(
} }
); );
#pragma pop_macro("scast") #pragma pop_macro("scast")
#pragma pop_macro("Zero")
#define gen_vec2f( vec_name, type ) gen__vec2f( txt( stringize(vec_name) ), txt( stringize(type) ) ) #define gen_vec2f( vec_name, type ) gen__vec2f( txt( stringize(vec_name) ), txt( stringize(type) ) )
CodeBody gen__vec2f( StrC vec_name, StrC 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_ops = parse_global_body( token_fmt( "type", vec_name, "unit_type", type, vec2i_ops) );
CodeBody vec_def = def_global_body( args( CodeBody vec_def = def_global_body( args(
vec_struct, vec_struct,
@ -481,6 +482,8 @@ Code gen__phys2( StrC type )
return result; return result;
} }
))); )));
#pragma pop_macro("rcast")
#pragma pop_macro("pcast")
CodeBody result = def_global_body( args( CodeBody result = def_global_body( args(
pos_struct, pos_struct,
@ -494,8 +497,6 @@ Code gen__phys2( StrC type )
ops ops
)); ));
return result; return result;
#pragma pop_macro("rcast")
#pragma pop_macro("pcast")
} }
int gen_main() int gen_main()
@ -558,4 +559,3 @@ int gen_main()
// gen::deinit(); // gen::deinit();
return 0; return 0;
} }
#endif

View File

@ -17,8 +17,10 @@ struct EngineState
MemoryArena world_arena; MemoryArena world_arena;
#if Build_Development
f32 auto_snapshot_interval; f32 auto_snapshot_interval;
f32 auto_snapshot_timer; f32 auto_snapshot_timer;
#endif
s32 wave_tone_hz; s32 wave_tone_hz;
s32 tone_volume; 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_up = (mouse->vertical_wheel.end > 0.f) * 10;
actions->move_down = (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; actions->load_auto_snapshot |= pressed( keyboard->L ) && keyboard->right_alt.ended_down;
#endif
} }
internal internal
@ -390,7 +394,9 @@ void startup( OffscreenBuffer* back_buffer, Memory* memory, platform::ModuleAPI*
Engine_Context = & state->context; Engine_Context = & state->context;
#if Build_Development
state->auto_snapshot_interval = 60.f; state->auto_snapshot_interval = 60.f;
#endif
state->tone_volume = 1000; 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; state->context.delta_time = delta_time;
// Engine auto_snapshot // Engine auto_snapshot
#if Build_Development
{ {
state->auto_snapshot_timer += delta_time; state->auto_snapshot_timer += delta_time;
if ( state->auto_snapshot_timer >= state->auto_snapshot_interval ) 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; state->auto_snapshot_timer = 0.f;
} }
} }
#endif
ControllerState* controller = & input->controllers[0]; 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 ); input_poll_engine_actions( input, & engine_actions );
#if Build_Development
if ( engine_actions.load_auto_snapshot ) if ( engine_actions.load_auto_snapshot )
{ {
s32 current_slot = memory->active_snapshot_slot; 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; 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. // 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; 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; state->sample_wave_switch ^= true;
} }
#if Build_Development
if ( engine_actions.loop_mode_game && ! memory->engine_loop_active ) if ( engine_actions.loop_mode_game && ! memory->engine_loop_active )
{ {
process_loop_mode( & take_game_snapshot, & load_game_snapshot, memory, state, input, platform_api ); process_loop_mode( & take_game_snapshot, & load_game_snapshot, memory, state, input, platform_api );
memory->game_loop_active = memory->replay_mode > ReplayMode_Off; memory->game_loop_active = memory->replay_mode > ReplayMode_Off;
} }
#if Build_Development
if ( engine_actions.pause_renderer ) if ( engine_actions.pause_renderer )
{ {
if ( state->renderer_paused ) if ( state->renderer_paused )
@ -1181,6 +1189,7 @@ void update_and_render( f32 delta_time, InputState* input, OffscreenBuffer* back
, & hero_bitmaps->head ); , & hero_bitmaps->head );
#endif #endif
#if Build_Development
// Auto-Snapshot percent bar // Auto-Snapshot percent bar
if (1) if (1)
{ {
@ -1191,7 +1200,6 @@ void update_and_render( f32 delta_time, InputState* input, OffscreenBuffer* back
, 0.f, 0.15f, 0.35f ); , 0.f, 0.15f, 0.35f );
} }
#if Build_Development
if ( memory->replay_mode == ReplayMode_Record ) if ( memory->replay_mode == ReplayMode_Record )
{ {
// TODO(Ed) : We're prob going to need a better indicator for recording... // TODO(Ed) : We're prob going to need a better indicator for recording...

View File

@ -6,7 +6,6 @@
#if INTELLISENSE_DIRECTIVES #if INTELLISENSE_DIRECTIVES
#include "platform/platform.hpp" #include "platform/platform.hpp"
#include "gen/vectors.hpp"
#include "engine_module.hpp" #include "engine_module.hpp"
#include "tile_map.hpp" #include "tile_map.hpp"

View File

@ -4,6 +4,7 @@
#pragma once #pragma once
#if INTELLISENSE_DIRECTIVES #if INTELLISENSE_DIRECTIVES
#include "engine_module.hpp" #include "engine_module.hpp"
#include "input.hpp"
#endif #endif
NS_ENGINE_BEGIN NS_ENGINE_BEGIN

View File

@ -64,6 +64,6 @@
# define fatal( message ) platform::impl_fatal( message ) # define fatal( message ) platform::impl_fatal( message )
#else #else
# define congrats( message ) # define congrats( message )
# define ensure( condition, message ) # define ensure( condition, message ) true
# define fatal( message ) # define fatal( message )
#endif #endif

View File

@ -1,3 +1,7 @@
#if INTELLISENSE_DIRECTIVES
#include "grime.hpp"
#endif
#pragma once #pragma once
#pragma region Basic Types #pragma region Basic Types

View File

@ -1,7 +1,24 @@
#if INTELLISENSE_DIRECTIVES #if INTELLISENSE_DIRECTIVES
#include "platform.hpp" #include "platform.hpp"
#include "engine/engine.hpp" #include "engine/engine.hpp"
#include "engine/engine_to_platform_api.hpp"
#include "win32.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 #endif
NS_PLATFORM_BEGIN NS_PLATFORM_BEGIN

View File

@ -1081,6 +1081,7 @@ WinMain( HINSTANCE instance, HINSTANCE prev_instance, LPSTR commandline, int sho
engine_api.shutdown( & engine_memory, & platform_api ); engine_api.shutdown( & engine_memory, & platform_api );
#if Build_Development
for ( s32 slot = 0; slot < engine_memory.Num_Snapshot_Slots; ++slot ) for ( s32 slot = 0; slot < engine_memory.Num_Snapshot_Slots; ++slot )
{ {
engine::MemorySnapshot& snapshot = engine_memory.snapshots[ 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_2 );
CloseHandle( snapshot.opaque_handle ); CloseHandle( snapshot.opaque_handle );
} }
#endif
unload_engine_module_api( & engine_api ); unload_engine_module_api( & engine_api );
DeleteFileA( Path_Engine_DLL_InUse ); DeleteFileA( Path_Engine_DLL_InUse );