package br.usp.ime.ep2.forms;

import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.FloatBuffer;

import javax.microedition.khronos.opengles.GL10;

import android.util.Log;

class Quad {

	public static final float[] VERTICES = {
		-1.0f, -1.0f, // bottom left
		-1.0f,  1.0f, // top left
		1.0f, -1.0f, // bottom right
		1.0f,  1.0f, // top right
	};
	
	protected float mPosX;
	protected float mPosY;
	private float mScale;
	private float[] mVertices;
	private float[] mColors;

	private FloatBuffer mVertexBuffer;
	private FloatBuffer mColorBuffer;

	private static final int FLOAT_SIZE_BYTES = Float.SIZE / 8;

	public Quad(float[] vertices, float[] colors, float pos_x, float pos_y, float scale) {
		mVertices = vertices;
		mColors = colors;
		mScale = scale;
		setPosX(pos_x);
		setPosY(pos_y);

		ByteBuffer vbb = ByteBuffer.allocateDirect(mVertices.length * FLOAT_SIZE_BYTES);
		vbb.order(ByteOrder.nativeOrder());
		mVertexBuffer = vbb.asFloatBuffer();
		mVertexBuffer.put(mVertices);
		mVertexBuffer.position(0);

		ByteBuffer cbb = ByteBuffer.allocateDirect(mColors.length * FLOAT_SIZE_BYTES);
		cbb.order(ByteOrder.nativeOrder());
		mColorBuffer = cbb.asFloatBuffer();
		mColorBuffer.put(mColors);
		mColorBuffer.position(0);
	}
	
	public float getPosX() {
		return mPosX;
	}
	
	public float getPosY() {
		return mPosY;
	}

	public float getLeftX() {
		return getPosX() + mVertices[0];		
	}
	
	public float getBottomY() {
		return getPosY() + mVertices[1];		
	}
	
	public float getTopY() {
		return getPosY() + mVertices[3];		
	}

	public float getRightX() {
		return getPosX() + mVertices[4];		
	}
	
	public void setPosX(float x) {
		mPosX = x;
	}

	public void setPosY(float y) {
		mPosY = y;
	}

	public void draw(GL10 gl) {
		gl.glMatrixMode(GL10.GL_MODELVIEW);
		gl.glPushMatrix();
		gl.glLoadIdentity();
		gl.glTranslatef(mPosX, mPosY, 0.0f);
		gl.glScalef(mScale, mScale, mScale);

		gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
		gl.glEnableClientState(GL10.GL_COLOR_ARRAY);

		gl.glVertexPointer(2, GL10.GL_FLOAT, 0, mVertexBuffer);
		gl.glColorPointer(4, GL10.GL_FLOAT, 0, mColorBuffer);

		gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, 4);

		gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
		gl.glDisableClientState(GL10.GL_COLOR_ARRAY);

		gl.glPopMatrix();
	}
}
@@ -163,211 +163,29 @@
 0;%0A%0A
-import android.util.Log;%0A%0Aclass Quad %7B%0A%0A%09public static final float%5B%5D VERTICES = %7B%0A%09%09-1.0f, -1.0f, // bottom left%0A%09%09-1.0f,  1.0f, // top left%0A%09%091.0f, -1.0f, // bottom right%0A%09%091.0f,  1.0f, // top right%0A%09%7D;
+abstract class Quad %7B
 %0A%09%0A%09

Convert Quad to abstract class