Example #1
0
        public static WindowControl Error(ControlBase parent, GLWindow game, string text, string title)
        {
            var wc = new WindowControl(parent, title, false);

            wc.MakeModal(true);
            wc.Width = 200;
            RichLabel l = new RichLabel(wc);

            //  Align.StretchHorizontally(l);
            l.Dock  = Pos.Top;
            l.Width = wc.Width;
            l.AddText(text, parent.Skin.Colors.Label.Default, parent.Skin.DefaultFont);
            wc.Layout();
            l.SizeToChildren(false, true);
            wc.Height = 65 + l.Height;
            Align.CenterHorizontally(l);
            Button btn = new Button(wc);

            btn.Name     = "Okay";
            btn.Text     = "Okay";
            btn.Height   = 20;
            btn.Y        = l.Y + l.Height + 10;
            btn.Width    = 100;
            btn.Clicked += (o, e) => { ((WindowControl)o.Parent).Close(); };
            Align.AlignLeft(l);
            wc.Show();
            wc.SetPosition((game.RenderSize.Width / 2) - (wc.Width / 2), (game.RenderSize.Height / 2) - (wc.Height / 2));
            wc.DisableResizing();
            return(wc);
        }
Example #2
0
        public static WindowControl Create(ControlBase parent, GLWindow game, string text, string title, bool ok, bool cancel)
        {
            var wc = new WindowControl(parent, title, false);

            wc.MakeModal(true);
            wc.Width = 200;
            RichLabel l = new RichLabel(wc);

            //  Align.StretchHorizontally(l);
            l.Dock  = Pos.Top;
            l.Width = wc.Width;
            l.AddText(text, parent.Skin.Colors.Label.Default, parent.Skin.DefaultFont);
            wc.Layout();
            l.SizeToChildren(false, true);
            wc.Height = 65 + l.Height;
            Align.CenterHorizontally(l);
            if (ok)
            {
                Button btn = new Button(wc);
                btn.Name   = "Okay";
                btn.Text   = "Okay";
                btn.Height = 20;
                btn.Y      = l.Y + l.Height + 10;
                btn.Width  = 100;
                Align.AlignLeft(l);
            }
            if (cancel)
            {
                Button btn = new Button(wc);
                btn.Name = "Cancel";
                btn.Text = "Cancel";
                btn.SizeToContents();
                btn.Height = 20;
                btn.Width  = 70;
                btn.Y      = l.Y + l.Height + 10;
                btn.X      = (wc.Width - 12) - btn.Width;
            }
            wc.Show();
            wc.SetPosition((game.RenderSize.Width / 2) - (wc.Width / 2), (game.RenderSize.Height / 2) - (wc.Height / 2));
            wc.DisableResizing();
            return(wc);
        }
Example #3
0
        public ExportVideoWindow(Gwen.Controls.ControlBase parent, GLWindow game) : base(parent, "Export Video")
        {
            game.Track.Stop();
            var openwindows = game.Canvas.GetOpenWindows();

            foreach (var v in openwindows)
            {
                if (v is WindowControl)
                {
                    ((WindowControl)v).Close();
                }
            }
            MakeModal(true);
            Width  = 400;
            Height = 280;
            ControlBase bottom = new ControlBase(this);

            bottom.Height = 150;
            bottom.Width  = 400 - 13;
            Align.AlignBottom(bottom);

            var buttonok = new Button(bottom);

            buttonok.Name   = "Okay";
            buttonok.Text   = "Record";
            buttonok.Height = 20;
            buttonok.Y      = 80;
            buttonok.Width  = 100;
            if (!Drawing.SafeFrameBuffer.CanRecord)
            {
                buttonok.IsHidden = true;
            }
            buttonok.Clicked += (o, e) =>
            {
                var wnd = ((WindowControl)o.Parent.Parent);
                wnd.Close();
                if (game.Track.GetFlag() == null)
                {
                    var pop = PopupWindow.Create(parent, game,
                                                 "No flag detected, place one at the end of the track so the recorder knows where to stop.",
                                                 "Error", true, false);
                    pop.FindChildByName("Okay", true).Clicked +=
                        (o1, e1) => { pop.Close(); };
                }
                else
                {
                    var  radiogrp = (RadioButtonGroup)this.FindChildByName("qualityselector", true);
                    bool is1080p  = radiogrp.Selected.Text == "1080p";
                    TrackFiles.TrackRecorder.RecordTrack(game, is1080p);
                }
            };
            Align.AlignLeft(buttonok);
            var buttoncancel = new Button(bottom);

            buttoncancel.Name     = "Cancel";
            buttoncancel.Text     = "Cancel";
            buttoncancel.Height   = 20;
            buttoncancel.Y        = 80;
            buttoncancel.Width    = 100;
            buttoncancel.Clicked += (o, e) => { this.Close(); };
            Align.AlignRight(buttoncancel);
            var label = new RichLabel(this);

            label.Dock  = Pos.Top;
            label.Width = this.Width;
            if (Drawing.SafeFrameBuffer.CanRecord)
            {
                label.AddText("You are about to export your track as a video file. Make sure the end of the track is marked by a flag. It will be located in the same folder as linerider.exe. Please allow some minutes depending on your computer speed. The window will become unresponsive during this time." + Environment.NewLine + Environment.NewLine + "After recording, a console window will open to encode the video. Closing it will cancel the process and all progress will be lost.", parent.Skin.Colors.Label.Default, parent.Skin.DefaultFont);
            }
            else
            {
                label.AddText("Video export is not supported on this machine." + Environment.NewLine + "Sorry.", parent.Skin.Colors.Label.Default, parent.Skin.DefaultFont);
            }
            label.SizeToChildren(false, true);
            var radio = new RadioButtonGroup(bottom);

            radio.Name = "qualityselector";
            radio.AddOption("720p").Select();
            radio.AddOption("1080p");
            Align.AlignLeft(radio);
            radio.Y += 20;
            if (!Drawing.SafeFrameBuffer.CanRecord)
            {
                radio.IsHidden = true;
            }
            DisableResizing();
        }