Ejemplo n.º 1
0
int keypress_minimap_handler (window_info *win, int mx, int my, Uint32 key, Uint32 unikey, Uint16 mods)
{
	if (is_within_radius(mx,my-ELW_TITLE_HEIGHT,float_minimap_size/2,float_minimap_size/2,float_minimap_size/2))
	{
		if((key == SDLK_KP_PLUS) || (key == SDLK_PAGEUP))
		{
			increase_zoom();
			return 1;
		}
		else if ((key == SDLK_KP_MINUS) ||  (key == SDLK_PAGEDOWN))
		{
			decrease_zoom();
			return 1;
		}
	}

	return 0;
}
Ejemplo n.º 2
0
int click_minimap_handler(window_info * win, int mx, int my, Uint32 flags)
{
	int close_button_x = win->len_x/2 + 32 - 1;
	if(left_click)
	{
		//check for close button click
		if((mx >=close_button_x) && (mx <=close_button_x + ELW_TITLE_HEIGHT) 
			&&	(my <= ELW_TITLE_HEIGHT))
		{
			hide_window(minimap_win);
			return 1;
		}
		else if(my >= ELW_TITLE_HEIGHT)
		{
			//check if the click is in the round area
			if(is_within_radius(mx,my-ELW_TITLE_HEIGHT,float_minimap_size/2,float_minimap_size/2,float_minimap_size/2))
			{
				minimap_walkto(mx, win->len_y - my);
				return 1;
			}
		}
		// title bar?
		else if ((mx > win->len_x/2-32) && (mx < win->len_x/2+32) && (my >= 0) && (my <= 2*ELW_TITLE_HEIGHT))
			return 1;
	}
	else if((flags & ELW_WHEEL) && is_within_radius(mx,my-ELW_TITLE_HEIGHT,float_minimap_size/2,float_minimap_size/2,float_minimap_size/2))
	{
		if(flags & ELW_WHEEL_UP)
			increase_zoom();
		else
			decrease_zoom();
		return 1;
	}

	return 0;
}