Screen to Grid is working pretty reliably, even if switching to float coordinates did make zoom at high values a bit wobbly.
This commit is contained in:
parent
e295bfb742
commit
6a4150ec05
3 changed files with 19 additions and 4 deletions
|
|
@ -283,10 +283,19 @@ void UITestScene::doAction(std::string name, std::string type)
|
|||
}
|
||||
|
||||
if (ACTION("gridtests", "start")) {
|
||||
|
||||
int tx, ty;
|
||||
auto mousepos = sf::Mouse::getPosition(game->getWindow());
|
||||
/*
|
||||
GridPoint* pgrid = grid.atScreenPixel(mousepos.x, mousepos.y, &tx, &ty);
|
||||
std::cout << "\ntx: " << tx << " ty: " << ty << std::endl;
|
||||
*/
|
||||
grid.screenToGrid(mousepos.x, mousepos.y, tx, ty);
|
||||
if (grid.inBounds(tx, ty)) {
|
||||
auto gridsq = grid.at(tx, ty);
|
||||
std::cout << "At (" << tx << ", " << ty << "): " << gridsq.tilesprite << std::endl;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// after processing: set actionState
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue