123
-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|536|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
Socoder -> Blitz -> Selecting a country

Tue, 19 May 2009, 14:50
Jayenkai
for each country...

if inside square (countrysquare left, countrysquare top, countrysquare right, countrysquare bottom) and colour under mouse = colour of country

(where countrysquare is a square around a country, which extends to the top left and bottom right of that specific country)

then pickedcountry = country!


That "should" work, but there might be odd places where the colours overlap the odd regions..
You should be able to fix that, though, by doing certain countries later on in the check..

-=-=-
''Load, Next List!''
Tue, 19 May 2009, 14:51
Phoenix
I would suggest that you could have an off-screen color coded map. You check the mouse coordinates on the screen in the color map, and then you see that if the color under the mouse on the color map is red then the country at that certain position is the US, for example. Was that a confusing explanation? I could draw up an example, if needed.

That should be sufficient for a small map such as the one you showed. If you have more complex needs then you could look into creating polygons (as you said) representing the countries' territories. This is probably not worth the extra work though.

|edit| Jay posted while I was typing this post up. |edit|
Tue, 19 May 2009, 20:16
JL235
A third alternative would be too manually cut up all the countries into individual images and then repaint them in their correct positions. Then it would be trivial to check if the mouse intersects with Latvia, Poland, China, Australia,.. etc.

But I like Phoenix's idea the best.