1
General / Hexagon grid
« on: May 12, 2019, 02:58:18 pm »
Hello, I got a hexagonal grid, and it does display right and I can even put textures on each hexagon. My problem is following:
In an additional std::map I store the coordinates of the central point and the x-y coordinate of the hexagon in the grid in a std::map<sf::Vector2f, sf::Vector2i> now I try to get the sf::Vector2i as return of a map search for displaying the Hexgrid coordinates in console for the one mouse if hoovering over in the window. I'm trying to do this with find_if algorithm on the map. The function is part of the Hexgrid class which holds the hexagonal grid:
however compiler notifies me of an error on converting pairs.
I also tried with another lambda:
Here the compiler can't convert pair to sf::vector2f.
So after a search I found that I might have to write something extra but can't realy bend my head around what it is and why this specific thing is lacking. Thanks for a response or a hint.
In an additional std::map I store the coordinates of the central point and the x-y coordinate of the hexagon in the grid in a std::map<sf::Vector2f, sf::Vector2i> now I try to get the sf::Vector2i as return of a map search for displaying the Hexgrid coordinates in console for the one mouse if hoovering over in the window. I'm trying to do this with find_if algorithm on the map. The function is part of the Hexgrid class which holds the hexagonal grid:
(click to show/hide)
however compiler notifies me of an error on converting pairs.
I also tried with another lambda:
(click to show/hide)
Here the compiler can't convert pair to sf::vector2f.
So after a search I found that I might have to write something extra but can't realy bend my head around what it is and why this specific thing is lacking. Thanks for a response or a hint.