Example #1
0
        // Standalone Memory Editor window
        internal void DrawWindow(string title, byte[] mem_data, int mem_size, int base_display_addr = 0x0000)
        {
            Sizes s = new Sizes();

            CalcSizes(ref s, mem_size, base_display_addr);

            LGui.Begin();
            LGui.BeginFrame(title, new LGuiVec2(s.WindowWidth, 500));

            DrawContents(mem_data, mem_size, base_display_addr);

            LGui.EndFrame();

            LGui.Slider("Cols", ref Cols, 4, 32, 1, true, "{0}", 200.0f);
            LGui.SameLine();
            OptShowAscii = LGui.CheckBox("OptShowAscii", OptShowAscii);
            LGui.SameLine();
            OptShowDataPreview = LGui.CheckBox("OptShowDataPreview", OptShowDataPreview);
            if (OptShowDataPreview && DataPreviewAddr == -1)
            {
                DataPreviewAddr = 0;
            }

            LGui.End();
        }
Example #2
0
        internal override void Render()
        {
            LGui.BeginFrame("Test", new LGuiRect(500, 5, 400, 400));

            LGui.Button("asd");

            LGui.Texture("1.jpg");

            LGui.EndFrame();

            if (LGui.BeginWindow("First Window", new LGuiVec2(300, 300)))
            {
                if (LGui.Button("Click Me"))
                {
                    System.Console.WriteLine("Window1");
                }

                LGui.ColorPicker("asd", ref Color);

                LGui.EndWindow();
            }

            if (LGui.BeginWindow("Second Window", new LGuiRect(400, 100, 300, 300), LGuiWindowFlags.NoCollapse))
            {
                if (LGui.Button("Click Me"))
                {
                    System.Console.WriteLine("Window2");
                }
                LGui.EndWindow();
            }

            if (LGui.BeginWindow("Third Window", new LGuiRect(200, 300, 300, 300), LGuiWindowFlags.NoTitle))
            {
                if (LGui.Button("Click Me"))
                {
                    System.Console.WriteLine("Window3");
                }
                LGui.EndWindow();
            }

            LGui.Text(LGuiColor.Red, "aaa");

            LGui.ProgressBar("bar1", Color.R);
        }
