ACSUtils Wiki

An ACS library for ZDoom-based ports

User Tools

Site Tools


functions:addons:rect

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
functions:addons:rect [2016/08/17 02:09] – [RectIsGrabbed] monsterovichfunctions: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:cursor|cursor]] library.+This is a simple library that implements basic UI elements in ACS. This library is an **addon** for the cursor library.
  
-<note tip>**ACSRect** is not bundled with official ACSUtils. You can download it [[https://github.com/Monsterovich/acsutils/archive/acsrect.zip|here]].</note>+<note tip>**ACSRect** is not bundled with official ACSUtils. You can download it [[https://gist.github.com/Monsterovich/33578899cf10790ce7f957f9be4a9de1|here]].</note>
  
 Define ''ACSUTILS_RECTLIB_SAVEDSTATES'' to specify the amount of required rectangles. Define ''ACSUTILS_RECTLIB_SAVEDSTATES'' to specify the amount of required rectangles.
 +
 +===== Usage =====
 +
 +<code>
 +...
 +
 +#define ACSUTILS_RECTLIB_USERVARS 1 // user defined
 +#include "acsutils.acs"
 +#include "acsrect.acs"
 +
 +...
 +</code>
  
 ===== Example ===== ===== Example =====
Line 30: Line 42:
  if (RectIsPressed(i, BT_ATTACK))  if (RectIsPressed(i, BT_ATTACK))
  log(s:"pressed");  log(s:"pressed");
 +
 + for (int j = 0; j <= rects; j++)
 + {
 + if (RectIntersects(i, j))
 + log(s:"rect ", d:i, s:" intersects with ", d:j);
 + }
   
  HudSetPoint(RectX1(i), RectX2(i));  HudSetPoint(RectX1(i), RectX2(i));