internal UICell(TextureID2D[] tid, object tag, TextureID2D overlay, float border = 0, string text = "", Color textcol = default(Color), ButtonPressedEventHandler pressed = null, int layer = 0) : base(tid, pressed, layer, tag.ToString()) { this.overlay = overlay; this.tag = tag; font = DataHandler.Fonts[0]; color = textcol; this.border = border; this.text = text; }
internal static Rectangle getTextureSource(TextureID2D id) { // Textures are expected to be square if (Textures[id.RefKey] == null) { return(new Rectangle(0, 0, 0, 0)); } int unitsperrow = Textures[id.RefKey].Width / TextureUnitDim; int texw = (int)(TextureUnitDim * id.WidthUnits); int texh = (int)(TextureUnitDim * id.HeightUnits); return(new Rectangle(id.Index % unitsperrow * TextureUnitDim + 1, id.Index / unitsperrow * TextureUnitDim + 1, texw - 1, texh - 1)); }
internal UIVisibleObject(TextureID2D[] tid, string id = "", int layer = 0) : base(id, layer) { // Use TextureID to describe the texture. new VisibleUIObject(new TextureID( // int groupIndex // Filename index in the array Datahandler.TextureFiles // , int idx // Index in the sheet // , int wunits=1, int hunits=1 width and hight units, default 1*1)) if (tid == null || tid.Length == 0 || !DataHandler.isValid(tid[0])) sprite = null; else { sprite = tid; size = new Vector2(tid[0].TotalWidth, tid[0].TotalHeight); } }
internal static bool isValid(TextureID2D tid) { return(tid != default(TextureID2D) && Textures.ContainsKey(tid.RefKey)); }
internal static Texture2D getTexture(TextureID2D tid) { return(Textures[tid.RefKey]); }