WorldBounds

Scripts

14 years
edited 8 years
Code (jass) Select
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