Lumenarium/src/foldhaus_interface.cpp

55 lines
1.6 KiB
C++
Raw Normal View History

2019-10-30 14:28:02 +00:00
FOLDHAUS_INPUT_COMMAND_PROC(CameraMouseControl)
{
if (State->NodeInteraction.NodeOffset >= 0) { return; }
if (KeyTransitionedDown(Event))
{
State->Camera_StartDragPos = V4(State->Camera.Position, 1);
}
if (!State->DrawUniverseOutputDisplay)
{
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);
}
else
{
State->UniverseOutputDisplayOffset += Mouse.DeltaPos;
}
}
FOLDHAUS_INPUT_COMMAND_PROC(CameraMouseZoom)
{
if (State->DrawUniverseOutputDisplay)
{
r32 DeltaZoom = (r32)(Mouse.Scroll) / 120;
State->UniverseOutputDisplayZoom = GSClamp(0.1f, State->UniverseOutputDisplayZoom + DeltaZoom, 4.f);
}
}
FOLDHAUS_INPUT_COMMAND_PROC(ToggleUniverseDebugView)
{
State->DrawUniverseOutputDisplay = !State->DrawUniverseOutputDisplay;
}
FOLDHAUS_INPUT_COMMAND_PROC(OpenNodeLister)
{
ActivateOperationMode(State->Operation_AddNode, &State->Modes);
State->InterfaceShowNodeLister = true;
2019-10-30 14:28:02 +00:00
State->NodeListMenuPosition = Mouse.Pos;
SetTextInputDestinationToString(&State->ActiveTextEntry, &State->GeneralPurposeSearchString);
State->ActiveCommands = &State->NodeListerCommandRegistry;
}
FOLDHAUS_INPUT_COMMAND_PROC(ToggleNodeDisplay)
{
State->NodeRenderSettings.Display = !State->NodeRenderSettings.Display;
}