MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / FindWindowFromPt

Function FindWindowFromPt

src/window.cpp:1845–1854  ·  view source on GitHub ↗

* Do a search for a window at specific coordinates. For this we start * at the topmost window, obviously and work our way down to the bottom * @param x position x to query * @param y position y to query * @return a pointer to the found window if any, nullptr otherwise */

Source from the content-addressed store, hash-verified

1843 * @return a pointer to the found window if any, nullptr otherwise
1844 */
1845Window *FindWindowFromPt(int x, int y)
1846{
1847 for (Window *w : Window::IterateFromFront()) {
1848 if (MayBeShown(w) && IsInsideBS(x, w->left, w->width) && IsInsideBS(y, w->top, w->height)) {
1849 return w;
1850 }
1851 }
1852
1853 return nullptr;
1854}
1855
1856/**
1857 * (re)initialize the windowing system

Callers 6

HandleMouseOverFunction · 0.85
HandleViewportScrollFunction · 0.85
HandleAutoscrollFunction · 0.85
MouseLoopFunction · 0.85
OnMouseLoopMethod · 0.85
GetTileFromScreenXYFunction · 0.85

Calls 2

MayBeShownFunction · 0.85
IsInsideBSFunction · 0.85

Tested by

no test coverage detected