示例#1
0
GUI_status ContainerViewGump::MouseWheel(sint32 x, sint32 y)
{
	int xpos, ypos;
	screen->get_mouse_location(&xpos, &ypos);
	ypos -= area.y;

	if(ypos >= container_widget_y_offset && ypos < container_widget_y_offset + container_widget->H())
	{
		if(y > 0)
		{
			container_widget->up_arrow();
		}
		else if(y < 0)
		{
			container_widget->down_arrow();
		}
	}
	else
	{
		if(is_actor_container() && party->get_member_num(actor) >= 0)
		{
			if(y > 0)
			{
				left_arrow();
			}
			else if(y < 0)
			{
				right_arrow();
			}
		}
	}
	return GUI_YUM;
}
示例#2
0
GUI_status ContainerViewGump::KeyDown(SDL_Keysym key)
{
	if(left_arrow_button && left_arrow_button->Status() == WIDGET_VISIBLE) // okay to change member number
	{
		KeyBinder *keybinder = Game::get_game()->get_keybinder();
		ActionType a = keybinder->get_ActionType(key);

		switch(keybinder->GetActionKeyType(a))
		{
			case NEXT_PARTY_MEMBER_KEY:
				right_arrow(); return GUI_YUM;
			case PREVIOUS_PARTY_MEMBER_KEY:
				left_arrow(); return GUI_YUM;
			case HOME_KEY:
				set_actor(party->get_actor(0));
				force_full_redraw_if_needed();
				return GUI_YUM;
			case END_KEY:
				set_actor(party->get_actor(party->get_party_size() - 1));
				force_full_redraw_if_needed();
				return GUI_YUM;
			default: break;
		}
	}
	/* moved into container widget
	switch(key.sym)
	    {
	        case SDLK_RETURN:
	        case SDLK_KP_ENTER:

	        	return GUI_YUM;
	        default:
	        	break;
	    }
	*/
	return container_widget->KeyDown(key);
}
void draw_arrow(Line* l,int x5, int y5, int ratio,CDC* pDC) {
	CBrush arrow_brush(ARROW_COLOR.rgb());
	CPen arrow_pen(PS_SOLID,1,ARROW_COLOR.rgb());
	auto ole_pen = pDC->SelectObject(arrow_pen);
	auto old_brush = pDC->SelectObject(arrow_brush);
	CPoint arrow[MAX_ARROWS];
	int point_count=0;
	switch (l->direction())
	{
	case STRAIGHT:
		point_count=straight_arrow(arrow,x5,y5,ratio);
		break;
	case LEFT:
		point_count=left_arrow(arrow,x5,y5,ratio);
		break;
	case RIGHT:
		point_count=right_arrow(arrow,x5,y5,ratio);
		break;
	case UTRUN:
		point_count=uturn_arrow(arrow,x5,y5,ratio);
		break;
	case STRAIGHT_LEFT:
		point_count=straight_left_arrow(arrow,x5,y5,ratio);
		break;
	case STRAIGHT_RIGHT:
		//point_count=straight_right_arrow(arrow,x5,y5,ratio);
		break;
	default:
		return;
		break;
	}
	pDC->Polygon(arrow,point_count);
	pDC->SelectObject(old_brush);
	pDC->SelectObject(arrow_pen);

}
示例#4
0
GUI_status ContainerViewGump::callback(uint16 msg, GUI_CallBack *caller, void *data)
{
	//close gump and return control to Magic class for clean up.
	if(caller == gump_button)
	{
		Game::get_game()->get_view_manager()->close_gump(this);
		return GUI_YUM;
	}
	else if(caller == down_arrow_button)
	{
		container_widget->down_arrow();
		return GUI_YUM;
	}
	else if(caller == up_arrow_button)
	{
		container_widget->up_arrow();
		return GUI_YUM;
	}
	else if(doll_button && caller == doll_button)
	{
		Game::get_game()->get_view_manager()->open_doll_view(actor);
		return GUI_YUM;
	}
	else if(left_arrow_button && caller == left_arrow_button)
	{
		left_arrow();
		return GUI_YUM;
	}
	else if(right_arrow_button && caller == right_arrow_button)
	{
		right_arrow();
		return GUI_YUM;
	}

    return GUI_PASS;
}