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 );
	}
Esempio n. 2
0
	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 );
	}
Esempio n. 3
0
    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);
    }
Esempio n. 4
0
	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 );
	}
Esempio n. 5
0
	// 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 );
	}
Esempio n. 6
0
 // 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 );
 }
Esempio n. 7
0
    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));
    }
Esempio n. 8
0
 // 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));
 }
Esempio n. 9
0
    // 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));
    }
Esempio n. 10
0
 public static UISlider create(string knobFilename, string trackFilename, int trackxPos, int trackyPos, UISliderLayout layout)
 {
     return(create(UI.firstToolkit, knobFilename, trackFilename, trackxPos, trackyPos, layout));
 }
Esempio n. 11
0
 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));
 }
Esempio n. 12
0
 // 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));
 }