Hello,
I am now creating level editor for my game where u can make maps/levels etc. for a game I am making.
The problem is that then I move the view HUD moves as it should, by that I mean it "stays" locked to a screen and everything seems fine, but then I try to press a sprite it does nothing, but then I tried to press around the sprite not the sprite it self and it works. It seems like sprite picture moved correctly but box which checks that if sprite is clicked(Don't know how it works just guessing) moved less or more and now is in incorrect place. Did anyone encountered this problem before?
Thanks in advance
if (_mousePosition.x > 0 && _mousePosition.x < _wSize.x && _mousePosition.y > 0 && _mousePosition.y < _wSize.y)
{
if (_mousePosition.x > _data->window.getSize().x - 20)
{
_view.move(300.0f * dt, 0);
MoveHudAndItsElementsRight(dt);
}
else if (_mousePosition.x < 20)
{
_view.move(-300.0f * dt, 0);
MoveHudAndItsElementsLeft(dt);
}
else if (_mousePosition.y < 20)
{
_view.move(0, -300.0f * dt);
MoveHudAndItsElementsUp(dt);
}
else if (_mousePosition.y > _data->window.getSize().y - 20)
{
_view.move(0, 300.0f * dt);
MoveHudAndItsElementsDown(dt);
}
}
_data->window.setView(_view);
}
void MapMaker::MoveHudAndItsElementsUp(float dt)
{
_mainBar.move(0, -300.0f * dt);
_tilesSelectBar.setPosition(_mainBar.getPosition().x, _mainBar.getPosition().y - _tilesSelectBar.getLocalBounds().height);
_objectsSelectBar.setPosition(_tilesSelectBar.getPosition().x + _tilesSelectBar.getLocalBounds().width, _tilesSelectBar.getPosition().y);
_greenTile1.setPosition(_mainBar.getPosition().x + 10, _mainBar.getPosition().y + 10);
_rockTile1.setPosition(_greenTile1.getPosition().x + _greenTile1.getLocalBounds().width, _greenTile1.getPosition().y);
}