   Class relationship question
  I am currently developing a UI. I have a few questions about class relationship interaction.My class designs:A Control class with subclasses Button & LabelA Screen class with subclass StartScreenThe StartScreen creates 2 Buttons and 1 LabelA UIManager which owns the StartScreen classA RenderManager which controls setting up D3D and renderingThe UIManager and the RenderManager are both singletonsI am drawing the controls from the StartScreen by referencing the UIManager from the RenderManager as such:hr = d3dDevice->BeginScene();hr = spriteHandler->Begin(NULL);hr = spriteHandler->Draw(UIManager::GetSingleton().ss->but_StartButton->GetUnClickedTexture(),NULL, &UIManager::GetSingleton().ss->but_StartButton->GetCenter(), &UIManager::GetSingleton().ss->but_StartButton->GetPosition(), D3DCOLOR_XRGB(255, 255, 255));hr = spriteHandler->End();hr = d3dDevice->EndScene();hr = d3dDevice->Present(NULL, NULL, NULL, NULL);===================This works (using the singleton reference to access the StartScreen control objects) however I think there may exist a cleaner way to do this.  I am thinking about how to build the collision detection for button clicks and dont want to continue this method if there is a better way.  Any thoughts?Also, rather than hardcoding the call to Draw each time per control, how can I iterate through the controls and draw them in a better way?Any help is greatly appreciated.Thank you   
  To create a collision detection you just need to maintain a rectangle which is the AABB for a given control.For starters you can then do a for each control test mouse (x,y). When you got that working you can do some interleaving so you don't have to do the "for each", but it works and is easy to implement. Also you can add circle/ellipsis tests etc at a later point.In my GUI every control has a reference to a component specific graphic object (it doesn't have to be component specific).The graphic object has a Render() method that takes the d3dDevice as argument, in your case the sprite.Then that method draws the control as it is supposed to.The render method does the following:- Draw my stuff.- For each child component Render()So to render my GUI I just call Render on the "GUI Base" if you will.Hope this helps.   ;  Thank you   