package eco;

import org.lwjgl.opengl.GL11;
import java.awt.Rectangle;

public class Button{

	public float x;
	public float y;

	public float size;

	private boolean clickFlag = false;

	public int tex;
	public int tey;
	
	public Button(float x, float y, float size, int tex, int tey){
		this.x = x;
		this.y = y;
		this.size = size;
		this.tex = tex;
		this.tey = tey;
	}

	public void click(float mousex, float mousey){
		Rectangle rect = new Rectangle((int) x, (int)y, (int)size, (int)size);
		if (rect.contains(mousex, mousey)){	
			clickFlag = true;		
		}
	}

	public boolean checkForClick(){
		if (clickFlag){
			clickFlag = false;
			return true;		
		}
		return false;
	}

	public void render(){
		TextureAtlas atlas = Render.atlas;		
		GL11.glBegin(GL11.GL_QUADS);
		GL11.glVertex2f(x, y);
		GL11.glTexCoord2f(atlas.getCoord(tex, true), atlas.getCoord(tey, true));
		GL11.glVertex2f(x + size, y);
		GL11.glTexCoord2f(atlas.getCoord(tex, false), atlas.getCoord(tey, true));
		GL11.glVertex2f(x + size, y + size);
		GL11.glTexCoord2f(atlas.getCoord(tex, false), atlas.getCoord(tey, false));
		GL11.glVertex2f(x, y + size);
		GL11.glTexCoord2f(atlas.getCoord(tex, true), atlas.getCoord(tey, false));
		GL11.glEnd();
		
	}

	
	
}

@@ -771,33 +771,8 @@
 S);%0A
-%09%09GL11.glVertex2f(x, y);%0A
 %09%09GL
@@ -799,35 +799,36 @@
 s.getCoord(tex, 
-tru
+fals
 e), atlas.getCoo
@@ -827,35 +827,36 @@
 s.getCoord(tey, 
-tru
+fals
 e));%0A%09%09GL11.glVe
@@ -863,23 +863,16 @@
 rtex2f(x
- + size
 , y);%0A%09%09
@@ -901,36 +901,35 @@
 s.getCoord(tex, 
-fals
+tru
 e), atlas.getCoo
@@ -936,19 +936,20 @@
 rd(tey, 
-tru
+fals
 e));%0A%09%09G
@@ -974,23 +974,16 @@
  size, y
- + size
 );%0A%09%09GL1
@@ -1009,36 +1009,35 @@
 s.getCoord(tex, 
-fals
+tru
 e), atlas.getCoo
@@ -1036,36 +1036,35 @@
 s.getCoord(tey, 
-fals
+tru
 e));%0A%09%09GL11.glVe
@@ -1071,16 +1071,23 @@
 rtex2f(x
+ + size
 , y + si
@@ -1123,35 +1123,36 @@
 s.getCoord(tex, 
-tru
+fals
 e), atlas.getCoo
@@ -1151,38 +1151,69 @@
 s.getCoord(tey, 
-false)
+true));%0A%09%09GL11.glVertex2f(x, y + size
 );%0A%09%09GL11.glEnd(

Update Button.java