summaryrefslogtreecommitdiff
path: root/imgui_helper_widgets.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'imgui_helper_widgets.cpp')
-rw-r--r--imgui_helper_widgets.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/imgui_helper_widgets.cpp b/imgui_helper_widgets.cpp
index 105dad2..17a9193 100644
--- a/imgui_helper_widgets.cpp
+++ b/imgui_helper_widgets.cpp
@@ -66,3 +66,21 @@ ImGui_WarpMouseFinish(ui *UI, ImVec2 MousePos)
Assert(0);
}
}
+
+static ImVec2
+ImGui_Brush_CalcMousePos(project_state *State, ImGuiIO &io, ImVec2 MouseDelta, int32 i, real32 DeltaDistance, real32 DeltaSlope)
+{
+ ImVec2 MousePos;
+ if (State->Brush.Type == brush_normal) {
+ MousePos = io.MousePos - (MouseDelta * (i / DeltaDistance));
+ } else if (State->Brush.Type == brush_wacky1) {
+ MousePos = io.MousePos + (io.MousePos * (i / MouseDelta));
+ } else if (State->Brush.Type == brush_wacky2) {
+ MousePos = io.MousePos - (MouseDelta / (i / DeltaDistance));
+ } else if (State->Brush.Type == brush_wacky3) {
+ MousePos = io.MousePos - (MouseDelta * (i / ImVec2(MouseDelta.y, MouseDelta.x)));
+ } else {
+ Assert(0);
+ }
+ return MousePos;
+}