This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
functions:addons:rect [2016/08/09 22:05] – korshun | functions:addons:rect [2017/07/13 18:42] – monsterovich | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Rectangle API ====== | ====== Rectangle API ====== | ||
- | This is a simple library that implements basic UI elements in ACS. This library is an **addon** for the [[functions: | + | This is a simple library that implements basic UI elements in ACS. This library is an **addon** for the cursor library. |
- | <note tip> | + | <note tip> |
Define '' | Define '' | ||
+ | |||
+ | ===== Usage ===== | ||
+ | |||
+ | < | ||
+ | ... | ||
+ | |||
+ | #define ACSUTILS_RECTLIB_USERVARS 1 // user defined | ||
+ | #include " | ||
+ | #include " | ||
+ | |||
+ | ... | ||
+ | </ | ||
===== Example ===== | ===== Example ===== | ||
Line 22: | Line 34: | ||
UpdateCursor(); | UpdateCursor(); | ||
HudSetPoint(CursorX(), | HudSetPoint(CursorX(), | ||
- | | + | |
for (int i = 0; i <= rects; i++) | for (int i = 0; i <= rects; i++) | ||
Line 30: | Line 42: | ||
if (RectIsPressed(i, | if (RectIsPressed(i, | ||
log(s:" | log(s:" | ||
+ | |||
+ | for (int j = 0; j <= rects; j++) | ||
+ | { | ||
+ | if (RectIntersects(i, | ||
+ | log(s:" | ||
+ | } | ||
HudSetPoint(RectX1(i), | HudSetPoint(RectX1(i), | ||
Line 129: | Line 147: | ||
Returns true if the rectangle contains the point with the coordinates //x y//, otherwise returns false. | Returns true if the rectangle contains the point with the coordinates //x y//, otherwise returns false. | ||
+ | |||
+ | ==== RectIntersects ==== | ||
+ | '' | ||
+ | |||
+ | Returns true if the rectangle with id //rect// intersects with other rectangle with id //rect2//. | ||
+ | |||
+ | <note tip> | ||
===== User Data ===== | ===== User Data ===== | ||
Line 189: | Line 214: | ||
'' | '' | ||
- | This function is similar to // | + | This function is similar to // |
==== RectIsPressed ==== | ==== RectIsPressed ==== | ||
'' | '' | ||
Line 196: | Line 220: | ||
This function is similar to // | This function is similar to // | ||
- | * Returns true, if user up the //key// after he clicked | + | * Returns true, if user released |
- | * Returns true, if cursor | + | * Returns true, if cursor |
Otherwise, it return false. | Otherwise, it return false. | ||