Source code: org/libsdl/video/SDLRect.java
1
2
3 package org.libsdl.video;
4
5 /**
6 * The <code>SDLRect</code> class does not directly represent an SDL_rect
7 * C structure. Instead, it is a pure Java object that must be converted
8 * to a native representation on the fly when needed.
9 * <p>
10 *
11 * @author Eric Wittmann
12 * @version $revision$
13 * @see org.libsdl.video.SDLSurface#getClipRect()
14 */
15 public class SDLRect
16 {
17 private int x;
18 private int y;
19 private int w;
20 private int h;
21
22 /**
23 * Constructs a new <code>SDLRect</code> with the given x, y, width, and
24 * height values.
25 * @param x Integer - x
26 * @param y Integer - y
27 * @param w Integer - width
28 * @param h Integer - height
29 */
30 public SDLRect(int x, int y, int w, int h) {
31 this.x = x;
32 this.y = y;
33 this.w = w;
34 this.h = h;
35 }
36
37 /**
38 * Get the x value
39 * @return Integer - get the x value
40 */
41 public int getX() {
42 return x;
43 }
44
45 /**
46 * Get the y value
47 * @return Integer - get the y value
48 */
49 public int getY() {
50 return y;
51 }
52
53 /**
54 * Get the width
55 * @return Integer - get the width
56 */
57 public int getWidth() {
58 return w;
59 }
60
61 /**
62 * Get the height
63 * @return Integer - get the height
64 */
65 public int getHeight() {
66 return h;
67 }
68
69 /**
70 * Set the x value
71 * @param x Integer - the new x value
72 */
73 public void setX(int x) {
74 this.x = x;
75 }
76
77 /**
78 * Set the y value
79 * @param y Integer - the new y value
80 */
81 public void setY(int y) {
82 this.y = y;
83 }
84
85 /**
86 * Set the width
87 * @param w Integer - the new width
88 */
89 public void setWidth(int w) {
90 this.w = w;
91 }
92
93 /**
94 * Set the height
95 * @param h Integer - the new height
96 */
97 public void setHeight(int h) {
98 this.h = h;
99 }
100 }