From 0164fea691e0261a64dcc14ce2aed84204fad374 Mon Sep 17 00:00:00 2001 From: Peter Slattery Date: Wed, 1 Jan 2020 18:41:43 -0800 Subject: [PATCH] added documentation to all files --- src/animation/foldhaus_animation.h | 10 + src/artnet/artnet.h | 11 +- src/assembly_parser.cpp | 12 +- src/assembly_parser.h | 12 +- src/dmx/dmx.h | 12 +- src/foldhaus_app.cpp | 12 +- src/foldhaus_app.h | 11 + src/foldhaus_assembly.cpp | 11 + src/foldhaus_assembly.h | 11 + src/foldhaus_command_dispatch.h | 12 +- src/foldhaus_debug.h | 11 + src/foldhaus_debug_visuals.h | 11 + src/foldhaus_default_nodes.h | 11 + src/foldhaus_interface.cpp | 11 + src/foldhaus_memory.h | 12 +- src/foldhaus_network_ordering.h | 11 + src/foldhaus_node.cpp | 171 +++++++- src/foldhaus_node.h | 19 +- src/foldhaus_node_gui.h | 11 + src/foldhaus_operation_mode.h | 11 + src/foldhaus_panel.h | 25 +- src/foldhaus_platform.h | 13 + src/foldhaus_renderer.cpp | 12 +- src/foldhaus_renderer.h | 29 +- src/foldhaus_sacn_view.cpp | 12 +- src/foldhaus_search_lister.cpp | 11 + src/foldhaus_search_lister.h | 11 + src/foldhaus_text_entry.cpp | 11 + src/foldhaus_text_entry.h | 12 +- ...oldhaus_util_radialumia_file_converter.cpp | 12 +- src/gs_array.h | 374 +++++++++--------- src/gs_font.h | 12 +- src/gs_hashtable.h | 12 +- src/gs_input.h | 12 +- src/gs_platform.h | 10 + src/gs_win32.cpp | 86 ++-- src/gs_win32.h | 11 + src/interface.h | 12 +- src/node/foldhaus_node_interface.cpp | 22 +- .../foldhaus_panel_animation_timeline.h | 10 + src/panels/foldhaus_panel_dmx_view.h | 13 +- src/panels/foldhaus_panel_hierarchy.h | 13 +- src/panels/foldhaus_panel_node_graph.h | 109 ++--- src/panels/foldhaus_panel_profiler.h | 13 +- src/panels/foldhaus_panel_sculpture_view.h | 9 + src/sacn/sacn.h | 13 +- src/test_patterns.h | 12 +- src/win32_foldhaus.cpp | 12 +- 48 files changed, 960 insertions(+), 336 deletions(-) diff --git a/src/animation/foldhaus_animation.h b/src/animation/foldhaus_animation.h index 81fc30d..c4de271 100644 --- a/src/animation/foldhaus_animation.h +++ b/src/animation/foldhaus_animation.h @@ -1,9 +1,16 @@ +// +// File: foldhaus_animation.h +// Author: Peter Slattery +// Creation Date: 2020-01-01 +// // TODO // [] - animation blending // [] - delete a layer // [] - will need a way to create an empty layer // [] - get a list of all animation procs +#ifndef FOLDHAUS_ANIMATION + #define ANIMATION_PROC(name) void name(assembly* Assembly, r32 Time) typedef ANIMATION_PROC(animation_proc); @@ -33,3 +40,6 @@ struct animation_system r32 AnimationStart; r32 AnimationEnd; }; + +#define FOLDHAUS_ANIMATION +#endif // FOLDHAUS_ANIMATION diff --git a/src/artnet/artnet.h b/src/artnet/artnet.h index f57667b..88a7725 100644 --- a/src/artnet/artnet.h +++ b/src/artnet/artnet.h @@ -1 +1,10 @@ -/* For future artnet implementation */ \ No newline at end of file +// +// File: artnet.h +// Author: Peter Slattery +// Creation Date: 2020-01-01 +// +/* For future artnet implementation */ +#ifndef ARTNET_H + +#define ARTNET_H +#endif // ARTNET_H diff --git a/src/assembly_parser.cpp b/src/assembly_parser.cpp index 6685c7d..b59a737 100644 --- a/src/assembly_parser.cpp +++ b/src/assembly_parser.cpp @@ -1,3 +1,10 @@ +// +// File: assembly_parser.cpp +// Author: Peter Slattery +// Creation Date: 2020-01-01 +// +#ifndef ASSEMBLY_PARSER_CPP + internal assembly_token ParseToken (tokenizer* Tokenizer) @@ -221,4 +228,7 @@ ParseAssemblyFile (u8* FileBase, s32 FileSize, memory_arena* Arena) ParseAssemblyFileBody(&AssemblyDefinition, &AssemblyFileTokenizer); return AssemblyDefinition; -} \ No newline at end of file +} + +#define ASSEMBLY_PARSER_CPP +#endif // ASSEMBLY_PARSER_CPP \ No newline at end of file diff --git a/src/assembly_parser.h b/src/assembly_parser.h index ccc384d..aa2f1ac 100644 --- a/src/assembly_parser.h +++ b/src/assembly_parser.h @@ -1,3 +1,10 @@ +// +// File: assembly_parser.h +// Author: Peter Slattery +// Creation Date: 2020-01-01 +// +#ifndef ASSEMBLY_PARSER_H + #define LED_STRIP_COUNT_IDENTIFIER "led_strip_count" #define LED_STRIP_IDENTIFIER "led_strip" @@ -58,4 +65,7 @@ struct assembly_definition s32 LEDStripCount; s32 TotalLEDCount; led_strip_definition* LEDStrips; -}; \ No newline at end of file +}; + +#define ASSEMBLY_PARSER_H +#endif // ASSEMBLY_PARSER_H \ No newline at end of file diff --git a/src/dmx/dmx.h b/src/dmx/dmx.h index 1851529..ed8e8b7 100644 --- a/src/dmx/dmx.h +++ b/src/dmx/dmx.h @@ -1,3 +1,10 @@ +// +// File: DMX_H +// Author: Peter Slattery +// Creation Date: 2020-01-01 +// +#ifndef DMX_H + struct dmx_buffer { s32 Universe; @@ -44,4 +51,7 @@ DMXBufferListAppend (dmx_buffer_list* AppendTo, dmx_buffer_list* Append) } return Result; -} \ No newline at end of file +} + +#define DMX_H +#endif // DMX_H \ No newline at end of file diff --git a/src/foldhaus_app.cpp b/src/foldhaus_app.cpp index 562d289..dd50e47 100644 --- a/src/foldhaus_app.cpp +++ b/src/foldhaus_app.cpp @@ -1,3 +1,10 @@ +// +// File: foldhaus_app.cpp +// Author: Peter Slattery +// Creation Date: 2020-01-01 +// +#ifndef FOLDHAUS_APP_CPP + #include "foldhaus_platform.h" #include "foldhaus_app.h" @@ -421,4 +428,7 @@ CLEANUP_APPLICATION(CleanupApplication) { app_state* State = (app_state*)Context.MemoryBase; SACNCleanup(&State->SACN, Context); -} \ No newline at end of file +} + +#define FOLDHAUS_APP_CPP +#endif // FOLDHAUS_APP_CPP \ No newline at end of file diff --git a/src/foldhaus_app.h b/src/foldhaus_app.h index 5882c96..2aec647 100644 --- a/src/foldhaus_app.h +++ b/src/foldhaus_app.h @@ -1,3 +1,10 @@ +// +// File: foldhaus_app.h +// Author: Peter Slattery +// Creation Date: 2020-01-01 +// +#ifndef FOLDHAUS_APP_H + #include "../meta/gs_meta_lexer.h" #include "gs_font.h" @@ -231,3 +238,7 @@ typedef PANEL_RENDER_PROC(panel_render_proc); #include "generated/foldhaus_panels_generated.h" #include "foldhaus_interface.cpp" + + +#define FOLDHAUS_APP_H +#endif // FOLDHAUS_APP_H \ No newline at end of file diff --git a/src/foldhaus_assembly.cpp b/src/foldhaus_assembly.cpp index 282b0f1..9c8a8e3 100644 --- a/src/foldhaus_assembly.cpp +++ b/src/foldhaus_assembly.cpp @@ -1,3 +1,10 @@ +// +// File: foldhaus_assembly.cpp +// Author: Peter Slattery +// Creation Date: 2020-01-01 +// +#ifndef FOLDHAUS_ASSEMBLY_CPP + internal s32 GetAssemblyMemorySizeFromDefinition(assembly_definition Definition, string Name) { @@ -115,3 +122,7 @@ UnloadAssembly (u32 AssemblyIndex, app_state* State, context Context) } } } + + +#define FOLDHAUS_ASSEMBLY_CPP +#endif // FOLDHAUS_ASSEMBLY_CPP \ No newline at end of file diff --git a/src/foldhaus_assembly.h b/src/foldhaus_assembly.h index 62ac818..6fbacd0 100644 --- a/src/foldhaus_assembly.h +++ b/src/foldhaus_assembly.h @@ -1,3 +1,10 @@ +// +// File: foldhaus_assembly.h +// Author: Peter Slattery +// Creation Date: 2020-01-01 +// +#ifndef FOLDHAUS_ASSEMBLY_H + struct led { s32 Index; @@ -36,3 +43,7 @@ struct assembly s32 LEDUniverseMapCount; leds_in_universe_range* LEDUniverseMap; }; + + +#define FOLDHAUS_ASSEMBLY_H +#endif // FOLDHAUS_ASSEMBLY_H \ No newline at end of file diff --git a/src/foldhaus_command_dispatch.h b/src/foldhaus_command_dispatch.h index e038e68..2a7fc1e 100644 --- a/src/foldhaus_command_dispatch.h +++ b/src/foldhaus_command_dispatch.h @@ -1,3 +1,10 @@ +// +// File: foldhaus_command_dispatch.h +// Author: Peter Slattery +// Creation Date: 2020-01-01 +// +#ifndef FOLDHAUS_COMMAND_DISPATCH_H + #define FOLDHAUS_INPUT_COMMAND_PROC(name) void name(app_state* State, input_entry Event, mouse_state Mouse) typedef FOLDHAUS_INPUT_COMMAND_PROC(input_command_proc); @@ -193,4 +200,7 @@ RegisterKeyPressCommand (input_command_registry* CommandRegistry, Command->Flags = Flags; Command->Mdfr = Mdfr; Command->Proc = Proc; -} \ No newline at end of file +} + +#define FOLDHAUS_COMMAND_DISPATCH_H +#endif // FOLDHAUS_COMMAND_DISPATCH_H \ No newline at end of file diff --git a/src/foldhaus_debug.h b/src/foldhaus_debug.h index d82b20f..7641db6 100644 --- a/src/foldhaus_debug.h +++ b/src/foldhaus_debug.h @@ -1,3 +1,10 @@ +// +// File: foldhaus_debug.h +// Author: Peter Slattery +// Creation Date: 2020-01-01 +// +#ifndef FOLDHAUS_DEBUG_H + #define SCOPE_NAME_LENGTH 256 struct scope_record { @@ -427,3 +434,7 @@ struct scope_tracker } } }; + + +#define FOLDHAUS_DEBUG_H +#endif // FOLDHAUS_DEBUG_H \ No newline at end of file diff --git a/src/foldhaus_debug_visuals.h b/src/foldhaus_debug_visuals.h index 7242ef9..3158e78 100644 --- a/src/foldhaus_debug_visuals.h +++ b/src/foldhaus_debug_visuals.h @@ -1,3 +1,10 @@ +// +// File: foldhaus_debug_visuals.h +// Author: Peter Slattery +// Creation Date: 2020-01-01 +// +#ifndef FOLDHAUS_DEBUG_VISUALS_H + internal void DrawDebugInterface (render_command_buffer* RenderBuffer, r32 StartX, interface_config Interface, r32 WindowWidth, r32 WindowHeight, r32 DeltaTime, app_state* State, camera Camera, mouse_state Mouse, memory_arena* Transient) { @@ -113,3 +120,7 @@ DrawDebugInterface (render_command_buffer* RenderBuffer, r32 StartX, interface_c TopOfScreenLinePos.y -= NewLineYOffset(*Interface.Font); } } + + +#define FOLDHAUS_DEBUG_VISUALS_H +#endif // FOLDHAUS_DEBUG_VISUALS_H \ No newline at end of file diff --git a/src/foldhaus_default_nodes.h b/src/foldhaus_default_nodes.h index bacafe1..ef88cdf 100644 --- a/src/foldhaus_default_nodes.h +++ b/src/foldhaus_default_nodes.h @@ -1,3 +1,10 @@ +// +// File: foldhaus_default_nodes.h +// Author: Peter Slattery +// Creation Date: 2020-01-01 +// +#ifndef FOLDHAUS_DEFAULT_NODES_H + ////////////////////////////////// // // Values @@ -135,3 +142,7 @@ NODE_PROC(MultiplyPatterns, multiply_patterns_data) LED++; } } + + +#define FOLDHAUS_DEFAULT_NODES_H +#endif // FOLDHAUS_DEFAULT_NODES_H \ No newline at end of file diff --git a/src/foldhaus_interface.cpp b/src/foldhaus_interface.cpp index f94e3a9..184bc74 100644 --- a/src/foldhaus_interface.cpp +++ b/src/foldhaus_interface.cpp @@ -1,3 +1,10 @@ +// +// File: foldhaus_interface.cpp +// Author: Peter Slattery +// Creation Date: 2020-01-01 +// +#ifndef FOLDHAUS_INTERFACE_CPP + //////////////////////////////////////// // // Universe View @@ -603,3 +610,7 @@ DrawAllPanels(panel_layout PanelLayout, render_command_buffer* RenderBuffer, mou DrawPanelBorder(*Panel, PanelBounds.Min, PanelBounds.Max, BorderColor, Mouse, RenderBuffer); } } + + +#define FOLDHAUS_INTERFACE_CPP +#endif // FOLDHAUS_INTERFACE_CPP \ No newline at end of file diff --git a/src/foldhaus_memory.h b/src/foldhaus_memory.h index cdbc2db..a807950 100644 --- a/src/foldhaus_memory.h +++ b/src/foldhaus_memory.h @@ -1,3 +1,10 @@ +// +// File: foldhaus_memory.h +// Author: Peter Slattery +// Creation Date: 2020-01-01 +// +#ifndef FOLDHAUS_MEMORY_H + #ifndef GS_MEMORY_H #if 0 @@ -266,4 +273,7 @@ PushSize_ (static_memory_arena* Arena, u32 Size) } #define GS_MEMORY_H -#endif // GS_MEMORY_H \ No newline at end of file +#endif // GS_MEMORY_H + +#define FOLDHAUS_MEMORY_H +#endif // FOLDHAUS_MEMORY_H \ No newline at end of file diff --git a/src/foldhaus_network_ordering.h b/src/foldhaus_network_ordering.h index 36349a5..65b60c7 100644 --- a/src/foldhaus_network_ordering.h +++ b/src/foldhaus_network_ordering.h @@ -1,3 +1,10 @@ +// +// File: foldhaus_network_ordering.h +// Author: Peter Slattery +// Creation Date: 2020-01-01 +// +#ifndef FOLDHAUS_NETWORK_ORDERING_H + // Packs a u8 to a known big endian buffer inline u8* PackB1(u8* ptr, u8 val) @@ -131,3 +138,7 @@ UpackL8(const u8* ptr) { return *((u64*)ptr); } + + +#define FOLDHAUS_NETWORK_ORDERING_H +#endif // FOLDHAUS_NETWORK_ORDERING_H \ No newline at end of file diff --git a/src/foldhaus_node.cpp b/src/foldhaus_node.cpp index e02160c..8c90f78 100644 --- a/src/foldhaus_node.cpp +++ b/src/foldhaus_node.cpp @@ -1,6 +1,175 @@ +// +// File: foldhaus_node.cpp +// Author: Peter Slattery +// Creation Date: 2020-01-01 +// +#ifndef FOLDHAUS_NODE_CPP + internal void -PushNodeOnWorkspace(s32 NodeSpecificationIndex, pattern_node_workspace* Workspace) +ClearNodeWorkspaceStorage(pattern_node_workspace* Workspace) +{ + ClearArena(&Workspace->Storage); + Workspace->SparseToSortedNodeMap = 0; + Workspace->SortedNodeHandles = 0; +} + +struct adjacency_list +{ + // TODO(Peter): Can make these as buffers, not single digits later + gs_list_handle NodeHandle; + adjacency_list* Next; +}; + +internal u32 +SortNodeNeighbors(u32 ContiguousNodeIndex, gs_list_handle NodeHandle, adjacency_list** NeighborsLists, b8* NodesVisited, gs_list_handle* SortedNodeHandles, u32 SortedNodesCount, s32* SparseToContiguousNodeMap) +{ + NodesVisited[ContiguousNodeIndex] = true; + + adjacency_list* Neighbor = NeighborsLists[ContiguousNodeIndex]; + while (Neighbor) + { + u32 ContiguousNeighborNodeIndex = SparseToContiguousNodeMap[Neighbor->NodeHandle.Index]; + if (!NodesVisited[ContiguousNeighborNodeIndex]) + { + SortedNodesCount = SortNodeNeighbors(ContiguousNeighborNodeIndex, Neighbor->NodeHandle, NeighborsLists, NodesVisited, SortedNodeHandles, SortedNodesCount, SparseToContiguousNodeMap); + } + Neighbor = Neighbor->Next; + } + + SortedNodeHandles[SortedNodesCount++] = NodeHandle; + return SortedNodesCount; +} + +internal s32* +CreateSparseToContiguousMap (pattern_node_workspace Workspace, memory_arena* Scratch) +{ + s32* Result = PushArray(Scratch, s32, Workspace.Nodes.OnePastLastUsed); + s32 ContiguousIndex = 0; + for (u32 SparseNodeIndex = 0; SparseNodeIndex < Workspace.Nodes.OnePastLastUsed; SparseNodeIndex++) + { + gs_list_entry* Entry = Workspace.Nodes.GetEntryAtIndex(SparseNodeIndex); + if (!EntryIsFree(Entry)) + { + Result[SparseNodeIndex] = ContiguousIndex++; + } + } + return Result; +} + +internal void +UpdateSortedNodes(pattern_node_workspace* Workspace, memory_arena* Scratch) +{ + ClearNodeWorkspaceStorage(Workspace); + + u32 NodeCount = Workspace->Nodes.Used; + u32 SparseNodeCount = Workspace->Nodes.OnePastLastUsed; + + s32* SparseToContiguousNodeMap = CreateSparseToContiguousMap(*Workspace, &Workspace->Storage); + + // NOTE(Peter): We need to sort this later on so I'm just storing list lengths in this format + // to begin with. + // NeighborsListLengths[n].Radix = the number of neighbors for the node + // NeighborsListLengths[n].ID = the sparse array index of the node + gs_radix_entry* NeighborsListLengths = PushArray(Scratch, gs_radix_entry, NodeCount); + adjacency_list** NeighborsLists = PushArray(Scratch, adjacency_list*, NodeCount); + GSZeroArray(NeighborsLists, adjacency_list*, SparseNodeCount); + + // Fill Radix + for (u32 n = 0; n < SparseNodeCount; n++) + { + s32 ContiguousIndex = SparseToContiguousNodeMap[n]; + if (ContiguousIndex >= 0) + { + NeighborsListLengths[ContiguousIndex].Radix = 0; + NeighborsListLengths[ContiguousIndex].ID = n; + } + } + + // Construct Adjaceny List + for (u32 c = 0; c < Workspace->Connections.Used; c++) + { + pattern_node_connection Connection = *Workspace->Connections.GetElementAtIndex(c); + + adjacency_list* ListAddition = PushStruct(Scratch, adjacency_list); + ListAddition->NodeHandle = Connection.DownstreamNodeHandle; + + s32 ContiguousNodeIndex = SparseToContiguousNodeMap[Connection.UpstreamNodeHandle.Index]; + ListAddition->Next = NeighborsLists[ContiguousNodeIndex]; + NeighborsLists[ContiguousNodeIndex] = ListAddition; + + // Increment the number of neighbors - stored in Radix + NeighborsListLengths[ContiguousNodeIndex].Radix++; + } + + // Sort by number of neighbors + RadixSortInPlace(NeighborsListLengths, Workspace->Nodes.Used); + + char* OutputCharArray = PushArray(Scratch, char, 1024); + string OutputString = MakeString(OutputCharArray, 0, 1024); + + PrintF(&OutputString, "Neighbors Lists: \n"); + for (u32 d = 0; d < Workspace->Nodes.Used; d++) + { + PrintF(&OutputString, " %d: Node [ %d ] : neighbors { ", d, NeighborsListLengths[d].ID); + + adjacency_list* Neighbors = NeighborsLists[d]; + while (Neighbors) + { + PrintF(&OutputString, "%d, ", Neighbors->NodeHandle.Index); + Neighbors = Neighbors->Next; + } + PrintF(&OutputString, " }\n"); + } + NullTerminate(&OutputString); + + OutputDebugStringA(OutputCharArray); + // This is a contiguous array. + b8* NodesVisited = PushArray(Scratch, b8, NodeCount); + GSZeroArray(NodesVisited, b8, NodeCount); + + Workspace->SortedNodeHandles = PushArray(&Workspace->Storage, gs_list_handle, NodeCount); + u32 SortedSparseNodeIndeciesUsed = 0; + + for (u32 n = 0; n < Workspace->Nodes.Used; n++) + { + gs_radix_entry SortedNeighborsCount = NeighborsListLengths[n]; + u32 NeighborCount = SortedNeighborsCount.Radix; + u32 NodeIndex = SortedNeighborsCount.ID; + gs_list_handle NodeHandle = Workspace->Nodes.GetEntryAtIndex(NodeIndex)->Handle; + u32 ContiguousNodeIndex = SparseToContiguousNodeMap[NodeIndex]; + + SortedSparseNodeIndeciesUsed = SortNodeNeighbors(ContiguousNodeIndex, NodeHandle, NeighborsLists, NodesVisited, Workspace->SortedNodeHandles, SortedSparseNodeIndeciesUsed, SparseToContiguousNodeMap); + } + + Workspace->SparseToSortedNodeMap = SparseToContiguousNodeMap; + for (u32 SortedIndex = 0; SortedIndex < NodeCount; SortedIndex++) + { + gs_list_handle SortedHandle = Workspace->SortedNodeHandles[SortedIndex]; + Workspace->SparseToSortedNodeMap[SortedHandle.Index] = SortedIndex; + } +} + +internal void +PushNodeOnWorkspace(s32 NodeSpecificationIndex, pattern_node_workspace* Workspace, memory_arena* Scratch) { pattern_node* NewNode = Workspace->Nodes.TakeElement(); NewNode->SpecificationIndex = NodeSpecificationIndex; + + UpdateSortedNodes(Workspace, Scratch); } + +internal void +PushNodeConnectionOnWorkspace(gs_list_handle UpstreamNodeHandle, u32 UpstreamPortIndex, gs_list_handle DownstreamNodeHandle, u32 DownstreamPortIndex, pattern_node_workspace* Workspace, memory_arena* Scratch) +{ + pattern_node_connection Connection = {}; + Connection.UpstreamNodeHandle = UpstreamNodeHandle; + Connection.DownstreamNodeHandle = DownstreamNodeHandle; + Connection.UpstreamPortIndex = UpstreamPortIndex; + Connection.DownstreamPortIndex = DownstreamPortIndex; + + Workspace->Connections.PushElementOnBucket(Connection); + UpdateSortedNodes(Workspace, Scratch); +} + +#define FOLDHAUS_NODE_CPP +#endif // FOLDHAUS_NODE_CPP \ No newline at end of file diff --git a/src/foldhaus_node.h b/src/foldhaus_node.h index cd4504d..81ebdf0 100644 --- a/src/foldhaus_node.h +++ b/src/foldhaus_node.h @@ -1,3 +1,10 @@ +// +// File: foldhaus_node.h +// Author: Peter Slattery +// Creation Date: 2020-01-01 +// +#ifndef FOLDHAUS_NODE_H + typedef enum node_type node_type; #define IsInputMember 1 << 0 @@ -75,6 +82,13 @@ struct pattern_node_workspace { gs_list Nodes; gs_bucket Connections; + + // This is storage for all the structures which follow. + // It is cleared when new nodes are added so that the + // acceleration structures can be recalculated + memory_arena Storage; + s32* SparseToSortedNodeMap; + gs_list_handle* SortedNodeHandles; }; @@ -107,4 +121,7 @@ NODE_STRUCT(output_node_data) NODE_PROC(OutputNode, output_node_data) { -} \ No newline at end of file +} + +#define FOLDHAUS_NODE_H +#endif // FOLDHAUS_NODE_H \ No newline at end of file diff --git a/src/foldhaus_node_gui.h b/src/foldhaus_node_gui.h index a70cf74..14d7a71 100644 --- a/src/foldhaus_node_gui.h +++ b/src/foldhaus_node_gui.h @@ -1,3 +1,10 @@ +// +// File: foldhaus_node_gui.h +// Author: Peter Slattery +// Creation Date: 2020-01-01 +// +#ifndef FOLDHAUS_NODE_GUI_H + struct gui_node { s32 Handle; @@ -11,3 +18,7 @@ struct gui_node_list s32 NodesUsed; gui_node Nodes[GUI_NODES_MAX]; }; + + +#define FOLDHAUS_NODE_GUI_H +#endif // FOLDHAUS_NODE_GUI_H \ No newline at end of file diff --git a/src/foldhaus_operation_mode.h b/src/foldhaus_operation_mode.h index 6c9b490..49d71bd 100644 --- a/src/foldhaus_operation_mode.h +++ b/src/foldhaus_operation_mode.h @@ -1,3 +1,10 @@ +// +// File: foldhaus_operation_mode.h +// Author: Peter Slattery +// Creation Date: 2020-01-01 +// +#ifndef FOLDHAUS_OPERATION_MODE_H + typedef struct operation_mode operation_mode; #define OPERATION_STATE_DEF(name) struct name @@ -81,3 +88,7 @@ CreateOperationState_ (operation_mode* Mode, operation_mode_system* System, s32 Mode->OpStateMemory = PushSize(&System->Arena, StateSize); return Mode->OpStateMemory; } + + +#define FOLDHAUS_OPERATION_MODE_H +#endif // FOLDHAUS_OPERATION_MODE_H \ No newline at end of file diff --git a/src/foldhaus_panel.h b/src/foldhaus_panel.h index ca49346..27f290a 100644 --- a/src/foldhaus_panel.h +++ b/src/foldhaus_panel.h @@ -1,14 +1,13 @@ -/* -File: foldhaus_panel.cpp -Description: a system for laying out panels on a screen -Author: Peter Slattery -Creation Date: 2019-12-26 - -Usage: -Include this file in ONE file in your project. -Define SetPanelDefinitionExternal - -*/ +// +// File: foldhaus_panel.h +// Author: Peter Slattery +// Creation Date: 2019-12-26 +// +// Usage: +// Include this file in ONE file in your project. +// Define SetPanelDefinitionExternal +// +#ifndef FOLDHAUS_PANEL_H typedef struct panel panel; @@ -351,3 +350,7 @@ GetPanelContainingPoint(v2 Point, panel_system* PanelSystem, rect WindowBounds) } return Result; } + + +#define FOLDHAUS_PANEL_H +#endif // FOLDHAUS_PANEL_H \ No newline at end of file diff --git a/src/foldhaus_platform.h b/src/foldhaus_platform.h index fdadcdc..f9db978 100644 --- a/src/foldhaus_platform.h +++ b/src/foldhaus_platform.h @@ -1,9 +1,18 @@ +// +// File: foldhaus_platform.h +// Author: Peter Slattery +// Creation Date: 2020-01-01 +// +#ifndef FOLDHAUS_PLATFORM_H + #include +#include #define GS_LANGUAGE_NO_PROFILER_DEFINES #include #include "gs_platform.h" +#include #include #include @@ -151,3 +160,7 @@ struct context platform_send_to* PlatformSendTo; platform_close_socket* PlatformCloseSocket; }; + + +#define FOLDHAUS_PLATFORM_H +#endif // FOLDHAUS_PLATFORM_H \ No newline at end of file diff --git a/src/foldhaus_renderer.cpp b/src/foldhaus_renderer.cpp index dbec96d..7988e3e 100644 --- a/src/foldhaus_renderer.cpp +++ b/src/foldhaus_renderer.cpp @@ -1,3 +1,10 @@ +// +// File: foldhaus_renderer.cpp +// Author: Peter Slattery +// Creation Date: 2020-01-01 +// +#ifndef FOLDHAUS_RENDERER_CPP + internal render_command_buffer AllocateRenderCommandBuffer (u8* Memory, s32 Size, renderer_realloc* Realloc) { @@ -177,4 +184,7 @@ internal void ClearRenderBuffer (render_command_buffer* Buffer) { Buffer->CommandMemoryUsed = 0; -} \ No newline at end of file +} + +#define FOLDHAUS_RENDERER_CPP +#endif // FOLDHAUS_RENDERER_CPP \ No newline at end of file diff --git a/src/foldhaus_renderer.h b/src/foldhaus_renderer.h index 5de719a..b29130f 100644 --- a/src/foldhaus_renderer.h +++ b/src/foldhaus_renderer.h @@ -1,3 +1,10 @@ +// +// File: foldhaus_renderer.h +// Author: Peter Slattery +// Creation Date: 2020-01-01 +// +#ifndef FOLDHAUS_RENDERER_H + #define IMMEDIATE_MODE_RENDERING 0 struct camera @@ -24,17 +31,17 @@ GetCameraModelViewMatrix (camera Camera) r32 Z = Camera.Position.z; m44 RotationMatrix = M44( - CamRight.x, CamUp.x, CamForward.x, 0, - CamRight.y, CamUp.y, CamForward.y, 0, - CamRight.z, CamUp.z, CamForward.z, 0, - 0, 0, 0, 1); + CamRight.x, CamUp.x, CamForward.x, 0, + CamRight.y, CamUp.y, CamForward.y, 0, + CamRight.z, CamUp.z, CamForward.z, 0, + 0, 0, 0, 1); m44 PositionMatrix = M44( - 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - -X, -Y, -Z, 1 - ); + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + -X, -Y, -Z, 1 + ); m44 ModelViewMatrix = PositionMatrix * RotationMatrix; @@ -654,3 +661,7 @@ PushRenderBoundingBox2D (render_command_buffer* Buffer, v2 Min, v2 Max, r32 Thic PushQuad2DOnBatch(&Batch, v2{Max.x - Thickness, Min.y}, Max, Color); PushQuad2DOnBatch(&Batch, Min, v2{Max.x, Min.y + Thickness}, Color); } + + +#define FOLDHAUS_RENDERER_H +#endif // FOLDHAUS_RENDERER_H \ No newline at end of file diff --git a/src/foldhaus_sacn_view.cpp b/src/foldhaus_sacn_view.cpp index d7ab536..97c0b40 100644 --- a/src/foldhaus_sacn_view.cpp +++ b/src/foldhaus_sacn_view.cpp @@ -1,3 +1,10 @@ +// +// File: foldhaus_sacn_view.cpp +// Author: Peter Slattery +// Creation Date: 2020-01-01 +// +#ifndef FOLDHAUS_SACN_VIEW_CPP + internal void DrawSACNUniversePixels (render_command_buffer* RenderBuffer, sacn_universe* ToDraw, v2 TopLeft, v2 Dimension) @@ -30,4 +37,7 @@ DrawSACNUniversePixels (render_command_buffer* RenderBuffer, sacn_universe* ToDr ++PixelsDrawn; } -} \ No newline at end of file +} + +#define FOLDHAUS_SACN_VIEW_CPP +#endif // FOLDHAUS_SACN_VIEW_CPP \ No newline at end of file diff --git a/src/foldhaus_search_lister.cpp b/src/foldhaus_search_lister.cpp index ee42843..78734b5 100644 --- a/src/foldhaus_search_lister.cpp +++ b/src/foldhaus_search_lister.cpp @@ -1,3 +1,10 @@ +// +// File: foldhaus_search_lister.cpp +// Author: Peter Slattery +// Creation Date: 2020-01-01 +// +#ifndef FOLDHAUS_SEARCH_LISTER_CPP + internal b32 NamePassesFilter (string Target, string Filter) { @@ -42,3 +49,7 @@ GetPrevFilteredItem (search_lister SearchLister) s32 Result = GSMax(SearchLister.HotItem - 1, 0); return Result; } + + +#define FOLDHAUS_SEARCH_LISTER_CPP +#endif // FOLDHAUS_SEARCH_LISTER_CPP \ No newline at end of file diff --git a/src/foldhaus_search_lister.h b/src/foldhaus_search_lister.h index 0f3ed1d..8cc4d15 100644 --- a/src/foldhaus_search_lister.h +++ b/src/foldhaus_search_lister.h @@ -1,3 +1,10 @@ +// +// File: foldhaus_search_lister.h +// Author: Peter Slattery +// Creation Date: 2020-01-01 +// +#ifndef FOLDHAUS_SEARCH_LISTER_H + struct search_lister { // TODO(Peter): Giving up trying to just use the source list for now. At the moment @@ -18,3 +25,7 @@ struct search_lister string Filter; }; + + +#define FOLDHAUS_SEARCH_LISTER_H +#endif // FOLDHAUS_SEARCH_LISTER_H \ No newline at end of file diff --git a/src/foldhaus_text_entry.cpp b/src/foldhaus_text_entry.cpp index 5c442ee..7909f2e 100644 --- a/src/foldhaus_text_entry.cpp +++ b/src/foldhaus_text_entry.cpp @@ -1,3 +1,10 @@ +// +// File: foldhaus_text_entry.cpp +// Author: Peter Slattery +// Creation Date: 2020-01-01 +// +#ifndef FOLDHAUS_TEXT_ENTRY_CPP + internal void ResetTextInput (text_entry* Input) { @@ -226,3 +233,7 @@ InitializeTextInputCommands (input_command_registry* Commands, memory_arena* Per { KeyCode_GreaterThan, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \ { KeyCode_Tilde, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \ { KeyCode_BackQuote, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar } + + +#define FOLDHAUS_TEXT_ENTRY_CPP +#endif // FOLDHAUS_TEXT_ENTRY_CPP \ No newline at end of file diff --git a/src/foldhaus_text_entry.h b/src/foldhaus_text_entry.h index 7726784..dd8ba00 100644 --- a/src/foldhaus_text_entry.h +++ b/src/foldhaus_text_entry.h @@ -1,3 +1,10 @@ +// +// File: foldhaus_text_entry.h +// Author: Peter Slattery +// Creation Date: 2020-01-01 +// +#ifndef FOLDHAUS_TEXT_ENTRY_H + enum text_translation_type { TextTranslateTo_String, @@ -23,4 +30,7 @@ struct text_entry s32 CursorPosition; text_entry_destination Destination; -}; \ No newline at end of file +}; + +#define FOLDHAUS_TEXT_ENTRY_H +#endif // FOLDHAUS_TEXT_ENTRY_H \ No newline at end of file diff --git a/src/foldhaus_util_radialumia_file_converter.cpp b/src/foldhaus_util_radialumia_file_converter.cpp index be1c22e..32945dd 100644 --- a/src/foldhaus_util_radialumia_file_converter.cpp +++ b/src/foldhaus_util_radialumia_file_converter.cpp @@ -1,3 +1,10 @@ +// +// File: foldhaus_util_radialumia_file_converter.cpp +// Author: Peter Slattery +// Creation Date: 2020-01-01 +// +#ifndef FOLDHAUS_UTIL_RADIALUMIA_FILE_CONVERTER_CPP + #define DEBUG #define DEBUG_TRACK_SCOPE(name) @@ -364,4 +371,7 @@ int main(int ArgCount, char* Args[]) fclose(OutputFile); return 0; -} \ No newline at end of file +} + +#define FOLDHAUS_UTIL_RADIALUMIA_FILE_CONVERTER_CPP +#endif // FOLDHAUS_UTIL_RADIALUMIA_FILE_CONVERTER_CPP \ No newline at end of file diff --git a/src/gs_array.h b/src/gs_array.h index 37c9855..73ed151 100644 --- a/src/gs_array.h +++ b/src/gs_array.h @@ -1,3 +1,10 @@ +// +// File: gs_array.h +// Author: Peter Slattery +// Creation Date: 2020-01-01 +// +#ifndef GS_ARRAY_H + struct free_list { free_list* Next; @@ -31,12 +38,12 @@ struct array_entry_handle #define TYPEDEF_ARRAY(element_type) \ struct element_type##_array_entry { \ - s32 Generation; \ - union \ - { \ - element_type Entry; \ - free_list Free; \ - }; \ +s32 Generation; \ +union \ +{ \ + element_type Entry; \ + free_list Free; \ +}; \ }; \ \ struct element_type##_array \ @@ -50,180 +57,183 @@ struct element_type##_array \ \ internal void \ GrowBuffer(element_type##_array* Buffer) \ -{ \ - s32 NewBucketSize = sizeof(element_type##_array_entry) * Buffer->BucketSize; \ - element_type##_array_entry* NewBucket = (element_type##_array_entry*)malloc(NewBucketSize); \ - GSZeroMemory((u8*)NewBucket, NewBucketSize); \ - \ - s32 NewBucketIndex = Buffer->BucketCount++; \ - if (!Buffer->Buckets) \ - { \ - Buffer->Buckets = (element_type##_array_entry**)malloc(sizeof(element_type##_array_entry*)); \ - } \ - else \ - { \ - Buffer->Buckets = (element_type##_array_entry**)realloc(Buffer->Buckets, sizeof(element_type##_array_entry*) * Buffer->BucketCount); \ - } \ - Buffer->Buckets[NewBucketIndex] = NewBucket; \ -} \ -\ -internal element_type##_array_entry* \ -GetEntryAtIndex (s32 Index, element_type##_array Buffer) \ -{ \ - bucket_index BucketIndex = GetBucketIndexForIndex(Index, Buffer.BucketSize); \ - element_type##_array_entry* Entry = Buffer.Buckets[BucketIndex.Bucket] + BucketIndex.IndexInBucket; \ - return Entry; \ -} \ -\ -internal array_entry_handle \ -PushElement (element_type Data, element_type##_array* Buffer) \ -{ \ - array_entry_handle Result = {}; \ - \ - if (Buffer->FreeList.Next != &Buffer->FreeList) \ - { \ - free_list* FreeList = Buffer->FreeList.Next; \ - element_type##_array_entry* Entry = GetEntryAtIndex(FreeList->Index, *Buffer); \ - Buffer->FreeList.Next = Entry->Free.Next; \ - \ - Result.Index = Entry->Free.Index; \ - Result.Generation = Entry->Generation; \ - Entry->Entry = Data; \ - \ - ++Buffer->Used; \ - } \ - else \ - { \ - if (Buffer->Used >= Buffer->BucketSize * Buffer->BucketCount) \ - { \ - GrowBuffer(Buffer); \ - } \ - \ - s32 Index = Buffer->Used++; \ - s32 BucketIndex = Index / Buffer->BucketSize; \ - s32 IndexInBucket = Index % Buffer->BucketSize; \ - \ - Buffer->Buckets[BucketIndex][IndexInBucket].Entry = Data; \ - Result.Index = Index; \ - Result.Generation = Buffer->Buckets[BucketIndex][IndexInBucket].Generation; \ - } \ - \ - return Result; \ -} \ -\ -internal element_type* \ -GetElementAtIndex (s32 Index, element_type##_array Buffer) \ -{ \ - Assert(Index < Buffer.Used); \ - element_type##_array_entry* Entry = GetEntryAtIndex(Index, Buffer); \ - element_type* Result = &Entry->Entry; \ - return Result; \ -} \ -\ -internal element_type* \ -GetElementWithHandle (array_entry_handle Handle, element_type##_array Buffer) \ -{ \ - element_type* Result = 0; \ - \ - element_type##_array_entry* Entry = GetEntryAtIndex(Handle.Index, Buffer); \ - \ - if (Entry->Generation == Handle.Generation) \ - { \ - Result = &Entry->Entry; \ - } \ - \ - return Result; \ -} \ -\ -internal void \ -RemoveElementAtIndex (s32 Index, element_type##_array* Buffer) \ -{ \ - Assert(Index < Buffer->Used); \ - \ - element_type##_array_entry* Entry = GetEntryAtIndex(Index, *Buffer); \ - ++Entry->Generation; \ - Entry->Free.Index = Index; \ - \ - Entry->Free.Next = Buffer->FreeList.Next; \ - Buffer->FreeList.Next = &Entry->Free; \ - \ -} \ - -// END OF CRAZY MACRO - - + { \ + s32 NewBucketSize = sizeof(element_type##_array_entry) * Buffer->BucketSize; \ + element_type##_array_entry* NewBucket = (element_type##_array_entry*)malloc(NewBucketSize); \ + GSZeroMemory((u8*)NewBucket, NewBucketSize); \ + \ + s32 NewBucketIndex = Buffer->BucketCount++; \ + if (!Buffer->Buckets) \ + { \ + Buffer->Buckets = (element_type##_array_entry**)malloc(sizeof(element_type##_array_entry*)); \ + } \ + else \ + { \ + Buffer->Buckets = (element_type##_array_entry**)realloc(Buffer->Buckets, sizeof(element_type##_array_entry*) * Buffer->BucketCount); \ + } \ + Buffer->Buckets[NewBucketIndex] = NewBucket; \ + } \ + \ + internal element_type##_array_entry* \ + GetEntryAtIndex (s32 Index, element_type##_array Buffer) \ + { \ + bucket_index BucketIndex = GetBucketIndexForIndex(Index, Buffer.BucketSize); \ + element_type##_array_entry* Entry = Buffer.Buckets[BucketIndex.Bucket] + BucketIndex.IndexInBucket; \ + return Entry; \ + } \ + \ + internal array_entry_handle \ + PushElement (element_type Data, element_type##_array* Buffer) \ + { \ + array_entry_handle Result = {}; \ + \ + if (Buffer->FreeList.Next != &Buffer->FreeList) \ + { \ + free_list* FreeList = Buffer->FreeList.Next; \ + element_type##_array_entry* Entry = GetEntryAtIndex(FreeList->Index, *Buffer); \ + Buffer->FreeList.Next = Entry->Free.Next; \ + \ + Result.Index = Entry->Free.Index; \ + Result.Generation = Entry->Generation; \ + Entry->Entry = Data; \ + \ + ++Buffer->Used; \ + } \ + else \ + { \ + if (Buffer->Used >= Buffer->BucketSize * Buffer->BucketCount) \ + { \ + GrowBuffer(Buffer); \ + } \ + \ + s32 Index = Buffer->Used++; \ + s32 BucketIndex = Index / Buffer->BucketSize; \ + s32 IndexInBucket = Index % Buffer->BucketSize; \ + \ + Buffer->Buckets[BucketIndex][IndexInBucket].Entry = Data; \ + Result.Index = Index; \ + Result.Generation = Buffer->Buckets[BucketIndex][IndexInBucket].Generation; \ + } \ + \ + return Result; \ + } \ + \ + internal element_type* \ + GetElementAtIndex (s32 Index, element_type##_array Buffer) \ + { \ + Assert(Index < Buffer.Used); \ + element_type##_array_entry* Entry = GetEntryAtIndex(Index, Buffer); \ + element_type* Result = &Entry->Entry; \ + return Result; \ + } \ + \ + internal element_type* \ + GetElementWithHandle (array_entry_handle Handle, element_type##_array Buffer) \ + { \ + element_type* Result = 0; \ + \ + element_type##_array_entry* Entry = GetEntryAtIndex(Handle.Index, Buffer); \ + \ + if (Entry->Generation == Handle.Generation) \ + { \ + Result = &Entry->Entry; \ + } \ + \ + return Result; \ + } \ + \ + internal void \ + RemoveElementAtIndex (s32 Index, element_type##_array* Buffer) \ + { \ + Assert(Index < Buffer->Used); \ + \ + element_type##_array_entry* Entry = GetEntryAtIndex(Index, *Buffer); \ + ++Entry->Generation; \ + Entry->Free.Index = Index; \ + \ + Entry->Free.Next = Buffer->FreeList.Next; \ + Buffer->FreeList.Next = &Entry->Free; \ + \ + } \ + + // END OF CRAZY MACRO + + #define TYPEDEF_CONTIGUOUS_ARRAY(element_type) \ -struct element_type##_contiguous_array \ -{ \ - element_type** Buckets; \ - s32 BucketSize; \ - s32 BucketCount; \ - s32 Used; \ -}; \ -\ -internal void \ -GrowBuffer(element_type##_contiguous_array* Buffer) \ -{ \ - s32 NewBucketSize = sizeof(element_type) * Buffer->BucketSize; \ - element_type* NewBucket = (element_type*)malloc(NewBucketSize); \ - GSZeroMemory((u8*)NewBucket, NewBucketSize); \ - \ - s32 NewBucketIndex = Buffer->BucketCount++; \ - if (!Buffer->Buckets) \ - { \ - Buffer->Buckets = (element_type**)malloc(sizeof(element_type*)); \ - } \ - else \ - { \ - Buffer->Buckets = (element_type**)realloc(Buffer->Buckets, sizeof(element_type*) * Buffer->BucketCount); \ - } \ - Buffer->Buckets[NewBucketIndex] = NewBucket; \ -} \ -\ -internal element_type* \ -GetElementAtIndex (s32 Index, element_type##_contiguous_array Buffer) \ - { \ - element_type* Entry = 0; \ - if (Index <= Buffer.Used) \ - { \ -bucket_index BucketIndex = GetBucketIndexForIndex(Index, Buffer.BucketSize); \ - Entry = Buffer.Buckets[BucketIndex.Bucket] + BucketIndex.IndexInBucket; \ - } \ - return Entry; \ -} \ -\ -internal s32 \ -PushElement (element_type Data, element_type##_contiguous_array* Buffer) \ -{ \ - s32 Result = -1; \ - \ - if (Buffer->Used >= Buffer->BucketSize * Buffer->BucketCount) \ - { \ - GrowBuffer(Buffer); \ - } \ - \ - s32 Index = Buffer->Used++; \ - s32 BucketIndex = Index / Buffer->BucketSize; \ - s32 IndexInBucket = Index % Buffer->BucketSize; \ - \ - Buffer->Buckets[BucketIndex][IndexInBucket] = Data; \ - Result = Index; \ - return Result; \ -} \ -\ -internal void \ -RemoveElementAtIndex (s32 Index, element_type##_contiguous_array* Buffer) \ -{ \ - Assert(Index < Buffer->Used); \ - \ - bucket_index IndexToRemove = GetBucketIndexForIndex(Index, Buffer->BucketSize); \ - bucket_index LastIndex = GetBucketIndexForIndex(Buffer->Used - 1, Buffer->BucketSize); \ - element_type ValueAtLastIndex = Buffer->Buckets[LastIndex.Bucket][LastIndex.IndexInBucket]; \ - Buffer->Buckets[IndexToRemove.Bucket][IndexToRemove.IndexInBucket] = ValueAtLastIndex; \ - --Buffer->Used; \ -} \ - -// END OF CRAZY MACRO - -TYPEDEF_ARRAY(array_entry_handle); -TYPEDEF_CONTIGUOUS_ARRAY(array_entry_handle); \ No newline at end of file + struct element_type##_contiguous_array \ + { \ + element_type** Buckets; \ + s32 BucketSize; \ + s32 BucketCount; \ + s32 Used; \ + }; \ + \ + internal void \ + GrowBuffer(element_type##_contiguous_array* Buffer) \ + { \ + s32 NewBucketSize = sizeof(element_type) * Buffer->BucketSize; \ + element_type* NewBucket = (element_type*)malloc(NewBucketSize); \ + GSZeroMemory((u8*)NewBucket, NewBucketSize); \ + \ + s32 NewBucketIndex = Buffer->BucketCount++; \ + if (!Buffer->Buckets) \ + { \ + Buffer->Buckets = (element_type**)malloc(sizeof(element_type*)); \ + } \ + else \ + { \ + Buffer->Buckets = (element_type**)realloc(Buffer->Buckets, sizeof(element_type*) * Buffer->BucketCount); \ + } \ + Buffer->Buckets[NewBucketIndex] = NewBucket; \ + } \ + \ + internal element_type* \ + GetElementAtIndex (s32 Index, element_type##_contiguous_array Buffer) \ + { \ + element_type* Entry = 0; \ + if (Index <= Buffer.Used) \ + { \ + bucket_index BucketIndex = GetBucketIndexForIndex(Index, Buffer.BucketSize); \ + Entry = Buffer.Buckets[BucketIndex.Bucket] + BucketIndex.IndexInBucket; \ + } \ + return Entry; \ + } \ + \ + internal s32 \ + PushElement (element_type Data, element_type##_contiguous_array* Buffer) \ + { \ + s32 Result = -1; \ + \ + if (Buffer->Used >= Buffer->BucketSize * Buffer->BucketCount) \ + { \ + GrowBuffer(Buffer); \ + } \ + \ + s32 Index = Buffer->Used++; \ + s32 BucketIndex = Index / Buffer->BucketSize; \ + s32 IndexInBucket = Index % Buffer->BucketSize; \ + \ + Buffer->Buckets[BucketIndex][IndexInBucket] = Data; \ + Result = Index; \ + return Result; \ + } \ + \ + internal void \ + RemoveElementAtIndex (s32 Index, element_type##_contiguous_array* Buffer) \ + { \ + Assert(Index < Buffer->Used); \ + \ + bucket_index IndexToRemove = GetBucketIndexForIndex(Index, Buffer->BucketSize); \ + bucket_index LastIndex = GetBucketIndexForIndex(Buffer->Used - 1, Buffer->BucketSize); \ + element_type ValueAtLastIndex = Buffer->Buckets[LastIndex.Bucket][LastIndex.IndexInBucket]; \ + Buffer->Buckets[IndexToRemove.Bucket][IndexToRemove.IndexInBucket] = ValueAtLastIndex; \ + --Buffer->Used; \ + } \ + + // END OF CRAZY MACRO + + TYPEDEF_ARRAY(array_entry_handle); + TYPEDEF_CONTIGUOUS_ARRAY(array_entry_handle); + +#define GS_ARRAY_H +#endif // GS_ARRAY_H \ No newline at end of file diff --git a/src/gs_font.h b/src/gs_font.h index 66fe1b6..e6265dd 100644 --- a/src/gs_font.h +++ b/src/gs_font.h @@ -1,3 +1,10 @@ +// +// File: gs_font.h +// Author: Peter Slattery +// Creation Date: 2020-01-01 +// +#ifndef GS_FONT_H + #ifndef GS_FONT_H struct codepoint_bitmap @@ -118,4 +125,7 @@ NewLineYOffset (bitmap_font Font) } #define GS_FONT_H -#endif \ No newline at end of file +#endif + +#define GS_FONT_H +#endif // GS_FONT_H \ No newline at end of file diff --git a/src/gs_hashtable.h b/src/gs_hashtable.h index ab0c014..a3d733c 100644 --- a/src/gs_hashtable.h +++ b/src/gs_hashtable.h @@ -1 +1,11 @@ -// \ No newline at end of file +// +// File: gs_hashtable.h +// Author: Peter Slattery +// Creation Date: 2020-01-01 +// +#ifndef GS_HASHTABLE_H + +// + +#define GS_HASHTABLE_H +#endif // GS_HASHTABLE_H \ No newline at end of file diff --git a/src/gs_input.h b/src/gs_input.h index 30bebb5..f30d06c 100644 --- a/src/gs_input.h +++ b/src/gs_input.h @@ -1,3 +1,10 @@ +// +// File: gs_input.h +// Author: Peter Slattery +// Creation Date: 2020-01-01 +// +#ifndef GS_INPUT_H + enum key_state_flags { KeyState_WasDown = 1 << 0, @@ -108,4 +115,7 @@ MouseButtonHeldDown (b32 MouseButtonState) b32 WasDown = KeyWasDown(MouseButtonState); b32 IsDown = KeyIsDown(MouseButtonState); return (WasDown && IsDown); -} \ No newline at end of file +} + +#define GS_INPUT_H +#endif // GS_INPUT_H \ No newline at end of file diff --git a/src/gs_platform.h b/src/gs_platform.h index 9f1b5a7..360b43e 100644 --- a/src/gs_platform.h +++ b/src/gs_platform.h @@ -1,3 +1,10 @@ +// +// File: gs_platform.h +// Author: Peter Slattery +// Creation Date: 2020-01-01 +// +#ifndef GS_PLATFORM_H + #ifndef GS_PLATFORM_H #ifndef GS_LANGUAGE_H @@ -385,5 +392,8 @@ GetSecondsElapsed (s64 Start, s64 End, s64 PerformanceCountFrequency) return Result; } +#define GS_PLATFORM_H +#endif // GS_PLATFORM_H + #define GS_PLATFORM_H #endif // GS_PLATFORM_H \ No newline at end of file diff --git a/src/gs_win32.cpp b/src/gs_win32.cpp index fd89867..57b4680 100644 --- a/src/gs_win32.cpp +++ b/src/gs_win32.cpp @@ -1,3 +1,10 @@ +// +// File: gs_win32.cpp +// Author: Peter Slattery +// Creation Date: 2020-01-01 +// +#ifndef GS_WIN32_CPP + #ifndef GS_WIN32_CPP struct win32_state @@ -141,18 +148,18 @@ Win32CreateWindow (HINSTANCE HInstance, char* WindowName, s32 Width, s32 Height, if (RegisterClass(&Result.Class)) { Result.Handle = CreateWindowEx( - 0, - Result.Class.lpszClassName, - WindowName, - WS_OVERLAPPEDWINDOW | WS_VISIBLE, - CW_USEDEFAULT, - CW_USEDEFAULT, - Width, - Height, - 0, - 0, - HInstance, - 0); + 0, + Result.Class.lpszClassName, + WindowName, + WS_OVERLAPPEDWINDOW | WS_VISIBLE, + CW_USEDEFAULT, + CW_USEDEFAULT, + Width, + Height, + 0, + 0, + HInstance, + 0); Result.DeviceContext = GetDC(Result.Handle); } @@ -281,17 +288,17 @@ HandleWindowEventUnlessWouldUseDefault (HWND WindowHandle, UINT Msg, WPARAM wPar LRESULT CALLBACK Win32HandleWindowsEvents ( -HWND WindowHandle, -UINT Msg, -WPARAM wParam, -LPARAM lParam -) + HWND WindowHandle, + UINT Msg, + WPARAM wParam, + LPARAM lParam + ) { handle_window_event_result EventResult = HandleWindowEventUnlessWouldUseDefault( - WindowHandle, - Msg, - wParam, - lParam); + WindowHandle, + Msg, + wParam, + lParam); if (!EventResult.Handled) { @@ -409,8 +416,8 @@ Win32GetKeyCode (int Win32VirtualKey, bool NumpadValid, bool TranslateToChar) internal handle_window_msg_result HandleWindowsMessage ( -HWND WindowHandle, -MSG Message) + HWND WindowHandle, + MSG Message) { handle_window_msg_result Result = {}; Result.NeedsUpdate = 0; @@ -616,7 +623,7 @@ PLATFORM_REALLOC(Win32Realloc) u8* NewMemory = Win32BasicAlloc(NewSize); if (Base) { - GSMemCopy(Base, NewMemory, OldSize); + GSMemCopy(Base, NewMemory, OldSize); Win32Free(Base, OldSize); } return NewMemory; @@ -629,13 +636,13 @@ PLATFORM_READ_ENTIRE_FILE(Win32ReadEntireFile) Result.Error = PLATFORM_MEMORY_NO_ERROR; HANDLE FileHandle = CreateFileA ( - Path, - GENERIC_READ, - 0, - NULL, - OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL, - NULL); + Path, + GENERIC_READ, + 0, + NULL, + OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL, + NULL); if (FileHandle != INVALID_HANDLE_VALUE) { @@ -671,13 +678,13 @@ PLATFORM_WRITE_ENTIRE_FILE(Win32WriteEntireFile) { b32 Result = false; HANDLE FileHandle = CreateFileA ( - Path, - GENERIC_WRITE, - 0, - NULL, - CREATE_ALWAYS, - FILE_ATTRIBUTE_NORMAL, - NULL); + Path, + GENERIC_WRITE, + 0, + NULL, + CREATE_ALWAYS, + FILE_ATTRIBUTE_NORMAL, + NULL); if (FileHandle != INVALID_HANDLE_VALUE) { @@ -1014,5 +1021,8 @@ BindTexture (s32 TextureHandle) glBindTexture(GL_TEXTURE_2D, TextureHandle); } +#define GS_WIN32_CPP +#endif // GS_WIN32_CPP + #define GS_WIN32_CPP #endif // GS_WIN32_CPP \ No newline at end of file diff --git a/src/gs_win32.h b/src/gs_win32.h index 4ec8bb3..d23d0cc 100644 --- a/src/gs_win32.h +++ b/src/gs_win32.h @@ -1,3 +1,10 @@ +// +// File: gs_win32.h +// Author: Peter Slattery +// Creation Date: 2020-01-01 +// +#ifndef GS_WIN32_H + #ifndef GS_WIN32_H struct platform_font_info @@ -11,3 +18,7 @@ struct platform_font_info #define GS_WIN32_H #endif // GS_WIN32_H + + +#define GS_WIN32_H +#endif // GS_WIN32_H \ No newline at end of file diff --git a/src/interface.h b/src/interface.h index 52265ba..a1b0fcb 100644 --- a/src/interface.h +++ b/src/interface.h @@ -1,3 +1,10 @@ +// +// File: interface.h +// Author: Peter Slattery +// Creation Date: 2020-01-01 +// +#ifndef INTERFACE_H + enum string_alignment { Align_Left, @@ -612,4 +619,7 @@ EvaluateSearchLister (render_command_buffer* RenderBuffer, v2 TopLeft, v2 Dimens } return Result; -} \ No newline at end of file +} + +#define INTERFACE_H +#endif // INTERFACE_H \ No newline at end of file diff --git a/src/node/foldhaus_node_interface.cpp b/src/node/foldhaus_node_interface.cpp index 2e44c67..ccb1fe2 100644 --- a/src/node/foldhaus_node_interface.cpp +++ b/src/node/foldhaus_node_interface.cpp @@ -1,3 +1,9 @@ +// +// File: foldhaus_node_interface.cpp +// Author: Peter Slattery +// Creation Date: 2020-01-01 +// +#ifndef FOLHAUS_NODE_INTERFACE_CPP //////////////////////////////////////// // @@ -89,8 +95,8 @@ FOLDHAUS_INPUT_COMMAND_PROC(OpenNodeLister) for (s32 i = 0; i < OpState->SearchLister.SourceListCount; i++) { OpState->SearchLister.SourceList[i] = MakeString( - NodeSpecifications[i].Name, - NodeSpecifications[i].NameLength); + NodeSpecifications[i].Name, + NodeSpecifications[i].NameLength); } } OpState->SearchLister.Filter = MakeString(PushArray(&State->Modes.Arena, char, 64), 0, 64); @@ -217,8 +223,8 @@ internal void BeginDraggingNodePort(app_state* State, node_interaction Interaction) { operation_mode* DragNodePortMode = ActivateOperationModeWithCommands( - &State->Modes, - DragNodePortInputCommands); + &State->Modes, + DragNodePortInputCommands); DragNodePortMode->Render = RenderDraggingNodePort; drag_node_port_operation_state* OpState = CreateOperationState(DragNodePortMode, @@ -276,8 +282,8 @@ internal void BeginDraggingNode(app_state* State, node_interaction Interaction) { operation_mode* DragNodeMode = ActivateOperationModeWithCommands( - &State->Modes, - DragNodeInputCommands); + &State->Modes, + DragNodeInputCommands); DragNodeMode->Render = RenderDraggingNode; drag_node_operation_state* OpState = CreateOperationState(DragNodeMode, @@ -496,3 +502,7 @@ FOLDHAUS_INPUT_COMMAND_PROC(OpenNodeView) OpState->SelectedNodeHandle = 0; } + + +#define FOLHAUS_NODE_INTERFACE_CPP +#endif // FOLHAUS_NODE_INTERFACE_CPP diff --git a/src/panels/foldhaus_panel_animation_timeline.h b/src/panels/foldhaus_panel_animation_timeline.h index 73cbc55..e5f38ea 100644 --- a/src/panels/foldhaus_panel_animation_timeline.h +++ b/src/panels/foldhaus_panel_animation_timeline.h @@ -1,3 +1,10 @@ +// +// File: foldhaus_panel_animation_timeline.h +// Author: Peter Slattery +// Creation Date: 2020-01-01 +// +#ifndef FOLDHAUS_PANEL_ANIMATION_TIMELINE_H + // TODO // [x] - Moving animation blocks // [x] - dragging beginning and end of time blocks @@ -479,3 +486,6 @@ PANEL_RENDER_PROC(AnimationTimeline_Render) State->AnimationSystem.Time = 0; } } + +#define FOLDHAUS_PANEL_ANIMATION_TIMELINE_H +#endif // FOLDHAUS_PANEL_ANIMATION_TIMELINE_H \ No newline at end of file diff --git a/src/panels/foldhaus_panel_dmx_view.h b/src/panels/foldhaus_panel_dmx_view.h index 1986403..ec4de0c 100644 --- a/src/panels/foldhaus_panel_dmx_view.h +++ b/src/panels/foldhaus_panel_dmx_view.h @@ -1,3 +1,10 @@ +// +// File: foldhaus_panel_dmx_view.h +// Author: Peter Slattery +// Creation Date: 2020-01-01 +// +#ifndef FOLDHAUS_PANEL_DMX_VIEW_H + PANEL_INIT_PROC(DMXView_Init) { @@ -74,4 +81,8 @@ PANEL_RENDER_PROC(DMXView_Render) UniverseList = UniverseList->Next; } #endif -} \ No newline at end of file +} + + +#define FOLDHAUS_PANEL_DMX_VIEW_H +#endif // FOLDHAUS_PANEL_DMX_VIEW_H \ No newline at end of file diff --git a/src/panels/foldhaus_panel_hierarchy.h b/src/panels/foldhaus_panel_hierarchy.h index d659461..459feec 100644 --- a/src/panels/foldhaus_panel_hierarchy.h +++ b/src/panels/foldhaus_panel_hierarchy.h @@ -1,3 +1,10 @@ +// +// File: foldhaus_panel_hierarchy.h +// Author: Peter Slattery +// Creation Date: 2020-01-01 +// +#ifndef FOLDHAUS_PANEL_HIERARCHY_H + PANEL_INIT_PROC(HierarchyView_Init) { @@ -75,4 +82,8 @@ PANEL_RENDER_PROC(HierarchyView_Render) List.ListElementsCount++; } -} \ No newline at end of file +} + + +#define FOLDHAUS_PANEL_HIERARCHY_H +#endif // FOLDHAUS_PANEL_HIERARCHY_H diff --git a/src/panels/foldhaus_panel_node_graph.h b/src/panels/foldhaus_panel_node_graph.h index e23d745..1d5a3ec 100644 --- a/src/panels/foldhaus_panel_node_graph.h +++ b/src/panels/foldhaus_panel_node_graph.h @@ -1,3 +1,10 @@ +// +// File: foldhaus_panel_node_graph.h +// Author: Peter Slattery +// Creation Date: 2020-01-01 +// +#ifndef FOLDHAUS_PANEL_NODE_GRAPH_H + struct visual_node { node_specification Spec; @@ -127,14 +134,10 @@ FOLDHAUS_INPUT_COMMAND_PROC(EndConnectNodesOperation) visual_port UpstreamPort = (OpState->IsInput & IsInputMember) ? VisualPort : OpState->VisualPort; visual_port DownstreamPort = (OpState->IsInput & IsInputMember) ? OpState->VisualPort : VisualPort; - // Make Connection - pattern_node_connection Connection = {}; - Connection.UpstreamNodeHandle = UpstreamPort.SparseNodeHandle; - Connection.DownstreamNodeHandle = DownstreamPort.SparseNodeHandle; - Connection.UpstreamPortIndex = UpstreamPort.PortIndex; - Connection.DownstreamPortIndex = DownstreamPort.PortIndex; + PushNodeConnectionOnWorkspace(UpstreamPort.SparseNodeHandle, UpstreamPort.PortIndex, + DownstreamPort.SparseNodeHandle, DownstreamPort.PortIndex, + &State->NodeWorkspace, &State->Transient); - State->NodeWorkspace.Connections.PushElementOnBucket(Connection); GraphState->LayoutIsDirty = true; } } @@ -242,7 +245,7 @@ DrawNodePorts(node_specification Spec, b32 InputMask, v2 Position, r32 LineHeigh } internal void -DrawNode (v2 Position, node_specification NodeSpecification, r32 NodeWidth, r32 LineHeight, interface_config Interface, render_command_buffer* RenderBuffer, mouse_state Mouse) +DrawNode (v2 Position, node_specification NodeSpecification, gs_list_handle NodeHandle, r32 NodeWidth, r32 LineHeight, interface_config Interface, render_command_buffer* RenderBuffer, mouse_state Mouse, memory_arena* Scratch) { u32 InputMembers = 0; u32 OutputMembers = 0; @@ -269,8 +272,11 @@ DrawNode (v2 Position, node_specification NodeSpecification, r32 NodeWidth, r32 v2 TextOffset = v2{Interface.Margin.x, 0}; PushRenderQuad2D(RenderBuffer, LinePosition, LinePosition + v2{NodeWidth, LineHeight}, v4{1.f, .24f, .39f, 1.f}); + string NodeName = MakeString(NodeSpecification.Name, NodeSpecification.NameLength); - DrawString(RenderBuffer, NodeName, Interface.Font, LinePosition + TextOffset, WhiteV4); + string NodePrintName = MakeString(PushArray(Scratch, char, 256), 0, 256); + PrintF(&NodePrintName, "%S [%d]", NodeName, NodeHandle.Index); + DrawString(RenderBuffer, NodePrintName, Interface.Font, LinePosition + TextOffset, WhiteV4); LinePosition.y -= LineHeight; DrawNodePorts(NodeSpecification, IsInputMember, LinePosition, LineHeight, Align_Left, TextOffset, Interface, RenderBuffer, Mouse); @@ -299,57 +305,18 @@ GetVisualPortIndexForNode(gs_list_handle SparseNodeHandle, u32 PortIndex, node_l } internal node_layout -ArrangeNodes(pattern_node_workspace Workspace, r32 NodeWidth, r32 LayerDistance, r32 LineHeight, memory_arena* Storage) +ArrangeNodes(pattern_node_workspace Workspace, r32 NodeWidth, r32 LayerDistance, r32 LineHeight, memory_arena* Storage, app_state* State) { node_layout Result = {}; - Result.SparseToContiguousNodeMapCount = Workspace.Nodes.OnePastLastUsed; - Result.SparseToContiguousNodeMap = PushArray(Storage, s32, Result.SparseToContiguousNodeMapCount); - u32 DestinationIndex = 0; - Result.VisualPortsCount = 0; - for (u32 i = 0; i < Result.SparseToContiguousNodeMapCount; i++) + for (u32 n = 0; n < Workspace.Nodes.Used; n++) { - gs_list_entry* Entry = Workspace.Nodes.GetEntryAtIndex(i); - if (!EntryIsFree(Entry)) - { - Result.SparseToContiguousNodeMap[i] = DestinationIndex++; - - pattern_node Node = Entry->Value; - node_specification Spec = NodeSpecifications[Node.SpecificationIndex]; - Result.VisualPortsCount += Spec.MemberListLength; - } - else - { - Result.SparseToContiguousNodeMap[i] = -1; - } - } - - // Figure out how to arrange nodes - Result.LayerCount = 1; - - Result.VisualNodeLayers = PushArray(Storage, u32, Workspace.Nodes.Used); - GSZeroMemory((u8*)Result.VisualNodeLayers, sizeof(u32) * Workspace.Nodes.Used); - - for (u32 c = 0; c < Workspace.Connections.Used; c++) - { - pattern_node_connection Connection = *Workspace.Connections.GetElementAtIndex(c); + gs_list_handle NodeHandle = Workspace.SortedNodeHandles[n]; + pattern_node Node = *Workspace.Nodes.GetElementWithHandle(NodeHandle); - u32 UpstreamNodeLayerIndex = Result.SparseToContiguousNodeMap[Connection.UpstreamNodeHandle.Index]; - u32 DownstreamNodeLayerIndex = Result.SparseToContiguousNodeMap[Connection.DownstreamNodeHandle.Index]; - - u32 UpstreamNodeInitialLayer = Result.VisualNodeLayers[UpstreamNodeLayerIndex]; - u32 DownstreamNodeLayer = Result.VisualNodeLayers[DownstreamNodeLayerIndex]; - - Result.VisualNodeLayers[UpstreamNodeLayerIndex] = GSMax(UpstreamNodeInitialLayer, DownstreamNodeLayer + 1); - Result.LayerCount = GSMax(Result.VisualNodeLayers[UpstreamNodeLayerIndex] + 1, Result.LayerCount); - } - - // Place Layer Columns - Result.LayerPositions = PushArray(Storage, v2, Result.LayerCount); - for (u32 l = 0; l < Result.LayerCount; l++) - { - u32 FromRight = Result.LayerCount - l; - Result.LayerPositions[l] = v2{ (NodeWidth + LayerDistance) * FromRight, 0 }; + u32 SpecIndex = Node.SpecificationIndex; + node_specification Spec = NodeSpecifications[SpecIndex]; + Result.VisualPortsCount += Spec.MemberListLength; } // Place nodes and connections @@ -359,20 +326,17 @@ ArrangeNodes(pattern_node_workspace Workspace, r32 NodeWidth, r32 LayerDistance, u32 VisualPortsUsed = 0; Result.VisualPorts = PushArray(Storage, visual_port, Result.VisualPortsCount); - for (u32 n = 0; n < Result.SparseToContiguousNodeMapCount; n++) + for (u32 n = 0; n < Workspace.Nodes.Used; n++) { - u32 NodeIndex = Result.SparseToContiguousNodeMap[n]; - gs_list_entry* NodeEntry = Workspace.Nodes.GetEntryAtIndex(NodeIndex); - pattern_node Node = NodeEntry->Value; + gs_list_handle NodeHandle = Workspace.SortedNodeHandles[n]; + pattern_node Node = *Workspace.Nodes.GetElementWithHandle(NodeHandle); u32 SpecIndex = Node.SpecificationIndex; node_specification Spec = NodeSpecifications[SpecIndex]; - u32 NodeLayer = Result.VisualNodeLayers[n]; visual_node* VisualNode = Result.VisualNodes + n; VisualNode->Spec = Spec; - VisualNode->Position = Result.LayerPositions[NodeLayer]; - Result.LayerPositions[NodeLayer].y -= 200; + VisualNode->Position = v2{(1.5f * NodeWidth) * n, 0}; // NOTE(Peter): These start at 2 to account for the offset past the node title s32 InputsCount = 2; @@ -397,12 +361,14 @@ ArrangeNodes(pattern_node_workspace Workspace, r32 NodeWidth, r32 LayerDistance, PortBounds.Max = PortBounds.Min + v2{8, 8}; visual_port* VisualPort = Result.VisualPorts + VisualPortsUsed++; - VisualPort->SparseNodeHandle = NodeEntry->Handle; + VisualPort->SparseNodeHandle = NodeHandle; VisualPort->PortIndex = p; VisualPort->PortBounds = PortBounds; } } + Result.VisualConnectionsCount = 0; + Result.VisualConnectionsCount = Workspace.Connections.Used; Result.VisualConnections = PushArray(Storage, visual_connection, Result.VisualConnectionsCount); for (u32 c = 0; c < Workspace.Connections.Used; c++) @@ -450,7 +416,7 @@ PANEL_RENDER_PROC(NodeGraph_Render) ClearArena(&GraphState->LayoutMemory); GraphState->Layout = {}; - GraphState->Layout = ArrangeNodes(State->NodeWorkspace, NodeWidth, LayerDistance, LineHeight, &GraphState->LayoutMemory); + GraphState->Layout = ArrangeNodes(State->NodeWorkspace, NodeWidth, LayerDistance, LineHeight, &GraphState->LayoutMemory, State); GraphState->LayoutIsDirty = false; } @@ -463,6 +429,10 @@ PANEL_RENDER_PROC(NodeGraph_Render) v2 Start = GraphState->ViewOffset + Connection.UpstreamPosition; v2 End = GraphState->ViewOffset + Connection.DownstreamPosition; PushRenderLine2D(RenderBuffer, Start, End, 1.5f, WhiteV4); + + v2 TempDim = v2{6, 6}; + PushRenderQuad2D(RenderBuffer, Start - TempDim, Start + TempDim, PinkV4); + PushRenderQuad2D(RenderBuffer, End - TempDim, End + TempDim, YellowV4); } if (GraphState->Layout.ConnectionIsInProgress) @@ -476,7 +446,8 @@ PANEL_RENDER_PROC(NodeGraph_Render) for (u32 i = 0; i < GraphState->Layout.VisualNodesCount; i++) { visual_node VisualNode = GraphState->Layout.VisualNodes[i]; - DrawNode(VisualNode.Position + GraphState->ViewOffset, VisualNode.Spec, NodeWidth, LineHeight, State->Interface, RenderBuffer, Mouse); + gs_list_handle NodeHandle = State->NodeWorkspace.SortedNodeHandles[i]; + DrawNode(VisualNode.Position + GraphState->ViewOffset, VisualNode.Spec, NodeHandle, NodeWidth, LineHeight, State->Interface, RenderBuffer, Mouse, &State->Transient); } for (u32 p = 0; p < GraphState->Layout.VisualPortsCount; p++) @@ -529,7 +500,7 @@ PANEL_RENDER_PROC(NodeGraph_Render) if (MouseButtonTransitionedDown(Mouse.LeftButtonState) && PointIsInRect(Mouse.DownPos, ElementBounds)) { - PushNodeOnWorkspace(i, &State->NodeWorkspace); + PushNodeOnWorkspace(i, &State->NodeWorkspace, &State->Transient); GraphState->LayoutIsDirty = true; MouseHandled = true; } @@ -539,4 +510,8 @@ PANEL_RENDER_PROC(NodeGraph_Render) { BeginPanNodeGraph(State, {}, Mouse); } -} \ No newline at end of file +} + + +#define FOLDHAUS_PANEL_NODE_GRAPH_H +#endif // FOLDHAUS_PANEL_NODE_GRAPH_H diff --git a/src/panels/foldhaus_panel_profiler.h b/src/panels/foldhaus_panel_profiler.h index 29f27ab..5cd9c07 100644 --- a/src/panels/foldhaus_panel_profiler.h +++ b/src/panels/foldhaus_panel_profiler.h @@ -1,3 +1,10 @@ +// +// File: foldhaus_panel_profiler.h +// Author: Peter Slattery +// Creation Date: 2020-01-01 +// +#ifndef FOLDHAUS_PANEL_PROFILER_H + PANEL_INIT_PROC(ProfilerView_Init) { @@ -196,4 +203,8 @@ PANEL_RENDER_PROC(ProfilerView_Render) ViewModeMin, ViewModeMax, VisibleFrame, Memory); } -} \ No newline at end of file +} + + +#define FOLDHAUS_PANEL_PROFILER_H +#endif // FOLDHAUS_PANEL_PROFILER_H diff --git a/src/panels/foldhaus_panel_sculpture_view.h b/src/panels/foldhaus_panel_sculpture_view.h index b9f7809..0f04851 100644 --- a/src/panels/foldhaus_panel_sculpture_view.h +++ b/src/panels/foldhaus_panel_sculpture_view.h @@ -1,3 +1,9 @@ +// +// File: foldhaus_panel_sculpture_view.h +// Author: Peter Slattery +// Creation Date: 2020-01-01 +// +#ifndef FOLDHAUS_PANEL_SCULPTURE_VIEW_H // 3D Mouse View @@ -166,3 +172,6 @@ PANEL_RENDER_PROC(SculptureView_Render) Context.GeneralWorkQueue->DoQueueWorkUntilDone(Context.GeneralWorkQueue, 0); Context.GeneralWorkQueue->ResetWorkQueue(Context.GeneralWorkQueue); } + +#define FOLDHAUS_PANEL_SCULPTURE_VIEW_H +#endif // FOLDHAUS_PANEL_SCULPTURE_VIEW_H \ No newline at end of file diff --git a/src/sacn/sacn.h b/src/sacn/sacn.h index 7e406dc..f746710 100644 --- a/src/sacn/sacn.h +++ b/src/sacn/sacn.h @@ -1,3 +1,10 @@ +// +// File: sacn.h +// Author: Peter Slattery +// Creation Date: 2020-01-01 +// +#ifndef SACN_H + #define NETWORKINTID_INVALID -1 #define DEFAULT_STREAMING_ACN_PORT 5568 @@ -335,4 +342,8 @@ SACNGetUniverseSendAddress(s32 Universe) u_long V4Address = (u_long)UpackB4(MulticastAddressBuffer); return V4Address; -} \ No newline at end of file +} + + +#define SACN_H +#endif // SACN_H \ No newline at end of file diff --git a/src/test_patterns.h b/src/test_patterns.h index 0b34d54..d166956 100644 --- a/src/test_patterns.h +++ b/src/test_patterns.h @@ -1,3 +1,10 @@ +// +// File: test_patterns.h +// Author: Peter Slattery +// Creation Date: 2020-01-01 +// +#ifndef TEST_PATTERNS_H + NODE_STRUCT(solid_color_data) { @@ -111,4 +118,7 @@ NODE_PROC(RevolvingDiscs, revolving_discs_data) } LED++; } -} \ No newline at end of file +} + +#define TEST_PATTERNS_H +#endif // TEST_PATTERNS_H \ No newline at end of file diff --git a/src/win32_foldhaus.cpp b/src/win32_foldhaus.cpp index 92c39d7..a8c45d8 100644 --- a/src/win32_foldhaus.cpp +++ b/src/win32_foldhaus.cpp @@ -1,3 +1,10 @@ +// +// File: win32_foldhaus.cpp +// Author: Peter Slattery +// Creation Date: 2020-01-01 +// +#ifndef WIN32_FOLDHAUS_CPP + #include #include #include @@ -709,4 +716,7 @@ WinMain ( } return 0; -} \ No newline at end of file +} + +#define WIN32_FOLDHAUS_CPP +#endif // WIN32_FOLDHAUS_CPP \ No newline at end of file