-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathPluginUI.cs
97 lines (82 loc) · 3.49 KB
/
PluginUI.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
using System;
using System.Runtime.InteropServices;
using ImGuiNET;
using static EasyZoom.Plugin;
using static EasyZoom.Configuration;
namespace EasyZoom
{
public class PluginUI
{
public bool IsVisible;
public void Draw()
{
if (!IsVisible)
return;
if (ImGui.Begin("EasyZoom", ref IsVisible, ImGuiWindowFlags.AlwaysAutoResize))
{
ImGui.SliderScalar("FOV", ImGuiDataType.Float, FovCurrent, FovMin, FovMax, $"{Marshal.PtrToStructure<float>(FovCurrent)} ({Marshal.PtrToStructure<float>(FovCurrent) * (180 / Math.PI):F2}°)");
if (ImGui.IsItemHovered() && ImGui.IsMouseDown(ImGuiMouseButton.Right))
Marshal.StructureToPtr(FovDefault, FovCurrent, true);
if (ImGui.DragScalar("FOV Min", ImGuiDataType.Float, FovMin, 0.005f, ZeroFloat, PiFloat, $"{Marshal.PtrToStructure<float>(FovMin)} ({Marshal.PtrToStructure<float>(FovMin) * (180 / Math.PI):F2}°)"))
{
config.FovMin = Marshal.PtrToStructure<float>(FovMin);
config.Save();
}
if (ImGui.IsItemHovered() && ImGui.IsMouseDown(ImGuiMouseButton.Right))
{
Marshal.StructureToPtr(FovMinDefault, FovMin, true);
config.FovMin = Marshal.PtrToStructure<float>(FovMin);
config.Save();
}
if (ImGui.DragScalar("FOV Max", ImGuiDataType.Float, FovMax, 0.005f, ZeroFloat, PiFloat, $"{Marshal.PtrToStructure<float>(FovMax)} ({Marshal.PtrToStructure<float>(FovMax) * (180 / Math.PI):F2}°)"))
{
config.FovMax = Marshal.PtrToStructure<float>(FovMax);
config.Save();
}
if (ImGui.IsItemHovered() && ImGui.IsMouseDown(ImGuiMouseButton.Right))
{
Marshal.StructureToPtr(FovMaxDefault, FovMax, true);
config.FovMax = Marshal.PtrToStructure<float>(FovMax);
config.Save();
}
ImGui.Spacing();
ImGui.SliderScalar("Zoom", ImGuiDataType.Float, ZoomCurrent, ZoomMin, ZoomMax, Marshal.PtrToStructure<float>(ZoomCurrent).ToString(), ImGuiSliderFlags.Logarithmic);
if (ImGui.IsItemHovered() && ImGui.IsMouseDown(ImGuiMouseButton.Right))
Marshal.StructureToPtr(ZoomDefault, ZoomCurrent, true);
if (ImGui.DragScalar("Zoom Min", ImGuiDataType.Float, ZoomMin, 1f, ZeroFloat, MaxFloat, Marshal.PtrToStructure<float>(ZoomMin).ToString(), ImGuiSliderFlags.Logarithmic))
{
config.ZoomMin = Marshal.PtrToStructure<float>(ZoomMin);
config.Save();
}
if (ImGui.IsItemHovered() && ImGui.IsMouseDown(ImGuiMouseButton.Right))
{
Marshal.StructureToPtr(ZoomMinDefault, ZoomMin, true);
config.ZoomMin = Marshal.PtrToStructure<float>(ZoomMin);
config.Save();
}
if (ImGui.DragScalar("Zoom Max", ImGuiDataType.Float, ZoomMax, 1f, ZeroFloat, MaxFloat, Marshal.PtrToStructure<float>(ZoomMax).ToString(), ImGuiSliderFlags.Logarithmic))
{
config.ZoomMax = Marshal.PtrToStructure<float>(ZoomMax);
config.Save();
}
if (ImGui.IsItemHovered() && ImGui.IsMouseDown(ImGuiMouseButton.Right))
{
Marshal.StructureToPtr(ZoomMaxDefault, ZoomMax, true);
config.ZoomMax = Marshal.PtrToStructure<float>(ZoomMax);
config.Save();
}
ImGui.Spacing();
//ImGui.SliderScalar("UpDown", ImGuiDataType.Float, UpDown, ZoomCurrent, ZoomCurrent, Marshal.PtrToStructure<float>(UpDown).ToString());
//if (ImGui.IsItemHovered() && ImGui.IsMouseDown(ImGuiMouseButton.Right))
// Marshal.StructureToPtr(UpDownDefault, UpDown, true);
//ImGui.Spacing();
if (ImGui.Checkbox("Disable camera collision", ref config.NoCollision))
{
SetCamNoCollision(config.NoCollision);
config.Save();
}
ImGui.End();
}
}
}
}