Began implementing a file view panel

This commit is contained in:
Peter Slattery 2020-03-08 16:15:26 -07:00
parent 2fbc916c79
commit f3c308e8fd
4 changed files with 61 additions and 1 deletions

View File

@ -251,6 +251,7 @@ struct panel_definition
#include "panels/foldhaus_panel_animation_timeline.h"
#include "panels/foldhaus_panel_hierarchy.h"
#include "panels/foldhaus_panel_node_graph.h"
#include "panels/foldhaus_panel_file_view.h"
#include "generated/foldhaus_panels_generated.h"

View File

@ -1,5 +1,6 @@
global_variable s32 GlobalPanelDefsCount = 6;
global_variable s32 GlobalPanelDefsCount = 7;
global_variable panel_definition GlobalPanelDefs[] = {
{ "File View", 9, FileView_Init, FileView_Cleanup, FileView_Render, FileView_Commands, FileView_CommandsCount },
{ "Sculpture View", 14, SculptureView_Init, SculptureView_Cleanup, SculptureView_Render, SculptureView_Commands, SculptureView_CommandsCount },
{ "Animation Timeline", 18, AnimationTimeline_Init, AnimationTimeline_Cleanup, AnimationTimeline_Render, AnimationTimeline_Commands, AnimationTimeline_CommandsCount },
{ "Dmx View", 8, DMXView_Init, DMXView_Cleanup, DMXView_Render, DMXView_Commands, DMXView_CommandsCount },

View File

@ -1,5 +1,6 @@
enum gsm_meta_tag_type
{
MetaTag_panel_type_file_view,
MetaTag_panel_type_node_graph,
MetaTag_node_output,
MetaTag_node_struct,
@ -16,6 +17,7 @@ MetaTag_panel_render,
MetaTag_panel_type_dmx_view,
};
gsm_meta_tag MetaTagStrings[] = {
{ "panel_type_file_view", 20 },
{ "panel_type_node_graph", 21 },
{ "node_output", 11 },
{ "node_struct", 11 },

View File

@ -0,0 +1,56 @@
//
// File: foldhaus_panel_file_view.h
// Author: Peter Slattery
// Creation Date: 2020-03-08
//
#ifndef FOLDHAUS_PANEL_FILE_VIEW_H
struct file_view_state
{
string WorkingDirectory;
};
input_command* FileView_Commands = 0;
s32 FileView_CommandsCount = 0;
GSMetaTag(panel_init);
GSMetaTag(panel_type_file_view);
internal void
FileView_Init(panel* Panel, app_state* State)
{
// TODO: :FreePanelMemory
file_view_state* FileViewState = PushStruct(&State->Permanent, file_view_state);
FileViewState->WorkingDirectory = MakeString(PushArray(&State->Permanent, char, 256), 256);
PrintF(&FileViewState->WorkingDirectory, "C:\\");
Panel->PanelStateMemory = (u8*)FileViewState;
}
GSMetaTag(panel_cleanup);
GSMetaTag(panel_type_file_view);
internal void
FileView_Cleanup(panel* Panel, app_state* State)
{
}
GSMetaTag(panel_render);
GSMetaTag(panel_type_file_view);
internal void
FileView_Render(panel Panel, rect PanelBounds, render_command_buffer* RenderBuffer, app_state* State, context Context, mouse_state Mouse)
{
rect HeaderBounds = {0};
HeaderBounds.Min = {PanelBounds.Min.x, PanelBounds.Max.y - 32};
HeaderBounds.Max = PanelBounds.Max;
rect ListBounds = {0};
ListBounds.Min = PanelBounds.Min;
ListBounds.Max = BottomRight(HeaderBounds);
PushRenderQuad2D(RenderBuffer, RectExpand(HeaderBounds), PinkV4);
PushRenderQuad2D(RenderBuffer, RectExpand(ListBounds), RedV4);
}
#define FOLDHAUS_PANEL_FILE_VIEW_H
#endif // FOLDHAUS_PANEL_FILE_VIEW_H