This repository has been archived by the owner on Jan 1, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
flxrect.monkey
139 lines (120 loc) · 3.95 KB
/
flxrect.monkey
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#rem
header:This module contains the FlxRect class.
[b]IMPORTANT![/b] When porting the library were excluded following original Flixel library FlxPoint class methods:
[code]copyFromFlash, copyToFlash[/code]
#end
Strict
#Rem
summary:Stores a rectangle.
#End
Class FlxRect
'summary:The X-coordinate of the point in space.
Field x:Float
'summary:The Y-coordinate of the point in space.
Field y:Float
'summary:Width of the rectangle..
Field width:Float
'summary:Height of the rectangle.
Field height:Float
#Rem
summary:Instantiate a new point object.
Params:
[list]
[*]x: The X-coordinate of the point in space.
[*]y: The Y-coordinate of the point in space.
[*]width: Desired width of the rectangle.
[*]height: Desired height of the rectangle.
[/list]
#End
Method New(x:Float = 0, y:Float = 0, width:Float = 0, height:Float = 0)
Make(x, y, width, height)
End Method
'summary:The X-coordinate of the left side of the rectangle.
Method Left:Float() Property
Return x
End Method
'summary:The X-coordinate of the right side of the rectangle.
Method Right:Float() Property
Return x + width
End Method
'summary:The Y-coordinate of the top side of the rectangle.
Method Top:Float() Property
Return y
End Method
'summary:The Y-coordinate of the bottom side of the rectangle.
Method Bottom:Float() Property
Return y + height
End Method
#Rem
summary:Instantiate a new point object.
Params:
[list]
[*]x: The X-coordinate of the point in space.
[*]y: The Y-coordinate of the point in space.
[*]width: Desired width of the rectangle.
[*]height: Desired height of the rectangle.
[/list]
#End
Method Make:FlxRect(x:Float = 0, y:Float = 0, width:Float = 0, height:Float = 0)
Self.x = x
Self.y = y
Self.width = width
Self.height = height
Return Self
End Method
#Rem
summary:Helper function, just copies the values from the specified rectangle.
Return a reference to itself.
[list]
[*]rect: Any [a flxrect.monkey.html]FlxRect[/a]
[/list]
#End
Method CopyFrom:FlxRect(rect:FlxRect)
x = rect.x
y = rect.y
width = rect.width
height = rect.height
return Self
End Method
#Rem
summary:Helper function, just copies the values from this rectangle to the specified rectangle.
Return a reference to the altered rectangle parameter.
[list]
[*]point: Any [a flxrect.monkey.html]FlxRect[/a]
[/list]
#End
Method CopyTo:FlxRect(rect:FlxRect)
rect.x = x
rect.y = y
rect.width = width
rect.height = height
return rect
End Method
End Class
#Rem
footer:Flixel is an open source game-making library that is completely free for personal or commercial use.
[quote]Copyright: Flixel - 2009-2011 Adam 'Atomic' Saltsman
Copyright: Monkey port - 2011 Arthur 'devolonter' Bikmullin
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
NOTE FROM THE AUTHOR: As far as I know, you only have to include
this license if you are redistributing source code that includes
the Flixel library. There is no need (or way, afaik) to include
it in your compiled flash games and apps![/quote]
#End