Updated gitignore, removed irrelevant member from panel_result

This commit is contained in:
Peter Slattery 2020-02-15 15:06:51 -08:00
parent 15e0b96f0c
commit 5bdcb99357
12 changed files with 88 additions and 54 deletions

3
.gitignore vendored
View File

@ -1,4 +1,5 @@
build/ build/
process/ process/
reference/ reference/
working_data/ working_data/
build_clang

32
build_clang.bat Normal file
View File

@ -0,0 +1,32 @@
@echo off
set ProjectDevFolder=%~dp0
set ProjectDevPath=%ProjectDevFolder:~0,-1%
pushd %ProjectDevPath%
IF NOT EXIST .\build_clang\ mkdir .\build_clang
C:\programs\ctime\ctime.exe -begin %ProjectDevPath%\build\win32_foldhaus_clang_build_time.ctm
set CommonCompilerFlags=-std=c++11 -Wno-writable-strings -Wno-unused-value -Wno-varargs -Wno-switch -Wno-microsoft-enum-forward-reference -DDEBUG=1
pushd .\build_clang\
REM Run the Preprocessor
foldhaus_meta.exe ..\src\foldhaus_app.cpp
echo WAITING FOR PDB TO WRITE > lock.tmp
clang %CommonCompilerFlags% ..\src\foldhaus_app.cpp -shared
set LastError=%ERRORLEVEL%
del lock.tmp
clang %CommonCompilerFlags% ..\src\win32_foldhaus.cpp -o win32_foldhaus.exe user32.lib winmm.lib gdi32.lib opengl32.lib dsound.lib Ws2_32.lib Comdlg32.lib
C:\programs\ctime\ctime.exe -end %ProjectDevPath%\build\win32_foldhaus_clang_build_time.ctm %LastError%
REM C:\programs\ctime\ctime.exe -stats %ProjectDevPath%\build\win32_foldhaus_clang_build_time.ctm
popd

View File

@ -47,6 +47,8 @@ InitializeTextFont (s32 CodepointCount, u8* CodepointMemory, s32 CodepointMemory
Assert(CodepointMemorySize >= (sizeof(char) + sizeof(codepoint_bitmap)) * CodepointCount); Assert(CodepointMemorySize >= (sizeof(char) + sizeof(codepoint_bitmap)) * CodepointCount);
Result.CodepointKeys = (char*)CodepointMemory; Result.CodepointKeys = (char*)CodepointMemory;
Result.CodepointValues = (codepoint_bitmap*)(CodepointMemory + (sizeof(char) * CodepointCount)); Result.CodepointValues = (codepoint_bitmap*)(CodepointMemory + (sizeof(char) * CodepointCount));
return Result;
} }
#define GLYPH_SKIRT 1 #define GLYPH_SKIRT 1

View File

@ -88,7 +88,13 @@ static void DebugPrint(char* Format, ...);
#if !defined(Assert) #if !defined(Assert)
// NOTE(peter): this writes to address 0 which is always illegal and will cause a crash // NOTE(peter): this writes to address 0 which is always illegal and will cause a crash
#define Assert(expression) if(!(expression)){ *((int *)0) = 5; } #define Assert(expression) \
if((expression)) \
{ \
}else{ \
volatile int* p = 0; \
*p = 5; \
}
#endif #endif
#define DEBUG_IF(condition) if (condition) #define DEBUG_IF(condition) if (condition)
@ -310,9 +316,9 @@ GSIntDivideRoundUpDef(s64);
#define GSRemapDef(type) \ #define GSRemapDef(type) \
static type GSRemap(type Value, type OldMin, type OldMax, type NewMin, type NewMax) { \ static type GSRemap(type Value, type OldMin, type OldMax, type NewMin, type NewMax) { \
type Result = (Value - OldMin) / (OldMax - OldMin); \ type Result = (Value - OldMin) / (OldMax - OldMin); \
Result = (Result * (NewMax - NewMin)) + NewMin; \ Result = (Result * (NewMax - NewMin)) + NewMin; \
return Result; \ return Result; \
} }
GSRemapDef(u8); GSRemapDef(u8);
GSRemapDef(u16); GSRemapDef(u16);

View File

