======================
LOOK! LICENSING TERMS
======================
look! is licensed under the BSD 3-Clause (also known as "BSD New" or
"BSD Simplified"), as follows:
Copyright (c) 2010-2012, Look...
If you think the Android project Look listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
Java Source Code
/**
*-----------------------------------------------------------------------------
* Copyright (c) 2012, Look! Development Team
* All rights reserved./*www.java2s.com*/
*
* Distributed under the terms of the BSD Simplified License.
*
* The full license is in the LICENSE file, distributed with this software.
*-----------------------------------------------------------------------------
*/package es.ucm.look.ar.hud;
import es.ucm.look.ar.ar3D.core.drawables.primitives.TrianglePrimitive;
import es.ucm.look.ar.math.geom.Point3;
publicclass Button extends TrianglePrimitive {
privatefloat x, y, width, height;
private ActionListener actionListener;
privateboolean pressed;
public Button(float x, float y, float width, float height) {
super(new Point3(x, y + height, 0.0f), new Point3(x + width, y + height, 0.0f), new Point3(x + width / 2, y, 0.0f));
this.x = x;
this.y = y;
this.width = width;
this.height = height;
pressed = false;
}
publicboolean contains(float touchX, float touchY) {
return x < touchX && touchX < x + width && y < touchY && touchY < y + height;
}
publicvoid setPressed( boolean p ){
this.pressed = p;
}
publicboolean isPressed(){
return pressed;
}
publicvoid actionPerformed( ){
actionListener.actionPerformed(this);
}
publicvoid setActionListener( ActionListener listener ){
this.actionListener = listener;
}
}