Author:
vbrain (posted
2013-02-27 12:47:12 , viewed 308 times)
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
public class Bounds
{
public float x , y , width , height ;
public Bounds (float x , float y , float width , float height )
{
this .x = x ;
this .y = y ;
this .width = width ;
this .height = height ;
}
public boolean contains (float x , float y )
{
if (x >= this .x && x <= this .x +width && y >= this .y && y <= this .y +height )
{
return true ;
}
return false ;
}
public boolean intersects (Bounds b )
{
boolean xBetween , widthBetween , yBetween , heightBetween ;
xBetween = widthBetween = yBetween = heightBetween = false ;
if (x >= b .x && x <= b .x +b .width )
xBetween = true ;
if (x +width >= b .x && x +width <= b .x +b .width )
widthBetween = true ;
if (y >= b .y && y <= b .y +b .height )
yBetween = true ;
if (y +height >= b .y && y +height <= b .y +b .height )
heightBetween = true ;
if ((widthBetween || xBetween ) && (yBetween || heightBetween ))
return true ;
return false ;
}
public float getWidth ()
{
return (width - x );
}
public float getHeight ()
{
return (height - y );
}
}
Special syntax:
To highlight a line (yellow background), prefix it with '@@'
To indicate that a line should be removed (red background), prefix it with '-'
To indicate that a line should be added (green background), prefix it with '+'
To post multiple snippets, seperate them by '~~~~'
ivj94
(580 views)
2018-03-24 14:47:39
ivj94
(44 views)
2018-03-24 14:46:31
ivj94
(371 views)
2018-03-24 14:43:53
Solater
(60 views)
2018-03-17 05:04:08
nelsongames
(105 views)
2018-03-05 17:56:34
Gornova
(147 views)
2018-03-02 22:15:33
buddyBro
(690 views)
2018-02-28 16:59:18
buddyBro
(90 views)
2018-02-28 16:45:17
xxMrPHDxx
(492 views)
2017-12-31 17:17:51
xxMrPHDxx
(728 views)
2017-12-31 17:15:51
java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org