public void AddDrawableComponent(IObjDrawComponent comp) { IObjDrawComponent[] temp = new IObjDrawComponent[drawableComponents.Length + 1]; for (int i = 0; i < DrawableComponents.Length; i++) { if (DrawableComponents[i] == comp) { return; // Temp *should* be deallocated } temp[i] = DrawableComponents[i]; } temp[temp.Length - 1] = comp; }
//public UIObject(Rectangle bounds) //{ //this.Bounds = bounds; //} //public UIObject(Rectangle bounds, IObjDrawComponent[] drawableComponents = null, IObjUpdateComponent[] updateableComponents = null) //{ // this.Bounds = bounds; // this.drawableComponents = drawableComponents; // this.updateableComponents = updateableComponents; //} public UIObject(Rectangle bounds, IObjDrawComponent drawableComponent = null, IObjUpdateComponent updateableComponent = null) { this.Bounds = bounds; this.drawableComponents = new IObjDrawComponent[] { drawableComponent }; this.updateableComponents = new IObjUpdateComponent[] { updateableComponent }; }