Over lapping buttons

Posted By: FoxHound

Over lapping buttons - 03/23/12 19:06

I need to make a panel that is a map of the USA. With it you could select a state and choose a level. However buttons are first not suppose to over lap and since the buttons will be square they would have to overlap. I don't see a better situation using multi-panels as they are usually seen square thanks to the way it looks at the buttons.

Any ideas?
Posted By: Espér

Re: Over lapping buttons - 03/23/12 19:14

Don´t use buttons for that

Use a Bitmap with fix colors for each state.
Now readout the pixel below the mouse spot with the pixel functions and ask for the pixel BGR.
When left clicking, start a function that calls the state option for the given color ^^

example:
Code:
var fhandler = bmap_lock(bitmap1,8888);
var keyhit = 0;

[...loop here...]
if(mouse_left == 1 && keyhit == 0)
{
	pixel = pixel_for_bmap(bitmap1, pix_x, pix_y);
	pixel_to_vec(temp,NULL,8888,pixel);
	
	if(temp.red <= 10 && temp.green <= 50 && temp.blue <= 63)  //Color of Montana hit
	{call_state("Montana");}
	else if(temp.red <= 255 && temp.green <= 0 && temp.blue <= 0)  //Color of Washington hit
	{call_state("Washington");}
	else if(temp.red <= 0 && temp.green <= 255 && temp.blue <= 0)  //Color of Iowa hit
	{call_state("Iowa");}
	[...etc...]
	
	keyhit = 1; //to lock mousekey
}
else if(mouse_left == 0 && keyhit == 1) //to unlock mousekey
{
	keyhit = 0;
}


[...after loop break...]
bmap_unlock(bitmap1);



pix_x and pix_y need to be calculated from the mouse_pos on the bitmap.

Additional Tipp:
You can use a color-bitmap to check the color, and a satellite bitmap as overlay to show a map.
Posted By: FoxHound

Re: Over lapping buttons - 03/23/12 20:00

Well done. I expected this to take a bit longer to get such a good idea so it will be a bit before I can implant this. Thanks.
© 2024 lite-C Forums