public GUISprite(Point2f pos, Size2f size) { vertices= new Point3f[4]; texcoords= new TexCoord[4]; colors= new Color[4]; faces= new ushort[6]; vertices[0]= new Point3f(pos.x, pos.y, 0f); vertices[1]= new Point3f(pos.x, pos.y+size.height, 0f); vertices[2]= new Point3f(pos.x+size.width, pos.y+size.height, 0f); vertices[3]= new Point3f(pos.x+size.width, pos.y, 0f); texcoords[0]= new TexCoord(0f, 0f); texcoords[1]= new TexCoord(0f, 1f); texcoords[2]= new TexCoord(1f, 1f); texcoords[3]= new TexCoord(1f, 0f); applyColor(new Color(255, 255, 255, 255)); faces[0]= 0; faces[1]= 1; faces[2]= 3; faces[3]= 1; faces[4]= 2; faces[5]= 3; bvolume= new BVRectangle(pos, pos+size); comp= null; tb= new Rectangle(0f, 0f, 1f, 1f); }
// Subtracts the two sizes together public Size3f subtract(Size2f size) { return new Size3f(width-size.width, height-size.height, depth); }
// Adds the two sizes together public Size3f add(Size2f size) { return new Size3f(width+size.width, height+size.height, depth); }
// Gets the minimum value of the size public static Size2f min(Size2f value, Size2f min) { // Variables Size2f temp= value; if(value.width< min.width) temp.width= min.width; if(value.height< min.height) temp.height= min.height; return temp; }
// Gets the maximum value of the size public static Size2f max(Size2f value, Size2f max) { // Variables Size2f temp= value; if(value.width> max.width) temp.width= max.width; if(value.height> max.height) temp.height= max.height; return temp; }
// Gets the most minimum size of the two given sizes public static Size2f getMostMin(Size2f val1, Size2f val2) { // Variables Size2f size= Size2f.NO_SIZE; if(val1.width< val2.width) size.width= val1.width; else size.width= val2.width; if(val1.height< val2.height) size.height= val1.height; else size.height= val2.height; return size; }
// Clamps the size to the given min and max bounds public static Size2f clamp(Size2f value, Size2f min, Size2f max) { // Variables Size2f temp= value; if(value.width< min.width) temp.width= min.width; else if(value.width> max.width) temp.width= max.width; if(value.height< min.height) temp.height= min.height; else if(value.height> max.height) temp.height= max.height; return temp; }
// Adds the point with a size to get another point public Point2f add(Size2f size) { return new Point2f(x+size.width, y+size.height); }
// Finds if the two sizes are equal to each other public bool equals(Size2f size) { return (width== size.width && height== size.height); }
// Adds the two sizes together public Size2f add(Size2f size) { return new Size2f(width+size.width, height+size.height); }
// Subtracts the point with a size to get another point public Point2i subtract(Size2f size) { return new Point2i(x-(int)size.width, y-(int)size.height); }
// Adds the point with a size to get another point public Point2i add(Size2f size) { return new Point2f(x+(int)size.width, y+(int)size.height); }
// Subtracts the point with a size to get another point public Point3f subtract(Size2f size) { return new Point3f(x-size.width, y-size.height, z); }
// Adds the point with a size to get another point public Point3f add(Size2f size) { return new Point3f(x+size.width, y+size.height, z); }
// Subtracts the two sizes together public Size2f subtract(Size2f size) { return new Size2f(width-size.width, height-size.height); }
public Rectangle(Point2f pmPos, Size2f pmSize) { pPos= pmPos; pSize= pmSize; bvolume= new BVRectangle(pPos, pPos+pSize); }
// Adds the point with a size to get another point public Point3i add(Size2f size) { return new Point3i(x+(int)size.width, y+(int)size.height, z); }