Table of Contents | ||||||||
|
||||||||
CheckButtons | ||||||||
Purpose Checks all buttons to see if any have a mouse-over event |
||||||||
Protoype string CButtonMngr::CheckButtons (int i_mousex, int i_mousey, exclude ex_list = exclude(), int i_flag = LIST_IN) |
||||||||
Parameters
|
||||||||
Description This function runs through all the buttons and hotspots in the manager and stops when it finds a hotspot or button under the mouse cursor and returns the ID of that object. This ID can then be used to change the object's state, among other things. Excluding Buttons If you want to exclude any button objects from the search, then you need to use the second to last parameter of the function. First you must compile a list (an STL vector) of objects that you want to exclude, then pass those in for ex_list. You do not have to pass a value for i_flags - the default value is all you need. Layering Objects If you want to search for more than one object under the cursor, you simply have to go into a while loop. Each iteration, call the function and see if there is a returned ID. If so, handle that ID and then add that ID onto the exclusion list and re-iterate. Each iteration wil ignore the previous objects and continue to find new objects at that location until it returns a null string. |
||||||||
Use CButtonMngr button; string button_id = button.CheckButtons(mouse_x, mouse_y); // add button to exclude list and check for more exclude ex_list; ex_list.push_back(button_id); button_id = button.CheckButtons(mouse_x, mouse_y, ex_list); |
||||||||
|
||||||||
|