Do you mean something like this?
#include <SFML/Graphics.hpp>
#include <iostream>
#include <vector>
#include <array>
int main()
{
sf::RenderWindow mMainWindow(sf::VideoMode(1000,600), "Map", sf::Style::Close);
sf::View view(sf::Vector2f(0, 0), sf::Vector2f(1000, 600));
mMainWindow.setFramerateLimit(60);
mMainWindow.setKeyRepeatEnabled(false);
view.zoom(0.1f);
int itcolorpos = 0;
int itpos = 0;
const std::string ProvinceArray[] = {"Province1", "Province2", "Province3"};
const std::vector<std::string> ProvinceVector(ProvinceArray,ProvinceArray+sizeof(ProvinceArray)/sizeof(std::string));
const sf::Vector3i ProvinceColorsArray[] = {sf::Vector3i(255,0,255), sf::Vector3i(0,255,255),sf::Vector3i(0,0,255)};
const std::vector<sf::Vector3i> ProvinceColorsVector(ProvinceColorsArray,ProvinceColorsArray+sizeof(ProvinceColorsArray)/sizeof(sf::Vector3i));
std::array<std::array<unsigned short, 8>, 10> Map = {{{0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 1, 2, 2, 2, 1, 1},
{0, 0, 1, 2, 2, 2, 1, 1},
{0, 0, 1, 1, 1, 1, 1, 1},
{0, 0, 1, 1, 1, 1, 1, 1},
{0, 0, 1, 1, 1, 1, 1, 1},
{0, 0, 1, 1, 1, 2, 2, 2},
{0, 0, 1, 1, 1, 2, 2, 2},
{0, 0, 1, 1, 1, 2, 2, 2}}};
sf::VertexArray MapDraw(sf::Points);
for(int y = 0; y < 8; y++)
{
for(int x = 0; x < 10; x++)
{
for (auto& it=ProvinceColorsVector.begin(); it!=ProvinceColorsVector.end(); ++it)
{
itcolorpos = it - ProvinceColorsVector.begin();
if(Map[x][y]==itcolorpos)
{
MapDraw.append(sf::Vertex(sf::Vector2f(y, x), sf::Color(ProvinceColorsVector[itcolorpos].x, ProvinceColorsVector[itcolorpos].y, ProvinceColorsVector[itcolorpos].z)));
}
}
}
}
while (mMainWindow.isOpen())
{
sf::Event event;
sf::Vector2i mousePos;
bool leftclicked = false;
while (mMainWindow.pollEvent(event))
{
switch (event.type)
{
case sf::Event::Closed:
mMainWindow.close();
break;
case sf::Event::MouseButtonPressed:
if (event.mouseButton.button == sf::Mouse::Left)
{
leftclicked = true;
mousePos = sf::Vector2i(event.mouseButton.x, event.mouseButton.y);
break;
}
}
}
sf::Vector2i pixel_pos = sf::Mouse::getPosition(mMainWindow);
sf::Vector2f coord_pos = mMainWindow.mapPixelToCoords(pixel_pos);
int abspos_x = coord_pos.x;
int abspos_y = coord_pos.y;
if(leftclicked)
{
if(abspos_x<=7 && abspos_x>=0 && abspos_y<=9 && abspos_y>=0)
{
for (auto& it=ProvinceVector.begin(); it!=ProvinceVector.end(); ++it)
{
itpos = it - ProvinceVector.begin();
if(Map[abspos_y][abspos_x]==itpos)
{
std::cout << ProvinceVector[itpos] << std::endl;
break;
}
}
}
}
mMainWindow.clear();
mMainWindow.setView(view);
mMainWindow.draw(MapDraw);
mMainWindow.display();
}
return 0;
}
Drawing here is only for demonstration purposes, but not necessary for functioning. Map is zoomed in for being able to see the pixels better. I could use 2d Vectors instead of 3d for the Color and set the third color to 0 (only relevant when drawing), but I definitely need more than 256 provinces.
But there are still big problems, so for example I have to fill in the information manually and that would take 100 years :-)
And the second problem is that an array can only hold some millions of pixels/numbers, but not hundreds of millions.
Even the VertexArray didn't work when I tried to fill it with some (2.4) billions of pixels, so the RAM/32 bit?/compiler limit problem still persists.