Warcraft 3 documentation

vJASS & Zinc Documentation
For the latest documentation about how it works vJASS and Zinc language layers for Warcraft III, please follow these links:
Jasshelper documentation - Zinc documentation - WC3 Optimizer documentation

WorldBounds

moyack · 3950

0 Members and 1 Guest are viewing this topic.

WorldBounds
on: February 21, 2012, 10:26:47 PM
Category: Geometry
Language: vJASS

Code: jass
  1. library WorldBounds /* v2.0.0.0
  2. ************************************************************************************
  3. *
  4. *       struct WorldBounds extends array
  5. *
  6. *               Fields
  7. *               -------------------------
  8. *
  9. *                       readonly static integer maxX
  10. *                       readonly static integer maxY
  11. *                       readonly static integer minX
  12. *                       readonly static integer minY
  13. *
  14. *                       readonly static integer centerX
  15. *                       readonly static integer centerY
  16. *
  17. *                       readonly static rect world
  18. *                       readonly static region worldRegion
  19. *
  20. ************************************************************************************/
  21.         private module WorldBoundInit
  22.                 private static method onInit takes nothing returns nothing
  23.                         set world=GetWorldBounds()
  24.                        
  25.                         set maxX = R2I(GetRectMaxX(world))
  26.                         set maxY = R2I(GetRectMaxY(world))
  27.                         set minX = R2I(GetRectMinX(world))
  28.                         set minY = R2I(GetRectMinY(world))
  29.                        
  30.                         set centerX = R2I((maxX + minX)/2)
  31.                         set centerY = R2I((minY + maxY)/2)
  32.                        
  33.                         set worldRegion = CreateRegion()
  34.                        
  35.                         call RegionAddRect(worldRegion, world)
  36.                 endmethod
  37.         endmodule
  38.        
  39.         struct WorldBounds extends array
  40.                 readonly static integer maxX
  41.                 readonly static integer maxY
  42.                 readonly static integer minX
  43.                 readonly static integer minY
  44.                
  45.                 readonly static integer centerX
  46.                 readonly static integer centerY
  47.                
  48.                 readonly static rect world
  49.                
  50.                 readonly static region worldRegion
  51.                
  52.                 implement WorldBoundInit
  53.         endstruct
  54. endlibrary
« Last Edit: December 19, 2017, 01:03:41 AM by moyack »



 

Vivir aprendiendo.co - A place for learning stuff, in Spanish   Chaos Realm - The world of Game modders and wc3 addicts   Diplo, a gaming community   WC3JASS.com - The JASS Vault + vJASS and Zinc   Jetcraft - A Starcraft II mod   WormTastic Clan (wTc)