public UIColorPicker( UIToolkit manager, Rect frame, int depth, UIUVRect uvFrame, Vector2 textureCoords ) : base(frame, depth, uvFrame) { //We store the coordinates of the top left of the subtexture this.textureCoords = textureCoords; manager.addTouchableSprite( this ); }
/// <summary> /// Creates a swipe detector with no related UI /// </summary> public static UISwipeDetector create( UIToolkit manager, Rect frame, int depth ) { // create the swipe detector var detector = new UISwipeDetector( frame, depth, UIUVRect.zero ); manager.addTouchableSprite( detector ); return detector; }
/// <summary> /// Creates a swipe detector with no related UI /// </summary> public static UISwipeDetector create(UIToolkit manager, Rect frame, int depth) { // create the swipe detector var detector = new UISwipeDetector(frame, depth, UIUVRect.zero); manager.addTouchableSprite(detector); return(detector); }
public UIButton( UIToolkit manager, Rect frame, int depth, UIUVRect uvFrame, UIUVRect highlightedUVframe ):base( frame, depth, uvFrame ) { // If a highlighted frame has not yet been set use the normalUVframe if( highlightedUVframe == UIUVRect.zero ) highlightedUVframe = uvFrame; this.highlightedUVframe = highlightedUVframe; manager.addTouchableSprite( this ); }
public UIButton(UIToolkit manager, Rect frame, int depth, UIUVRect uvFrame, UIUVRect highlightedUVframe) : base(frame, depth, uvFrame) { // If a highlighted frame has not yet been set use the normalUVframe if (highlightedUVframe == UIUVRect.zero) { highlightedUVframe = uvFrame; } this.highlightedUVframe = highlightedUVframe; manager.addTouchableSprite(this); }
/// <summary> /// Creates a swipe detector with a texture backing the hit area /// </summary> public static UISwipeDetector create( UIToolkit manager, string filename, int xPos, int yPos, int depth ) { // grab the texture details var normalTI = manager.textureInfoForFilename( filename ); var frame = new Rect( xPos, yPos, normalTI.frame.width, normalTI.frame.height ); // create the swipe detector var detector = new UISwipeDetector( frame, depth, normalTI.uvRect ); manager.addTouchableSprite( detector ); return detector; }
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); }
/// <summary> /// Creates a swipe detector with a texture backing the hit area /// </summary> public static UISwipeDetector create(UIToolkit manager, string filename, int xPos, int yPos, int depth) { // grab the texture details var normalTI = manager.textureInfoForFilename(filename); var frame = new Rect(xPos, yPos, normalTI.frame.width, normalTI.frame.height); // create the swipe detector var detector = new UISwipeDetector(frame, depth, normalTI.uvRect); manager.addTouchableSprite(detector); return(detector); }
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 UIButton( UIToolkit manager, Rect frame, int depth, UIUVRect uvFrame, UIUVRect highlightedUVframe ):base( frame, depth, uvFrame ) { // Save a copy of our uvFrame here so that when highlighting turns off we have the original UVs _normalUVframe = uvFrame; // If a highlighted frame has not yet been set use the normalUVframe if( highlightedUVframe == UIUVRect.zero ) highlightedUVframe = uvFrame; this.highlightedUVframe = highlightedUVframe; manager.addTouchableSprite( this ); }
public UIGhostJoystick(UIToolkit manager, Rect frame, int depth, UISprite joystickSprite) : base(frame, depth, UIUVRect.zero) { // Save out the uvFrame for the sprite so we can highlight _tempUVframe = joystickSprite.uvFrame; // Save the joystickSprite and make it a child of the us for organization purposes _joystickSprite = joystickSprite; _joystickSprite.parentUIObject = this; resetJoystick(); manager.addTouchableSprite(this); _manager = manager; }
public UIButton(UIToolkit manager, Rect frame, int depth, UIUVRect uvFrame, UIUVRect highlightedUVframe) : base(frame, depth, uvFrame) { // Save a copy of our uvFrame here so that when highlighting turns off we have the original UVs _normalUVframe = uvFrame; // If a highlighted frame has not yet been set use the normalUVframe if (highlightedUVframe == UIUVRect.zero) { highlightedUVframe = uvFrame; } this.highlightedUVframe = highlightedUVframe; manager.addTouchableSprite(this); }
private UIToolkit _manager; // we need this for getting at texture details after the constructor #endregion Fields #region Constructors public UIGhostJoystick( UIToolkit manager, Rect frame, int depth, UISprite joystickSprite) : base(frame, depth, UIUVRect.zero) { // Save out the uvFrame for the sprite so we can highlight _tempUVframe = joystickSprite.uvFrame; // Save the joystickSprite and make it a child of the us for organization purposes _joystickSprite = joystickSprite; _joystickSprite.parentUIObject = this; resetJoystick(); manager.addTouchableSprite( this ); _manager = manager; }
public UIJoystick(UIToolkit manager, Rect frame, int depth, UISprite joystickSprite, float xPos, float yPos) : base(frame, depth, UIUVRect.zero) { // Save out the uvFrame for the sprite so we can highlight _normalUVframe = joystickSprite.uvFrame; // Save the joystickSprite and make it a child of the us for organization purposes _joystickSprite = joystickSprite; _joystickSprite.parentUIObject = this; // Move the joystick to its default position after converting the offset to a vector3 _joystickOffset = new Vector3(xPos, yPos); // Set the maxMovement which will in turn calculate the _joystickBoundary this.maxJoystickMovement = _maxJoystickMovement; resetJoystick(); manager.addTouchableSprite(this); _manager = manager; }
public UIJoystick( UIToolkit manager, Rect frame, int depth, UISprite joystickSprite, float xPos, float yPos ):base( frame, depth, UIUVRect.zero ) { // Save out the uvFrame for the sprite so we can highlight _normalUVframe = joystickSprite.uvFrame; // Save the joystickSprite and make it a child of the us for organization purposes _joystickSprite = joystickSprite; _joystickSprite.parentUIObject = this; // Move the joystick to its default position after converting the offset to a vector3 _joystickOffset = new Vector3( xPos, yPos ); // Set the maxMovement which will in turn calculate the _joystickBoundary this.maxJoystickMovement = _maxJoystickMovement; resetJoystick(); manager.addTouchableSprite( this ); _manager = manager; }
/// <summary> /// Initializes a new instance of the <see cref="UISlice9"/> class. /// </summary> /// <param name='manager'> /// Manager. /// </param> /// <param name='frame'> /// Frame. /// </param> /// <param name='depth'> /// Depth. /// </param> /// <param name='uvFrame'> /// Uv frame. /// </param> /// <param name='highlightedUVframe'> /// Highlighted U vframe. /// </param> /// <param name='width'> /// Final width /// </param> /// <param name='height'> /// Final height /// </param> /// <param name='sTP'> /// Top Margin /// </param> /// <param name='sRT'> /// Right Margin /// </param> /// <param name='sBT'> /// Bottom Margin /// </param> /// <param name='sLT'> /// Left Margin /// </param> public UISlice9(UIToolkit manager, Rect frame, int depth, UIUVRect uvFrame, UIUVRect highlightedUVframe, int width, int height, int sTP, int sRT, int sBT, int sLT) : base(frame, depth, uvFrame) { // If a highlighted frame has not yet been set use the normalUVframe if (highlightedUVframe == UIUVRect.zero) { highlightedUVframe = uvFrame; } this.highlightedUVframe = highlightedUVframe; int stretchedWidth = width - (sLT + sRT); int stretchedHeight = height - (sTP + sBT); this.manager = manager; // Top Left spriteSlices[0] = new UISprite(new Rect(frame.x, frame.y, sLT, sTP), depth, new UIUVRect(uvFrame.frame.x, uvFrame.frame.y, sLT, sTP, manager.textureSize)); spriteSlices[0].client.transform.parent = this.client.transform; manager.addSprite(spriteSlices[0]); // Top Middle spriteSlices[1] = new UISprite(new Rect(frame.x + sLT, frame.y, stretchedWidth, sTP), depth, new UIUVRect(uvFrame.frame.x + sLT, uvFrame.frame.y, uvFrame.frame.width - (sRT + sLT), sTP, manager.textureSize)); spriteSlices[1].client.transform.parent = this.client.transform; manager.addSprite(spriteSlices[1]); // Top Right spriteSlices[2] = new UISprite(new Rect(frame.x + sLT + stretchedWidth, frame.y, sRT, sTP), depth, new UIUVRect(uvFrame.frame.x + sLT + (uvFrame.frame.width - (sRT + sLT)), uvFrame.frame.y, sRT, sTP, manager.textureSize)); spriteSlices[2].client.transform.parent = this.client.transform; manager.addSprite(spriteSlices[2]); // Middle Left spriteSlices[3] = new UISprite(new Rect(frame.x, frame.y + sTP, sLT, stretchedHeight), depth, new UIUVRect(uvFrame.frame.x, uvFrame.frame.y + sTP, sLT, uvFrame.frame.height - (sTP + sBT), manager.textureSize)); spriteSlices[3].client.transform.parent = this.client.transform; manager.addSprite(spriteSlices[3]); // Middle Middle spriteSlices[4] = new UISprite(new Rect(frame.x + sLT, frame.y + sTP, stretchedWidth, stretchedHeight), depth, new UIUVRect(uvFrame.frame.x + sLT, uvFrame.frame.y + sTP, uvFrame.frame.height - (sTP + sBT), (int)frame.width - (sLT + sRT), manager.textureSize)); spriteSlices[4].client.transform.parent = this.client.transform; manager.addSprite(spriteSlices[4]); // Middle Right spriteSlices[5] = new UISprite(new Rect(frame.x + sLT + stretchedWidth, frame.y + sTP, sRT, stretchedHeight), depth, new UIUVRect(uvFrame.frame.x + (uvFrame.frame.width - sRT), uvFrame.frame.y + sTP, sRT, uvFrame.frame.height - (sBT + sTP), manager.textureSize)); spriteSlices[5].client.transform.parent = this.client.transform; manager.addSprite(spriteSlices[5]); // Bottom Left spriteSlices[6] = new UISprite(new Rect(frame.x, frame.y + sTP + stretchedHeight, sLT, sBT), depth, new UIUVRect(uvFrame.frame.x, uvFrame.frame.y + (uvFrame.frame.height - sBT), sLT, sBT, manager.textureSize)); spriteSlices[6].client.transform.parent = this.client.transform; manager.addSprite(spriteSlices[6]); // Bottom Middle spriteSlices[7] = new UISprite(new Rect(frame.x + sLT, frame.y + sTP + stretchedHeight, stretchedWidth, sBT), depth, new UIUVRect(uvFrame.frame.x + sLT, uvFrame.frame.y + (uvFrame.frame.height - sBT), uvFrame.frame.width - (sLT + sRT), sBT, manager.textureSize)); spriteSlices[7].client.transform.parent = this.client.transform; manager.addSprite(spriteSlices[7]); // Bottom Right spriteSlices[8] = new UISprite(new Rect(frame.x + sLT + stretchedWidth, frame.y + sTP + stretchedHeight, sRT, sBT), depth, new UIUVRect(uvFrame.frame.x + sLT + (uvFrame.frame.width - (sRT + sLT)), uvFrame.frame.y + (uvFrame.frame.height - sBT), sRT, sBT, manager.textureSize)); spriteSlices[8].client.transform.parent = this.client.transform; manager.addSprite(spriteSlices[8]); this.setSize(width, height); manager.addTouchableSprite(this); }
/// <summary> /// Initializes a new instance of the <see cref="UISlice9"/> class. /// </summary> /// <param name='manager'> /// Manager. /// </param> /// <param name='frame'> /// Frame. /// </param> /// <param name='depth'> /// Depth. /// </param> /// <param name='uvFrame'> /// Uv frame. /// </param> /// <param name='highlightedUVframe'> /// Highlighted U vframe. /// </param> /// <param name='width'> /// Final width /// </param> /// <param name='height'> /// Final height /// </param> /// <param name='sTP'> /// Top Margin /// </param> /// <param name='sRT'> /// Right Margin /// </param> /// <param name='sBT'> /// Bottom Margin /// </param> /// <param name='sLT'> /// Left Margin /// </param> public UISlice9( UIToolkit manager, Rect frame, int depth, UIUVRect uvFrame, UIUVRect highlightedUVframe, int width, int height, int sTP, int sRT, int sBT, int sLT ):base( frame, depth, uvFrame ) { // If a highlighted frame has not yet been set use the normalUVframe if( highlightedUVframe == UIUVRect.zero ) highlightedUVframe = uvFrame; this.highlightedUVframe = highlightedUVframe; int stretchedWidth = width - ( sLT + sRT ); int stretchedHeight = height - ( sTP + sBT ); this.manager = manager; // Top Left spriteSlices[0] = new UISprite( new Rect( frame.x, frame.y, sLT, sTP ), depth, new UIUVRect( uvFrame.frame.x, uvFrame.frame.y, sLT, sTP, manager.textureSize ) ); spriteSlices[0].client.transform.parent = this.client.transform; manager.addSprite( spriteSlices[0] ); // Top Middle spriteSlices[1] = new UISprite( new Rect( frame.x + sLT, frame.y, stretchedWidth, sTP ), depth, new UIUVRect( uvFrame.frame.x + sLT, uvFrame.frame.y, uvFrame.frame.width - ( sRT + sLT ), sTP, manager.textureSize ) ); spriteSlices[1].client.transform.parent = this.client.transform; manager.addSprite( spriteSlices[1] ); // Top Right spriteSlices[2] = new UISprite( new Rect( frame.x + sLT + stretchedWidth, frame.y, sRT, sTP ), depth, new UIUVRect( uvFrame.frame.x + sLT + ( uvFrame.frame.width - ( sRT + sLT ) ), uvFrame.frame.y, sRT, sTP, manager.textureSize ) ); spriteSlices[2].client.transform.parent = this.client.transform; manager.addSprite( spriteSlices[2] ); // Middle Left spriteSlices[3] = new UISprite( new Rect( frame.x, frame.y + sTP, sLT, stretchedHeight ), depth, new UIUVRect( uvFrame.frame.x, uvFrame.frame.y + sTP, sLT, uvFrame.frame.height - ( sTP + sBT ), manager.textureSize ) ); spriteSlices[3].client.transform.parent = this.client.transform; manager.addSprite( spriteSlices[3] ); // Middle Middle spriteSlices[4] = new UISprite( new Rect( frame.x + sLT, frame.y + sTP, stretchedWidth, stretchedHeight ), depth, new UIUVRect( uvFrame.frame.x + sLT, uvFrame.frame.y + sTP, uvFrame.frame.height - ( sTP + sBT ), (int)frame.width - ( sLT + sRT ), manager.textureSize ) ); spriteSlices[4].client.transform.parent = this.client.transform; manager.addSprite( spriteSlices[4] ); // Middle Right spriteSlices[5] = new UISprite( new Rect( frame.x + sLT + stretchedWidth, frame.y + sTP, sRT, stretchedHeight ), depth, new UIUVRect( uvFrame.frame.x + ( uvFrame.frame.width - sRT ), uvFrame.frame.y + sTP, sRT, uvFrame.frame.height - ( sBT + sTP ), manager.textureSize ) ); spriteSlices[5].client.transform.parent = this.client.transform; manager.addSprite( spriteSlices[5] ); // Bottom Left spriteSlices[6] = new UISprite( new Rect( frame.x, frame.y + sTP + stretchedHeight, sLT, sBT ), depth, new UIUVRect( uvFrame.frame.x, uvFrame.frame.y + ( uvFrame.frame.height - sBT ), sLT, sBT, manager.textureSize ) ); spriteSlices[6].client.transform.parent = this.client.transform; manager.addSprite( spriteSlices[6] ); // Bottom Middle spriteSlices[7] = new UISprite( new Rect( frame.x + sLT, frame.y + sTP + stretchedHeight, stretchedWidth, sBT ), depth, new UIUVRect( uvFrame.frame.x + sLT, uvFrame.frame.y + ( uvFrame.frame.height - sBT ), uvFrame.frame.width - ( sLT + sRT ), sBT, manager.textureSize ) ); spriteSlices[7].client.transform.parent = this.client.transform; manager.addSprite( spriteSlices[7] ); // Bottom Right spriteSlices[8] = new UISprite( new Rect( frame.x + sLT + stretchedWidth, frame.y + sTP + stretchedHeight, sRT, sBT ), depth, new UIUVRect( uvFrame.frame.x + sLT + ( uvFrame.frame.width - ( sRT + sLT ) ), uvFrame.frame.y + ( uvFrame.frame.height - sBT ), sRT, sBT, manager.textureSize ) ); spriteSlices[8].client.transform.parent = this.client.transform; manager.addSprite( spriteSlices[8] ); this.setSize( width, height ); manager.addTouchableSprite( this ); }
public UIColorPicker(UIToolkit manager, Rect frame, int depth, UIUVRect uvFrame, Vector2 textureCoords) : base(frame, depth, uvFrame) { //We store the coordinates of the top left of the subtexture this.textureCoords = textureCoords; manager.addTouchableSprite(this); }