Being *BeingManager::findBeingByPixel(int x, int y) const { Beings::const_iterator itr = mBeings.begin(); Beings::const_iterator itr_end = mBeings.end(); for (; itr != itr_end; ++itr) { Being *being = (*itr); int xtol = being->getWidth() / 2; int uptol = being->getHeight(); if ((being->isAlive()) && (being != player_node) && (being->getPixelX() - xtol <= x) && (being->getPixelX() + xtol >= x) && (being->getPixelY() - uptol <= y) && (being->getPixelY() >= y)) { return being; } } return NULL; }
void DebugWindow::draw(gcn::Graphics *g) { Window::draw(g); if (player_node) { Being *target = player_node->getTarget(); if (target) { Graphics *g2 = static_cast<Graphics*>(g); target->draw(g2, -target->getPixelX() + 16 + getWidth() / 2, -target->getPixelY() + 32 + getHeight() / 2); } } }