Exemplo n.º 1
0
Arquivo: GUI.cs Projeto: randomcrab/SE
        public static bool InputText(string label, ref string val, uint maxLength, GUIInputTextFlags flags, string fmt)
        {
            float itemSize = GUIUtility.GetPreferredElementWidthSize(1, !string.IsNullOrEmpty(fmt));

            GUIUtility.TextIndentFunction(fmt);

            SetNextItemWidth(itemSize);
            return(ImGui.InputText(label, ref val, maxLength, (ImGuiInputTextFlags)flags));
        }
Exemplo n.º 2
0
Arquivo: GUI.cs Projeto: randomcrab/SE
 public static bool InputSByte(string label, ref sbyte val, sbyte?step, sbyte?stepFast, GUIInputTextFlags flags, string fmt)
 => InputScalar(label, ImGuiDataType.S8, ref val, step, stepFast, flags, fmt);
Exemplo n.º 3
0
Arquivo: GUI.cs Projeto: randomcrab/SE
 public static bool InputUShort(string label, ref ushort val, ushort?step, ushort?stepFast, GUIInputTextFlags flags, string fmt)
 => InputScalar(label, ImGuiDataType.U16, ref val, step, stepFast, flags, fmt);
Exemplo n.º 4
0
Arquivo: GUI.cs Projeto: randomcrab/SE
 public static bool InputUInt(string label, ref uint val, uint?step, uint?stepFast, GUIInputTextFlags flags, string fmt)
 => InputScalar(label, ImGuiDataType.U32, ref val, step, stepFast, flags, fmt);
Exemplo n.º 5
0
Arquivo: GUI.cs Projeto: randomcrab/SE
 public static bool InputULong(string label, ref ulong val, ulong?step, ulong?stepFast, GUIInputTextFlags flags, string fmt)
 => InputScalar(label, ImGuiDataType.U64, ref val, step, stepFast, flags, fmt);
Exemplo n.º 6
0
Arquivo: GUI.cs Projeto: randomcrab/SE
        private static unsafe bool InputScalar <T>(string label, ImGuiDataType dataType, ref T val, T?step, T?stepFast, GUIInputTextFlags flags, string fmt) where T : unmanaged
        {
            float itemSize = GUIUtility.GetPreferredElementWidthSize(1, !string.IsNullOrEmpty(fmt));

            GUIUtility.TextIndentFunction(fmt);

            IntPtr valPtr;
            IntPtr stepPtr     = IntPtr.Zero;
            IntPtr stepFastPtr = IntPtr.Zero;

            fixed(T *ptr = &val)
            {
                valPtr = (IntPtr)ptr;
            }

            if (step.HasValue)
            {
                T temp = step.Value;
                stepPtr = (IntPtr)(&temp);
            }
            if (stepFast.HasValue)
            {
                T temp = stepFast.Value;
                stepFastPtr = (IntPtr)(&temp);
            }

            SetNextItemWidth(itemSize);
            return(ImGui.InputScalar(label, dataType, valPtr, stepPtr, stepFastPtr, fmt, (ImGuiInputTextFlags)flags));
        }
Exemplo n.º 7
0
Arquivo: GUI.cs Projeto: randomcrab/SE
        public static bool InputDouble(string label, ref double val, float step, float stepFast, GUIInputTextFlags flags, string fmt)
        {
            float itemSize = GUIUtility.GetPreferredElementWidthSize(1, !string.IsNullOrEmpty(fmt));

            GUIUtility.TextIndentFunction(fmt);

            SetNextItemWidth(itemSize);
            return(ImGui.InputDouble(label, ref val, step, stepFast, null, (ImGuiInputTextFlags)flags));
        }
Exemplo n.º 8
0
Arquivo: GUI.cs Projeto: randomcrab/SE
        public static bool InputVector4(string label, ref Vector4 val, float step, float stepFast, GUIInputTextFlags flags, string fmt)
        {
            float itemSize = GUIUtility.GetPreferredElementWidthSize(3, !string.IsNullOrEmpty(fmt));

            GUIUtility.TextIndentFunction(fmt);

            Text("X");
            SameLine();
            SetNextItemWidth(itemSize);
            bool x = ImGui.InputFloat(label + "X", ref val.X, step, stepFast, null, (ImGuiInputTextFlags)flags);

            TextInlined("Y");
            SetNextItemWidth(itemSize);
            bool y = ImGui.InputFloat(label + "Y", ref val.Y, step, stepFast, null, (ImGuiInputTextFlags)flags);

            TextInlined("Y");
            SetNextItemWidth(itemSize);
            bool z = ImGui.InputFloat(label + "Z", ref val.Z, step, stepFast, null, (ImGuiInputTextFlags)flags);

            TextInlined("Y");
            SetNextItemWidth(itemSize);
            bool w = ImGui.InputFloat(label + "W", ref val.W, step, stepFast, null, (ImGuiInputTextFlags)flags);

            return(x || y || z || w);
        }
Exemplo n.º 9
0
Arquivo: GUI.cs Projeto: randomcrab/SE
        public static bool InputRectangleF(string label, ref RectangleF val, float step, float stepFast, GUIInputTextFlags flags, string fmt)
        {
            float itemSize = GUIUtility.GetPreferredElementWidthSize(2, !string.IsNullOrEmpty(fmt));

            GUIUtility.TextIndentFunction(fmt);

            Text("X");
            SameLine();
            SetNextItemWidth(itemSize);
            bool x = ImGui.InputFloat(label + "X", ref val.X, step, stepFast, null, (ImGuiInputTextFlags)flags);

            TextInlined("Y");
            SetNextItemWidth(itemSize);
            bool y = ImGui.InputFloat(label + "Y", ref val.Y, step, stepFast, null, (ImGuiInputTextFlags)flags);

            ImGui.NewLine();
            Indent();
            Text("W");
            SameLine();
            SetNextItemWidth(itemSize);
            bool w = ImGui.InputFloat(label + "W", ref val.Width, step, stepFast, null, (ImGuiInputTextFlags)flags);

            TextInlined("H");
            SetNextItemWidth(itemSize);
            bool h = ImGui.InputFloat(label + "H", ref val.Height, step, stepFast, null, (ImGuiInputTextFlags)flags);

            return(x || y || w || h);
        }