public static UISlider create( UIToolkit manager, string knobFilename, string trackFilename, int trackxPos, int trackyPos, UISliderLayout layout, int depth = 2, bool knobInFront = true ) { // create the track first so we can use its dimensions to position the knob var trackTI = manager.textureInfoForFilename( trackFilename ); var trackFrame = new Rect( trackxPos, trackyPos, trackTI.frame.width, trackTI.frame.height ); // create a knob using our cacluated position var knobDepth = knobInFront ? depth - 1 : depth + 1; var knob = manager.addSprite( knobFilename, trackxPos, trackyPos, knobDepth, true ); return new UISlider( manager, trackFrame, depth, trackTI.uvRect, knob, layout ); }
public UISlider( UIToolkit manager, Rect frame, int depth, UIUVRect uvFrame, UISprite sliderKnob, UISliderLayout layout, bool rotated ):base( frame, depth, uvFrame, rotated ) { this.layout = layout; // save the sliderKnob and make it a child of the slider for organization purposes _sliderKnob = sliderKnob; _sliderKnob.parentUIObject = this; // setup the min/max position values for the sliderKnob updateSliderKnobConstraints(); manager.addTouchableSprite( this ); }
public UISlider(UIToolkit manager, Rect frame, int depth, UIUVRect uvFrame, UISprite sliderKnob, UISliderLayout layout) : base(frame, depth, uvFrame) { this.layout = layout; // save the sliderKnob and make it a child of the slider for organization purposes _sliderKnob = sliderKnob; _sliderKnob.parentUIObject = this; // setup the min/max position values for the sliderKnob updateSliderKnobConstraints(); manager.addTouchableSprite(this); }
public static UISlider create( UIToolkit manager, string knobFilename, string trackFilename, int trackxPos, int trackyPos, UISliderLayout layout ) { // create the track first so we can use its dimensions to position the knob var trackTI = manager.textureInfoForFilename( trackFilename ); var trackFrame = new Rect( trackxPos, trackyPos, trackTI.frame.width, trackTI.frame.height ); // position the knob based on the knobs size, layout and the track size if( layout == UISliderLayout.Horizontal ) trackyPos += (int)trackTI.frame.height / 2; else trackxPos += (int)trackTI.frame.width / 2; // create a knob using our cacluated position var knob = manager.addSprite( knobFilename, trackxPos, trackyPos, 1, true ); return new UISlider( manager, trackFrame, 2, trackTI.uvRect, knob, layout, trackTI.rotated ); }
// The knobs x/y coordinates should be relative to the tracks and it is measured from the center of the knob public static UISlider create( string knobFilename, string trackFilename, int trackxPos, int trackyPos, UISliderLayout layout ) { return create( UI.firstToolkit, knobFilename, trackFilename, trackxPos, trackyPos, layout ); }
// The knobs x/y coordinates should be relative to the tracks and it is measured from the center of the knob public static UISlider create( string knobFilename, string trackFilename, int trackxPos, int trackyPos, UISliderLayout layout, int depth = 2, bool knobInFront = true ) { return create( UI.firstToolkit, knobFilename, trackFilename, trackxPos, trackyPos, layout, depth, knobInFront ); }
public static UISlider create(UIToolkit manager, string knobFilename, string trackFilename, int trackxPos, int trackyPos, UISliderLayout layout, int depth = 2, bool knobInFront = true) { // create the track first so we can use its dimensions to position the knob var trackTI = manager.textureInfoForFilename(trackFilename); var trackFrame = new Rect(trackxPos, trackyPos, trackTI.frame.width, trackTI.frame.height); // create a knob using our cacluated position var knobDepth = knobInFront ? depth - 1 : depth + 1; var knob = manager.addSprite(knobFilename, trackxPos, trackyPos, knobDepth, true); return(new UISlider(manager, trackFrame, depth, trackTI.uvRect, knob, layout)); }
// The knobs x/y coordinates should be relative to the tracks and it is measured from the center of the knob public static UISlider create(string knobFilename, string trackFilename, int trackxPos, int trackyPos, UISliderLayout layout, int depth = 2, bool knobInFront = true) { return(create(UI.firstToolkit, knobFilename, trackFilename, trackxPos, trackyPos, layout, depth, knobInFront)); }
// the knobs x/y coordinates should be relative to the tracks and it is measured from the center of the knob public static UISlider create(UIToolkit manager, string knobFilename, string trackFilename, int trackxPos, int trackyPos, UISliderLayout layout) { // create the track first so we can use its dimensions to position the knob var trackTI = manager.textureInfoForFilename(trackFilename); var trackFrame = new Rect(trackxPos, trackyPos, trackTI.size.x, trackTI.size.y); // position the knob based on the knobs size, layout and the track size if (layout == UISliderLayout.Horizontal) { trackyPos += (int)trackTI.size.y / 2; } else { trackxPos += (int)trackTI.size.x / 2; } // create a knob using our cacluated position var knob = manager.addSprite(knobFilename, trackxPos, trackyPos, 1, true); return(new UISlider(manager, trackFrame, 2, trackTI.uvRect, knob, layout)); }
public static UISlider create(string knobFilename, string trackFilename, int trackxPos, int trackyPos, UISliderLayout layout) { return(create(UI.firstToolkit, knobFilename, trackFilename, trackxPos, trackyPos, layout)); }
public static UISlider create(UIToolkit manager, string knobFilename, string trackFilename, int trackxPos, int trackyPos, UISliderLayout layout, int depth) { return(create(manager, knobFilename, trackFilename, trackxPos, trackyPos, layout, depth, true)); }
// The knobs x/y coordinates should be relative to the tracks and it is measured from the center of the knob public static UISlider create(string knobFilename, string trackFilename, int trackxPos, int trackyPos, UISliderLayout layout) { return(create(knobFilename, trackFilename, trackxPos, trackyPos, layout, 2)); }