Project_Maat/src/Utils.h
trotFunky 4b39ac42fd A* implementation
Working except for end of path endless loop (0,0 point appearing in paths for no reason?)

Commit mainly because the HDD is on the verge of dying
2019-06-09 05:18:28 +02:00

33 lines
960 B
C++

//
// Created by trotfunky on 07/06/19.
//
#ifndef PROJECT_MAAT_UTILS_H
#define PROJECT_MAAT_UTILS_H
#include <cstdint>
#include <string>
#include <SFML/Graphics.hpp>
#include <iostream>
namespace pro_maat
{
// Used as the base of all grid based computations
using GridUnit = int16_t;
// Used when dealing with the grid representation of the map
using GridPos = std::pair<GridUnit,GridUnit>;
static constexpr uint8_t pixelsPerUnit = 30;
static constexpr char levelFolder[] = "resources/";
static constexpr char textureFolder[] = "resources/";
static constexpr char fontFolder[] = "resources/";
void errorWindow(const std::string& error);
// Good heuristic on 4-way grids
float manhattanDistance(const GridPos& leftHandSide, const GridPos& rightHandSide);
/// Gets the 4 cardinal neighbours on the grid with edge checking
const std::vector<pro_maat::GridPos> getNeighbours(const GridPos& origin, const GridPos& gridSize);
}
#endif //PROJECT_MAAT_UTILS_H