public static VertexPositionTexture[] Quad(GraphicsDevice device, float X, float Y, float Width, float Height, Renderer.Rect TexMap, Texture2D WindowSkin) { VertexPositionTexture[] f = new VertexPositionTexture[6]; int ML = TexMap.Left; int MR = TexMap.Right; int MT = TexMap.Top; int MB = TexMap.Bottom; Vector3 AA = PixelToScreen(device, X, Y); Vector3 AB = PixelToScreen(device, X + Width, Y); Vector3 BA = PixelToScreen(device, X, Y + Height); Vector3 BB = PixelToScreen(device, X + Width, Y + Height); VertexPositionTexture VAA = new VertexPositionTexture(AA, Renderer.TexelToCoord(ML, MT, WindowSkin)); VertexPositionTexture VAB = new VertexPositionTexture(AB, Renderer.TexelToCoord(MR, MT, WindowSkin)); VertexPositionTexture VBA = new VertexPositionTexture(BA, Renderer.TexelToCoord(ML, MB, WindowSkin)); VertexPositionTexture VBB = new VertexPositionTexture(BB, Renderer.TexelToCoord(MR, MB, WindowSkin)); f[0] = VAA; f[1] = VAB; f[2] = VBA; f[3] = VAB; f[4] = VBB; f[5] = VBA; return(f); }
public static VertexPositionTexture[] Button(GraphicsDevice device, float X, float Y, float Width, float Height, Texture2D WindowSkin, bool Hot = false) { VertexPositionTexture[] f = new VertexPositionTexture[54]; float qt = 0.125f / 4f; int blocksize = 4; float buttonoffset = 0.5f;// 0.375f; int bo = 64; float delta = Hot ? 0.125f : 0; int d = Hot ? 16 : 0; Vector3 TLC = PixelToScreen(device, X, Y); Vector3 TLM = PixelToScreen(device, X + blocksize, Y); Vector3 TRM = PixelToScreen(device, X + Width - blocksize, Y); Vector3 TRC = PixelToScreen(device, X + Width, Y); Vector3 TMLC = PixelToScreen(device, X, Y + blocksize); Vector3 TMLM = PixelToScreen(device, X + blocksize, Y + blocksize); Vector3 TMRM = PixelToScreen(device, X + Width - blocksize, Y + blocksize); Vector3 TMRC = PixelToScreen(device, X + Width, Y + blocksize); Vector3 BMLC = PixelToScreen(device, X, Y + Height - blocksize); Vector3 BMLM = PixelToScreen(device, X + blocksize, Y + Height - blocksize); Vector3 BMRM = PixelToScreen(device, X + Width - blocksize, Y + Height - blocksize); Vector3 BMRC = PixelToScreen(device, X + Width, Y + Height - blocksize); Vector3 BLC = PixelToScreen(device, X, Y + Height); Vector3 BLM = PixelToScreen(device, X + blocksize, Y + Height); Vector3 BRM = PixelToScreen(device, X + Width - blocksize, Y + Height); Vector3 BRC = PixelToScreen(device, X + Width, Y + Height); //top left corner Vector2 TTLC = Renderer.TexelToCoord(64, 0, WindowSkin); f[0] = new VertexPositionTexture(TLC, Renderer.TexelToCoord(bo, d, WindowSkin)); // f[0].TextureCoordinate = TTLC; f[1] = new VertexPositionTexture(TLM, Renderer.TexelToCoord(bo + blocksize, d, WindowSkin)); f[2] = new VertexPositionTexture(TMLC, Renderer.TexelToCoord(bo, d + blocksize, WindowSkin)); f[3] = new VertexPositionTexture(TLM, new Vector2(buttonoffset + qt, 0 + delta)); f[4] = new VertexPositionTexture(TMLM, new Vector2(buttonoffset + qt, qt + delta)); f[5] = new VertexPositionTexture(TMLC, new Vector2(buttonoffset + 0, qt + delta)); //top f[6] = new VertexPositionTexture(TLM, new Vector2(buttonoffset + qt, 0 + delta)); f[7] = new VertexPositionTexture(TRM, new Vector2(buttonoffset + qt * 2, 0 + delta)); f[8] = new VertexPositionTexture(TMLM, new Vector2(buttonoffset + qt, qt + delta)); //* f[9] = new VertexPositionTexture(TRM, new Vector2(buttonoffset + qt * 2, 0 + delta)); f[10] = new VertexPositionTexture(TMRM, new Vector2(buttonoffset + qt * 2, qt + delta)); f[11] = new VertexPositionTexture(TMLM, new Vector2(buttonoffset + qt, qt + delta)); //*/ //top right corner f[12] = new VertexPositionTexture(TRM, new Vector2(buttonoffset + qt * 2, 0 + delta)); f[13] = new VertexPositionTexture(TRC, new Vector2(buttonoffset + qt * 3, 0 + delta)); f[14] = new VertexPositionTexture(TMRM, new Vector2(buttonoffset + qt * 2, qt + delta)); f[15] = new VertexPositionTexture(TRC, new Vector2(buttonoffset + qt * 3, 0 + delta)); f[16] = new VertexPositionTexture(TMRC, new Vector2(buttonoffset + qt * 3, qt + delta)); f[17] = new VertexPositionTexture(TMRM, new Vector2(buttonoffset + qt * 2, qt + delta)); //middle left f[18] = new VertexPositionTexture(TMLC, new Vector2(buttonoffset + 0, qt + delta)); f[19] = new VertexPositionTexture(TMLM, new Vector2(buttonoffset + qt, qt + delta)); f[20] = new VertexPositionTexture(BMLC, new Vector2(buttonoffset + 0, qt * 2 + delta)); f[21] = new VertexPositionTexture(TMLM, new Vector2(buttonoffset + qt, qt + delta)); f[22] = new VertexPositionTexture(BMLM, new Vector2(buttonoffset + qt, qt * 2 + delta)); f[23] = new VertexPositionTexture(BMLC, new Vector2(buttonoffset + 0, qt * 2 + delta)); //*/ //middle f[24] = new VertexPositionTexture(TMLM, new Vector2(buttonoffset + 0 + qt, qt + delta)); f[25] = new VertexPositionTexture(TMRM, new Vector2(buttonoffset + 0 + qt * 2, qt + delta)); f[26] = new VertexPositionTexture(BMLM, new Vector2(buttonoffset + 0 + qt, qt * 2 + delta)); f[27] = new VertexPositionTexture(TMRM, new Vector2(buttonoffset + 0 + qt * 2, qt + delta)); f[28] = new VertexPositionTexture(BMRM, new Vector2(buttonoffset + 0 + qt * 2, qt * 2 + delta)); f[29] = new VertexPositionTexture(BMLM, new Vector2(buttonoffset + 0 + qt, qt * 2 + delta)); //middle right f[30] = new VertexPositionTexture(TMRM, new Vector2(buttonoffset + qt * 2, qt + delta)); f[31] = new VertexPositionTexture(TMRC, new Vector2(buttonoffset + qt * 3, qt + delta)); f[32] = new VertexPositionTexture(BMRM, new Vector2(buttonoffset + qt * 2, qt * 2 + delta)); f[33] = new VertexPositionTexture(TMRC, new Vector2(buttonoffset + qt * 3, qt + delta)); f[34] = new VertexPositionTexture(BMRC, new Vector2(buttonoffset + qt * 3, qt * 2 + delta)); f[35] = new VertexPositionTexture(BMRM, new Vector2(buttonoffset + qt * 2, qt * 2 + delta)); //bottom left f[36] = new VertexPositionTexture(BMLC, new Vector2(buttonoffset + 0, qt * 2 + delta)); f[37] = new VertexPositionTexture(BMLM, new Vector2(buttonoffset + qt, qt * 2 + delta)); f[38] = new VertexPositionTexture(BLC, new Vector2(buttonoffset + 0, qt * 3 + delta)); f[39] = new VertexPositionTexture(BMLM, new Vector2(buttonoffset + qt, qt * 2 + delta)); f[40] = new VertexPositionTexture(BLM, new Vector2(buttonoffset + qt, qt * 3 + delta)); f[41] = new VertexPositionTexture(BLC, new Vector2(buttonoffset + 0, qt * 3 + delta)); //bottom f[42] = new VertexPositionTexture(BMLM, new Vector2(buttonoffset + qt, qt * 2 + delta)); f[43] = new VertexPositionTexture(BMRM, new Vector2(buttonoffset + qt * 2, qt * 2 + delta)); f[44] = new VertexPositionTexture(BLM, new Vector2(buttonoffset + qt, qt * 3 + delta)); f[45] = new VertexPositionTexture(BMRM, new Vector2(buttonoffset + qt * 2, qt * 2 + delta)); f[46] = new VertexPositionTexture(BRM, new Vector2(buttonoffset + qt * 2, qt * 3 + delta)); f[47] = new VertexPositionTexture(BLM, new Vector2(buttonoffset + qt, qt * 3 + delta)); //bottom right f[48] = new VertexPositionTexture(BMRM, new Vector2(buttonoffset + qt * 2, qt * 2 + delta)); f[49] = new VertexPositionTexture(BMRC, new Vector2(buttonoffset + qt * 3, qt * 2 + delta)); f[50] = new VertexPositionTexture(BRM, new Vector2(buttonoffset + qt * 2, qt * 3 + delta)); f[51] = new VertexPositionTexture(BMRC, new Vector2(buttonoffset + qt * 3, qt * 2 + delta)); f[52] = new VertexPositionTexture(BRC, new Vector2(buttonoffset + qt * 3, qt * 3 + delta)); f[53] = new VertexPositionTexture(BRM, new Vector2(buttonoffset + qt * 2, qt * 3 + delta)); //eventually return(f); }
public static VertexPositionTexture[] SlicedQuad(GraphicsDevice device, float X, float Y, float Width, float Height, Renderer.Slice9 TexMap, Texture2D WindowSkin) { VertexPositionTexture[] f = new VertexPositionTexture[54]; int ML = TexMap.Left; int MR = TexMap.Right; int MT = TexMap.Top; int MB = TexMap.Bottom; Vector3 AA = PixelToScreen(device, X, Y); Vector3 AB = PixelToScreen(device, X + ML, Y); Vector3 AC = PixelToScreen(device, X + Width - MR, Y); Vector3 AD = PixelToScreen(device, X + Width, Y); Vector3 BA = PixelToScreen(device, X, Y + MT); Vector3 BB = PixelToScreen(device, X + ML, Y + MT); Vector3 BC = PixelToScreen(device, X + Width - MR, Y + MT); Vector3 BD = PixelToScreen(device, X + Width, Y + MT); Vector3 CA = PixelToScreen(device, X, Y + Height - MB); Vector3 CB = PixelToScreen(device, X + ML, Y + Height - MB); Vector3 CC = PixelToScreen(device, X + Width - MR, Y + Height - MB); Vector3 CD = PixelToScreen(device, X + Width, Y + Height - MB); Vector3 DA = PixelToScreen(device, X, Y + Height); Vector3 DB = PixelToScreen(device, X + ML, Y + Height); Vector3 DC = PixelToScreen(device, X + Width - MR, Y + Height); Vector3 DD = PixelToScreen(device, X + Width, Y + Height); //top left corner //Vector2 TTLC = Renderer.TexelToCoord(64, 0, WindowSkin); VertexPositionTexture VAA = new VertexPositionTexture(AA, Renderer.TexelToCoord(TexMap.AA, WindowSkin)); VertexPositionTexture VAB = new VertexPositionTexture(AB, Renderer.TexelToCoord(TexMap.AB, WindowSkin)); VertexPositionTexture VAC = new VertexPositionTexture(AC, Renderer.TexelToCoord(TexMap.AC, WindowSkin)); VertexPositionTexture VAD = new VertexPositionTexture(AD, Renderer.TexelToCoord(TexMap.AD, WindowSkin)); VertexPositionTexture VBA = new VertexPositionTexture(BA, Renderer.TexelToCoord(TexMap.BA, WindowSkin)); VertexPositionTexture VBB = new VertexPositionTexture(BB, Renderer.TexelToCoord(TexMap.BB, WindowSkin)); VertexPositionTexture VBC = new VertexPositionTexture(BC, Renderer.TexelToCoord(TexMap.BC, WindowSkin)); VertexPositionTexture VBD = new VertexPositionTexture(BD, Renderer.TexelToCoord(TexMap.BD, WindowSkin)); VertexPositionTexture VCA = new VertexPositionTexture(CA, Renderer.TexelToCoord(TexMap.CA, WindowSkin)); VertexPositionTexture VCB = new VertexPositionTexture(CB, Renderer.TexelToCoord(TexMap.CB, WindowSkin)); VertexPositionTexture VCC = new VertexPositionTexture(CC, Renderer.TexelToCoord(TexMap.CC, WindowSkin)); VertexPositionTexture VCD = new VertexPositionTexture(CD, Renderer.TexelToCoord(TexMap.CD, WindowSkin)); VertexPositionTexture VDA = new VertexPositionTexture(DA, Renderer.TexelToCoord(TexMap.DA, WindowSkin)); VertexPositionTexture VDB = new VertexPositionTexture(DB, Renderer.TexelToCoord(TexMap.DB, WindowSkin)); VertexPositionTexture VDC = new VertexPositionTexture(DC, Renderer.TexelToCoord(TexMap.DC, WindowSkin)); VertexPositionTexture VDD = new VertexPositionTexture(DD, Renderer.TexelToCoord(TexMap.DD, WindowSkin)); f[0] = VAA; f[1] = VAB; f[2] = VBA; f[3] = VAB; f[4] = VBB; f[5] = VBA; //top f[6] = VAB; // new VertexPositionTexture(TLM, new Vector2(buttonoffset + qt, 0 + delta)); f[7] = VAC; // new VertexPositionTexture(TRM, new Vector2(buttonoffset + qt * 2, 0 + delta)); f[8] = VBB; // new VertexPositionTexture(TMLM, new Vector2(buttonoffset + qt, qt + delta)); //* f[9] = VAC; // new VertexPositionTexture(TRM, new Vector2(buttonoffset + qt * 2, 0 + delta)); f[10] = VBC; // new VertexPositionTexture(TMRM, new Vector2(buttonoffset + qt * 2, qt + delta)); f[11] = VBB; // new VertexPositionTexture(TMLM, new Vector2(buttonoffset + qt, qt + delta)); //*/ //top right corner f[12] = VAC; // new VertexPositionTexture(TRM, new Vector2(buttonoffset + qt * 2, 0 + delta)); f[13] = VAD; // new VertexPositionTexture(TRC, new Vector2(buttonoffset + qt * 3, 0 + delta)); f[14] = VBC; // new VertexPositionTexture(TMRM, new Vector2(buttonoffset + qt * 2, qt + delta)); f[15] = VAD; // new VertexPositionTexture(TRC, new Vector2(buttonoffset + qt * 3, 0 + delta)); f[16] = VBD; // new VertexPositionTexture(TMRC, new Vector2(buttonoffset + qt * 3, qt + delta)); f[17] = VBC; // new VertexPositionTexture(TMRM, new Vector2(buttonoffset + qt * 2, qt + delta)); //middle left f[18] = VBA; // new VertexPositionTexture(TMLC, new Vector2(buttonoffset + 0, qt + delta)); f[19] = VBB; // new VertexPositionTexture(TMLM, new Vector2(buttonoffset + qt, qt + delta)); f[20] = VCA; // new VertexPositionTexture(BMLC, new Vector2(buttonoffset + 0, qt * 2 + delta)); f[21] = VBB; // new VertexPositionTexture(TMLM, new Vector2(buttonoffset + qt, qt + delta)); f[22] = VCB; // new VertexPositionTexture(BMLM, new Vector2(buttonoffset + qt, qt * 2 + delta)); f[23] = VCA; // new VertexPositionTexture(BMLC, new Vector2(buttonoffset + 0, qt * 2 + delta)); //*/ //middle f[24] = VBB; // new VertexPositionTexture(TMLM, new Vector2(buttonoffset + 0 + qt, qt + delta)); f[25] = VBC; // new VertexPositionTexture(TMRM, new Vector2(buttonoffset + 0 + qt * 2, qt + delta)); f[26] = VCB; // new VertexPositionTexture(BMLM, new Vector2(buttonoffset + 0 + qt, qt * 2 + delta)); f[27] = VBC; // new VertexPositionTexture(TMRM, new Vector2(buttonoffset + 0 + qt * 2, qt + delta)); f[28] = VCC; // VertexPositionTexture(BMRM, new Vector2(buttonoffset + 0 + qt * 2, qt * 2 + delta)); f[29] = VCB; // VertexPositionTexture(BMLM, new Vector2(buttonoffset + 0 + qt, qt * 2 + delta)); //middle right f[30] = VBC; // new VertexPositionTexture(TMRM, new Vector2(buttonoffset + qt * 2, qt + delta)); f[31] = VBD; // new VertexPositionTexture(TMRC, new Vector2(buttonoffset + qt * 3, qt + delta)); f[32] = VCC; // new VertexPositionTexture(BMRM, new Vector2(buttonoffset + qt * 2, qt * 2 + delta)); f[33] = VBD; // new VertexPositionTexture(TMRC, new Vector2(buttonoffset + qt * 3, qt + delta)); f[34] = VCD; // VertexPositionTexture(BMRC, new Vector2(buttonoffset + qt * 3, qt * 2 + delta)); f[35] = VCC; // VertexPositionTexture(BMRM, new Vector2(buttonoffset + qt * 2, qt * 2 + delta)); //bottom left f[36] = VCA; // new VertexPositionTexture(BMLC, new Vector2(buttonoffset + 0, qt * 2 + delta)); f[37] = VCB; // VertexPositionTexture(BMLM, new Vector2(buttonoffset + qt, qt * 2 + delta)); f[38] = VDA; // VertexPositionTexture(BLC, new Vector2(buttonoffset + 0, qt * 3 + delta)); f[39] = VCB; // VertexPositionTexture(BMLM, new Vector2(buttonoffset + qt, qt * 2 + delta)); f[40] = VDB; // VertexPositionTexture(BLM, new Vector2(buttonoffset + qt, qt * 3 + delta)); f[41] = VDA; // VertexPositionTexture(BLC, new Vector2(buttonoffset + 0, qt * 3 + delta)); //bottom f[42] = VCB; // new VertexPositionTexture(BMLM, new Vector2(buttonoffset + qt, qt * 2 + delta)); f[43] = VCC; // new VertexPositionTexture(BMRM, new Vector2(buttonoffset + qt * 2, qt * 2 + delta)); f[44] = VDB; // new VertexPositionTexture(BLM, new Vector2(buttonoffset + qt, qt * 3 + delta)); f[45] = VCC; // new VertexPositionTexture(BMRM, new Vector2(buttonoffset + qt * 2, qt * 2 + delta)); f[46] = VDC; // new VertexPositionTexture(BRM, new Vector2(buttonoffset + qt * 2, qt * 3 + delta)); f[47] = VDB; // new VertexPositionTexture(BLM, new Vector2(buttonoffset + qt, qt * 3 + delta)); //bottom right f[48] = VCC; // new VertexPositionTexture(BMRM, new Vector2(buttonoffset + qt * 2, qt * 2 + delta)); f[49] = VCD; // new VertexPositionTexture(BMRC, new Vector2(buttonoffset + qt * 3, qt * 2 + delta)); f[50] = VDC; // new VertexPositionTexture(BRM, new Vector2(buttonoffset + qt * 2, qt * 3 + delta)); f[51] = VCD; // new VertexPositionTexture(BMRC, new Vector2(buttonoffset + qt * 3, qt * 2 + delta)); f[52] = VDD; // new VertexPositionTexture(BRC, new Vector2(buttonoffset + qt * 3, qt * 3 + delta)); f[53] = VDC; // new VertexPositionTexture(BRM, new Vector2(buttonoffset + qt * 2, qt * 3 + delta)); //eventually return(f); }