private void CreateAdvancedTab(TabControl tcontainer) { var container = tcontainer.AddPage("Advanced").Page; PropertyTree tree = new PropertyTree(container); var pt = tree.Add("Advanced"); tree.ExpandAll(); tree.Dock = Pos.Top; var zoom = CreateEditableNumber("Zoom", game.Track.Zoom.ToString(), pt); zoom.MinValue = 0.1; zoom.MaxValue = 200; zoom.ValueChanged += (o, e) => { if (!double.IsNaN(zoom.NumValue)) { game.Zoom((float)zoom.NumValue - game.Track.Zoom); } }; tree.Dock = Pos.Fill; var mar = tree.Margin; mar.Right = 100; tree.Margin = mar; pt.SplitWidth = 200; Button btn = new Button(container); btn.Width = 100; btn.Height = 20; Align.AlignBottom(btn); Align.AlignRight(btn); }
public static GameCanvas CreateCanvas(GLWindow game) { var renderer = new Gwen.Renderer.OpenTK(); var tx = new Texture(renderer); Gwen.Renderer.OpenTK.LoadTextureInternal(tx, GameResources.DefaultSkin); var skin = new TexturedBase(renderer, tx, GameResources.DefaultColors); var bmpfont = new Gwen.Renderer.OpenTK.BitmapFont(renderer, "SourceSansPro", 10, 10, GameResources.SourceSansProq, new List <System.Drawing.Bitmap> { GameResources.SourceSansPro_img }); skin.DefaultFont = bmpfont; var canvas = new GameCanvas(skin, game) { Renderer = renderer }; canvas.SpriteLoading = new Sprite(canvas); canvas.SpriteLoading.SetImage(GameResources.loading); canvas.SpriteLoading.IsHidden = true; canvas.SpriteLoading.IsTabable = false; canvas.SpriteLoading.KeyboardInputEnabled = false; canvas.SpriteLoading.MouseInputEnabled = false; canvas.SpriteLoading.SetSize(32, 32); canvas.SpriteLoading.RotationPoint.X = 16; canvas.SpriteLoading.RotationPoint.Y = 16; canvas.SpriteLoading.SetPosition(canvas.Width - 32, 0); var timeslider = new HorizontalIntSlider(canvas) { X = 120, Y = canvas.Height - 25, Width = canvas.Width - 120 * 2, Height = 25, IsTabable = false, IsHidden = true, KeyboardInputEnabled = false, Name = "timeslider", }; var btnfastfoward = new ImageButton(canvas) { X = timeslider.Right, Y = canvas.Height - 25, Width = 24, Height = 24, IsTabable = false, IsHidden = true, KeyboardInputEnabled = false, Name = "btnfastforward" }; btnfastfoward.SetImage(GameResources.fast_forward, GameResources.fast_forward_white); var btnslowmo = new ImageButton(canvas) { X = timeslider.X - 24, Y = canvas.Height - 25, Width = 24, Height = 24, IsTabable = false, IsHidden = true, KeyboardInputEnabled = false, Name = "btnslowmo" }; btnslowmo.SetImage(GameResources.rewind, GameResources.rewind_white); btnslowmo.Clicked += (o, e) => { game.PlaybackDown(); }; btnfastfoward.Clicked += (o, e) => { game.PlaybackUp(); }; timeslider.ValueChanged += canvas.timeslider_ValueChanged; var labelTrackName = new Label(canvas) { TextColor = System.Drawing.Color.Black, Dock = Pos.Left, Margin = new Margin(5, 0, 0, 0), Name = "trackname" }; Label labeliteration = new Label(canvas); labeliteration.Name = "labeliterations"; labeliteration.Font = new Font(renderer, "Arial", 18); labeliteration.SetText(""); labeliteration.TextColor = Color.Black; Align.PlaceDownLeft(labeliteration, labelTrackName); var toprightcontainer = new ControlBase(canvas) { Dock = Pos.Right, Width = 150, Height = 300, MouseInputEnabled = false }; var fps = new Label(toprightcontainer) { TextColor = Color.Black, Name = "fps" }; var labelppf = new Label(toprightcontainer) { TextColor = Color.Black, Name = "ppf" }; var labelPlayback = new Label(toprightcontainer) { TextColor = Color.Black, Name = "labelplayback" }; var flagtime = new Label(canvas) { TextColor = Color.Black, Name = "flagtime" }; var textheight = renderer.MeasureText(skin.DefaultFont, "@").Y + 3; labelppf.SetPosition(0, textheight); labelPlayback.SetPosition(0, textheight * 2); var vslider = new VerticalSlider(canvas) { Min = 0.1f, Max = 24f, Value = game.Track.Zoom, IsTabable = false }; vslider.ValueChanged += (o, e) => { var slider = (VerticalSlider)o; var diff = slider.Value - game.Track.Zoom; game.Zoom(diff, false); }; vslider.SetPosition(0, (int)canvas.Height - 150); vslider.Name = "vslider"; Align.AlignRight(vslider); vslider.Height = 125; return(canvas); }
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(); }
public GameCanvas(SkinBase skin, MainWindow Game, Gwen.Renderer.OpenTK renderer) : base(skin) { game = Game; this.Renderer = renderer; BoundsChanged += GameCanvas_BoundsChanged; SpriteLoading = new Sprite(this); SpriteLoading.SetImage(GameResources.loading); SpriteLoading.IsHidden = true; SpriteLoading.IsTabable = false; SpriteLoading.KeyboardInputEnabled = false; SpriteLoading.MouseInputEnabled = false; SpriteLoading.SetSize(32, 32); SpriteLoading.RotationPoint.X = 16; SpriteLoading.RotationPoint.Y = 16; SpriteLoading.SetPosition(Width - 32, 0); Scrubber = new HorizontalIntSlider(this) { X = 120, Y = Height - 25, Width = Width - 120 * 2, Height = 25, IsTabable = false, IsHidden = true, KeyboardInputEnabled = false, Name = "timeslider", }; var btnfastfoward = new ImageButton(this) { X = Scrubber.Right, Y = Height - 36, Width = 32, Height = 32, IsTabable = false, IsHidden = true, KeyboardInputEnabled = false, Name = "btnfastforward" }; btnfastfoward.SetImage(GameResources.fast_forward, GameResources.fast_forward_white); var btnslowmo = new ImageButton(this) { X = Scrubber.X - 24, Y = Height - 36, Width = 32, Height = 32, IsTabable = false, IsHidden = true, KeyboardInputEnabled = false, Name = "btnslowmo" }; btnslowmo.SetImage(GameResources.rewind, GameResources.rewind_white); btnslowmo.Clicked += (o, e) => { game.PlaybackSpeedDown(); }; btnfastfoward.Clicked += (o, e) => { game.PlaybackSpeedUp(); }; Scrubber.ValueChanged += scrubber_ValueChanged; var labelTrackName = new Label(this) { TextColor = System.Drawing.Color.Black, Dock = Pos.Left, Margin = new Margin(5, 0, 0, 20), Name = "trackname" }; Label labeliteration = new Label(this); labeliteration.Name = "labeliterations"; labeliteration.SetText(""); labeliteration.TextColor = Color.Black; Align.PlaceDownLeft(labeliteration, labelTrackName); var toprightcontainer = new ControlBase(this) { Dock = Pos.Right, IsTabable = false, Width = 150, Height = 300, MouseInputEnabled = false }; new Label(toprightcontainer) { TextColor = Color.Black, Name = "fps" }; var labelppf = new Label(toprightcontainer) { TextColor = Color.Black, Name = "ppf" }; var labelPlayback = new Label(toprightcontainer) { TextColor = Color.Black, Name = "labelplayback" }; new Label(this) { TextColor = Color.Black, Name = "flagtime" }; var textheight = renderer.MeasureText(skin.DefaultFont, "").Y + 3; labelppf.SetPosition(0, textheight); labelPlayback.SetPosition(0, textheight * 2); var vslider = new VerticalSlider(this) { Min = 0.1f, Max = 24f, Value = game.Track.Zoom, IsTabable = false, KeyboardInputEnabled = false }; vslider.ValueChanged += (o, e) => { var slider = (VerticalSlider)o; game.SetZoom(slider.Value, false); }; vslider.SetPosition(0, (int)Height - 150); vslider.Name = "vslider"; Align.AlignRight(vslider); vslider.Height = 125; }