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); }
public GUIButton(GUISprite sprite) : base(sprite) { pText= "BUTTON"; pHoverTexture= pTexture; pPressedTexture= pTexture; pDisabledTexture= pTexture; pHoverColor= new Color(255, 128, 0); pPressedColor= new Color(0, 128, 255); if(pSprite!= null) { pTexBounds= pSprite.textureBounds; pHoverTexBounds= pSprite.textureBounds; pPressedTexBounds= pSprite.textureBounds; pDisabledTexBounds= pSprite.textureBounds; } else { pTexBounds= new Rectangle(0f, 0f, 1f, 1f); pHoverTexBounds= new Rectangle(0f, 0f, 1f, 1f); pPressedTexBounds= new Rectangle(0f, 0f, 1f, 1f); pDisabledTexBounds= new Rectangle(0f, 0f, 1f, 1f); } bEText= false; bETexHover= false; bETexPressed= false; bETexDisabled= false; bEFgColor= false; bEHoverColor= false; bEPressedColor= false; bEHoverTexBounds= false; bEPressedTexBounds= false; bEDisabledTexBounds= false; e_text= null; e_texHover= null; e_texPressed= null; e_texDisabled= null; e_fgColor= null; e_hoverColor= null; e_pressedColor= null; e_hoverTexBounds= null; e_pressedTexBounds= null; e_disabledTexBounds= null; }
// Sets the texture bounds for rendering without calling the event internal void setTextureBounds(Rectangle rect) { tb= rect; if(texture.WIDTH!= 0 && texture.HEIGHT!= 0) { texcoords[0]= new TexCoord(rect.x, rect.y, texture); texcoords[1]= new TexCoord(rect.x, rect.y+rect.height, texture); texcoords[2]= new TexCoord(rect.x+rect.width, rect.y+rect.height, texture); texcoords[3]= new TexCoord(rect.x+rect.width, rect.y, texture); } }
// Sets the bounds for rendering without calling the event internal void setBounds(Rectangle rect) { vertices[0]= new Point3f(rect.x, rect.y, 0f); vertices[1]= new Point3f(rect.x, rect.y+rect.height, 0f); vertices[2]= new Point3f(rect.x+rect.width, rect.y+rect.height, 0f); vertices[3]= new Point3f(rect.x+rect.width, rect.y, 0f); bvolume= new BVRectangle(rect.x, rect.y, rect.width, rect.height); }
// Sets all the texture bounds to the given rectangle bounds public void setAllTextureBounds(Rectangle rect) { texBounds= rect; hoverTextureBounds= rect; pressedTextureBounds= rect; disabledTextureBounds= rect; }