Made modes work with hot code reloading, dealt with a bug in the search lister that allowed you to select an item from an empty list, pulled NodeRenderSettings back out into app_state, and generally filled out the operation mode system.
This commit is contained in:
parent
d90b275cff
commit
6c71c5a89d
|
@ -342,21 +342,13 @@ RELOAD_STATIC_DATA(ReloadStaticData)
|
||||||
|
|
||||||
GlobalDebugServices = DebugServices;
|
GlobalDebugServices = DebugServices;
|
||||||
|
|
||||||
if (State->InputCommandRegistry.Size > 0)
|
if (State->DefaultInputCommandRegistry.Size > 0)
|
||||||
{
|
{
|
||||||
RegisterKeyPressCommand(&State->InputCommandRegistry, KeyCode_MouseLeftButton, Command_Began | Command_Held | Command_Ended, KeyCode_Invalid,
|
RegisterKeyPressCommand(&State->DefaultInputCommandRegistry, KeyCode_MouseLeftButton, Command_Began, KeyCode_Invalid,
|
||||||
CameraMouseControl);
|
Begin3DViewMouseRotate);
|
||||||
RegisterKeyPressCommand(&State->InputCommandRegistry, KeyCode_U, Command_Began, KeyCode_Invalid, OpenUniverseView);
|
RegisterKeyPressCommand(&State->DefaultInputCommandRegistry, KeyCode_U, Command_Began, KeyCode_Invalid, OpenUniverseView);
|
||||||
RegisterKeyPressCommand(&State->InputCommandRegistry, KeyCode_A, Command_Began, KeyCode_Invalid, OpenNodeLister);
|
RegisterKeyPressCommand(&State->DefaultInputCommandRegistry, KeyCode_A, Command_Began, KeyCode_Invalid, OpenNodeLister);
|
||||||
RegisterKeyPressCommand(&State->InputCommandRegistry, KeyCode_Tab, Command_Began, KeyCode_Invalid, OpenNodeView);
|
RegisterKeyPressCommand(&State->DefaultInputCommandRegistry, KeyCode_Tab, Command_Began, KeyCode_Invalid, OpenNodeView);
|
||||||
|
|
||||||
// Node Lister
|
|
||||||
RegisterKeyPressCommand(&State->NodeListerCommandRegistry, KeyCode_DownArrow, Command_Began, KeyCode_Invalid, NodeListerNextItem);
|
|
||||||
RegisterKeyPressCommand(&State->NodeListerCommandRegistry, KeyCode_UpArrow, Command_Began, KeyCode_Invalid, NodeListerPrevItem);
|
|
||||||
RegisterKeyPressCommand(&State->NodeListerCommandRegistry, KeyCode_Enter, Command_Began, KeyCode_Invalid, SelectAndCloseNodeLister);
|
|
||||||
RegisterKeyPressCommand(&State->NodeListerCommandRegistry, KeyCode_MouseLeftButton, Command_Began, KeyCode_Invalid, CloseNodeLister);
|
|
||||||
RegisterKeyPressCommand(&State->NodeListerCommandRegistry, KeyCode_Esc, Command_Began, KeyCode_Invalid, CloseNodeLister);
|
|
||||||
InitializeTextInputCommands(&State->NodeListerCommandRegistry, State->Permanent);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -371,9 +363,7 @@ INITIALIZE_APPLICATION(InitializeApplication)
|
||||||
|
|
||||||
InitMemoryArena(&State->SACNMemory, 0, 0, Context.PlatformAlloc);
|
InitMemoryArena(&State->SACNMemory, 0, 0, Context.PlatformAlloc);
|
||||||
|
|
||||||
InitializeInputCommandRegistry(&State->InputCommandRegistry, 32, State->Permanent);
|
InitializeInputCommandRegistry(&State->DefaultInputCommandRegistry, 32, State->Permanent);
|
||||||
InitializeInputCommandRegistry(&State->NodeListerCommandRegistry, 128, State->Permanent);
|
|
||||||
State->ActiveCommands = &State->InputCommandRegistry;
|
|
||||||
|
|
||||||
s32 CommandQueueSize = 32;
|
s32 CommandQueueSize = 32;
|
||||||
command_queue_entry* CommandQueueMemory = PushArray(State->Permanent,
|
command_queue_entry* CommandQueueMemory = PushArray(State->Permanent,
|
||||||
|
@ -458,7 +448,6 @@ INITIALIZE_APPLICATION(InitializeApplication)
|
||||||
State->Camera.Far = 100.0f;
|
State->Camera.Far = 100.0f;
|
||||||
State->Camera.Position = v3{0, 0, -250};
|
State->Camera.Position = v3{0, 0, -250};
|
||||||
State->Camera.LookAt = v3{0, 0, 0};
|
State->Camera.LookAt = v3{0, 0, 0};
|
||||||
State->Camera_StartDragPos = V4(State->Camera.Position, 1);
|
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
char Path[] = "radialumia.fold";
|
char Path[] = "radialumia.fold";
|
||||||
|
@ -470,11 +459,13 @@ INITIALIZE_APPLICATION(InitializeApplication)
|
||||||
GlobalDebugServices->Interface.RenderSculpture = true;
|
GlobalDebugServices->Interface.RenderSculpture = true;
|
||||||
|
|
||||||
State->NodeList = AllocateNodeList(State->Permanent, Kilobytes(64));
|
State->NodeList = AllocateNodeList(State->Permanent, Kilobytes(64));
|
||||||
|
|
||||||
State->OutputNode = PushOutputNodeOnList(State->NodeList, v2{500, 250}, State->Permanent);
|
State->OutputNode = PushOutputNodeOnList(State->NodeList, v2{500, 250}, State->Permanent);
|
||||||
|
{
|
||||||
InitializeEmptyString(&State->GeneralPurposeSearchString, PushArray(State->Permanent, char, 256), 256);
|
State->NodeRenderSettings.PortColors[MemberType_r32] = RedV4;
|
||||||
|
State->NodeRenderSettings.PortColors[MemberType_s32] = GreenV4;
|
||||||
|
State->NodeRenderSettings.PortColors[MemberType_v4] = BlueV4;
|
||||||
|
State->NodeRenderSettings.Font = State->Font;
|
||||||
|
}
|
||||||
ReloadStaticData(Context, GlobalDebugServices);
|
ReloadStaticData(Context, GlobalDebugServices);
|
||||||
|
|
||||||
{ // MODES PLAYGROUND
|
{ // MODES PLAYGROUND
|
||||||
|
@ -497,14 +488,12 @@ UPDATE_AND_RENDER(UpdateAndRender)
|
||||||
ClearArena(State->Transient);
|
ClearArena(State->Transient);
|
||||||
|
|
||||||
{
|
{
|
||||||
input_command_registry* ActiveCommands = State->ActiveCommands;
|
input_command_registry ActiveCommands = State->DefaultInputCommandRegistry;
|
||||||
if (State->Modes.ActiveModesCount > 0)
|
if (State->Modes.ActiveModesCount > 0)
|
||||||
{
|
{
|
||||||
ActiveCommands = &State->Modes.ActiveModes[State->Modes.ActiveModesCount - 1].Commands;
|
ActiveCommands = State->Modes.ActiveModes[State->Modes.ActiveModesCount - 1].Commands;
|
||||||
}
|
}
|
||||||
|
|
||||||
ActivateQueuedCommandRegistry(State);
|
|
||||||
|
|
||||||
for (s32 EventIdx = 0; EventIdx < InputQueue.QueueUsed; EventIdx++)
|
for (s32 EventIdx = 0; EventIdx < InputQueue.QueueUsed; EventIdx++)
|
||||||
{
|
{
|
||||||
input_entry Event = InputQueue.Entries[EventIdx];
|
input_entry Event = InputQueue.Entries[EventIdx];
|
||||||
|
@ -514,15 +503,15 @@ UPDATE_AND_RENDER(UpdateAndRender)
|
||||||
// frame when the button was released, even if the command is registered to both events
|
// frame when the button was released, even if the command is registered to both events
|
||||||
if (KeyTransitionedDown(Event))
|
if (KeyTransitionedDown(Event))
|
||||||
{
|
{
|
||||||
FindAndPushExistingCommand(State->ActiveCommands, Event, Command_Began, &State->CommandQueue);
|
FindAndPushExistingCommand(ActiveCommands, Event, Command_Began, &State->CommandQueue);
|
||||||
}
|
}
|
||||||
else if (KeyTransitionedUp(Event))
|
else if (KeyTransitionedUp(Event))
|
||||||
{
|
{
|
||||||
FindAndPushExistingCommand(State->ActiveCommands, Event, Command_Ended, &State->CommandQueue);
|
FindAndPushExistingCommand(ActiveCommands, Event, Command_Ended, &State->CommandQueue);
|
||||||
}
|
}
|
||||||
else if (KeyHeldDown(Event))
|
else if (KeyHeldDown(Event))
|
||||||
{
|
{
|
||||||
FindAndPushExistingCommand(State->ActiveCommands, Event, Command_Held, &State->CommandQueue);
|
FindAndPushExistingCommand(ActiveCommands, Event, Command_Held, &State->CommandQueue);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Event.Key == KeyCode_MouseLeftButton)
|
if (Event.Key == KeyCode_MouseLeftButton)
|
||||||
|
@ -549,7 +538,7 @@ UPDATE_AND_RENDER(UpdateAndRender)
|
||||||
Entry->Command.Proc(State, Entry->Event, Mouse);
|
Entry->Command.Proc(State, Entry->Event, Mouse);
|
||||||
}
|
}
|
||||||
|
|
||||||
RemoveNonPersistantCommandsFromQueueAndUpdatePersistentEvents(&State->CommandQueue);
|
ClearCommandQueue(&State->CommandQueue);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (State->LEDBufferList)
|
if (State->LEDBufferList)
|
||||||
|
|
|
@ -49,6 +49,7 @@ struct assembly
|
||||||
typedef struct app_state app_state;
|
typedef struct app_state app_state;
|
||||||
|
|
||||||
#include "foldhaus_command_dispatch.h"
|
#include "foldhaus_command_dispatch.h"
|
||||||
|
#include "foldhaus_command_dispatch.cpp"
|
||||||
#include "foldhaus_operation_mode.h"
|
#include "foldhaus_operation_mode.h"
|
||||||
|
|
||||||
#include "foldhaus_text_entry.h"
|
#include "foldhaus_text_entry.h"
|
||||||
|
@ -67,15 +68,7 @@ struct app_state
|
||||||
|
|
||||||
operation_mode_system Modes;
|
operation_mode_system Modes;
|
||||||
|
|
||||||
input_command_registry InputCommandRegistry;
|
input_command_registry DefaultInputCommandRegistry;
|
||||||
// TODO(Peter): At the moment this is only still here because text input into nodes utilizes it.
|
|
||||||
// Get rid of this once Modes are working and you can switch all text input over to various modes
|
|
||||||
input_command_registry NodeListerCommandRegistry;
|
|
||||||
// NOTE(Peter): stores the address of the command registry to be activated next frame.
|
|
||||||
// was having a problem where switching command registry's in the middle of the loop trying to
|
|
||||||
// execute commands was causing problems.
|
|
||||||
input_command_registry* NextCommandRegistry;
|
|
||||||
input_command_registry* ActiveCommands;
|
|
||||||
|
|
||||||
input_command_queue CommandQueue;
|
input_command_queue CommandQueue;
|
||||||
text_entry ActiveTextEntry;
|
text_entry ActiveTextEntry;
|
||||||
|
@ -95,22 +88,18 @@ struct app_state
|
||||||
interface_config Interface;
|
interface_config Interface;
|
||||||
|
|
||||||
r32 PixelsToWorldScale;
|
r32 PixelsToWorldScale;
|
||||||
v4 Camera_StartDragPos;
|
|
||||||
|
|
||||||
node_list* NodeList;
|
node_list* NodeList;
|
||||||
interface_node* OutputNode;
|
interface_node* OutputNode;
|
||||||
|
|
||||||
node_render_settings NodeRenderSettings;
|
node_render_settings NodeRenderSettings;
|
||||||
|
|
||||||
string GeneralPurposeSearchString;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO(Peter): Once rendering nodes becomes an operation_mode you can get rid of this pre-declaration
|
|
||||||
internal void OpenColorPicker(app_state* State, v4* Address);
|
internal void OpenColorPicker(app_state* State, v4* Address);
|
||||||
|
|
||||||
#include "foldhaus_debug_visuals.h"
|
#include "foldhaus_debug_visuals.h"
|
||||||
#include "foldhaus_sacn_view.cpp"
|
#include "foldhaus_sacn_view.cpp"
|
||||||
#include "foldhaus_command_dispatch.cpp"
|
|
||||||
#include "foldhaus_node.cpp"
|
#include "foldhaus_node.cpp"
|
||||||
#include "foldhaus_text_entry.cpp"
|
#include "foldhaus_text_entry.cpp"
|
||||||
#include "foldhaus_search_lister.cpp"
|
#include "foldhaus_search_lister.cpp"
|
||||||
|
|
|
@ -42,29 +42,9 @@ InitializeCommandQueue(command_queue_entry* Memory, s32 MemorySize)
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
RemoveNonPersistantCommandsFromQueueAndUpdatePersistentEvents(input_command_queue* Queue)
|
ClearCommandQueue(input_command_queue* Queue)
|
||||||
{
|
{
|
||||||
#if 0
|
|
||||||
s32 PersistantCommandsCount = 0;
|
|
||||||
for (s32 i = 0; i < Queue->Used; i++)
|
|
||||||
{
|
|
||||||
command_queue_entry* Entry = Queue->Commands + i;
|
|
||||||
if (!Entry->RemoveOnExecute)
|
|
||||||
{
|
|
||||||
Entry->Event.State |= KeyState_WasDown;
|
|
||||||
// NOTE(Peter): If i == PersistantCommandsCount, then we don't need to copy the
|
|
||||||
// command anywhere
|
|
||||||
if (i != PersistantCommandsCount)
|
|
||||||
{
|
|
||||||
Queue->Commands[PersistantCommandsCount] = *Entry;
|
|
||||||
}
|
|
||||||
PersistantCommandsCount++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Queue->Used = PersistantCommandsCount;
|
|
||||||
#else
|
|
||||||
Queue->Used = 0;
|
Queue->Used = 0;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
|
@ -110,30 +90,14 @@ RemoveCommandFromQueue(input_command_queue* Queue, input_command Command, input_
|
||||||
RemoveCommandFromQueue(Queue, CommandIndex);
|
RemoveCommandFromQueue(Queue, CommandIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void
|
|
||||||
QueueNextFrameCommandRegistry (input_command_registry* NewRegistry, app_state* State)
|
|
||||||
{
|
|
||||||
State->NextCommandRegistry = NewRegistry;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void
|
|
||||||
ActivateQueuedCommandRegistry (app_state* State)
|
|
||||||
{
|
|
||||||
if (State->NextCommandRegistry)
|
|
||||||
{
|
|
||||||
State->ActiveCommands = State->NextCommandRegistry;
|
|
||||||
State->NextCommandRegistry = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal input_command*
|
internal input_command*
|
||||||
FindExistingCommand (input_command_registry* CommandRegistry, key_code Key, key_code Mdfr, b32 Flags)
|
FindExistingCommand (input_command_registry CommandRegistry, key_code Key, key_code Mdfr, b32 Flags)
|
||||||
{
|
{
|
||||||
input_command* Result = 0;
|
input_command* Result = 0;
|
||||||
|
|
||||||
for (s32 Cmd = 0; Cmd < CommandRegistry->Used; Cmd++)
|
for (s32 Cmd = 0; Cmd < CommandRegistry.Used; Cmd++)
|
||||||
{
|
{
|
||||||
input_command* Command = CommandRegistry->Commands + Cmd;
|
input_command* Command = CommandRegistry.Commands + Cmd;
|
||||||
if (Command->Key == Key && Command->Mdfr == Mdfr)
|
if (Command->Key == Key && Command->Mdfr == Mdfr)
|
||||||
{
|
{
|
||||||
b32 FlagsOverlap = Flags & Command->Flags;
|
b32 FlagsOverlap = Flags & Command->Flags;
|
||||||
|
@ -149,7 +113,7 @@ FindExistingCommand (input_command_registry* CommandRegistry, key_code Key, key_
|
||||||
}
|
}
|
||||||
|
|
||||||
internal b32
|
internal b32
|
||||||
FindAndPushExistingCommand(input_command_registry* CommandRegistry, input_entry Event, b32 Flags, input_command_queue* CommandQueue)
|
FindAndPushExistingCommand(input_command_registry CommandRegistry, input_entry Event, b32 Flags, input_command_queue* CommandQueue)
|
||||||
{
|
{
|
||||||
b32 CommandFound = false;
|
b32 CommandFound = false;
|
||||||
input_command* Command = FindExistingCommand(CommandRegistry, Event.Key, (key_code)0, Flags);
|
input_command* Command = FindExistingCommand(CommandRegistry, Event.Key, (key_code)0, Flags);
|
||||||
|
@ -168,7 +132,7 @@ RegisterKeyPressCommand (input_command_registry* CommandRegistry,
|
||||||
key_code Mdfr,
|
key_code Mdfr,
|
||||||
input_command_proc* Proc)
|
input_command_proc* Proc)
|
||||||
{
|
{
|
||||||
input_command* Command = FindExistingCommand(CommandRegistry, Key, Mdfr, Flags);
|
input_command* Command = FindExistingCommand(*CommandRegistry, Key, Mdfr, Flags);
|
||||||
|
|
||||||
if (!Command)
|
if (!Command)
|
||||||
{
|
{
|
||||||
|
@ -182,4 +146,4 @@ RegisterKeyPressCommand (input_command_registry* CommandRegistry,
|
||||||
Command->Flags = Flags;
|
Command->Flags = Flags;
|
||||||
Command->Mdfr = Mdfr;
|
Command->Mdfr = Mdfr;
|
||||||
Command->Proc = Proc;
|
Command->Proc = Proc;
|
||||||
}
|
}
|
|
@ -1,6 +1,9 @@
|
||||||
#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)
|
||||||
typedef FOLDHAUS_INPUT_COMMAND_PROC(input_command_proc);
|
typedef FOLDHAUS_INPUT_COMMAND_PROC(input_command_proc);
|
||||||
|
|
||||||
|
// NOTE(Peter): Helper function so I don't have to remember the parameters to this define
|
||||||
|
#define ExecFoldhausCommand(cmd) cmd(State, Event, Mouse)
|
||||||
|
|
||||||
enum input_command_flags
|
enum input_command_flags
|
||||||
{
|
{
|
||||||
Command_Began = 1 << 0,
|
Command_Began = 1 << 0,
|
||||||
|
@ -15,8 +18,8 @@ enum input_command_flags
|
||||||
struct input_command
|
struct input_command
|
||||||
{
|
{
|
||||||
key_code Key;
|
key_code Key;
|
||||||
b32 Flags;
|
|
||||||
key_code Mdfr;
|
key_code Mdfr;
|
||||||
|
b32 Flags;
|
||||||
input_command_proc* Proc;
|
input_command_proc* Proc;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -20,9 +20,17 @@ DrawDebugInterface (render_command_buffer* RenderBuffer, r32 StartX, interface_c
|
||||||
|
|
||||||
r32 FramesPerSecond = 1.0f / DeltaTime;
|
r32 FramesPerSecond = 1.0f / DeltaTime;
|
||||||
|
|
||||||
PrintF(&DebugString, "Framerate: %.*f s %d fps | Modes: %d Memory Used: %d / %d | Commands: %d",
|
string ModeName = MakeStringLiteral("Base Mode");
|
||||||
|
if (State->Modes.ActiveModesCount > 0 &&
|
||||||
|
State->Modes.ActiveModes[State->Modes.ActiveModesCount - 1].Name.Length > 0)
|
||||||
|
{
|
||||||
|
ModeName = State->Modes.ActiveModes[State->Modes.ActiveModesCount - 1].Name;
|
||||||
|
}
|
||||||
|
|
||||||
|
PrintF(&DebugString, "Framerate: %.*f s %d fps | Current Mode: %.*s Modes: %d Memory Used: %d / %d | Commands: %d",
|
||||||
5, DeltaTime,
|
5, DeltaTime,
|
||||||
(u32)FramesPerSecond,
|
(u32)FramesPerSecond,
|
||||||
|
ModeName.Length, ModeName.Memory,
|
||||||
State->Modes.ActiveModesCount,
|
State->Modes.ActiveModesCount,
|
||||||
State->Modes.Arena.CurrentRegion->Used,
|
State->Modes.Arena.CurrentRegion->Used,
|
||||||
State->Modes.Arena.CurrentRegion->Size,
|
State->Modes.Arena.CurrentRegion->Size,
|
||||||
|
|
|
@ -1,19 +1,3 @@
|
||||||
FOLDHAUS_INPUT_COMMAND_PROC(CameraMouseControl)
|
|
||||||
{
|
|
||||||
if (KeyTransitionedDown(Event))
|
|
||||||
{
|
|
||||||
State->Camera_StartDragPos = V4(State->Camera.Position, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
v2 TotalDeltaPos = Mouse.Pos - Mouse.DownPos;
|
|
||||||
|
|
||||||
m44 XRotation = GetXRotation(-TotalDeltaPos.y * State->PixelsToWorldScale);
|
|
||||||
m44 YRotation = GetYRotation(TotalDeltaPos.x * State->PixelsToWorldScale);
|
|
||||||
m44 Combined = XRotation * YRotation;
|
|
||||||
|
|
||||||
State->Camera.Position = V3(Combined * State->Camera_StartDragPos);
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////
|
////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Universe View
|
// Universe View
|
||||||
|
@ -22,6 +6,7 @@ FOLDHAUS_INPUT_COMMAND_PROC(CameraMouseControl)
|
||||||
|
|
||||||
struct universe_view_operation_state
|
struct universe_view_operation_state
|
||||||
{
|
{
|
||||||
|
b32 MouseDown;
|
||||||
v2 DisplayOffset;
|
v2 DisplayOffset;
|
||||||
r32 Zoom;
|
r32 Zoom;
|
||||||
};
|
};
|
||||||
|
@ -30,13 +15,26 @@ OPERATION_RENDER_PROC(RenderUniverseView)
|
||||||
{
|
{
|
||||||
DEBUG_TRACK_SCOPE(DrawUniverseOutputDisplay);
|
DEBUG_TRACK_SCOPE(DrawUniverseOutputDisplay);
|
||||||
|
|
||||||
// TODO(Peter): Pass this in as a parameter
|
|
||||||
universe_view_operation_state* OpState = (universe_view_operation_state*)Operation.OpStateMemory;
|
universe_view_operation_state* OpState = (universe_view_operation_state*)Operation.OpStateMemory;
|
||||||
|
|
||||||
string TitleBarString = InitializeEmptyString(PushArray(State->Transient, char, 64), 64);
|
string TitleBarString = InitializeEmptyString(PushArray(State->Transient, char, 64), 64);
|
||||||
|
|
||||||
v2 DisplayArea_Dimension = v2{600, 600};
|
v2 DisplayArea_Dimension = v2{600, 600};
|
||||||
|
|
||||||
v2 DisplayContents_Offset = OpState->DisplayOffset;
|
v2 DisplayContents_Offset = OpState->DisplayOffset;
|
||||||
|
|
||||||
|
//
|
||||||
|
// TODO(Peter): I don't like this. Dragging the Universe view should be an operation mode, just
|
||||||
|
// like rotating the 3D view, but modes don't have access to the state of modes above them in the stack
|
||||||
|
// (and attempting to cast those states to the appropriate type seems risky)
|
||||||
|
//
|
||||||
|
// :NeedToPassStateDownModeChain
|
||||||
|
//
|
||||||
|
if (OpState->MouseDown)
|
||||||
|
{
|
||||||
|
DisplayContents_Offset += (Mouse.Pos - Mouse.DownPos);
|
||||||
|
}
|
||||||
|
|
||||||
v2 DisplayArea_TopLeft = v2{300, (r32)RenderBuffer->ViewHeight - 50} + DisplayContents_Offset;
|
v2 DisplayArea_TopLeft = v2{300, (r32)RenderBuffer->ViewHeight - 50} + DisplayContents_Offset;
|
||||||
v2 UniverseDisplayDimension = v2{100, 100} * OpState->Zoom;
|
v2 UniverseDisplayDimension = v2{100, 100} * OpState->Zoom;
|
||||||
v2 Padding = v2{25, 50} * OpState->Zoom;
|
v2 Padding = v2{25, 50} * OpState->Zoom;
|
||||||
|
@ -82,19 +80,24 @@ OPERATION_RENDER_PROC(RenderUniverseView)
|
||||||
// TODO(Peter): Something isn't working with my laptop trackpad's zoom
|
// TODO(Peter): Something isn't working with my laptop trackpad's zoom
|
||||||
FOLDHAUS_INPUT_COMMAND_PROC(UniverseZoom)
|
FOLDHAUS_INPUT_COMMAND_PROC(UniverseZoom)
|
||||||
{
|
{
|
||||||
// TODO(Peter): Pass this in as a parameter
|
universe_view_operation_state* OpState = GetCurrentOperationState(State->Modes, universe_view_operation_state);
|
||||||
operation_mode Mode = State->Modes.ActiveModes[State->Modes.ActiveModesCount - 1];
|
|
||||||
universe_view_operation_state* OpState = (universe_view_operation_state*)Mode.OpStateMemory;
|
|
||||||
r32 DeltaZoom = (r32)(Mouse.Scroll) / 120;
|
r32 DeltaZoom = (r32)(Mouse.Scroll) / 120;
|
||||||
OpState->Zoom = GSClamp(0.1f, OpState->Zoom + DeltaZoom, 4.f);
|
OpState->Zoom = GSClamp(0.1f, OpState->Zoom + DeltaZoom, 4.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
FOLDHAUS_INPUT_COMMAND_PROC(UniverseViewPan)
|
FOLDHAUS_INPUT_COMMAND_PROC(UniverseViewEndPan)
|
||||||
{
|
{
|
||||||
// TODO(Peter): Pass this in as a parameter
|
// :NeedToPassStateDownModeChain
|
||||||
operation_mode Mode = State->Modes.ActiveModes[State->Modes.ActiveModesCount - 1];
|
universe_view_operation_state* OpState = GetCurrentOperationState(State->Modes, universe_view_operation_state);
|
||||||
universe_view_operation_state* OpState = (universe_view_operation_state*)Mode.OpStateMemory;
|
OpState->MouseDown = false;
|
||||||
OpState->DisplayOffset += Mouse.DeltaPos;
|
OpState->DisplayOffset = OpState->DisplayOffset + (Mouse.Pos - Mouse.DownPos);
|
||||||
|
}
|
||||||
|
|
||||||
|
FOLDHAUS_INPUT_COMMAND_PROC(UniverseViewBeginPan)
|
||||||
|
{
|
||||||
|
// :NeedToPassStateDownModeChain
|
||||||
|
universe_view_operation_state* OpState = GetCurrentOperationState(State->Modes, universe_view_operation_state);
|
||||||
|
OpState->MouseDown = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
FOLDHAUS_INPUT_COMMAND_PROC(CloseUniverseView)
|
FOLDHAUS_INPUT_COMMAND_PROC(CloseUniverseView)
|
||||||
|
@ -102,18 +105,17 @@ FOLDHAUS_INPUT_COMMAND_PROC(CloseUniverseView)
|
||||||
DeactivateCurrentOperationMode(&State->Modes);
|
DeactivateCurrentOperationMode(&State->Modes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
input_command UniverseViewCommands [] = {
|
||||||
|
{ KeyCode_MouseLeftButton, KeyCode_Invalid, Command_Began, UniverseViewBeginPan },
|
||||||
|
{ KeyCode_MouseLeftButton, KeyCode_Invalid, Command_Ended, UniverseViewEndPan },
|
||||||
|
{ KeyCode_U, KeyCode_Invalid, Command_Began, CloseUniverseView },
|
||||||
|
};
|
||||||
|
|
||||||
FOLDHAUS_INPUT_COMMAND_PROC(OpenUniverseView)
|
FOLDHAUS_INPUT_COMMAND_PROC(OpenUniverseView)
|
||||||
{
|
{
|
||||||
operation_mode* UniverseViewMode = ActivateOperationMode(&State->Modes);
|
operation_mode* UniverseViewMode = ActivateOperationModeWithCommands(&State->Modes, "Universe View", UniverseViewCommands);
|
||||||
UniverseViewMode->Render = RenderUniverseView;
|
UniverseViewMode->Render = RenderUniverseView;
|
||||||
|
|
||||||
{ // Mode Commands
|
|
||||||
InitializeInputCommandRegistry(&UniverseViewMode->Commands, 3, &State->Modes.Arena);
|
|
||||||
RegisterKeyPressCommand(&UniverseViewMode->Commands, KeyCode_MouseLeftButton, Command_Began | Command_Ended, KeyCode_Invalid, UniverseViewPan);
|
|
||||||
RegisterKeyPressCommand(&UniverseViewMode->Commands, KeyCode_U, Command_Began, KeyCode_Invalid, CloseUniverseView);
|
|
||||||
RegisterMouseWheelCommand(&UniverseViewMode->Commands, UniverseZoom);
|
|
||||||
}
|
|
||||||
|
|
||||||
// State Setup
|
// State Setup
|
||||||
universe_view_operation_state* OpState = CreateOperationState(UniverseViewMode,
|
universe_view_operation_state* OpState = CreateOperationState(UniverseViewMode,
|
||||||
&State->Modes,
|
&State->Modes,
|
||||||
|
@ -159,17 +161,13 @@ OPERATION_RENDER_PROC(RenderNodeLister)
|
||||||
|
|
||||||
FOLDHAUS_INPUT_COMMAND_PROC(NodeListerNextItem)
|
FOLDHAUS_INPUT_COMMAND_PROC(NodeListerNextItem)
|
||||||
{
|
{
|
||||||
// TODO(Peter): Pass this in as a parameter
|
node_lister_operation_state* OpState = GetCurrentOperationState(State->Modes, node_lister_operation_state);
|
||||||
operation_mode Mode = State->Modes.ActiveModes[State->Modes.ActiveModesCount - 1];
|
|
||||||
node_lister_operation_state* OpState = (node_lister_operation_state*)Mode.OpStateMemory;
|
|
||||||
OpState->SearchLister.HotItem = GetNextFilteredItem(OpState->SearchLister);
|
OpState->SearchLister.HotItem = GetNextFilteredItem(OpState->SearchLister);
|
||||||
}
|
}
|
||||||
|
|
||||||
FOLDHAUS_INPUT_COMMAND_PROC(NodeListerPrevItem)
|
FOLDHAUS_INPUT_COMMAND_PROC(NodeListerPrevItem)
|
||||||
{
|
{
|
||||||
// TODO(Peter): Pass this in as a parameter
|
node_lister_operation_state* OpState = GetCurrentOperationState(State->Modes, node_lister_operation_state);
|
||||||
operation_mode Mode = State->Modes.ActiveModes[State->Modes.ActiveModesCount - 1];
|
|
||||||
node_lister_operation_state* OpState = (node_lister_operation_state*)Mode.OpStateMemory;
|
|
||||||
OpState->SearchLister.HotItem = GetPrevFilteredItem(OpState->SearchLister);
|
OpState->SearchLister.HotItem = GetPrevFilteredItem(OpState->SearchLister);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -180,31 +178,29 @@ FOLDHAUS_INPUT_COMMAND_PROC(CloseNodeLister)
|
||||||
|
|
||||||
FOLDHAUS_INPUT_COMMAND_PROC(SelectAndCloseNodeLister)
|
FOLDHAUS_INPUT_COMMAND_PROC(SelectAndCloseNodeLister)
|
||||||
{
|
{
|
||||||
// TODO(Peter): Pass this in as a parameter
|
node_lister_operation_state* OpState = GetCurrentOperationState(State->Modes, node_lister_operation_state);
|
||||||
operation_mode Mode = State->Modes.ActiveModes[State->Modes.ActiveModesCount - 1];
|
|
||||||
node_lister_operation_state* OpState = (node_lister_operation_state*)Mode.OpStateMemory;
|
|
||||||
|
|
||||||
s32 FilteredNodeIndex = OpState->SearchLister.HotItem;
|
s32 FilteredNodeIndex = OpState->SearchLister.HotItem;
|
||||||
s32 NodeIndex = OpState->SearchLister.FilteredIndexLUT[FilteredNodeIndex];
|
if (FilteredNodeIndex >= 0)
|
||||||
PushNodeOnListFromSpecification(State->NodeList, NodeSpecifications[NodeIndex],
|
{
|
||||||
Mouse.Pos, State->Permanent);
|
s32 NodeIndex = OpState->SearchLister.FilteredIndexLUT[FilteredNodeIndex];
|
||||||
|
PushNodeOnListFromSpecification(State->NodeList, NodeSpecifications[NodeIndex],
|
||||||
|
Mouse.Pos, State->Permanent);
|
||||||
|
}
|
||||||
CloseNodeLister(State, Event, Mouse);
|
CloseNodeLister(State, Event, Mouse);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
input_command UniverseViewCommads [] = {
|
||||||
|
{ KeyCode_DownArrow, KeyCode_Invalid, Command_Began, NodeListerNextItem },
|
||||||
|
{ KeyCode_UpArrow, KeyCode_Invalid, Command_Began, NodeListerPrevItem },
|
||||||
|
{ KeyCode_Enter, KeyCode_Invalid, Command_Began, SelectAndCloseNodeLister },
|
||||||
|
{ KeyCode_MouseLeftButton, KeyCode_Invalid, Command_Began, CloseNodeLister },
|
||||||
|
{ KeyCode_Esc, KeyCode_Invalid, Command_Began, CloseNodeLister },
|
||||||
|
DEFAULT_TEXT_ENTRY_INPUT_COMMANDS_ARRAY_ENTRY,
|
||||||
|
};
|
||||||
|
|
||||||
FOLDHAUS_INPUT_COMMAND_PROC(OpenNodeLister)
|
FOLDHAUS_INPUT_COMMAND_PROC(OpenNodeLister)
|
||||||
{
|
{
|
||||||
// TODO(Peter): This won't work with hot code reloading
|
operation_mode* AddNodeOperation = ActivateOperationModeWithCommands(&State->Modes, "Node Lister", UniverseViewCommads);
|
||||||
operation_mode* AddNodeOperation = ActivateOperationMode(&State->Modes);
|
|
||||||
|
|
||||||
{ // Mode Commands
|
|
||||||
InitializeInputCommandRegistry(&AddNodeOperation->Commands, 128, &State->Modes.Arena);
|
|
||||||
RegisterKeyPressCommand(&AddNodeOperation->Commands, KeyCode_DownArrow, Command_Began, KeyCode_Invalid, NodeListerNextItem);
|
|
||||||
RegisterKeyPressCommand(&AddNodeOperation->Commands, KeyCode_UpArrow, Command_Began, KeyCode_Invalid, NodeListerPrevItem);
|
|
||||||
RegisterKeyPressCommand(&AddNodeOperation->Commands, KeyCode_Enter, Command_Began, KeyCode_Invalid, SelectAndCloseNodeLister);
|
|
||||||
RegisterKeyPressCommand(&AddNodeOperation->Commands, KeyCode_MouseLeftButton, Command_Began, KeyCode_Invalid, CloseNodeLister);
|
|
||||||
RegisterKeyPressCommand(&AddNodeOperation->Commands, KeyCode_Esc, Command_Began, KeyCode_Invalid, CloseNodeLister);
|
|
||||||
InitializeTextInputCommands(&AddNodeOperation->Commands, &State->Modes.Arena);
|
|
||||||
}
|
|
||||||
|
|
||||||
AddNodeOperation->Render = RenderNodeLister;
|
AddNodeOperation->Render = RenderNodeLister;
|
||||||
|
|
||||||
|
@ -222,8 +218,7 @@ FOLDHAUS_INPUT_COMMAND_PROC(OpenNodeLister)
|
||||||
NodeSpecifications[i].NameLength);
|
NodeSpecifications[i].NameLength);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
OpState->SearchLister.Filter = State->ActiveTextEntry.Buffer;
|
OpState->SearchLister.Filter = MakeString(PushArray(&State->Modes.Arena, char, 64), 0, 64);
|
||||||
|
|
||||||
|
|
||||||
OpState->SearchLister.FilteredListMax = OpState->SearchLister.SourceListCount;
|
OpState->SearchLister.FilteredListMax = OpState->SearchLister.SourceListCount;
|
||||||
OpState->SearchLister.FilteredListCount = 0;
|
OpState->SearchLister.FilteredListCount = 0;
|
||||||
|
@ -231,7 +226,7 @@ FOLDHAUS_INPUT_COMMAND_PROC(OpenNodeLister)
|
||||||
}
|
}
|
||||||
|
|
||||||
OpState->ListPosition = Mouse.Pos;
|
OpState->ListPosition = Mouse.Pos;
|
||||||
SetTextInputDestinationToString(&State->ActiveTextEntry, &State->GeneralPurposeSearchString);
|
SetTextInputDestinationToString(&State->ActiveTextEntry, &OpState->SearchLister.Filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////
|
////////////////////////////////////////
|
||||||
|
@ -253,7 +248,6 @@ CloseColorPicker(app_state* State)
|
||||||
|
|
||||||
OPERATION_RENDER_PROC(RenderColorPicker)
|
OPERATION_RENDER_PROC(RenderColorPicker)
|
||||||
{
|
{
|
||||||
// TODO(Peter): Pass this in as a parameter
|
|
||||||
color_picker_operation_state* OpState = (color_picker_operation_state*)Operation.OpStateMemory;
|
color_picker_operation_state* OpState = (color_picker_operation_state*)Operation.OpStateMemory;
|
||||||
|
|
||||||
|
|
||||||
|
@ -269,8 +263,7 @@ OPERATION_RENDER_PROC(RenderColorPicker)
|
||||||
internal void
|
internal void
|
||||||
OpenColorPicker(app_state* State, v4* ValueAddr)
|
OpenColorPicker(app_state* State, v4* ValueAddr)
|
||||||
{
|
{
|
||||||
// TODO(Peter): This won't work with hot code reloading
|
operation_mode* ColorPickerMode = ActivateOperationMode(&State->Modes, "Color Picker");
|
||||||
operation_mode* ColorPickerMode = ActivateOperationMode(&State->Modes);
|
|
||||||
ColorPickerMode->Render = RenderColorPicker;
|
ColorPickerMode->Render = RenderColorPicker;
|
||||||
|
|
||||||
color_picker_operation_state* OpState = CreateOperationState(ColorPickerMode,
|
color_picker_operation_state* OpState = CreateOperationState(ColorPickerMode,
|
||||||
|
@ -280,6 +273,142 @@ OpenColorPicker(app_state* State, v4* ValueAddr)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Node Field Text Edit
|
||||||
|
//
|
||||||
|
///////////////////////////////////////
|
||||||
|
|
||||||
|
FOLDHAUS_INPUT_COMMAND_PROC(EndNodeFieldTextEdit)
|
||||||
|
{
|
||||||
|
DeactivateCurrentOperationMode(&State->Modes);
|
||||||
|
}
|
||||||
|
|
||||||
|
input_command NodeFieldTextEditCommands [] = {
|
||||||
|
{ KeyCode_Enter, KeyCode_Invalid, Command_Began, EndNodeFieldTextEdit},
|
||||||
|
DEFAULT_TEXT_ENTRY_INPUT_COMMANDS_ARRAY_ENTRY,
|
||||||
|
};
|
||||||
|
|
||||||
|
internal void
|
||||||
|
BeginNodeFieldTextEdit(app_state* State, interface_node* Node, node_interaction Interaction)
|
||||||
|
{
|
||||||
|
operation_mode* NodeFieldTextEditMode = ActivateOperationModeWithCommands(&State->Modes,
|
||||||
|
"Node Field Text Edit",
|
||||||
|
NodeFieldTextEditCommands);
|
||||||
|
|
||||||
|
node_connection* Connection = Node->Connections + Interaction.InputValue;
|
||||||
|
struct_member_type InputType = Connection->Type;
|
||||||
|
if (InputType == MemberType_r32)
|
||||||
|
{
|
||||||
|
SetTextInputDestinationToFloat(&State->ActiveTextEntry, &Connection->R32Value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Node Port Mouse Drag
|
||||||
|
//
|
||||||
|
///////////////////////////////////////
|
||||||
|
|
||||||
|
struct drag_node_port_operation_state
|
||||||
|
{
|
||||||
|
node_interaction Interaction;
|
||||||
|
};
|
||||||
|
|
||||||
|
OPERATION_RENDER_PROC(RenderDraggingNodePort)
|
||||||
|
{
|
||||||
|
drag_node_port_operation_state* OpState = (drag_node_port_operation_state*)Operation.OpStateMemory;
|
||||||
|
UpdateDraggingNodePort(Mouse.Pos, OpState->Interaction, State->NodeList,
|
||||||
|
State->NodeRenderSettings, RenderBuffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
FOLDHAUS_INPUT_COMMAND_PROC(EndDraggingNodePort)
|
||||||
|
{
|
||||||
|
drag_node_port_operation_state* OpState = GetCurrentOperationState(State->Modes, drag_node_port_operation_state);
|
||||||
|
|
||||||
|
TryConnectNodes(OpState->Interaction, Mouse.Pos, State->NodeList, State->NodeRenderSettings);
|
||||||
|
DeactivateCurrentOperationMode(&State->Modes);
|
||||||
|
}
|
||||||
|
|
||||||
|
input_command DragNodePortInputCommands[] = {
|
||||||
|
{ KeyCode_MouseLeftButton, KeyCode_Invalid, Command_Ended, EndDraggingNodePort },
|
||||||
|
};
|
||||||
|
|
||||||
|
internal void
|
||||||
|
BeginDraggingNodePort(app_state* State, node_interaction Interaction)
|
||||||
|
{
|
||||||
|
operation_mode* DragNodePortMode = ActivateOperationModeWithCommands(
|
||||||
|
&State->Modes,
|
||||||
|
"Drag Node Port",
|
||||||
|
DragNodePortInputCommands);
|
||||||
|
DragNodePortMode->Render = RenderDraggingNodePort;
|
||||||
|
|
||||||
|
drag_node_port_operation_state* OpState = CreateOperationState(DragNodePortMode,
|
||||||
|
&State->Modes,
|
||||||
|
drag_node_port_operation_state);
|
||||||
|
OpState->Interaction = Interaction;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Node Field Mouse Drag
|
||||||
|
//
|
||||||
|
///////////////////////////////////////
|
||||||
|
|
||||||
|
OPERATION_RENDER_PROC(RenderDragNodeField)
|
||||||
|
{
|
||||||
|
// TODO(Peter):
|
||||||
|
//UpdateDraggingNodeValue(Mouse.Pos, Mouse.OldPos, OpState->Interaction, State->NodeList, State->NodeRenderSettings, State);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal void
|
||||||
|
BeginInteractWithNodeField(app_state* State, node_interaction Interaction)
|
||||||
|
{
|
||||||
|
// TODO(Peter):
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Node Field Mouse Drag
|
||||||
|
//
|
||||||
|
///////////////////////////////////////
|
||||||
|
|
||||||
|
struct drag_node_operation_state
|
||||||
|
{
|
||||||
|
node_interaction Interaction;
|
||||||
|
};
|
||||||
|
|
||||||
|
OPERATION_RENDER_PROC(RenderDraggingNode)
|
||||||
|
{
|
||||||
|
drag_node_operation_state* OpState = GetCurrentOperationState(State->Modes, drag_node_operation_state);
|
||||||
|
UpdateDraggingNode(Mouse.Pos, OpState->Interaction, State->NodeList,
|
||||||
|
State->NodeRenderSettings);
|
||||||
|
}
|
||||||
|
|
||||||
|
FOLDHAUS_INPUT_COMMAND_PROC(EndDraggingNode)
|
||||||
|
{
|
||||||
|
DeactivateCurrentOperationMode(&State->Modes);
|
||||||
|
}
|
||||||
|
|
||||||
|
input_command DragNodeInputCommands[] = {
|
||||||
|
{ KeyCode_MouseLeftButton, KeyCode_Invalid, Command_Ended, EndDraggingNode },
|
||||||
|
};
|
||||||
|
|
||||||
|
internal void
|
||||||
|
BeginDraggingNode(app_state* State, node_interaction Interaction)
|
||||||
|
{
|
||||||
|
operation_mode* DragNodeMode = ActivateOperationModeWithCommands(
|
||||||
|
&State->Modes,
|
||||||
|
"Drag Node",
|
||||||
|
DragNodeInputCommands);
|
||||||
|
DragNodeMode->Render = RenderDraggingNode;
|
||||||
|
|
||||||
|
drag_node_operation_state* OpState = CreateOperationState(DragNodeMode,
|
||||||
|
&State->Modes,
|
||||||
|
drag_node_operation_state);
|
||||||
|
OpState->Interaction = Interaction;
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////
|
////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Node View
|
// Node View
|
||||||
|
@ -288,75 +417,65 @@ OpenColorPicker(app_state* State, v4* ValueAddr)
|
||||||
|
|
||||||
struct node_view_operation_state
|
struct node_view_operation_state
|
||||||
{
|
{
|
||||||
node_interaction Interaction;
|
|
||||||
node_render_settings RenderSettings;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
FOLDHAUS_INPUT_COMMAND_PROC(NodeViewMousePickNode)
|
FOLDHAUS_INPUT_COMMAND_PROC(NodeViewBeginMouseDragInteraction)
|
||||||
{
|
{
|
||||||
// TODO(Peter): Pass this in as a parameter
|
node_view_operation_state* OpState = GetCurrentOperationState(State->Modes, node_view_operation_state);
|
||||||
operation_mode Mode = State->Modes.ActiveModes[State->Modes.ActiveModesCount - 1];
|
|
||||||
node_view_operation_state* OpState = (node_view_operation_state*)Mode.OpStateMemory;
|
|
||||||
|
|
||||||
if (Mouse.LeftButtonTransitionedDown)
|
node_offset Node = GetNodeUnderPoint(State->NodeList, Mouse.DownPos, State->NodeRenderSettings);
|
||||||
|
if (Node.Node)
|
||||||
{
|
{
|
||||||
node_offset Node = GetNodeUnderPoint(State->NodeList, Mouse.Pos, OpState->RenderSettings);
|
node_interaction NewInteraction = GetNodeInteractionType(Node.Node,
|
||||||
if (Node.Node)
|
Node.Offset,
|
||||||
|
Mouse.Pos,
|
||||||
|
State->NodeRenderSettings);
|
||||||
|
if (IsDraggingNodePort(NewInteraction))
|
||||||
{
|
{
|
||||||
OpState->Interaction = GetNodeInteractionType(Node.Node, Node.Offset, Mouse.Pos, OpState->RenderSettings);
|
BeginDraggingNodePort(State, NewInteraction);
|
||||||
|
}
|
||||||
|
else if(IsDraggingNodeValue(NewInteraction))
|
||||||
|
{
|
||||||
|
// TODO(Peter): This probably wants to live in a mouse held action
|
||||||
|
// the first frame we realize we're held over a field, just transition to
|
||||||
|
// drag node field
|
||||||
|
//BeginInteractWithNodeField(State, NewInteraction, State->NodeRenderSettings);
|
||||||
|
}
|
||||||
|
else // IsDraggingNode
|
||||||
|
{
|
||||||
|
BeginDraggingNode(State, NewInteraction);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (Mouse.LeftButtonTransitionedUp)
|
}
|
||||||
|
|
||||||
|
FOLDHAUS_INPUT_COMMAND_PROC(NodeViewBeginMouseSelectInteraction)
|
||||||
|
{
|
||||||
|
node_view_operation_state* OpState = GetCurrentOperationState(State->Modes, node_view_operation_state);
|
||||||
|
|
||||||
|
node_offset NodeOffset = GetNodeUnderPoint(State->NodeList, Mouse.Pos, State->NodeRenderSettings);
|
||||||
|
if (NodeOffset.Node)
|
||||||
{
|
{
|
||||||
if (IsDraggingNodePort(OpState->Interaction))
|
node_interaction NewInteraction = GetNodeInteractionType(NodeOffset.Node,
|
||||||
|
NodeOffset.Offset,
|
||||||
|
Mouse.Pos,
|
||||||
|
State->NodeRenderSettings);
|
||||||
|
if(IsDraggingNodeValue(NewInteraction))
|
||||||
{
|
{
|
||||||
TryConnectNodes(OpState->Interaction, Mouse.Pos, State->NodeList, OpState->RenderSettings);
|
BeginNodeFieldTextEdit(State, NodeOffset.Node, NewInteraction);
|
||||||
OpState->Interaction = NewEmptyNodeInteraction();
|
|
||||||
}
|
}
|
||||||
else if(IsDraggingNodeValue(OpState->Interaction))
|
|
||||||
{
|
|
||||||
// This is just a click
|
|
||||||
if (Mag(Mouse.DeltaPos) < 10)
|
|
||||||
{
|
|
||||||
node_interaction Interaction = OpState->Interaction;
|
|
||||||
interface_node* Node = GetNodeAtOffset(State->NodeList, Interaction.NodeOffset);
|
|
||||||
node_connection* Connection = Node->Connections + Interaction.InputValue;
|
|
||||||
struct_member_type InputType = Connection->Type;
|
|
||||||
if (InputType == MemberType_r32)
|
|
||||||
{
|
|
||||||
SetTextInputDestinationToFloat(&State->ActiveTextEntry, &Connection->R32Value);
|
|
||||||
// TODO(Peter): This is wrong, should be something to do with capturing text input
|
|
||||||
State->ActiveCommands = &State->NodeListerCommandRegistry;
|
|
||||||
}
|
|
||||||
OpState->Interaction = NewEmptyNodeInteraction();
|
|
||||||
}
|
|
||||||
else // This is the case where you dragged the value
|
|
||||||
{
|
|
||||||
OpState->Interaction = NewEmptyNodeInteraction();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
OpState->Interaction = NewEmptyNodeInteraction();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
OPERATION_RENDER_PROC(RenderNodeView)
|
OPERATION_RENDER_PROC(RenderNodeView)
|
||||||
{
|
{
|
||||||
// TODO(Peter): Pass this in as a parameter
|
|
||||||
node_view_operation_state* OpState = (node_view_operation_state*)Operation.OpStateMemory;
|
node_view_operation_state* OpState = (node_view_operation_state*)Operation.OpStateMemory;
|
||||||
|
|
||||||
UpdateDraggingNode(Mouse.Pos, OpState->Interaction, State->NodeList,
|
// TODO(Peter): Not sure we want to be doing Node Functionality updates in a mode. This should happen every
|
||||||
OpState->RenderSettings);
|
// frame regardless of whether or not we're viewing the nodes.
|
||||||
UpdateDraggingNodePort(Mouse.Pos, OpState->Interaction, State->NodeList,
|
// TODO(Peter): Make sure that RenderNodeList isn't also updating them!!
|
||||||
OpState->RenderSettings, RenderBuffer);
|
|
||||||
UpdateDraggingNodeValue(Mouse.Pos, Mouse.OldPos, OpState->Interaction, State->NodeList, OpState->RenderSettings, State);
|
|
||||||
|
|
||||||
ResetNodesUpdateState(State->NodeList);
|
ResetNodesUpdateState(State->NodeList);
|
||||||
|
|
||||||
RenderNodeList(State->NodeList, OpState->RenderSettings, RenderBuffer);
|
RenderNodeList(State->NodeList, State->NodeRenderSettings, RenderBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
FOLDHAUS_INPUT_COMMAND_PROC(CloseNodeView)
|
FOLDHAUS_INPUT_COMMAND_PROC(CloseNodeView)
|
||||||
|
@ -364,27 +483,63 @@ FOLDHAUS_INPUT_COMMAND_PROC(CloseNodeView)
|
||||||
DeactivateCurrentOperationMode(&State->Modes);
|
DeactivateCurrentOperationMode(&State->Modes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
input_command NodeViewCommands [] = {
|
||||||
|
{ KeyCode_Tab, KeyCode_Invalid, Command_Began, CloseNodeView},
|
||||||
|
{ KeyCode_A, KeyCode_Invalid, Command_Began, OpenNodeLister},
|
||||||
|
{ KeyCode_MouseLeftButton, KeyCode_Invalid, Command_Began, NodeViewBeginMouseDragInteraction},
|
||||||
|
{ KeyCode_MouseLeftButton, KeyCode_Invalid, Command_Ended, NodeViewBeginMouseSelectInteraction},
|
||||||
|
};
|
||||||
|
|
||||||
FOLDHAUS_INPUT_COMMAND_PROC(OpenNodeView)
|
FOLDHAUS_INPUT_COMMAND_PROC(OpenNodeView)
|
||||||
{
|
{
|
||||||
// TODO(Peter): This won't work with hot code reloading
|
operation_mode* NodeViewMode = ActivateOperationModeWithCommands(&State->Modes, "Node View", NodeViewCommands);
|
||||||
operation_mode* NodeViewMode = ActivateOperationMode(&State->Modes);
|
|
||||||
NodeViewMode->Render = RenderNodeView;
|
NodeViewMode->Render = RenderNodeView;
|
||||||
|
|
||||||
{ // Mode Commands
|
|
||||||
InitializeInputCommandRegistry(&NodeViewMode->Commands, 3, &State->Modes.Arena);
|
|
||||||
|
|
||||||
RegisterKeyPressCommand(&NodeViewMode->Commands, KeyCode_Tab, Command_Began, KeyCode_Invalid, CloseNodeView);
|
|
||||||
RegisterKeyPressCommand(&NodeViewMode->Commands, KeyCode_A, Command_Began, KeyCode_Invalid, OpenNodeLister);
|
|
||||||
RegisterKeyPressCommand(&NodeViewMode->Commands, KeyCode_MouseLeftButton, Command_Began | Command_Ended, KeyCode_Invalid,
|
|
||||||
NodeViewMousePickNode);
|
|
||||||
}
|
|
||||||
|
|
||||||
node_view_operation_state* OpState = CreateOperationState(NodeViewMode,
|
node_view_operation_state* OpState = CreateOperationState(NodeViewMode,
|
||||||
&State->Modes,
|
&State->Modes,
|
||||||
node_view_operation_state);
|
node_view_operation_state);
|
||||||
OpState->Interaction = NewEmptyNodeInteraction();
|
|
||||||
OpState->RenderSettings.PortColors[MemberType_r32] = RedV4;
|
|
||||||
OpState->RenderSettings.PortColors[MemberType_s32] = GreenV4;
|
|
||||||
OpState->RenderSettings.PortColors[MemberType_v4] = BlueV4;
|
|
||||||
OpState->RenderSettings.Font = State->Font;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// 3D View Mouse Rotate
|
||||||
|
//
|
||||||
|
///////////////////////////////////////
|
||||||
|
|
||||||
|
struct mouse_rotate_view_operation_state
|
||||||
|
{
|
||||||
|
v4 CameraStartPos;
|
||||||
|
};
|
||||||
|
|
||||||
|
OPERATION_RENDER_PROC(Update3DViewMouseRotate)
|
||||||
|
{
|
||||||
|
mouse_rotate_view_operation_state* OpState = (mouse_rotate_view_operation_state*)Operation.OpStateMemory;
|
||||||
|
|
||||||
|
v2 TotalDeltaPos = Mouse.Pos - Mouse.DownPos;
|
||||||
|
|
||||||
|
m44 XRotation = GetXRotation(-TotalDeltaPos.y * State->PixelsToWorldScale);
|
||||||
|
m44 YRotation = GetYRotation(TotalDeltaPos.x * State->PixelsToWorldScale);
|
||||||
|
m44 Combined = XRotation * YRotation;
|
||||||
|
|
||||||
|
State->Camera.Position = V3(Combined * OpState->CameraStartPos);
|
||||||
|
}
|
||||||
|
|
||||||
|
FOLDHAUS_INPUT_COMMAND_PROC(End3DViewMouseRotate)
|
||||||
|
{
|
||||||
|
DeactivateCurrentOperationMode(&State->Modes);
|
||||||
|
}
|
||||||
|
|
||||||
|
input_command MouseRotateViewCommands [] = {
|
||||||
|
{ KeyCode_MouseLeftButton, KeyCode_Invalid, Command_Ended, End3DViewMouseRotate},
|
||||||
|
};
|
||||||
|
|
||||||
|
FOLDHAUS_INPUT_COMMAND_PROC(Begin3DViewMouseRotate)
|
||||||
|
{
|
||||||
|
operation_mode* RotateViewMode = ActivateOperationModeWithCommands(&State->Modes, "Rotate 3D View", MouseRotateViewCommands);
|
||||||
|
RotateViewMode->Render = Update3DViewMouseRotate;
|
||||||
|
|
||||||
|
mouse_rotate_view_operation_state* OpState = CreateOperationState(RotateViewMode,
|
||||||
|
&State->Modes,
|
||||||
|
mouse_rotate_view_operation_state);
|
||||||
|
OpState->CameraStartPos = V4(State->Camera.Position, 1);
|
||||||
|
}
|
|
@ -8,6 +8,8 @@ struct operation_mode
|
||||||
input_command_registry Commands;
|
input_command_registry Commands;
|
||||||
operation_render_proc* Render;
|
operation_render_proc* Render;
|
||||||
u8* OpStateMemory;
|
u8* OpStateMemory;
|
||||||
|
|
||||||
|
string Name;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define OPERATION_MODES_MAX 32
|
#define OPERATION_MODES_MAX 32
|
||||||
|
@ -23,15 +25,40 @@ struct operation_mode_system
|
||||||
};
|
};
|
||||||
|
|
||||||
internal operation_mode*
|
internal operation_mode*
|
||||||
ActivateOperationMode (operation_mode_system* System)
|
ActivateOperationMode (operation_mode_system* System, char* ModeName)
|
||||||
{
|
{
|
||||||
Assert(System->ActiveModesCount < OPERATION_MODES_MAX);
|
Assert(System->ActiveModesCount < OPERATION_MODES_MAX);
|
||||||
s32 ModeIndex = System->ActiveModesCount++;
|
s32 ModeIndex = System->ActiveModesCount++;
|
||||||
System->ActiveModes[ModeIndex] = {};
|
|
||||||
System->ModeMemorySnapshots[ModeIndex] = TakeSnapshotOfArena(System->Arena);
|
System->ModeMemorySnapshots[ModeIndex] = TakeSnapshotOfArena(System->Arena);
|
||||||
|
|
||||||
|
operation_mode NewMode = {};
|
||||||
|
s32 NameLength = CharArrayLength(ModeName);
|
||||||
|
NewMode.Name = MakeString(PushArray(&System->Arena, char, NameLength), 0, NameLength);
|
||||||
|
CopyCharArrayToString(ModeName, &NewMode.Name);
|
||||||
|
System->ActiveModes[ModeIndex] = NewMode;
|
||||||
|
|
||||||
return &System->ActiveModes[ModeIndex];
|
return &System->ActiveModes[ModeIndex];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define ActivateOperationModeWithCommands(sys, name, cmds) \
|
||||||
|
ActivateOperationModeWithCommands_(sys, name, cmds, (s32)(sizeof(cmds) / sizeof(cmds[0])));
|
||||||
|
|
||||||
|
internal operation_mode*
|
||||||
|
ActivateOperationModeWithCommands_(operation_mode_system* System, char* ModeName, input_command* Commands, s32 CommandsCount)
|
||||||
|
{
|
||||||
|
operation_mode* NewMode = ActivateOperationMode(System, ModeName);
|
||||||
|
|
||||||
|
InitializeInputCommandRegistry(&NewMode->Commands, CommandsCount, &System->Arena);
|
||||||
|
for (s32 i = 0; i < CommandsCount; i++)
|
||||||
|
{
|
||||||
|
input_command Command = Commands[i];
|
||||||
|
RegisterKeyPressCommand(&NewMode->Commands, Command.Key, Command.Flags, Command.Mdfr, Command.Proc);
|
||||||
|
}
|
||||||
|
|
||||||
|
return NewMode;
|
||||||
|
}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
DeactivateCurrentOperationMode (operation_mode_system* System)
|
DeactivateCurrentOperationMode (operation_mode_system* System)
|
||||||
{
|
{
|
||||||
|
@ -43,9 +70,13 @@ DeactivateCurrentOperationMode (operation_mode_system* System)
|
||||||
#define CreateOperationState(mode, modeSystem, stateType) \
|
#define CreateOperationState(mode, modeSystem, stateType) \
|
||||||
(stateType*)CreateOperationState_(mode, modeSystem, sizeof(stateType))
|
(stateType*)CreateOperationState_(mode, modeSystem, sizeof(stateType))
|
||||||
|
|
||||||
|
#define GetCurrentOperationState(modeSystem, stateType) \
|
||||||
|
(stateType*)State->Modes.ActiveModes[State->Modes.ActiveModesCount - 1].OpStateMemory;
|
||||||
|
|
||||||
|
|
||||||
internal u8*
|
internal u8*
|
||||||
CreateOperationState_ (operation_mode* Mode, operation_mode_system* System, s32 StateSize)
|
CreateOperationState_ (operation_mode* Mode, operation_mode_system* System, s32 StateSize)
|
||||||
{
|
{
|
||||||
Mode->OpStateMemory = PushSize(&System->Arena, StateSize);
|
Mode->OpStateMemory = PushSize(&System->Arena, StateSize);
|
||||||
return Mode->OpStateMemory;
|
return Mode->OpStateMemory;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,11 @@ FilterSearchLister (search_lister* SearchLister)
|
||||||
SearchLister->FilteredIndexLUT[SearchLister->FilteredListCount++] = i;
|
SearchLister->FilteredIndexLUT[SearchLister->FilteredListCount++] = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (SearchLister->FilteredListCount == 0)
|
||||||
|
{
|
||||||
|
SearchLister->HotItem = -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal s32
|
internal s32
|
||||||
|
|
|
@ -83,7 +83,6 @@ FOLDHAUS_INPUT_COMMAND_PROC(TextEntryInsertChar)
|
||||||
|
|
||||||
InsertChar(&State->ActiveTextEntry.Buffer, Char, State->ActiveTextEntry.CursorPosition);
|
InsertChar(&State->ActiveTextEntry.Buffer, Char, State->ActiveTextEntry.CursorPosition);
|
||||||
State->ActiveTextEntry.CursorPosition++;
|
State->ActiveTextEntry.CursorPosition++;
|
||||||
// TODO(Peter): Do we want to do this after every single character?
|
|
||||||
PipeSearchStringToDestination(&State->ActiveTextEntry);
|
PipeSearchStringToDestination(&State->ActiveTextEntry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,14 +106,123 @@ InitializeTextInputCommands (input_command_registry* Commands, memory_arena* Per
|
||||||
{
|
{
|
||||||
if (Commands->Size > 0)
|
if (Commands->Size > 0)
|
||||||
{
|
{
|
||||||
RegisterKeyPressCommand(Commands, KeyCode_Backspace, Command_Began, KeyCode_Invalid, RemoveCharacterFromEntryString);
|
RegisterKeyPressCommand(Commands, KeyCode_Backspace, Command_Began | Command_Held, KeyCode_Invalid, RemoveCharacterFromEntryString);
|
||||||
RegisterKeyPressCommand(Commands, KeyCode_LeftArrow, Command_Began, KeyCode_Invalid, TextEntryMoveCursorLeft);
|
RegisterKeyPressCommand(Commands, KeyCode_LeftArrow, Command_Began | Command_Held, KeyCode_Invalid, TextEntryMoveCursorLeft);
|
||||||
RegisterKeyPressCommand(Commands, KeyCode_RightArrow, Command_Began, KeyCode_Invalid, TextEntryMoveCursorRight);
|
RegisterKeyPressCommand(Commands, KeyCode_RightArrow, Command_Began | Command_Held, KeyCode_Invalid, TextEntryMoveCursorRight);
|
||||||
|
|
||||||
for (s32 i = KeyCode_a; i < KeyCode_UpArrow; i++)
|
for (s32 i = KeyCode_a; i < KeyCode_UpArrow; i++)
|
||||||
{
|
{
|
||||||
RegisterKeyPressCommand(Commands, (key_code)i, Command_Began, KeyCode_Invalid, TextEntryInsertChar);
|
RegisterKeyPressCommand(Commands, (key_code)i, Command_Began | Command_Held, KeyCode_Invalid, TextEntryInsertChar);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define DEFAULT_TEXT_ENTRY_INPUT_COMMANDS_ARRAY_ENTRY \
|
||||||
|
{ KeyCode_Backspace, KeyCode_Invalid, Command_Began | Command_Held, RemoveCharacterFromEntryString }, \
|
||||||
|
{ KeyCode_LeftArrow, KeyCode_Invalid, Command_Began | Command_Held, TextEntryMoveCursorLeft }, \
|
||||||
|
{ KeyCode_RightArrow, KeyCode_Invalid, Command_Began | Command_Held, TextEntryMoveCursorRight }, \
|
||||||
|
{ KeyCode_a, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_b, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_c, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_d, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_e, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_f, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_g, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_h, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_i, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_j, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_k, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_l, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_m, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_n, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_o, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_p, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_q, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_r, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_s, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_t, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_u, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_v, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_w, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_x, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_y, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_z, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_A, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_B, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_C, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_D, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_E, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_F, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_G, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_H, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_I, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_J, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_K, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_L, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_M, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_N, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_O, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_P, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_Q, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_R, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_S, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_T, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_U, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_V, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_W, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_X, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_Y, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_Z, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_0, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_1, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_2, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_3, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_4, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_5, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_6, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_7, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_8, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_9, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_Num0, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_Num1, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_Num2, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_Num3, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_Num4, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_Num5, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_Num6, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_Num7, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_Num8, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_Num9, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_Bang, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_At, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_Pound, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_Dollar, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_Percent, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_Carrot, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_Ampersand, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_Star, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_LeftParen, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_RightParen, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_Minus, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_Plus, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_Equals, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_Underscore, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_LeftBrace, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_RightBrace, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_LeftBracket, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_RightBracket, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_Colon, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_SemiColon, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_SingleQuote, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_DoubleQuote, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_ForwardSlash, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_Backslash, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_Pipe, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_Comma, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_Period, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_QuestionMark, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ KeyCode_LessThan, KeyCode_Invalid, Command_Began | Command_Held, TextEntryInsertChar }, \
|
||||||
|
{ 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 }
|
||||||
|
|
|
@ -1046,6 +1046,7 @@ CopyCharArrayToString (char* Source, string* Dest)
|
||||||
*Dst++ = *Src++;
|
*Dst++ = *Src++;
|
||||||
Copied++;
|
Copied++;
|
||||||
}
|
}
|
||||||
|
*Dst++ = 0;
|
||||||
Dest->Length = Copied;
|
Dest->Length = Copied;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1060,6 +1061,7 @@ CopyCharArrayToString (char* Source, s32 SourceLength, string* Dest)
|
||||||
{
|
{
|
||||||
*Dst++ = *Src++;
|
*Dst++ = *Src++;
|
||||||
}
|
}
|
||||||
|
*Dst++ = 0;
|
||||||
Dest->Length = SourceLength;
|
Dest->Length = SourceLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -579,7 +579,7 @@ EvaluateSearchLister (render_command_buffer* RenderBuffer, v2 TopLeft, v2 Dimens
|
||||||
DrawString(RenderBuffer, Title, Font, 14, v2{TopLeft.x, TopLeft.y - 25}, WhiteV4);
|
DrawString(RenderBuffer, Title, Font, 14, v2{TopLeft.x, TopLeft.y - 25}, WhiteV4);
|
||||||
|
|
||||||
MakeStringBuffer(DebugString, 256);
|
MakeStringBuffer(DebugString, 256);
|
||||||
PrintF(&DebugString, "Hot Item: %d", HotItem);
|
PrintF(&DebugString, "Hot Item: %d | Filtered Items: %d", HotItem, ListLength);
|
||||||
DrawString(RenderBuffer, DebugString, Font, 14, v2{TopLeft.x + 256, TopLeft.y - 25}, WhiteV4);
|
DrawString(RenderBuffer, DebugString, Font, 14, v2{TopLeft.x + 256, TopLeft.y - 25}, WhiteV4);
|
||||||
TopLeft.y -= 30;
|
TopLeft.y -= 30;
|
||||||
|
|
||||||
|
|
32
todo.txt
32
todo.txt
|
@ -1,38 +1,27 @@
|
||||||
TODO FOLDHAUS
|
TODO FOLDHAUS
|
||||||
|
|
||||||
Intermediate Lifetime Memory & Operations
|
BUGS
|
||||||
x Intermediate lifetime memory arena
|
- Typing a period into a float value doesn't register. Problem here is that we arent' translating key presses into characters at the win32 layer. Need to do that.
|
||||||
x Temporary memory region = a multi frame operation
|
|
||||||
x Concept of an operation - temporary memory + interface command registry
|
|
||||||
x Allow one operation at a time at first
|
|
||||||
x Push/pop operations on a list?
|
|
||||||
- Current Operations:
|
|
||||||
- - View Sculpture (this might be an exception since its so central)
|
|
||||||
- x View/Edit Nodes
|
|
||||||
- x Add Node (needs nesting)
|
|
||||||
- x View SACN
|
|
||||||
|
|
||||||
- Why does backspacing in text entry not save when you close and reopen the node lister?
|
|
||||||
- Typing a period into a float value doesn't register
|
|
||||||
|
|
||||||
Hardening
|
Hardening
|
||||||
|
- turn the default sculpture view into an operation mode ? (have to think about this)
|
||||||
|
- Then we want to think about separating out mode render functions from mode update functions. Not sure its necessary but having something that operates like an update funciton but is called render is weird. Might want some sort of coroutine functionality in place, where modes can add and remove optional, parallel
|
||||||
|
update functions
|
||||||
- memory visualization
|
- memory visualization
|
||||||
- separate rendering thread
|
- separate rendering thread
|
||||||
- cache led positions. Only update if they are moving
|
- cache led positions. Only update if they are moving
|
||||||
x input context changes
|
|
||||||
- - shift drag to 10x drag speed
|
- - shift drag to 10x drag speed
|
||||||
- select nodes -> delete nodes
|
- select nodes -> delete nodes
|
||||||
- remove node connections
|
- remove node connections
|
||||||
|
|
||||||
|
UI Improvements
|
||||||
|
- highlight node field under active edit
|
||||||
|
|
||||||
Name
|
Name
|
||||||
- Splash screen (like blender) (thisll be fun)
|
- Splash screen (like blender) (thisll be fun)
|
||||||
- - Image importer (stb image? or find a png > bmp converter for the image you have)
|
- - Image importer (stb image? or find a png > bmp converter for the image you have)
|
||||||
- - Display on startup
|
- - Display on startup
|
||||||
|
|
||||||
/Debug
|
|
||||||
x Make debug scope tracking thread safe - was throwing an error in stringsequal but that stopped.
|
|
||||||
x Keep an eye out.
|
|
||||||
|
|
||||||
Application
|
Application
|
||||||
- More efficient HSV <-> RGB
|
- More efficient HSV <-> RGB
|
||||||
|
|
||||||
|
@ -55,9 +44,8 @@ Interface
|
||||||
- Update the text system - use system fonts
|
- Update the text system - use system fonts
|
||||||
|
|
||||||
Switch To Nodes
|
Switch To Nodes
|
||||||
x basic node elements
|
- evaluation step (one node at a time)
|
||||||
- - evaluation step (one node at a time)
|
- selector node (has a list of connections that it can switch between)
|
||||||
- - selector node (has a list of connections that it can switch between)
|
|
||||||
- serialize
|
- serialize
|
||||||
- delete nodes
|
- delete nodes
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
BUGS
|
||||||
|
x if there is nothing in the filtered list when searching for a node, hitting enter still selects one
|
||||||
|
|
||||||
|
Intermediate Lifetime Memory & Operations
|
||||||
|
x Intermediate lifetime memory arena
|
||||||
|
x Temporary memory region = a multi frame operation
|
||||||
|
x Concept of an operation - temporary memory + interface command registry
|
||||||
|
x Allow one operation at a time at first
|
||||||
|
x Push/pop operations on a list?
|
||||||
|
- Current Operations:
|
||||||
|
- - View Sculpture (this might be an exception since its so central)
|
||||||
|
- x View/Edit Nodes
|
||||||
|
- x Add Node (needs nesting)
|
||||||
|
- x View SACN
|
||||||
|
x make modes work with hot code reloading: rather than do the whole series of initialize command registry,
|
||||||
|
x and manually adding each command, store the commands as an array, and auto iterate over them when you
|
||||||
|
x push the mode on the mode stack
|
||||||
|
x decided I don't like storing NodeRenderSettings in each operation mode. Probably want to put it back in x app_state
|
||||||
|
|
||||||
|
/Debug
|
||||||
|
x Make debug scope tracking thread safe - was throwing an error in stringsequal but that stopped.
|
||||||
|
x Keep an eye out.
|
||||||
|
|
||||||
|
Switch To Nodes
|
||||||
|
x basic node elements
|
||||||
|
|
||||||
|
Hardening
|
||||||
|
x input context changes
|
Loading…
Reference in New Issue