Example #3
0
        internal override void Render()
        {
            LGui.BeginFrame("Main Window", new LGuiVec2(950, 530));

            LGui.Text("LiteGui Demo");

            LGui.Separator();

            LGui.BeginLayout(LGuiLayoutMode.Horizontal);
            if (LGui.Button("Save"))
            {
                Console.WriteLine(Value_.ToString());
            }
            LGui.BeginLayout(LGuiLayoutMode.Vertical);
            if (LGui.Button("End1"))
            {
                Console.WriteLine(Value_.ToString());
            }
            if (LGui.Button("End2"))
            {
                Console.WriteLine(Value_.ToString());
            }
            LGui.EndLayout();
            LGui.EndLayout();

            LGui.Separator(LGuiColor.Red);

            LGui.Text(Color_, "Picker Color");

            if (LGui.Button("ColorPicker"))
            {
                LGui.OpenPopup("Color Picker Popup 1");
            }

            if (LGui.BeginPopup("Color Picker Popup 1", /*new LGuiRect(100, 100, 260, 310)*/ new LGuiVec2(260, 310)))
            {
                LGui.ColorPicker("ColorPicker1", ref Color_);
                LGui.EndPopup();
            }

            LGui.ProgressBar("Bar", ProBar_ / 1000.0f);
            ProBar_ += Rnd_.Next(0, 5);
            if (ProBar_ > 1000)
            {
                ProBar_ = 0;
            }

            LGui.ListBox("ListBox1", ref ItemIndex, Items, new LGuiVec2(150, 200));

            LGui.Combox("Combox1", ref ItemIndex, Items, 150, 200);

            Value_ = LGui.CheckBox("IsShow", Value_);

            //LGui.BeginLayout(LGuiLayoutMode.Horizontal);
            RValue_ = LGui.RadioButton("Radio 1", 1, RValue_);
            LGui.SameLine();
            RValue_ = LGui.RadioButton("Radio 2", 2, RValue_);
            LGui.SameLine();
            if (LGui.BeginToolTips(new LGuiVec2(200, 60)))
            {
                LGui.Text("This is tips");
                LGui.Button("Tips Btn");
                LGui.EndToolTips();
            }

            RValue_ = LGui.RadioButton("Radio 3", 3, RValue_);
            LGui.SetToolTips("this is other tips");
            //LGui.EndLayout();

            LGui.InputText("Input1", ref Str1_);
            LGui.InputText("Input2", ref Str2_);

            LGui.BeginFrame("List1", new LGuiVec2(300, 300));

            LGui.Text(new LGuiColor(1.0f, 0.0f, 0.0f), "Color Text");

            LGui.BeginFrame("List2", new LGuiVec2(100, 200));

            LGui.Text("AA");
            LGui.Text("AA");
            LGui.Text("AA");
            LGui.Text("AA");
            LGui.Text("AA");
            LGui.Text("AA");
            LGui.Text("AA");
            LGui.Text("AA");
            LGui.Text("AA");
            LGui.Text("AA");

            LGui.EndFrame();
            LGui.Separator();

            if (Value_)
            {
                if (LGui.BeginGroup("Test Group 0"))
                {
                    LGui.Text("Group 0 Text");
                    LGui.Text("Group 0 Text");
                    LGui.Text("Group 0 Text");
                    LGui.EndGroup();
                }

                for (var Index = 0; Index < 50; ++Index)
                {
                    LGui.Text("{0} Text", Index);
                    LGui.Slider("Slider" + Index, ref SliderValue_, 0, 1, 0.1f, true, Value_ ? "{0:0.0}" : "", 200);
                }

                if (LGui.BeginGroup("Test Group 1"))
                {
                    LGui.Text("Group 1 Text");
                    LGui.Text("Group 1 Text");
                    LGui.Text("Group 1 Text");
                    LGui.EndGroup();
                }

                var TPos = LGui.GetCursorPos();
                LGui.Texture(1, new LGuiVec2(50, 50));
                if (LGui.BeginToolTips(new LGuiVec2(110, 110)))
                {
                    var MousePos = LGui.GetIO().MousePos;
                    var BeginPos = MousePos - TPos;
                    var TexSize  = TextureCache.GetSize(1);
                    BeginPos.X = BeginPos.X / 50.0f * TexSize.X;
                    BeginPos.Y = BeginPos.Y / 50.0f * TexSize.Y;
                    var SrcRect = new LGuiRect(BeginPos, new LGuiVec2(90, 70));
                    SrcRect.Size = new LGuiVec2(Math.Min(SrcRect.Size.X, TexSize.X), Math.Min(SrcRect.Size.Y, TexSize.Y));
                    LGui.Text("X:{0} Y:{1}", (int)BeginPos.X, (int)BeginPos.Y);
                    LGui.Texture(1, SrcRect, new LGuiVec2(90, 70));
                    LGui.EndToolTips();
                }
            }

            LGui.EndFrame();

            //LGui.Separator();
            LGui.Button("Push Text");
            //LGui.Separator();

            if (LGui.BeginGroup("Test Group 2"))
            {
                LGui.Text("Group 2 Text");
                LGui.Text("Group 2 Text");
                LGui.Text("Group 2 Text");

                if (LGui.BeginGroup("Test Group 22"))
                {
                    LGui.BeginFrame("FFFF", new LGuiVec2(100, 100));
                    {
                        LGui.Text("Group 222 Text");
                        LGui.Text("Group 222 Text");
                    }
                    LGui.EndFrame();
                    LGui.EndGroup();
                }
                LGui.EndGroup();
            }

            if (LGui.BeginGroup("Test Group 3"))
            {
                LGui.Text("Group 3 Text");
                LGui.EndGroup();
            }

            LGui.EndFrame();
        }