vn/code/vn_workspace_editor.h

64 lines
1.5 KiB
C

/* date = May 13th 2023 6:20 pm */
#ifndef VN_WORKSPACE_EDITOR_H
#define VN_WORKSPACE_EDITOR_H
/* sixten(NOTE): Node types
*
* Text(String, opt. Character) -> Node
* Branch(Strings[0..n]) -> Nodes[0..n]
*
*/
enum workspace_editor_node_type
{
Workspace_EditorNode_None,
Workspace_EditorNode_Start,
Workspace_EditorNode_Text,
Workspace_EditorNode_Branch,
};
struct workspace_editor_node
{
workspace_editor_node_type Type;
workspace_editor_node *Next;
workspace_editor_node *Prev;
ui_box *Box;
ui_box *TitleBox;
ui_box *CloseBox;
v2 P;
};
struct workspace_editor_lister_dropdown
{
// sixten: Input field
char InputField[128];
s32 InputFieldUsed;
b32 InputFieldSelected;
// sixten: Properties
b32 Open;
v2 P;
};
//- sixten: Managing nodes
static workspace_editor_node *Workspace_GetNewEditorNode(struct workspace_view *View);
//- sixten: Transformations
inline v2 Workspace_ViewToWorld(v2 Offset, r32 Scale, v2 Dim, v2 P);
inline v2 Workspace_WorldToView(v2 Offset, r32 Scale, v2 Dim, v2 P);
inline r32 Workspace_CalculateScaleFromZoomLevel(r32 ZoomLevel);
//- sixten: Lister dropdown
static void Workspace_OpenListerDropdown(v2 MouseP);
//- sixten: Builder code
static void Workspace_BuildEditorListerDropdown(workspace_editor_lister_dropdown *ListerDropdown);
static void Workspace_EditorDrawCallback(render_group *Group, glyph_atlas *Atlas, ui_box *Box, void *Data);
static void Workspace_BuildEditor(struct workspace_view *View);
#endif //VN_WORKSPACE_EDITOR_H