@ -156,8 +156,10 @@ typedef unsigned long long int gs_mem_u64;
#ifdef DEBUG #ifdef DEBUG
#if !defined(GSMem_Assert) #if !defined(GSMem_Assert)
#define GSMem_Assert(expression) \ #define GSMem_Assert(expression) \
if(!(expression)) { \ if((expression)) { \
*((int *)0) = 5; \ }else{ \
volatile int* p = 0; \
*p = 5; \
} }
#endif #endif
@ -567,7 +569,7 @@ ClearArena(memory_arena* Arena)
static arena_snapshot static arena_snapshot
TakeSnapshotOfArena(memory_arena* Arena) TakeSnapshotOfArena(memory_arena* Arena)
{ {
Assert(Arena->FindAddressRule == FindAddress_InLastBufferOnly); GSMem_Assert(Arena->FindAddressRule == FindAddress_InLastBufferOnly);
arena_snapshot Result = {}; arena_snapshot Result = {};
Result.Arena = Arena; Result.Arena = Arena;
@ -593,7 +595,7 @@ TakeSnapshotOfArena(memory_arena* Arena)
static void static void
ClearArenaToSnapshot(memory_arena* Arena, arena_snapshot Snapshot) ClearArenaToSnapshot(memory_arena* Arena, arena_snapshot Snapshot)
{ {
Assert(Arena == Snapshot.Arena); GSMem_Assert(Arena == Snapshot.Arena);
memory_buffer* HeadBufferAtSnapshot = Arena->Buffers + Snapshot.HeadBufferAtSnapshot; memory_buffer* HeadBufferAtSnapshot = Arena->Buffers + Snapshot.HeadBufferAtSnapshot;
if (HeadBufferAtSnapshot) if (HeadBufferAtSnapshot)

View File

@ -189,9 +189,9 @@ v4 operator- (v4 A)
return Result; return Result;
} }
#define V2OpV2Def(op) v2 operator##op (v2 A, v2 B) { return v2{ A.x op B.x, A.y op B.y };} #define V2OpV2Def(op) v2 operator op (v2 A, v2 B) { return v2{ A.x op B.x, A.y op B.y };}
#define V3OpV3Def(op) v3 operator##op (v3 A, v3 B) { return v3{ A.x op B.x, A.y op B.y, A.z op B.z };} #define V3OpV3Def(op) v3 operator op (v3 A, v3 B) { return v3{ A.x op B.x, A.y op B.y, A.z op B.z };}
#define V4OpV4Def(op) v4 operator##op (v4 A, v4 B) { return v4{ A.x op B.x, A.y op B.y, A.z op B.z, A.w op B.w };} #define V4OpV4Def(op) v4 operator op (v4 A, v4 B) { return v4{ A.x op B.x, A.y op B.y, A.z op B.z, A.w op B.w };}
V2OpV2Def(+) V2OpV2Def(+)
V2OpV2Def(-) V2OpV2Def(-)
V2OpV2Def(/) V2OpV2Def(/)
@ -208,9 +208,9 @@ V4OpV4Def(*)
#undef V3OpV3Def #undef V3OpV3Def
#undef V4OpV4Def #undef V4OpV4Def
#define V2RefOpV2Def(op) v2 operator##op (v2& A, v2 B) { return v2{ A.x op B.x, A.y op B.y };} #define V2RefOpV2Def(op) v2 operator op (v2& A, v2 B) { return v2{ A.x op B.x, A.y op B.y };}
#define V3RefOpV3Def(op) v3 operator##op (v3& A, v3 B) { return v3{ A.x op B.x, A.y op B.y, A.z op B.z };} #define V3RefOpV3Def(op) v3 operator op (v3& A, v3 B) { return v3{ A.x op B.x, A.y op B.y, A.z op B.z };}
#define V4RefOpScalarDef(op) v4 operator##op (v4& A, v4 B) { return v4{ A.x op B.x, A.y op B.y, A.z op B.z, A.w op B.w };} #define V4RefOpScalarDef(op) v4 operator op (v4& A, v4 B) { return v4{ A.x op B.x, A.y op B.y, A.z op B.z, A.w op B.w };}
V2RefOpV2Def(+=) V2RefOpV2Def(+=)
V2RefOpV2Def(-=) V2RefOpV2Def(-=)
V3RefOpV3Def(+=) V3RefOpV3Def(+=)
@ -221,9 +221,9 @@ V4RefOpScalarDef(-=)
#undef V3RefOpV3Def #undef V3RefOpV3Def
#undef V4RefOpV4Def #undef V4RefOpV4Def
#define V2OpScalarDef(op) v2 operator##op (v2 A, float B) { return v2{ A.x op B, A.y op B };} #define V2OpScalarDef(op) v2 operator op (v2 A, float B) { return v2{ A.x op B, A.y op B };}
#define V3OpScalarDef(op) v3 operator##op (v3 A, float B) { return v3{ A.x op B, A.y op B, A.z op B };} #define V3OpScalarDef(op) v3 operator op (v3 A, float B) { return v3{ A.x op B, A.y op B, A.z op B };}
#define V4OpScalarDef(op) v4 operator##op (v4 A, float B) { return v4{ A.x op B, A.y op B, A.z op B, A.w op B };} #define V4OpScalarDef(op) v4 operator op (v4 A, float B) { return v4{ A.x op B, A.y op B, A.z op B, A.w op B };}
V2OpScalarDef(*) V2OpScalarDef(*)
V2OpScalarDef(/) V2OpScalarDef(/)
V3OpScalarDef(*) V3OpScalarDef(*)
@ -235,9 +235,9 @@ V4OpScalarDef(/)
#undef V4POpScalarDef #undef V4POpScalarDef
#define V2POpScalarDef(op) v2 operator##op (v2& A, float B) { return v2{ A->x op B, A->y op B };} #define V2POpScalarDef(op) v2 operator op (v2& A, float B) { return v2{ A->x op B, A->y op B };}
#define V3POpScalarDef(op) v3 operator##op (v3& A, float B) { return v3{ A->x op B, A->y op B, A->z op B };} #define V3POpScalarDef(op) v3 operator op (v3& A, float B) { return v3{ A->x op B, A->y op B, A->z op B };}
#define V4POpScalarDef(op) v4 operator##op (v4& A, float B) { return v4{ A->x op B, A->y op B, A->z op B, A->w op B };} #define V4POpScalarDef(op) v4 operator op (v4& A, float B) { return v4{ A->x op B, A->y op B, A->z op B, A->w op B };}
V2OpScalarDef(*=) V2OpScalarDef(*=)
V2OpScalarDef(/=) V2OpScalarDef(/=)
V3OpScalarDef(*=) V3OpScalarDef(*=)

View File

@ -225,7 +225,7 @@ GetIndexForNameHash(debug_frame* Frame, u32 NameHash)
for (s32 Offset = 0; Offset < Frame->ScopeNamesMax; Offset++) for (s32 Offset = 0; Offset < Frame->ScopeNamesMax; Offset++)
{ {
u32 Index = (NameHash + Offset) % Frame->ScopeNamesMax; u32 Index = (NameHash + Offset) % Frame->ScopeNamesMax;
if ((Frame->ScopeNamesHash[Index].Hash == NameHash)) if (Frame->ScopeNamesHash[Index].Hash == NameHash)
{ {
Result = Index; Result = Index;
break; break;
@ -399,7 +399,7 @@ internal r32 DEBUGGetSecondsElapsed (s64 Start, s64 End, r32 PerformanceCountFre
} }
#ifdef DEBUG #ifdef DEBUG
#define DEBUG_TRACK_FUNCTION scope_tracker ScopeTracker (__FUNCTION__, GlobalDebugServices) #define DEBUG_TRACK_FUNCTION scope_tracker ScopeTracker ((char*)__func__, GlobalDebugServices)
#define DEBUG_TRACK_SCOPE(name) scope_tracker ScopeTracker_##name (#name, GlobalDebugServices) #define DEBUG_TRACK_SCOPE(name) scope_tracker ScopeTracker_##name (#name, GlobalDebugServices)
#else #else
#define DEBUG_TRACK_FUNCTION #define DEBUG_TRACK_FUNCTION

View File

@ -271,7 +271,7 @@ struct multi_option_label_result
internal multi_option_label_result internal multi_option_label_result
EvaluateMultiOptionLabel (render_command_buffer* RenderBuffer, EvaluateMultiOptionLabel (render_command_buffer* RenderBuffer,
v2 Min, v2 Max, string Label, string Options[], v2 Min, v2 Max, string Label, string Options[], s32 OptionsCount,
interface_config Config, mouse_state Mouse) interface_config Config, mouse_state Mouse)
{ {
multi_option_label_result Result = {}; multi_option_label_result Result = {};
@ -283,7 +283,7 @@ EvaluateMultiOptionLabel (render_command_buffer* RenderBuffer,
v2 ButtonDim = v2{ButtonSide, ButtonSide}; v2 ButtonDim = v2{ButtonSide, ButtonSide};
v2 ButtonPos = Max - (ButtonDim + Config.Margin); v2 ButtonPos = Max - (ButtonDim + Config.Margin);
for (s32 b = 0; b < sizeof(Options) / sizeof(Options[0]); b++) for (s32 b = 0; b < OptionsCount; b++)
{ {
button_result Button = EvaluateButton(RenderBuffer, ButtonPos, ButtonPos + ButtonDim, button_result Button = EvaluateButton(RenderBuffer, ButtonPos, ButtonPos + ButtonDim,
Options[b], Config, Mouse); Options[b], Config, Mouse);
@ -301,13 +301,12 @@ EvaluateMultiOptionLabel (render_command_buffer* RenderBuffer,
// NOTE(Peter): returns IndexPressed = -1 if the button itself is pressed, as opposed // NOTE(Peter): returns IndexPressed = -1 if the button itself is pressed, as opposed
// to one of its options // to one of its options
internal multi_option_label_result internal multi_option_label_result
EvaluateMultiOptionButton (render_command_buffer* RenderBuffer, v2 Min, v2 Max, string Text, string Options[], b32 Selected, EvaluateMultiOptionButton (render_command_buffer* RenderBuffer, v2 Min, v2 Max, string Text, string Options[], s32 OptionsCount, b32 Selected,
interface_config Config, mouse_state Mouse) interface_config Config, mouse_state Mouse)
{ {
multi_option_label_result Result = {}; multi_option_label_result Result = {};
Result.Pressed = false; Result.Pressed = false;
s32 OptionsCount = sizeof(Options) / sizeof(Options[0]);
r32 ButtonSide = (Max.y - Min.y) - (2 * Config.Margin.y); r32 ButtonSide = (Max.y - Min.y) - (2 * Config.Margin.y);
v2 ButtonDim = v2{ButtonSide, ButtonSide}; v2 ButtonDim = v2{ButtonSide, ButtonSide};
@ -386,31 +385,29 @@ EvaluateSlider (render_command_buffer* RenderBuffer, v2 Min, v2 Max, string Labe
struct panel_result struct panel_result
{ {
s32 Depth;
v2 NextPanelMin; v2 NextPanelMin;
v2 ChildMin, ChildMax; v2 ChildMin, ChildMax;
}; };
internal panel_result internal panel_result
EvaluatePanel (render_command_buffer* RenderBuffer, v2 Min, v2 Max, s32 Depth, interface_config Config) EvaluatePanel (render_command_buffer* RenderBuffer, v2 Min, v2 Max, interface_config Config)
{ {
panel_result Result = {}; panel_result Result = {};
Result.Depth = Depth;
Result.ChildMin = Min + Config.Margin; Result.ChildMin = Min + Config.Margin;
Result.ChildMax = Max - Config.Margin; Result.ChildMax = Max - Config.Margin;
Result.NextPanelMin = v2{Max.x, Min.y}; Result.NextPanelMin = v2{Max.x, Min.y};
v4 BG = Config.PanelBGColors[Depth]; v4 BG = Config.PanelBGColors[0];
PushRenderQuad2D(RenderBuffer, Min, Max, BG); PushRenderQuad2D(RenderBuffer, Min, Max, BG);
return Result; return Result;
} }
internal panel_result internal panel_result
EvaluatePanel (render_command_buffer* RenderBuffer, v2 Min, v2 Max, string Label, s32 Depth, interface_config Config) EvaluatePanel (render_command_buffer* RenderBuffer, v2 Min, v2 Max, string Label, interface_config Config)
{ {
panel_result Result = EvaluatePanel(RenderBuffer, Min, Max, Depth, Config); panel_result Result = EvaluatePanel(RenderBuffer, Min, Max, Config);
v2 TextPos = v2{ v2 TextPos = v2{
Min.x + Config.Margin.x, Min.x + Config.Margin.x,
@ -427,7 +424,7 @@ EvaluatePanel(render_command_buffer* RenderBuffer, panel_result* ParentPanel, r3
{ {
v2 Min = v2{ParentPanel->ChildMin.x, ParentPanel->ChildMax.y - Height}; v2 Min = v2{ParentPanel->ChildMin.x, ParentPanel->ChildMax.y - Height};
v2 Max = ParentPanel->ChildMax; v2 Max = ParentPanel->ChildMax;
panel_result Result = EvaluatePanel(RenderBuffer, Min, Max, Title, ParentPanel->Depth + 1, Config); panel_result Result = EvaluatePanel(RenderBuffer, Min, Max, Title, Config);
ParentPanel->ChildMax.y = Min.y - Config.Margin.y; ParentPanel->ChildMax.y = Min.y - Config.Margin.y;

View File

@ -454,8 +454,7 @@ AnimationTimeline_Render(panel Panel, rect PanelBounds, render_command_buffer* R
v2 OptionsRowMin = v2{ PanelBounds.Min.x, TimelineBounds.Max.y }; v2 OptionsRowMin = v2{ PanelBounds.Min.x, TimelineBounds.Max.y };
v2 OptionsRowMax = PanelBounds.Max; v2 OptionsRowMax = PanelBounds.Max;
panel_result AnimationPanel = EvaluatePanel(RenderBuffer, OptionsRowMin, OptionsRowMax, panel_result AnimationPanel = EvaluatePanel(RenderBuffer, OptionsRowMin, OptionsRowMax, State->Interface);
0, State->Interface);
r32 ButtonWidth = 35; r32 ButtonWidth = 35;
v2 ButtonMin = v2{0, 0}; v2 ButtonMin = v2{0, 0};

View File

@ -26,6 +26,11 @@ DMXView_Cleanup(panel* Panel, app_state* State)
} }
#if 0
// NOTE(Peter): Here to illustrate what old SACN Universe drawing looked like
// This won't actually function
// :NoLongerFunctionalSACNCodeButThatsOk
internal void internal void
DrawSACNUniversePixels (render_command_buffer* RenderBuffer, sacn_universe* ToDraw, DrawSACNUniversePixels (render_command_buffer* RenderBuffer, sacn_universe* ToDraw,
v2 TopLeft, v2 Dimension) v2 TopLeft, v2 Dimension)
@ -59,12 +64,14 @@ DrawSACNUniversePixels (render_command_buffer* RenderBuffer, sacn_universe* ToDr
++PixelsDrawn; ++PixelsDrawn;
} }
} }
#endif
GSMetaTag(panel_render); GSMetaTag(panel_render);
internal void internal void
DMXView_Render(panel Panel, rect PanelBounds, render_command_buffer* RenderBuffer, app_state* State, context Context, mouse_state Mouse) DMXView_Render(panel Panel, rect PanelBounds, render_command_buffer* RenderBuffer, app_state* State, context Context, mouse_state Mouse)
{ {
#if 0 #if 0
// :NoLongerFunctionalSACNCodeButThatsOk
DEBUG_TRACK_SCOPE(DrawUniverseOutputDisplay); DEBUG_TRACK_SCOPE(DrawUniverseOutputDisplay);
universe_view_operation_state* OpState = (universe_view_operation_state*)Operation.OpStateMemory; universe_view_operation_state* OpState = (universe_view_operation_state*)Operation.OpStateMemory;

View File

@ -169,7 +169,7 @@ BeginConnectNodesOperation(visual_port VisualPort, u32 VisualPortIndex, mouse_st
// //
input_command NodeGraph_Commands[] = { input_command NodeGraph_Commands[] = {
{ 0 } {}
}; };
GSMetaTag(panel_init); GSMetaTag(panel_init);

View File

@ -2,31 +2,18 @@ TODO FOLDHAUS
Ground Up Reengineering Ground Up Reengineering
- Metaprogramming - Metaprogramming
x refactor for speed
x use #include statements to crawl through the codebase
x generalize the system
- panels metaprogramming - panels metaprogramming
- fix memory layout (remeber to profile before and after) - fix memory layout (remeber to profile before and after)
x Hot Code Reloading
x Fix it
- Make the DLL truly platform agnostic - Make the DLL truly platform agnostic
- math.h: present for trig functions - math.h: present for trig functions
- windows.h: only thing left is InterlockedIncrement and InterlockedAdd - windows.h: only thing left is InterlockedIncrement and InterlockedAdd
- Win32 Platform Layer - Win32 Platform Layer
x Capture Mouse Events that start on the window but end outside
x Mouse up when mouse down was in the window
- Enumerate Directory Contents (you started this in win32_foldhaus_fileio.h) - Enumerate Directory Contents (you started this in win32_foldhaus_fileio.h)
-
x File Loading
x Gracefully handle File Not found
- Internal Log File - Internal Log File
NOTE: This should not be a part of the debug system NOTE: This should not be a part of the debug system
x Basic logging
- Save output log to a file continuously - Save output log to a file continuously
- Have a window where we can view the log within the app - Have a window where we can view the log within the app
- Create a bar that displays the most recent error message - Create a bar that displays the most recent error message
@ -45,10 +32,6 @@ x File Loading
- Lighting - Lighting
- Clipping (with error checking) - Clipping (with error checking)
- Asset Loading
- images
- icon system
- Sculptures - Sculptures
- store scale in the assembly definition file - store scale in the assembly definition file
- cache led vertex buffers - cache led vertex buffers
@ -70,6 +53,11 @@ x File Loading
- lister with icon options - lister with icon options
- panel system: destroy panel by extending it beyond its max, not just its min - panel system: destroy panel by extending it beyond its max, not just its min
- Asset Loading
- images
- icon system - integrate with interface
- Sculpture View - Sculpture View
- mouse spatial interaction - handles, and hover for info - mouse spatial interaction - handles, and hover for info
- debug capabilities (toggle strip/led/universe colors) - debug capabilities (toggle strip/led/universe colors)