cinera_handmade.network/cmuratori/hero/code/code193.hmml

56 lines
3.8 KiB
Plaintext

[video output=day193 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Run-time Setting of Compile-time Variables" vod_platform=youtube id=9ND-2a_hP0g annotator=Miblo annotator=debiatan]
[0:08][Recap]
[0:41][Plan for today]
[1:43][Review of last episode]
[2:03][We will be extending the debug system so that we can compile in and out debug features more easily]
[3:21][Optional compilation of ground chunk outlines]
[4:47][Optional compilation of the particle fountain]
[5:07][Why doesn't the particle system work?]
[6:50][The fountain depends on outdated font code]
[7:00][handmade.cpp: Go back to the head fountain][quote 257]
[7:32][The game overwrote our changes to the handmade config file. Let's prevent that from happening again]
[8:29][Optional compilation of the particle grid]
[8:48][Optional compilation of room outlines]
[9:28][Fixing an outdated call to DrawRectangle]
[12:28][Optional compilation of ground chunk checkerboard patterns]
[13:38][Optional compilation of ground chunk reset on DLL reload]
[15:40][Optional compilation of weird renderer buffer sizes]
[18:14][Finding out the correct findstr syntax to list all "#if 0" occurrences]
[20:40][Optional compilation of the behavior that makes the familiar follow the hero]
[21:29][Optional compilation of bilinear lighting sampling]
[22:09][Optional compilation of the room-based camera movement]
[22:30][The room-based camera is broken. Let's fix it]
[28:10][It's working now]
[29:08][We have enough items for the moment]
[29:55][We want to know the values of our compilation switches to write them out to handmade_config.h]
[30:57][The debug_variable struct will keep the names of the switches, their values and their types]
[31:51][Defining them using the DEBUG_VARIABLE_LISTING macro]
[33:32][Writing the variables to the config file]
[36:00][What parameters does _snprintf_s require?]
[40:00][Stepping though the code that builds the contents of the config file]
[40:45][Writing the file worked]
[40:59][Printing the variable list instead of the old menu items]
[41:52][Toggling debug variables]
[43:08][Testing. It works]
[43:42][The run-time exclusion of pieces of debug code has some nice properties...]
[45:10][...the only small catch is it still takes too many steps to add a new switch]
[46:14][We would like the listing to upgrade itself automatically after a new variable is added, but parsing the code just for that may be going overboard]
[47:05][Let's keep the variable listings in a separate file]
[48:31][Our radial menu should allow us to _not_ select something once it's active]
[50:00][Coloring menu items depending on their value]
[51:08][Testing. The menu should not select an action when we remain at its center]
[52:06][The compilation process is a bit slow, but we can skip the compilation of the asset builder]
[53:23][Q&A][:speech]
[54:45][@Flederfalter][I don't understand why a single if-statement would be expensive if we do it at runtime. Can you give an example?]
[1:07:54][@elxenoaizd][Why are we adding // b32 comment in the config file?]
[1:08:30][@TheSizik][Can you toggle the debug options while looping?]
[1:09:41][Separate out the mouse handling from the recorded input][:"input handling"]
[1:11:31][Prepare to try operating the debug :UI while looping][:run]
[1:11:45][Increase the debug menu radius in DrawDebugMainMenu()][:ui]
[1:12:13][Try out the debug :UI while looping][:run]
[1:13:06][@andsz_][You should add an optimization switch to the UI at some point]
[1:14:02][@andsz_][Wouldn't -O2 optimize those dead branches out?]
[1:14:41][@ingenero][Could you have an option to either recompile or simply toggle an "if"? It seems like most of the time you would use the regular "if" so the change is instantaneous, but in extreme cases you could easily just do the recompile option]
[1:16:25][We are overtime][:speech]
[/video]