Tweaked just a wee bit
This commit is contained in:
@@ -29,6 +29,11 @@ void App::Input() {
|
|||||||
while (window->pollEvent(event)) {
|
while (window->pollEvent(event)) {
|
||||||
if (event.type == sf::Event::Closed)
|
if (event.type == sf::Event::Closed)
|
||||||
window->close();
|
window->close();
|
||||||
|
if (sf::Mouse::isButtonPressed(sf::Mouse::Left)) {
|
||||||
|
sf::Vector2i mouse_position = sf::Mouse::getPosition(*window);
|
||||||
|
explorer->setDestination(sf::Vector2i(mouse_position.x/ 5, mouse_position.y/ 5));
|
||||||
|
}
|
||||||
|
|
||||||
if (event.type == sf::Event::KeyPressed) {
|
if (event.type == sf::Event::KeyPressed) {
|
||||||
if (event.key.code == sf::Keyboard::Q) {
|
if (event.key.code == sf::Keyboard::Q) {
|
||||||
explorer->setDestination(sf::Vector2i(20, 20));
|
explorer->setDestination(sf::Vector2i(20, 20));
|
||||||
@@ -99,7 +104,6 @@ void App::Render() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Draw the explorer
|
// Draw the explorer
|
||||||
|
|
||||||
for (int x2 = 1; x2 < 5; x2++) {
|
for (int x2 = 1; x2 < 5; x2++) {
|
||||||
for (int y2 = 1; y2 < 5; y2++) {
|
for (int y2 = 1; y2 < 5; y2++) {
|
||||||
|
|
||||||
|
|||||||
@@ -146,11 +146,11 @@ std::deque<int> Pather::loop() {
|
|||||||
|
|
||||||
while (!openList.empty() && !early_exit) {
|
while (!openList.empty() && !early_exit) {
|
||||||
// Early exit jankyness, need to change this
|
// Early exit jankyness, need to change this
|
||||||
//if (closedList.size() > 3000) {
|
if (closedList.size() > 1000) {
|
||||||
// no_path = true;
|
no_path = true;
|
||||||
// early_exit = true;
|
early_exit = true;
|
||||||
// break;
|
break;
|
||||||
//}
|
}
|
||||||
if (active_node->xy.x == end_node->xy.x && active_node->xy.y == end_node->xy.y) {
|
if (active_node->xy.x == end_node->xy.x && active_node->xy.y == end_node->xy.y) {
|
||||||
early_exit = true;
|
early_exit = true;
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user