public WaveForm() { InitializeComponent(); WaveStyle = new WaveStyle(); SliderStyle = new SliderStyle(); playingTimer.Elapsed += PlayingTimer_Elapsed; }
public void SliderOnUpdateDirectionIsHorizontal() { tlog.Debug(tag, $"SliderOnUpdateDirectionIsHorizontal START"); var testingTarget = new MySlider() { Size = new Size(100, 5), Direction = Slider.DirectionType.Horizontal, IsEnabled = true, }; Assert.IsNotNull(testingTarget, "null handle"); Assert.IsInstanceOf <Slider>(testingTarget, "Should return Slider instance."); testingTarget.MinValue = 0.0f; testingTarget.MaxValue = 100.0f; testingTarget.BgTrackColor = Color.Cyan; testingTarget.LowIndicatorImageURL = image_path; testingTarget.LowIndicatorSize = new Size(8, 8); testingTarget.HighIndicatorImageURL = image_path; testingTarget.HighIndicatorSize = new Size(10, 10); SliderStyle style1 = new SliderStyle() { IndicatorType = Slider.IndicatorType.Image, }; testingTarget.ApplyStyle(style1); try { testingTarget.MyOnUpdate(); } catch (Exception e) { tlog.Debug(tag, e.Message.ToString()); Assert.Fail("Caught Exception : Failed!"); } SliderStyle style2 = new SliderStyle() { IndicatorType = Slider.IndicatorType.Text, }; testingTarget.ApplyStyle(style2); try { testingTarget.MyOnUpdate(); } catch (Exception e) { tlog.Debug(tag, e.Message.ToString()); Assert.Fail("Caught Exception : Failed!"); } testingTarget.Dispose(); tlog.Debug(tag, $"SliderOnUpdateDirectionIsHorizontal END (OK)"); }
private void InitSliders() { // Null style construction slider_null_style[0] = CreateByProperty(800, 50, 20, Slider.DirectionType.Horizontal); slider_null_style[1] = CreateByProperty(800, 50, 30, Slider.DirectionType.Horizontal); slider_null_style[1].LowIndicatorTextContent = "SubText"; slider_null_style[1].LowIndicatorSize = new Size(100, 40); slider_null_style[2] = CreateByProperty(50, 400, 20, Slider.DirectionType.Vertical); slider_null_style[3] = CreateByProperty(50, 400, 30, Slider.DirectionType.Vertical); slider_null_style[3].LowIndicatorTextContent = "SubText"; slider_null_style[3].LowIndicatorSize = new Size(100, 40); // Style construction SliderStyle st = new SliderStyle { TrackThickness = 4, Track = new ImageViewStyle { BackgroundColor = new Selector <Color> { All = new Color(0, 0, 0, 0.1f), } }, Progress = new ImageViewStyle { BackgroundColor = new Selector <Color> { All = new Color(0.05f, 0.63f, 0.9f, 1), } }, Thumb = new ImageViewStyle { Size = new Size(60, 60), ResourceUrl = new Selector <string> { Normal = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_slide_handler_normal.png", Pressed = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_slide_handler_press.png", }, BackgroundImage = new Selector <string> { Normal = "", Pressed = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_slide_handler_effect.png", } } }; slider_style[0] = CreateByStyle(st, 800, 50, 20, Slider.DirectionType.Horizontal); slider_style[1] = CreateByStyle(st, 800, 50, 30, Slider.DirectionType.Horizontal); slider_style[1].LowIndicatorTextContent = "SubText"; slider_style[1].LowIndicatorSize = new Size(100, 40); slider_style[2] = CreateByStyle(st, 50, 400, 20, Slider.DirectionType.Vertical); slider_style[3] = CreateByStyle(st, 50, 400, 30, Slider.DirectionType.Vertical); slider_style[3].LowIndicatorTextContent = "SubText"; slider_style[3].LowIndicatorSize = new Size(100, 40); }
public void ApplySliderStyle(SliderStyle style) { ApplyWidgetStyle(style); if (style.KnobStyle != null) { Widget.ApplyButtonStyle(style.KnobStyle); } }
protected Slider(SliderStyle sliderStyle) { Widget = new Button(); Widget.Down += WidgetOnDown; Widget.Up += WidgetOnUp; if (sliderStyle != null) { ApplySliderStyle(sliderStyle); } Maximum = 100; }
protected Slider(SliderStyle sliderStyle) { InternalChild = new ImageButton((ImageButtonStyle)null) { ReleaseOnMouseLeft = false }; if (sliderStyle != null) { ApplySliderStyle(sliderStyle); } Maximum = 100; }
protected Slider(SliderStyle sliderStyle) { InternalChild = new ImageButton((ImageButtonStyle)null) { ReleaseOnMouseLeft = false }; InternalChild.PressedChanged += WidgetOnPressedChanged; if (sliderStyle != null) { ApplySliderStyle(sliderStyle); } Maximum = 100; }
private Slider CreateByStyle(SliderStyle st, int w, int h, int curValue, Slider.DirectionType dir) { // input style in construction Slider source = new Slider(st); source.Direction = dir; root.Add(source); source.Focusable = true; source.MinValue = MIN_VALUE; source.MaxValue = MAX_VALUE; source.StateChangedEvent += OnStateChanged; source.ValueChanged += OnValueChanged; source.SlidingFinished += OnSlidingFinished; source.Size = new Size(w, h); source.CurrentValue = curValue; return(source); }
private Slider CreateByAttributes(SliderStyle attrs, int posX, int posY, int w, int h, int curValue, Slider.DirectionType dir) { Slider source = new Slider(attrs); source.Direction = dir; root.Add(source); source.Focusable = true; source.MinValue = MIN_VALUE; source.MaxValue = MAX_VALUE; source.StateChangedEvent += OnStateChanged; source.ValueChangedEvent += OnValueChanged; source.SlidingFinishedEvent += OnSlidingFinished; source.Position2D = new Position2D(posX, posY); source.Size2D = new Size2D(w, h); source.CurrentValue = curValue; return(source); }
public override void onAddedToEntity() { base.onAddedToEntity(); var skin = Skin.createDefaultSkin(); var main_table = stage.addElement(new Table()); //main_table.defaults().setPadTop(10).setMinWidth(800).setMinHeight(600).setMaxWidth(1280).setMaxHeight(720); //main_table.defaults().setPrefWidth(600).setPrefHeight(400); main_table.setFillParent(true).center(); /*var pl = entity.scene.content.Load<Texture2D>("plane"); * var im = new Image(pl); * var m = main_table.add(im); * main_table.row();*/ main_table.add(new Label("Starting thrust")); var tsl = new Slider(50, 275, 1, false, SliderStyle.create(Color.Gray, Color.Black)); tsl.setValue(thrust); var thr_label = new Label(thrust.ToString()); tsl.onChanged += (val) => { thrust = val; thr_label.setText(val.ToString()); }; main_table.add(tsl); main_table.add(thr_label); main_table.row(); main_table.add(new Label("Trim")); var sl = new Slider(-1, 1, 0.02f, false, SliderStyle.create(Color.Gray, Color.Black)); sl.setValue(trim); var trm_label = new Label(trim.ToString()); sl.onChanged += (val) => { trim = val; trm_label.setText(val.ToString()); }; main_table.add(sl); main_table.add(trm_label); main_table.row(); var go_button = new TextButton("Fly!", TextButtonStyle.create(Color.LightGray, Color.DarkGray, Color.Gray)); go_button.setWidth(100); go_button.setHeight(50); go_button.onClicked += (but) => { Console.WriteLine("ui " + trim + " " + thrust); Core.scene = new PlaneScene(trim, thrust); }; main_table.add(go_button); }
/// <summary> /// Creates skin styles /// </summary> /// <param name="contentManager">Content manager</param> public GameSkin(NezContentManager contentManager) { Skin = new Skin(); Skin.Add("title-label", new LabelStyle() { Font = contentManager.LoadBitmapFont(Content.OswaldTitleFont) }); Skin.Add("label", new LabelStyle() { Font = contentManager.LoadBitmapFont(Content.DefaultTitleFont) }); var inputCursor = new PrimitiveDrawable(Color.Black); inputCursor.MinHeight = 10; inputCursor.MinWidth = 5; var font = contentManager.LoadBitmapFont(Content.DefaultTitleFont); font.FontSize = 24; var style = Skin.Add("inputfield", new TextFieldStyle() { Font = font, FontColor = Color.Black, Cursor = inputCursor, FocusedBackground = new PrimitiveDrawable(Color.Gray), Background = new PrimitiveDrawable(Color.White), Selection = new PrimitiveDrawable(Color.Blue) }); Skin.Add("regular-button", TextButtonStyle.Create(Color.Gray, new Color(61, 9, 85), new Color(61, 9, 107))); var sliderStyle = SliderStyle.Create(Color.Yellow, new Color(61, 9, 107)); sliderStyle.Knob.MinWidth *= 1.5f; sliderStyle.Knob.MinHeight *= 1.5f; sliderStyle.Background.MinWidth *= 0.5f; Skin.Add("slider", sliderStyle); }
public override void initialize() { s1 = content.Load <Song>("Sound/Music/WelcomeToTheJungle"); addRenderer(new RenderLayerExcludeRenderer(0, 999)); addRenderer(new ScreenSpaceRenderer(10, 999)); var canvas = createEntity("ui") .addComponent(new UICanvas()); canvas.setRenderLayer(999); var table = canvas.stage.addElement(new Table()) .setFillParent(true); table.defaults().setPadTop(20); var bar = new ProgressBar(0.0f, 1.0f, 0.01f, false, ProgressBarStyle.create(Color.Black, Color.White)); table.add(bar); table.row(); var slider = new Slider(0.0f, 1.0f, 0.01f, false, SliderStyle.create(Color.DarkGray, Color.LightYellow)); table.add(slider); table.row(); var button = new Button(ButtonStyle.create(Color.Black, Color.DarkGray, Color.Green)); button.onClicked += Button_onClicked; table.add(button).setMinWidth(100).setMinHeight(30); canvas.isFullScreen = true; }
public SliderInformation(SliderStyle style, int startingPositionX, int startingPositionY, int sensitivity = 1) { this.sliderStyle = style; if (style == SliderStyle.Horizontal) { this.xPos = startingPositionX; } else if (style == SliderStyle.Vertical) { this.yPos = startingPositionY; } else if (style == SliderStyle.Square) { this.xPos = startingPositionX; this.yPos = startingPositionY; } this.minX = 0; this.minY = 0; this.maxX = 100; this.maxY = 100; this.sensitivity = sensitivity; }
private Slider CreateByProperty(int w, int h, int curValue, Slider.DirectionType dir) { // Setting the property of selector is not supported now, so add these in style first. SliderStyle st = new SliderStyle { Thumb = new ImageViewStyle() { ResourceUrl = new Selector <string> { Normal = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_slide_handler_normal.png", Pressed = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_slide_handler_press.png", }, BackgroundImage = new Selector <string> { Normal = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_slide_handler_normal.png", Pressed = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_slide_handler_effect.png", } } }; Slider source = new Slider(st); source.TrackThickness = 5; source.ThumbSize = new Size(60, 60); source.BgTrackColor = new Color(0, 0, 0, 0.1f); source.SlidedTrackColor = new Color(0.05f, 0.63f, 0.9f, 1); source.Direction = dir; source.Focusable = true; source.FocusableInTouch = true; source.MinValue = MIN_VALUE; source.MaxValue = MAX_VALUE; source.StateChangedEvent += OnStateChanged; source.ValueChanged += OnValueChanged; source.SlidingStarted += OnSlidingStarted; source.SlidingFinished += OnSlidingFinished; source.Size = new Size(w, h); source.CurrentValue = curValue; return(source); }
public SliderInformation(SliderStyle style, int startingPositionX, int startingPositionY, int sensitivity = 1) { this.sliderStyle = style; switch (style) { case SliderStyle.Horizontal: this.xPos = startingPositionX; break; case SliderStyle.Vertical: this.yPos = startingPositionY; break; case SliderStyle.Square: this.xPos = startingPositionX; this.yPos = startingPositionY; break; } this.minX = 0; this.minY = 0; this.maxX = 100; this.maxY = 100; this.sensitivity = sensitivity; }
public static void SetupUI(Scene scene) { scene.addRenderer(new ScreenSpaceRenderer(100, (int)RenderLayer.ScreenSpace)); scene.addRenderer(new RenderLayerExcludeRenderer(0, (int)RenderLayer.ScreenSpace)); var canvas = scene.createEntity("ui").addComponent(new UICanvas()); canvas.isFullScreen = true; canvas.renderLayer = (int)RenderLayer.ScreenSpace; var table = canvas.stage.addElement(new Table()); table.setFillParent(true).top().left().padTop(10); var bar = new ProgressBar(0, 1, 0.1f, false, ProgressBarStyle.create(Color.Yellow, Color.Black)); table.add(bar); table.row().setPadTop(10); var slider = new Slider(0, 1, 0.1f, false, SliderStyle.create(Color.White, Color.Black)); table.add(slider); table.row(); }
public UISlider(Vector2f size, Color lowColor, Color highColor, float selectorWidth, Color selectorColor, SliderStyle style = SliderStyle.Meter, SliderSelectorStyle selectorStyle = SliderSelectorStyle.Rectangle) { m_Size = size; m_LowColor = lowColor; m_HighColor = highColor; m_BackgroundShape = new VertexArray(PrimitiveType.Quads); switch (style) { case SliderStyle.Gradient: m_BackgroundShape.Append(new Vertex(new Vector2f(0, 0), m_LowColor)); m_BackgroundShape.Append(new Vertex(new Vector2f(m_Size.X, 0), m_HighColor)); m_BackgroundShape.Append(new Vertex(m_Size, m_HighColor)); m_BackgroundShape.Append(new Vertex(new Vector2f(0, m_Size.Y), m_LowColor)); m_ForegroundShape = null; break; case SliderStyle.Meter: m_BackgroundShape.Append(new Vertex(new Vector2f(0, 0), m_HighColor)); m_BackgroundShape.Append(new Vertex(new Vector2f(m_Size.X, 0), m_HighColor)); m_BackgroundShape.Append(new Vertex(m_Size, m_HighColor)); m_BackgroundShape.Append(new Vertex(new Vector2f(0, m_Size.Y), m_HighColor)); m_ForegroundShape = new RectangleShape(size) { FillColor = lowColor }; break; } switch (selectorStyle) { case SliderSelectorStyle.Rectangle: m_Selector = new RectangleShape(new Vector2f(selectorWidth, m_Size.Y)) { FillColor = selectorColor, Position = new Vector2f(m_Size.X, 0), Origin = new Vector2f(selectorWidth / 2f, 0) }; break; case SliderSelectorStyle.Circle: m_Selector = new CircleShape(selectorWidth / 2f) { FillColor = selectorColor, Position = new Vector2f(m_Size.X, m_Size.Y / 2f), Origin = new Vector2f(selectorWidth / 2f, selectorWidth / 2f) }; break; } }
public VerticalSlider(SliderStyle style) : base(style) { HorizontalAlignment = HorizontalAlignment.Left; VerticalAlignment = VerticalAlignment.Stretch; }
public MaterialStyle(ColorPalette colorPalette) { PrimaryColorPalette = colorPalette; SecondaryColorPalette = colorPalette; Button = OutlinedButton = new ButtonStyle { TextColor = colorPalette.P900, Border = new RoundedRectangle(4f).Stroke(Colors.Grey, 1f, true), BackgroundColor = new StyleAwareValue <ControlState, Color> { [ControlState.Default] = colorPalette.PD900, [ControlState.Hovered] = Colors.Grey.WithAlpha(.6f), [ControlState.Pressed] = Colors.Grey.WithAlpha(.4f), }, Padding = new Thickness(16, 0, 16, 0), Shadow = null, }; ContainedButton = new ButtonStyle { TextColor = colorPalette.PD900, Border = new RoundedRectangle(4f).Stroke(Colors.Grey, 1f, true), BackgroundColor = new StyleAwareValue <ControlState, Color> { [ControlState.Default] = colorPalette.P900, [ControlState.Hovered] = colorPalette.P800, [ControlState.Pressed] = colorPalette.P700, }, Shadow = new Graphics.Shadow().WithColor(Colors.Grey).WithRadius(1).WithOffset(new Size(1, 1)), Padding = new Thickness(16, 0, 16, 0), }; TextButton = new ButtonStyle { TextColor = colorPalette.P900, Padding = new Thickness(16, 0, 16, 0), BackgroundColor = new StyleAwareValue <ControlState, Color> { [ControlState.Default] = Colors.Transparent, [ControlState.Hovered] = Colors.Grey.WithAlpha(.6f), [ControlState.Pressed] = Colors.Grey.WithAlpha(.4f), }, Shadow = null, Border = null, }; Navbar = new NavbarStyle { BackgroundColor = colorPalette.P500, TextColor = colorPalette.PD500 }; Slider = new SliderStyle { ThumbColor = colorPalette.P500, ProgressColor = colorPalette.P500, TrackColor = colorPalette.P100, }; ProgressBar = new ProgressBarStyle { ProgressColor = colorPalette.P500, TrackColor = colorPalette.P100, }; }
public SliderStyle(SliderStyle style) : base(style) { KnobStyle = style.KnobStyle != null ? new ImageButtonStyle(style.KnobStyle) : null; }
public void ApplySliderStyle(SliderStyle style) { ApplyWidgetStyle(style); InternalChild.ApplyImageButtonStyle(style.KnobStyle); }
public static void SetSliderStyle(Slider slider, SliderStyle value) { slider.SetValue(SliderStyleProperty, value); }
public SliderStyle(SliderStyle style) : base(style) { KnobStyle = new ButtonStyle(style.KnobStyle); }
public void Activate() { Window window = NUIApplication.GetDefaultWindow(); root = new View() { Size2D = new Size2D(1920, 1080), }; window.Add(root); CreateInforText(); ///////////////////////////////////////////////Create by Property////////////////////////////////////////////////////////// createText[0] = new TextLabel(); createText[0].Text = "Create Slider just by properties"; createText[0].TextColor = Color.White; createText[0].Size2D = new Size2D(450, 100); createText[0].Position2D = new Position2D(200, 100); createText[0].MultiLine = true; root.Add(createText[0]); slider[0] = CreateByProperty(40, 300, 800, 50, 20, Slider.DirectionType.Horizontal); slider[1] = CreateByProperty(300, 450, 50, 400, 20, Slider.DirectionType.Vertical); slider[2] = CreateByProperty(40, 400, 800, 50, 30, Slider.DirectionType.Horizontal); slider[2].Style.LowIndicator.Text = "SubText"; slider[2].LowIndicatorSize = new Size(100, 40); slider[3] = CreateByProperty(600, 450, 50, 400, 30, Slider.DirectionType.Vertical); slider[3].Style.LowIndicator.Text = "SubText"; slider[3].LowIndicatorSize = new Size(100, 40); /////////////////////////////////////////////Create by Attributes////////////////////////////////////////////////////////// createText[1] = new TextLabel(); createText[1].TextColor = Color.White; createText[1].Text = "Create Slider just by Attributes"; createText[1].Size2D = new Size2D(450, 100); createText[1].Position2D = new Position2D(1000, 100); createText[1].MultiLine = true; root.Add(createText[1]); SliderStyle attributes = new SliderStyle { TrackThickness = 4, Track = new ImageViewStyle { BackgroundColor = new Selector <Color> { All = new Color(0, 0, 0, 0.1f), } }, Progress = new ImageViewStyle { BackgroundColor = new Selector <Color> { All = new Color(0.05f, 0.63f, 0.9f, 1), } }, Thumb = new ImageViewStyle { Size = new Size(60, 60), ResourceUrl = new Selector <string> { Normal = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_slide_handler_normal.png", Pressed = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_slide_handler_press.png", }, BackgroundImage = new Selector <string> { Normal = "", Pressed = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_slide_handler_effect.png", } }, //ThumbBackground = new ImageViewStyle //{ // Size = new Size(60, 60), // ResourceUrl = new Selector<string> // { // Normal = "", // Pressed = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_slide_handler_effect.png", // } //} }; slider2[0] = CreateByAttributes(attributes, 890, 300, 800, 50, 20, Slider.DirectionType.Horizontal); slider2[1] = CreateByAttributes(attributes, 1150, 450, 50, 400, 20, Slider.DirectionType.Vertical); slider2[2] = CreateByAttributes(attributes, 890, 400, 800, 50, 30, Slider.DirectionType.Horizontal); slider2[2].Style.LowIndicator.Text = "SubText"; slider2[2].LowIndicatorSize = new Size(100, 40); slider2[3] = CreateByAttributes(attributes, 1450, 450, 50, 400, 30, Slider.DirectionType.Vertical); slider2[3].Style.LowIndicator.Text = "SubText"; slider2[3].LowIndicatorSize = new Size(100, 40); }
public static void SetSliderStyle(DependencyObject obj, SliderStyle value) { obj.SetValue(SliderStyleProperty, value); }