MCPcopy Create free account
hub / github.com/OpenXcom/OpenXcom / mouseClick

Method mouseClick

src/Battlescape/MedikitView.cpp:98–113  ·  view source on GitHub ↗

* Handles clicks on the medikit view. * @param action Pointer to an action. * @param state State that the action handlers belong to. */

Source from the content-addressed store, hash-verified

96 * @param state State that the action handlers belong to.
97 */
98void 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.

Callers

nothing calls this directly

Calls 9

getSurfaceSetMethod · 0.80
getRelativeXMouseMethod · 0.80
getRelativeYMouseMethod · 0.80
getTotalFramesMethod · 0.80
getFrameMethod · 0.80
getPixelMethod · 0.80
getResourcePackMethod · 0.45
getXScaleMethod · 0.45
getYScaleMethod · 0.45

Tested by

no test coverage detected