   Assign action to shapes (square, triangle, ellipse)
  So, is it even possible to make, kinda like custom shaped buttons with the following shapes: square, triangle, ellipse?I have drawn some shapes, with a following line of code but I can't quite figure out how to calculate when the mouse is on the shapes I have drawn?' Example code:ssurface.DrawBox(50, 50, 300, 300)I though first that it's quite simple, to calculate when the mouse coordinates are inside a square, for example:' Define a table, as large as there are pixels on the shapeDim coordinateTable(squareHeight * squareWidth, 1)Dim i As Integeri = 0   For yTopCoordinate To squareHeight   'Starting from the top  For xLeftCoordinate To squareWidth    'Line by line coordinateTable(i, 0) = mouseY coordinateTable(i, 1) = mouseX i += 1  Next xLeftCoordinate   Next yTopCoordinateI'm not quite sure about this code, cause I haven't tested it, but I think you get the idea.After this, there is somekind of check, where I use For-loop to check is there a cell on the table, that maches with the coordinates with mouse coordinates.But this code has a fatal flaw, because if the square is not aligned with the x-dimension (it's rotated from the starting position) then the code doesn't work.I'm using Visual Studio 2005 with DirectX SDK (june) and the language I'd prefer with this thing is Visual Basic.   
  The easiest way to do it in a game is use an Ortho matrix to draw the controls. Then all you have to do is check if the cursor hovers over one of your controls. Here's a funtion from my game:protected bool MouseOnTop(int x, int y)   {  return (   (x < (Position.X + Width / 2))&& (x > (Position.X - Width / 2))&& (y > (PositionY - Heith / 2))&& (y < (PositionY + Heith / 2))    );   }// 'Position' is the control position in screen coordinates.//  Width and Heith is the width and heith of your widget.The above code works only with rectangular controls. For controls that have other shapes you'll need some crazy math or (the method I use) have a ray-mesh intersection test. If that sounds blurry search for 'ray picking'.   