Basic file lister functionality. Extended Win32EnumerateDirectory; it now includes folders if proper flags are set.
This commit is contained in:
parent
d08de9b99f
commit
15a2cb080e
|
@ -5,7 +5,7 @@
|
|||
//
|
||||
#ifndef FOLDHAUS_COMMAND_DISPATCH_H
|
||||
|
||||
#define FOLDHAUS_INPUT_COMMAND_PROC(name) void name(app_state* State, input_entry Event, mouse_state Mouse)
|
||||
#define FOLDHAUS_INPUT_COMMAND_PROC(name) void name(app_state* State, input_entry Event, mouse_state Mouse, context Context)
|
||||
typedef FOLDHAUS_INPUT_COMMAND_PROC(input_command_proc);
|
||||
|
||||
// NOTE(Peter): Helper function so I don't have to remember the parameters to this define
|
||||
|
|
|
@ -20,7 +20,7 @@ enum panel_edit_mode
|
|||
};
|
||||
|
||||
internal void
|
||||
SetPanelDefinition(panel* Panel, s32 NewPanelDefinitionIndex, app_state* State)
|
||||
SetPanelDefinition(panel* Panel, s32 NewPanelDefinitionIndex, app_state* State, context Context)
|
||||
{
|
||||
s32 OldPanelDefinitionIndex = Panel->PanelDefinitionIndex;
|
||||
Panel->PanelDefinitionIndex = NewPanelDefinitionIndex;
|
||||
|
@ -29,7 +29,7 @@ SetPanelDefinition(panel* Panel, s32 NewPanelDefinitionIndex, app_state* State)
|
|||
{
|
||||
GlobalPanelDefs[OldPanelDefinitionIndex].Cleanup(Panel, State);
|
||||
}
|
||||
GlobalPanelDefs[NewPanelDefinitionIndex].Init(Panel, State);
|
||||
GlobalPanelDefs[NewPanelDefinitionIndex].Init(Panel, State, Context);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -254,7 +254,7 @@ FOLDHAUS_INPUT_COMMAND_PROC(EndSplitPanelOperation)
|
|||
Panel->Left->Panel.PanelStateMemory = Panel->PanelStateMemory;
|
||||
Panel->Left->Panel.PanelStateMemorySize = Panel->PanelStateMemorySize;
|
||||
|
||||
SetPanelDefinition(&Panel->Right->Panel, Panel->PanelDefinitionIndex, State);
|
||||
SetPanelDefinition(&Panel->Right->Panel, Panel->PanelDefinitionIndex, State, Context);
|
||||
|
||||
DeactivateCurrentOperationMode(&State->Modes);
|
||||
}
|
||||
|
@ -400,7 +400,7 @@ DrawPanelBorder(panel Panel, v2 PanelMin, v2 PanelMax, v4 Color, mouse_state* Mo
|
|||
}
|
||||
|
||||
internal void
|
||||
DrawPanelFooter(panel* Panel, render_command_buffer* RenderBuffer, rect2 FooterBounds, mouse_state Mouse, app_state* State)
|
||||
DrawPanelFooter(panel* Panel, render_command_buffer* RenderBuffer, rect2 FooterBounds, mouse_state Mouse, app_state* State, context Context)
|
||||
{
|
||||
PushRenderQuad2D(RenderBuffer, FooterBounds.Min, v2{FooterBounds.Max.x, FooterBounds.Min.y + 25}, v4{.5f, .5f, .5f, 1.f});
|
||||
PushRenderQuad2D(RenderBuffer, FooterBounds.Min, FooterBounds.Min + v2{25, 25}, WhiteV4);
|
||||
|
@ -431,7 +431,7 @@ DrawPanelFooter(panel* Panel, render_command_buffer* RenderBuffer, rect2 FooterB
|
|||
gs_string DefName = MakeString(Def.PanelName, Def.PanelNameLength);
|
||||
if (ui_Button(&State->Interface, DefName, ButtonBounds))
|
||||
{
|
||||
SetPanelDefinition(Panel, i, State);
|
||||
SetPanelDefinition(Panel, i, State, Context);
|
||||
Panel->PanelSelectionMenuOpen = false;
|
||||
}
|
||||
|
||||
|
@ -464,7 +464,7 @@ RenderPanel(panel* Panel, rect2 PanelBounds, rect2 WindowBounds, render_command_
|
|||
Definition.Render(*Panel, PanelViewBounds, RenderBuffer, State, Context);
|
||||
|
||||
PushRenderOrthographic(RenderBuffer, WindowBounds);
|
||||
DrawPanelFooter(Panel, RenderBuffer, FooterBounds, Mouse, State);
|
||||
DrawPanelFooter(Panel, RenderBuffer, FooterBounds, Mouse, State, Context);
|
||||
}
|
||||
|
||||
internal void
|
||||
|
|
|
@ -9,7 +9,7 @@ typedef struct operation_mode operation_mode;
|
|||
|
||||
#define OPERATION_STATE_DEF(name) struct name
|
||||
|
||||
#define OPERATION_RENDER_PROC(name) void name(app_state* State, render_command_buffer* RenderBuffer, operation_mode Operation, mouse_state Mouse)
|
||||
#define OPERATION_RENDER_PROC(name) void name(app_state* State, render_command_buffer* RenderBuffer, operation_mode Operation, mouse_state Mouse, context Context)
|
||||
typedef OPERATION_RENDER_PROC(operation_render_proc);
|
||||
|
||||
struct operation_mode
|
||||
|
|
|
@ -152,7 +152,7 @@ OPERATION_RENDER_PROC(UpdateDragAnimationClip)
|
|||
animation_block* AnimationBlock = State->AnimationSystem.Blocks.GetElementWithHandle(State->SelectedAnimationBlockHandle);
|
||||
if (!AnimationBlock)
|
||||
{
|
||||
EndCurrentOperationMode(State, {}, Mouse);
|
||||
EndCurrentOperationMode(State, {}, Mouse, Context);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -274,7 +274,7 @@ s32 AnimationTimeline_CommandsCount = 2;
|
|||
GSMetaTag(panel_init);
|
||||
GSMetaTag(panel_type_animation_timeline);
|
||||
internal void
|
||||
AnimationTimeline_Init(panel* Panel, app_state* State)
|
||||
AnimationTimeline_Init(panel* Panel, app_state* State, context Context)
|
||||
{
|
||||
// TODO: :FreePanelMemory
|
||||
animation_timeline_state* TimelineState = PushStruct(&State->Permanent, animation_timeline_state);
|
||||
|
@ -293,7 +293,7 @@ AnimationTimeline_Cleanup(panel* Panel, app_state* State)
|
|||
internal void
|
||||
DrawFrameBar (animation_system* AnimationSystem, ui_interface Interface, frame_range VisibleFrames, rect2 BarBounds, app_state* State)
|
||||
{
|
||||
gs_string TempString = PushString(&State->Transient, 256);
|
||||
gs_string TempString = PushString(State->Transient, 256);
|
||||
|
||||
s32 VisibleFrameCount = VisibleFrames.Max - VisibleFrames.Min;
|
||||
|
||||
|
@ -455,7 +455,7 @@ DrawAnimationBlock (animation_block AnimationBlock, v4 BlockColor, frame_range V
|
|||
internal gs_list_handle
|
||||
DrawAnimationTimeline (animation_system* AnimationSystem, animation_timeline_state* TimelineState, rect2 PanelBounds, gs_list_handle SelectedBlockHandle, ui_interface* Interface, app_state* State)
|
||||
{
|
||||
gs_string Tempgs_string = PushString(&State->Transient, 256);
|
||||
gs_string Tempgs_string = PushString(State->Transient, 256);
|
||||
gs_list_handle Result = SelectedBlockHandle;
|
||||
|
||||
rect2 LayerMenuBounds, TimelineBounds;
|
||||
|
|
|
@ -18,7 +18,7 @@ s32 DMXView_CommandsCount = 0;
|
|||
GSMetaTag(panel_init);
|
||||
GSMetaTag(panel_type_dmx_view);
|
||||
internal void
|
||||
DMXView_Init(panel* Panel, app_state* State)
|
||||
DMXView_Init(panel* Panel, app_state* State, context Context)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -8,21 +8,51 @@
|
|||
struct file_view_state
|
||||
{
|
||||
gs_string WorkingDirectory;
|
||||
gs_memory_arena FileNamesArena;
|
||||
gs_file_info_array FileNames;
|
||||
};
|
||||
|
||||
input_command* FileView_Commands = 0;
|
||||
s32 FileView_CommandsCount = 0;
|
||||
|
||||
// TODO(pjs): 2 - On Change Dir function
|
||||
// - clears the memory arena
|
||||
// - enumerates the new directory in the memory arena
|
||||
|
||||
internal void
|
||||
FileViewUpdateWorkingDirectory(gs_const_string WorkingDirectory, file_view_state* State, context Context)
|
||||
{
|
||||
ClearArena(&State->FileNamesArena);
|
||||
|
||||
State->WorkingDirectory = PushString(&State->FileNamesArena, WorkingDirectory.Length + 2);
|
||||
PrintF(&State->WorkingDirectory, "%S", WorkingDirectory);
|
||||
if (State->WorkingDirectory.Str[State->WorkingDirectory.Length - 1] != '\\')
|
||||
{
|
||||
AppendPrintF(&State->WorkingDirectory, "\\");
|
||||
}
|
||||
if (State->WorkingDirectory.Str[State->WorkingDirectory.Length - 1] != '*')
|
||||
{
|
||||
AppendPrintF(&State->WorkingDirectory, "*");
|
||||
}
|
||||
|
||||
State->FileNames = EnumerateDirectory(Context.ThreadContext.FileHandler, &State->FileNamesArena, State->WorkingDirectory.ConstString, EnumerateDirectory_IncludeDirectories);
|
||||
}
|
||||
|
||||
GSMetaTag(panel_init);
|
||||
GSMetaTag(panel_type_file_view);
|
||||
internal void
|
||||
FileView_Init(panel* Panel, app_state* State)
|
||||
FileView_Init(panel* Panel, app_state* State, context Context)
|
||||
{
|
||||
// TODO: :FreePanelMemory
|
||||
file_view_state* FileViewState = PushStruct(&State->Permanent, file_view_state);
|
||||
Panel->PanelStateMemory = (u8*)FileViewState;
|
||||
FileViewState->FileNamesArena = CreateMemoryArena(Context.ThreadContext.Allocator);
|
||||
|
||||
#if 0
|
||||
FileViewState->WorkingDirectory = MakeString(PushArray(&State->Permanent, char, 256), 256);
|
||||
PrintF(&FileViewState->WorkingDirectory, "C:\\");
|
||||
Panel->PanelStateMemory = (u8*)FileViewState;
|
||||
#endif
|
||||
FileViewUpdateWorkingDirectory(ConstString("C:\\projects\\Lumenarium\\src\\app"), FileViewState, Context);
|
||||
}
|
||||
|
||||
GSMetaTag(panel_cleanup);
|
||||
|
@ -38,16 +68,21 @@ GSMetaTag(panel_type_file_view);
|
|||
internal void
|
||||
FileView_Render(panel Panel, rect2 PanelBounds, render_command_buffer* RenderBuffer, app_state* State, context Context)
|
||||
{
|
||||
rect2 HeaderBounds = {0};
|
||||
HeaderBounds.Min = {PanelBounds.Min.x, PanelBounds.Max.y - 32};
|
||||
HeaderBounds.Max = PanelBounds.Max;
|
||||
file_view_state* FileViewState = (file_view_state*)Panel.PanelStateMemory;
|
||||
ui_layout Layout = ui_CreateLayout(State->Interface, PanelBounds);
|
||||
|
||||
rect2 ListBounds = {0};
|
||||
ListBounds.Min = PanelBounds.Min;
|
||||
ListBounds.Max = RectBottomRight(HeaderBounds);
|
||||
// Header
|
||||
rect2 HeaderBounds = ui_ReserveElementBounds(&Layout);
|
||||
|
||||
// File Display
|
||||
for (u32 i = 0; i < FileViewState->FileNames.Count; i++)
|
||||
{
|
||||
gs_file_info File = FileViewState->FileNames.Values[i];
|
||||
gs_string PathString = PushString(State->Transient, File.Path.Length);
|
||||
PrintF(&PathString, "%S", File.Path);
|
||||
ui_LayoutDrawString(&State->Interface, &Layout, PathString, State->Interface.Style.TextColor);
|
||||
}
|
||||
|
||||
PushRenderQuad2D(RenderBuffer, HeaderBounds.Min, HeaderBounds.Max, PinkV4);
|
||||
PushRenderQuad2D(RenderBuffer, ListBounds.Min, ListBounds.Max, RedV4);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ s32 HierarchyView_CommandsCount = 0;
|
|||
GSMetaTag(panel_init);
|
||||
GSMetaTag(panel_type_hierarchy);
|
||||
internal void
|
||||
HierarchyView_Init(panel* Panel, app_state* State)
|
||||
HierarchyView_Init(panel* Panel, app_state* State, context Context)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -30,10 +30,10 @@ internal void
|
|||
HierarchyView_Render(panel Panel, rect2 PanelBounds, render_command_buffer* RenderBuffer, app_state* State, context Context)
|
||||
{
|
||||
ui_layout Layout = ui_CreateLayout(State->Interface, PanelBounds);
|
||||
gs_string Tempgs_string = PushString(&State->Transient, 256);
|
||||
gs_string TempString = PushString(State->Transient, 256);
|
||||
u32 LineCount = (u32)(Rect2Height(PanelBounds) / Layout.RowHeight) + 1;
|
||||
u32 AssembliesToDraw = Min(LineCount, State->Assemblies.Count);
|
||||
rect2* LineBounds = PushArray(&State->Transient, rect2, LineCount);
|
||||
rect2* LineBounds = PushArray(State->Transient, rect2, LineCount);
|
||||
|
||||
// Fill in alternating color rows for the backgrounds
|
||||
for (u32 Line = 0; Line < LineCount; Line++)
|
||||
|
@ -46,12 +46,12 @@ HierarchyView_Render(panel Panel, rect2 PanelBounds, render_command_buffer* Rend
|
|||
for (u32 AssemblyIndex = 0; AssemblyIndex < AssembliesToDraw; AssemblyIndex++)
|
||||
{
|
||||
assembly Assembly = State->Assemblies.Values[AssemblyIndex];
|
||||
PrintF(&Tempgs_string, "%S", Assembly.Name);
|
||||
PrintF(&TempString, "%S", Assembly.Name);
|
||||
|
||||
ui_layout ItemLayout = ui_CreateLayout(State->Interface, LineBounds[AssemblyIndex]);
|
||||
ui_StartRow(&ItemLayout, 2);
|
||||
{
|
||||
ui_LayoutDrawString(&State->Interface, &ItemLayout, Tempgs_string, State->Interface.Style.TextColor);
|
||||
ui_LayoutDrawString(&State->Interface, &ItemLayout, TempString, State->Interface.Style.TextColor);
|
||||
if (ui_LayoutListButton(&State->Interface, &ItemLayout, MakeString("X"), AssemblyIndex))
|
||||
{
|
||||
UnloadAssembly(AssemblyIndex, State, Context);
|
||||
|
@ -63,10 +63,10 @@ HierarchyView_Render(panel Panel, rect2 PanelBounds, render_command_buffer* Rend
|
|||
if (AssembliesToDraw < LineCount)
|
||||
{
|
||||
// NOTE(Peter): Add assembly button
|
||||
PrintF(&Tempgs_string, "+ Add Assembly");
|
||||
if (ui_ListButton(&State->Interface, Tempgs_string, LineBounds[AssembliesToDraw], AssembliesToDraw))
|
||||
PrintF(&TempString, "+ Add Assembly");
|
||||
if (ui_ListButton(&State->Interface, TempString, LineBounds[AssembliesToDraw], AssembliesToDraw))
|
||||
{
|
||||
gs_string FilePath = PushString(&State->Transient, 256);
|
||||
gs_string FilePath = PushString(State->Transient, 256);
|
||||
|
||||
// TODO(Peter): Took out file opening temporarily while I get things back up and running.
|
||||
// Ideally we can just write our own file lister using the new filehandler so that
|
||||
|
|
|
@ -11,7 +11,7 @@ s32 ProfilerView_CommandsCount = 0;
|
|||
GSMetaTag(panel_init);
|
||||
GSMetaTag(panel_type_profiler);
|
||||
internal void
|
||||
ProfilerView_Init(panel* Panel, app_state* State)
|
||||
ProfilerView_Init(panel* Panel, app_state* State, context Context)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -139,7 +139,7 @@ GSMetaTag(panel_type_profiler);
|
|||
internal void
|
||||
ProfilerView_Render(panel Panel, rect2 PanelBounds, render_command_buffer* RenderBuffer, app_state* State, context Context)
|
||||
{
|
||||
gs_memory_arena* Memory = &State->Transient;
|
||||
gs_memory_arena* Memory = State->Transient;
|
||||
gs_string String = PushString(Memory, 256);
|
||||
|
||||
v4 FrameColors[] = { GreenV4, YellowV4, RedV4, WhiteV4 };
|
||||
|
|
|
@ -55,7 +55,7 @@ global s32 SculptureView_CommandsCount = 1;
|
|||
GSMetaTag(panel_init);
|
||||
GSMetaTag(panel_type_sculpture_view);
|
||||
internal void
|
||||
SculptureView_Init(panel* Panel, app_state* State)
|
||||
SculptureView_Init(panel* Panel, app_state* State, context Context)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -175,7 +175,7 @@ SculptureView_Render(panel Panel, rect2 PanelBounds, render_command_buffer* Rend
|
|||
u32 NextLEDIndex = 0;
|
||||
for (u32 Job = 0; Job < JobsNeeded; Job++)
|
||||
{
|
||||
gs_data Data = PushSizeToData(&State->Transient, sizeof(draw_leds_job_data));
|
||||
gs_data Data = PushSizeToData(State->Transient, sizeof(draw_leds_job_data));
|
||||
draw_leds_job_data* JobData = (draw_leds_job_data*)Data.Memory;
|
||||
JobData->LedBuffer = *LedBuffer;
|
||||
JobData->StartIndex = NextLEDIndex;
|
||||
|
@ -207,7 +207,7 @@ SculptureView_Render(panel Panel, rect2 PanelBounds, render_command_buffer* Rend
|
|||
v4 LedPosition = LedBuffer->Positions[FocusPixel];
|
||||
v2 LedOnScreenPosition = SculptureView_WorldToScreenPosition(LedPosition, State->Camera, PanelBounds);
|
||||
|
||||
gs_string Tempgs_string = PushString(&State->Transient, 256);
|
||||
gs_string Tempgs_string = PushString(State->Transient, 256);
|
||||
PrintF(&Tempgs_string, "%f %f", LedOnScreenPosition.x, LedOnScreenPosition.y);
|
||||
DrawString(RenderBuffer, Tempgs_string, State->Interface.Style.Font, v2{PanelBounds.Min.x + 100, PanelBounds.Max.y - 200}, WhiteV4);
|
||||
|
||||
|
|
|
@ -52,12 +52,12 @@ INITIALIZE_APPLICATION(InitializeApplication)
|
|||
*State = {};
|
||||
|
||||
State->Permanent = CreateMemoryArena(Context.ThreadContext.Allocator);
|
||||
State->Transient = CreateMemoryArena(Context.ThreadContext.Allocator);
|
||||
State->Transient = Context.ThreadContext.Transient;
|
||||
|
||||
State->Assemblies.CountMax = 8;
|
||||
State->Assemblies.Values = PushArray(&State->Permanent, assembly, State->Assemblies.CountMax);
|
||||
|
||||
State->GlobalLog = PushStruct(&State->Transient, event_log);
|
||||
State->GlobalLog = PushStruct(State->Transient, event_log);
|
||||
*State->GlobalLog = {0};
|
||||
|
||||
s32 CommandQueueSize = 32;
|
||||
|
@ -154,10 +154,10 @@ INITIALIZE_APPLICATION(InitializeApplication)
|
|||
|
||||
#if 1
|
||||
gs_const_string SculpturePath = ConstString("data/blumen_lumen_v2.fold");
|
||||
LoadAssembly(&State->Assemblies, &State->LedSystem, &State->Transient, Context, SculpturePath, State->GlobalLog);
|
||||
LoadAssembly(&State->Assemblies, &State->LedSystem, State->Transient, Context, SculpturePath, State->GlobalLog);
|
||||
|
||||
SculpturePath = ConstString("data/radialumia_v2.fold");
|
||||
LoadAssembly(&State->Assemblies, &State->LedSystem, &State->Transient, Context, SculpturePath, State->GlobalLog);
|
||||
LoadAssembly(&State->Assemblies, &State->LedSystem, State->Transient, Context, SculpturePath, State->GlobalLog);
|
||||
#endif
|
||||
|
||||
State->PixelsToWorldScale = .01f;
|
||||
|
@ -184,11 +184,11 @@ INITIALIZE_APPLICATION(InitializeApplication)
|
|||
|
||||
InitializePanelSystem(&State->PanelSystem);
|
||||
panel* Panel = TakeNewPanel(&State->PanelSystem);
|
||||
SetPanelDefinition(Panel, PanelType_SculptureView, State);
|
||||
SetPanelDefinition(Panel, PanelType_SculptureView, State, Context);
|
||||
}
|
||||
|
||||
internal void
|
||||
HandleInput (app_state* State, rect2 WindowBounds, input_queue InputQueue, mouse_state Mouse)
|
||||
HandleInput (app_state* State, rect2 WindowBounds, input_queue InputQueue, mouse_state Mouse, context Context)
|
||||
{
|
||||
DEBUG_TRACK_FUNCTION;
|
||||
|
||||
|
@ -240,7 +240,7 @@ HandleInput (app_state* State, rect2 WindowBounds, input_queue InputQueue, mouse
|
|||
for (s32 CommandIdx = State->CommandQueue.Used - 1; CommandIdx >= 0; CommandIdx--)
|
||||
{
|
||||
command_queue_entry* Entry = &State->CommandQueue.Commands[CommandIdx];
|
||||
Entry->Command.Proc(State, Entry->Event, Mouse);
|
||||
Entry->Command.Proc(State, Entry->Event, Mouse, Context);
|
||||
}
|
||||
|
||||
ClearCommandQueue(&State->CommandQueue);
|
||||
|
@ -305,13 +305,13 @@ UPDATE_AND_RENDER(UpdateAndRender)
|
|||
// and need to persist beyond the end of the UpdateAndRender call. In the release version, we won't
|
||||
// zero the Transient arena when we clear it so it wouldn't be a problem, but it is technically
|
||||
// incorrect to clear the arena, and then access the memory later.
|
||||
ClearArena(&State->Transient);
|
||||
ClearArena(State->Transient);
|
||||
Context->Mouse.CursorType = CursorType_Arrow;
|
||||
|
||||
PushRenderClearScreen(RenderBuffer);
|
||||
State->Camera.AspectRatio = RectAspectRatio(Context->WindowBounds);
|
||||
|
||||
HandleInput(State, State->WindowBounds, InputQueue, Context->Mouse);
|
||||
HandleInput(State, State->WindowBounds, InputQueue, Context->Mouse, *Context);
|
||||
|
||||
if (State->AnimationSystem.TimelineShouldAdvance) {
|
||||
// TODO(Peter): Revisit this. This implies that the framerate of the animation system
|
||||
|
@ -331,9 +331,9 @@ UPDATE_AND_RENDER(UpdateAndRender)
|
|||
r32 FrameTime = CurrentFrame * State->AnimationSystem.SecondsPerFrame;
|
||||
|
||||
u32 CurrentBlocksMax = State->AnimationSystem.LayersCount;
|
||||
b8* CurrentBlocksFilled = PushArray(&State->Transient, b8, CurrentBlocksMax);
|
||||
b8* CurrentBlocksFilled = PushArray(State->Transient, b8, CurrentBlocksMax);
|
||||
ZeroArray(CurrentBlocksFilled, b8, CurrentBlocksMax);
|
||||
animation_block* CurrentBlocks = PushArray(&State->Transient, animation_block, CurrentBlocksMax);
|
||||
animation_block* CurrentBlocks = PushArray(State->Transient, animation_block, CurrentBlocksMax);
|
||||
|
||||
for (u32 i = 0; i < State->AnimationSystem.Blocks.Used; i++)
|
||||
{
|
||||
|
@ -345,7 +345,7 @@ UPDATE_AND_RENDER(UpdateAndRender)
|
|||
CurrentBlocks[Block.Layer] = Block;
|
||||
}
|
||||
|
||||
led_buffer* LayerLEDBuffers = PushArray(&State->Transient, led_buffer, CurrentBlocksMax);
|
||||
led_buffer* LayerLEDBuffers = PushArray(State->Transient, led_buffer, CurrentBlocksMax);
|
||||
for (u32 AssemblyIndex = 0; AssemblyIndex < State->Assemblies.Count; AssemblyIndex++)
|
||||
{
|
||||
assembly* Assembly = &State->Assemblies.Values[AssemblyIndex];
|
||||
|
@ -358,14 +358,14 @@ UPDATE_AND_RENDER(UpdateAndRender)
|
|||
|
||||
// Prep Temp Buffer
|
||||
LayerLEDBuffers[Layer] = *AssemblyLedBuffer;
|
||||
LayerLEDBuffers[Layer].Colors = PushArray(&State->Transient, pixel, AssemblyLedBuffer->LedCount);
|
||||
LayerLEDBuffers[Layer].Colors = PushArray(State->Transient, pixel, AssemblyLedBuffer->LedCount);
|
||||
|
||||
u32 FramesIntoBlock = CurrentFrame - Block.Range.Min;
|
||||
r32 SecondsIntoBlock = FramesIntoBlock * State->AnimationSystem.SecondsPerFrame;
|
||||
|
||||
u32 AnimationProcIndex = Block.AnimationProcHandle - 1;
|
||||
animation_proc* AnimationProc = GlobalAnimationClips[AnimationProcIndex].Proc;
|
||||
AnimationProc(&LayerLEDBuffers[Layer], *Assembly, SecondsIntoBlock, &State->Transient);
|
||||
AnimationProc(&LayerLEDBuffers[Layer], *Assembly, SecondsIntoBlock, State->Transient);
|
||||
}
|
||||
|
||||
// Consolidate Temp Buffers
|
||||
|
@ -468,7 +468,7 @@ UPDATE_AND_RENDER(UpdateAndRender)
|
|||
State->Interface.RenderBuffer = RenderBuffer;
|
||||
State->Interface.Mouse = Context->Mouse;
|
||||
|
||||
panel_layout PanelsToRender = GetPanelLayout(&State->PanelSystem, State->WindowBounds, &State->Transient);
|
||||
panel_layout PanelsToRender = GetPanelLayout(&State->PanelSystem, State->WindowBounds, State->Transient);
|
||||
DrawAllPanels(PanelsToRender, RenderBuffer, &Context->Mouse, State, *Context);
|
||||
|
||||
for (s32 m = 0; m < State->Modes.ActiveModesCount; m++)
|
||||
|
@ -476,7 +476,7 @@ UPDATE_AND_RENDER(UpdateAndRender)
|
|||
operation_mode OperationMode = State->Modes.ActiveModes[m];
|
||||
if (OperationMode.Render != 0)
|
||||
{
|
||||
OperationMode.Render(State, RenderBuffer, OperationMode, Context->Mouse);
|
||||
OperationMode.Render(State, RenderBuffer, OperationMode, Context->Mouse, *Context);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ enum network_protocol
|
|||
struct app_state
|
||||
{
|
||||
gs_memory_arena Permanent;
|
||||
gs_memory_arena Transient;
|
||||
gs_memory_arena* Transient;
|
||||
|
||||
// Engine
|
||||
//
|
||||
|
@ -212,7 +212,7 @@ FOLDHAUS_INPUT_COMMAND_PROC(EndCurrentOperationMode)
|
|||
DeactivateCurrentOperationMode(&State->Modes);
|
||||
}
|
||||
|
||||
#define PANEL_INIT_PROC(name) void name(panel* Panel, app_state* State)
|
||||
#define PANEL_INIT_PROC(name) void name(panel* Panel, app_state* State, context Context)
|
||||
typedef PANEL_INIT_PROC(panel_init_proc);
|
||||
|
||||
#define PANEL_CLEANUP_PROC(name) void name(panel* Panel, app_state* State)
|
||||
|
|
|
@ -252,6 +252,25 @@ struct temp_file_list
|
|||
temp_file_list_entry* Last;
|
||||
};
|
||||
|
||||
internal void
|
||||
Win32SetFileInfoFromFindFileData(gs_file_info* Info, WIN32_FIND_DATA FindFileData, gs_const_string SearchPath, gs_memory_arena* Storage)
|
||||
{
|
||||
u32 FileNameLength = CharArrayLength(FindFileData.cFileName);
|
||||
|
||||
// NOTE(Peter): String Storage
|
||||
// Storing the string in the final storage means we don't have to copy the string later, and all
|
||||
// strings will be continguous in memory at the calling site, though they will be before the array
|
||||
gs_string FileName = PushString(Storage, SearchPath.Length + FileNameLength + 1);
|
||||
PrintF(&FileName, "%S%.*s", SearchPath, FileName.Size, FindFileData.cFileName);
|
||||
NullTerminate(&FileName);
|
||||
|
||||
Info->FileSize = Win32HighLowToU64(FindFileData.nFileSizeLow, FindFileData.nFileSizeHigh);
|
||||
Info->CreationTime = Win32FileTimeToU64(FindFileData.ftCreationTime);
|
||||
Info->LastWriteTime = Win32FileTimeToU64(FindFileData.ftLastWriteTime);
|
||||
Info->Path = FileName.ConstString;
|
||||
Info->IsDirectory = HasFlag(FindFileData.dwFileAttributes, FILE_ATTRIBUTE_DIRECTORY);
|
||||
}
|
||||
|
||||
internal u32
|
||||
Win32EnumerateDirectoryIntoTempList(gs_file_handler FileHandler, temp_file_list* TempList, gs_const_string Path, gs_memory_arena* Storage, b32 Flags)
|
||||
{
|
||||
|
@ -266,6 +285,8 @@ Win32EnumerateDirectoryIntoTempList(gs_file_handler FileHandler, temp_file_list*
|
|||
{
|
||||
do
|
||||
{
|
||||
b32 AddFile = true;
|
||||
|
||||
if (HasFlag(FindFileData.dwFileAttributes, FILE_ATTRIBUTE_DIRECTORY))
|
||||
{
|
||||
if (HasFlag(Flags, EnumerateDirectory_Recurse))
|
||||
|
@ -280,29 +301,14 @@ Win32EnumerateDirectoryIntoTempList(gs_file_handler FileHandler, temp_file_list*
|
|||
}
|
||||
}
|
||||
|
||||
if (HasFlag(Flags, EnumerateDirectory_IncludeDirectories))
|
||||
{
|
||||
FilesCount += 1;
|
||||
}
|
||||
AddFile = HasFlag(Flags, EnumerateDirectory_IncludeDirectories);
|
||||
}
|
||||
else
|
||||
|
||||
if (AddFile)
|
||||
{
|
||||
temp_file_list_entry* File = PushStruct(FileHandler.Transient, temp_file_list_entry);
|
||||
File->Info.FileSize = Win32HighLowToU64(FindFileData.nFileSizeLow, FindFileData.nFileSizeHigh);
|
||||
File->Info.CreationTime = Win32FileTimeToU64(FindFileData.ftCreationTime);
|
||||
File->Info.LastWriteTime = Win32FileTimeToU64(FindFileData.ftLastWriteTime);
|
||||
File->Next = 0;
|
||||
|
||||
u32 FileNameLength = CharArrayLength(FindFileData.cFileName);
|
||||
|
||||
// NOTE(Peter): String Storage
|
||||
// Storing the string in the final storage means we don't have to copy the string later, and all
|
||||
// strings will be continguous in memory at the calling site, though they will be before the array
|
||||
gs_string FileName = PushString(Storage, SearchPath.Length + FileNameLength + 1);
|
||||
PrintF(&FileName, "%S%.*s", SearchPath, FileName.Size, FindFileData.cFileName);
|
||||
NullTerminate(&FileName);
|
||||
File->Info.Path = FileName.ConstString;
|
||||
|
||||
*File = {0};
|
||||
Win32SetFileInfoFromFindFileData(&File->Info, FindFileData, SearchPath, Storage);
|
||||
SLLPushOrInit(TempList->First, TempList->Last, File);
|
||||
FilesCount += 1;
|
||||
}
|
||||
|
|
|
@ -1861,35 +1861,7 @@ PrintFArgsList (gs_string* String, char* Format, va_list Args)
|
|||
{
|
||||
if (FormatAt[0] == '\\')
|
||||
{
|
||||
FormatAt++;
|
||||
Assert(IsBase8(FormatAt[0]) || // Octal Escape Sequences - \0 is in this set
|
||||
FormatAt[0] == '\'' ||
|
||||
FormatAt[0] == '\"' ||
|
||||
FormatAt[0] == '\?' ||
|
||||
FormatAt[0] == '\\' ||
|
||||
FormatAt[0] == 'a' || // Audible Bell
|
||||
FormatAt[0] == 'b' || // Backspace
|
||||
FormatAt[0] == 'f' || // Form Feed - New Page
|
||||
FormatAt[0] == 'n' || // Line Feed - New Line
|
||||
FormatAt[0] == 'r' || // Carriage Return
|
||||
FormatAt[0] == 't' || // Tab
|
||||
FormatAt[0] == 'v'); // Vertical Tab
|
||||
|
||||
// Not Handled (see cpp spec) \nnn \xnn \unnnn \Unnnnnnnn
|
||||
Assert(FormatAt[0] != 'x' || FormatAt[0] != 'u' || FormatAt[0] != 'U');
|
||||
|
||||
if (IsBase8(FormatAt[0]))
|
||||
{
|
||||
// TODO(Peter): this should keep going until it finds a non-octal character code
|
||||
// but the only one we really need is \0 atm so I'm just handling that one
|
||||
Assert(FormatAt[0] == '0');
|
||||
OutChar(String, (char)0);
|
||||
FormatAt++;
|
||||
}
|
||||
else
|
||||
{
|
||||
OutChar(String, *FormatAt++);
|
||||
}
|
||||
OutChar(String, *FormatAt++);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -772,6 +772,7 @@ struct gs_file_info
|
|||
u64 FileSize;
|
||||
u64 CreationTime;
|
||||
u64 LastWriteTime;
|
||||
b32 IsDirectory;
|
||||
};
|
||||
|
||||
struct gs_file_info_array
|
||||
|
|
Loading…
Reference in New Issue