* Handles clicks on the medikit view. * @param action Pointer to an action. * @param state State that the action handlers belong to. */
| 96 | * @param state State that the action handlers belong to. |
| 97 | */ |
| 98 | void MedikitView::mouseClick (Action *action, State *) |
| 99 | { |
| 100 | SurfaceSet *set = _game->getResourcePack()->getSurfaceSet("MEDIBITS.DAT"); |
| 101 | int x = action->getRelativeXMouse() / action->getXScale(); |
| 102 | int y = action->getRelativeYMouse() / action->getYScale(); |
| 103 | for (int i = 0; i < set->getTotalFrames(); i++) |
| 104 | { |
| 105 | Surface * surface = set->getFrame (i); |
| 106 | if (surface->getPixel(x, y)) |
| 107 | { |
| 108 | _selectedPart = i; |
| 109 | _redraw = true; |
| 110 | break; |
| 111 | } |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | /** |
| 116 | * Gets the selected body part. |
nothing calls this directly
no test coverage detected