Last change
on this file was abe7b3d, checked in by dportnoy <devnull@…>, 14 years ago |
Changed the package names from com.example.* to com.medievaltech.*
|
-
Property mode
set to
100644
|
File size:
763 bytes
|
Line | |
---|
1 | package com.medievaltech.gui;
|
---|
2 |
|
---|
3 | import android.graphics.*;
|
---|
4 |
|
---|
5 | public class GUIObject {
|
---|
6 | protected int x, y, width, height;
|
---|
7 | protected Paint p; //all properties of the object are determined through the paint object
|
---|
8 |
|
---|
9 | public GUIObject(int newX, int newY, int newWidth, int newHeight, Paint p) {
|
---|
10 | x = newX;
|
---|
11 | y = newY;
|
---|
12 | width = newWidth;
|
---|
13 | height = newHeight;
|
---|
14 | this.p = p;
|
---|
15 | }
|
---|
16 |
|
---|
17 | public void draw(Canvas c) {
|
---|
18 |
|
---|
19 | }
|
---|
20 |
|
---|
21 | public boolean isClicked(float xCoord, float yCoord) {
|
---|
22 | return x <= xCoord && xCoord <= x+width && y <= yCoord && yCoord <= y+height;
|
---|
23 | }
|
---|
24 |
|
---|
25 | public int getX() {
|
---|
26 | return x;
|
---|
27 | }
|
---|
28 |
|
---|
29 | public int getY() {
|
---|
30 | return y;
|
---|
31 | }
|
---|
32 |
|
---|
33 | public int getWidth() {
|
---|
34 | return width;
|
---|
35 | }
|
---|
36 |
|
---|
37 | public int getHeight() {
|
---|
38 | return height;
|
---|
39 | }
|
---|
40 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.