# SRect

**الأعضاء** 22

|       |                       |                                                                                   |
| ----- | --------------------- | --------------------------------------------------------------------------------- |
| دالة  | [Contains](#contains) | Returns true if the x and y components of point is a point inside this rectangle. |
| دالة  | [Overlaps](#overlaps) | Returns true if the other rectangle overlaps this one.                            |
| دالة  | [Equals](#equals)     | Returns true if the rectangles are the same.                                      |
| دالة  | [ToString](#tostring) | Returns string for this Rect.                                                     |
| دالة  | [New](#new)           | Constructs a new SRect                                                            |
| خاصية | [X](#x)               | –                                                                                 |
| خاصية | [Y](#y)               | –                                                                                 |
| خاصية | [Width](#width)       | –                                                                                 |
| خاصية | [Height](#height)     | –                                                                                 |
| خاصية | [Position](#position) | The X and Y position of the rectangle.                                            |
| خاصية | [Center](#center)     | The position of the center of the rectangle.                                      |
| خاصية | [Min](#min)           | The position of the minimum corner of the rectangle.                              |
| خاصية | [Max](#max)           | The position of the maximum corner of the rectangle.                              |
| خاصية | [Size](#size)         | The width and height of the rectangle.                                            |
| خاصية | [XMin](#xmin)         | The minimum X coordinate of the rectangle.                                        |
| خاصية | [YMin](#ymin)         | The minimum Y coordinate of the rectangle.                                        |
| خاصية | [XMax](#xmax)         | The maximum Y coordinate of the rectangle.                                        |
| خاصية | [YMax](#ymax)         | The maximum Y coordinate of the rectangle.                                        |
| خاصية | [Left](#left)         | –                                                                                 |
| خاصية | [Right](#right)       | –                                                                                 |
| خاصية | [Top](#top)           | –                                                                                 |
| خاصية | [Bottom](#bottom)     | –                                                                                 |

## الدوال

### Contains

bool Contains([SVector](/docs/ar/scripting/client-scripting-api-reference/types/svector.md) point)

bool Contains([SVector](/docs/ar/scripting/client-scripting-api-reference/types/svector.md) point, bool allowInverse)

Returns true if the x and y components of point is a point inside this rectangle. If allowInverse is present and true, the width and height of the Rect are allowed to take negative values (ie, the min value is greater than the max), and the test will still work.

المعاملات

| الاسم        | النوع                                                                         | القيمة الافتراضية |
| ------------ | ----------------------------------------------------------------------------- | ----------------- |
| point        | [SVector](/docs/ar/scripting/client-scripting-api-reference/types/svector.md) | –                 |
| allowInverse | bool                                                                          | –                 |

القيم المرجعة

`bool`

مثال

**Lua**

```lua
newRect=Rect.New(0,0,150,150)
otherRect = Rect.New(0,0,150,150)

isContains = newRect.Contains(otherRect)
--or
isContains = newRect.Contains(otherRect , true)

```

### Overlaps

bool Overlaps(SRect other)

bool Overlaps(SRect other, bool allowInverse)

Returns true if the other rectangle overlaps this one. If allowInverse is present and true, the widths and heights of the Rects are allowed to take negative values (ie, the min value is greater than the max), and the test will still work.

المعاملات

| الاسم        | النوع | القيمة الافتراضية |
| ------------ | ----- | ----------------- |
| other        | SRect | –                 |
| allowInverse | bool  | –                 |

القيم المرجعة

`bool`

مثال

**Lua**

```lua
newRect=Rect.New(0,0,150,150)
otherRect = Rect.New(0,0,150,150)

isOverlapping = newRect.Overlaps(otherRect)
--or
isOverlapping = newRect.Overlaps(otherRect , true)

```

### Equals

bool Equals(SRect other)

Returns true if the rectangles are the same.

المعاملات

| الاسم | النوع | القيمة الافتراضية |
| ----- | ----- | ----------------- |
| other | SRect | –                 |

القيم المرجعة

`bool`

مثال

**Lua**

```lua
newRect=Rect.New(0,0,150,150)
otherRect = Rect.New(0,0,150,150)
AreEqual = newRect.Equals(otherRect)

```

### ToString

string ToString(string format)

string ToString()

Returns string for this Rect.

المعاملات

| الاسم  | النوع  | القيمة الافتراضية |
| ------ | ------ | ----------------- |
| format | string | –                 |

القيم المرجعة

`string`

مثال

**Lua**

```lua
newRect=Rect.New(0,0,150,150)
otherRect = Rect.New(0,0,150,150)
AreEqual = newRect.Equals(otherRect)

```

### New

static SRect New(float x, float y, float width, float height)

Constructs a new SRect

المعاملات

| الاسم  | النوع | القيمة الافتراضية |
| ------ | ----- | ----------------- |
| x      | float | –                 |
| y      | float | –                 |
| width  | float | –                 |
| height | float | –                 |

القيم المرجعة

`SRect`

مثال

**Lua**

```lua
newRect=Rect.New(0,0,150,150)

```

## الخصائص

### X

float X {get; set; }

مثال

**Lua**

```lua
newRect=Rect.New(0,0,150,150)
newRect.X = 10.0

```

### Y

float Y {get; set; }

مثال

**Lua**

```lua
newRect=Rect.New(0,0,150,150)
newRect.Y = 10.0

```

### Width

float Width {get; set; }

مثال

**Lua**

```lua
newRect=Rect.New(0,0,150,150)
newRect.Width = 10.0

```

### Height

float Height {get; set; }

مثال

**Lua**

```lua
newRect=Rect.New(0,0,150,150)
newRect.Height = 10.0

```

### Position

[SVector](/docs/ar/scripting/client-scripting-api-reference/types/svector.md) Position {get; }

The X and Y position of the rectangle.

مثال

**Lua**

```lua
newRect=Rect.New(50,50,150,150)
positionVector = newRect.position

```

### Center

[SVector](/docs/ar/scripting/client-scripting-api-reference/types/svector.md) Center {get; }

The position of the center of the rectangle.

مثال

**Lua**

```lua
newRect = Rect.New(50,50,150,150)
VectorCenter = newRect.Center

```

### Min

[SVector](/docs/ar/scripting/client-scripting-api-reference/types/svector.md) Min {get; }

The position of the minimum corner of the rectangle.

مثال

**Lua**

```lua
newRect=Rect.New(0,0,150,150)
vectorMin = newRect.Min

```

### Max

[SVector](/docs/ar/scripting/client-scripting-api-reference/types/svector.md) Max {get; }

The position of the maximum corner of the rectangle.

مثال

**Lua**

```lua
newRect=Rect.New(0,0,150,150)
vectorMax = newRect.Max

```

### Size

[SVector](/docs/ar/scripting/client-scripting-api-reference/types/svector.md) Size {get; }

The width and height of the rectangle.

مثال

**Lua**

```lua
newRect=Rect.New(0,0,150,150)
vectorSize = newRect.Size

```

### XMin

float XMin {get; }

The minimum X coordinate of the rectangle.

مثال

**Lua**

```lua
newRect=Rect.New(0,0,150,150)
floatXMin = newRect.XMin

```

### YMin

float YMin {get; }

The minimum Y coordinate of the rectangle.

مثال

**Lua**

```lua
newRect=Rect.New(0,0,150,150)
floatYMin = newRect.YMin

```

### XMax

float XMax {get; }

The maximum Y coordinate of the rectangle.

مثال

**Lua**

```lua
newRect=Rect.New(0,0,150,150)
floatXMax = newRect.XMax

```

### YMax

float YMax {get; }

The maximum Y coordinate of the rectangle.

مثال

**Lua**

```lua
newRect=Rect.New(0,0,150,150)
floatYMax = newRect.YMax

```

### Left

float Left {get; }

مثال

**Lua**

```lua
newRect=Rect.New(0,0,150,150)
floatLeft = newRect.Left

```

### Right

float Right {get; }

مثال

**Lua**

```lua
newRect=Rect.New(0,0,150,150)
floatRight = newRect.Right

```

### Top

float Top {get; }

مثال

**Lua**

```lua
newRect=Rect.New(0,0,150,150)
floatTop = newRect.Top

```

### Bottom

float Bottom {get; }

مثال

**Lua**

```lua
newRect=Rect.New(0,0,150,150)
floatBottom = newRect.Bottom

```
