ACSUtils Wiki

An ACS library for ZDoom-based ports

User Tools

Site Tools


functions:mod

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
functions:mod [2017/07/15 15:12]
korshun created
functions:mod [2017/07/15 15:13] (current)
korshun
Line 25: Line 25:
 mod(4, 3) -> 1 mod(4, 3) -> 1
 mod(5, 3) -> 2 mod(5, 3) -> 2
 +</code>
 +
 +Using mod to implement menu cycling easily:
 +
 +<code>
 +if (KeyPressed(BT_DOWN))
 +    menuindex++;
 +if (KeyPressed(BT_UP))
 +    menuindex--;
 +    
 +menuindex = mod(menuindex, NUM_MENU_ITEMS);
 </code> </code>
functions/mod.1500120720.txt.gz ยท Last modified: 2017/07/15 15:12 by korshun