예제 #1
0
파일: Window.cpp 프로젝트: jjiezheng/urho3d
void Window::OnHover(const IntVector2& position, const IntVector2& screenPosition, int buttons, int qualifiers, Cursor* cursor)
{
    if (dragMode_ == DRAG_NONE)
    {
        WindowDragMode mode = GetDragMode(position);
        SetCursorShape(mode, cursor);
    }
    else
        SetCursorShape(dragMode_, cursor);
}
예제 #2
0
bool UpdateCursorShape(QWidget *widget, int x, int y, int border_width)
{
    const CornerEdge ce = GetCornerEdge(widget, x, y, border_width);
    const XCursorType x_cursor = CornerEdge2XCursor(ce);
    if (x_cursor != XCursorType::kInvalid) {
        return SetCursorShape(widget, static_cast<unsigned int>(x_cursor));
    } else {
        ResetCursorShape(widget);
        return false;
    }
}
예제 #3
0
파일: Window.cpp 프로젝트: jjiezheng/urho3d
void Window::OnDragBegin(const IntVector2& position, const IntVector2& screenPosition, int buttons, int qualifiers, Cursor* cursor)
{
    if (buttons != MOUSEB_LEFT || !CheckAlignment())
    {
        dragMode_ = DRAG_NONE;
        return;
    }

    dragBeginCursor_ = screenPosition;
    dragBeginPosition_ = GetPosition();
    dragBeginSize_ = GetSize();
    dragMode_ = GetDragMode(position);
    SetCursorShape(dragMode_, cursor);
}
// Shows Main Menu of game
int  MM_ShowMainMenu(){
	int c,res=0;

	system("cls");//first clear all screen
	system(SysColors[2]);//set back color of screen to black with white font
	SetCursorShape(True,100);

	CenterAlignedPrint("|||||||||",0,GE.ConSize.Width,0,1);
	CenterAlignedPrint("|||||||||||||||||||",0,GE.ConSize.Width,1,1);
	SetFColor(Colors[1][0],Colors[1][4]);
	CenterAlignedPrint("///////////// S N /-\\ K S \\\\\\\\\\\\\\\\\\\\\\\\\\",0,GE.ConSize.Width,2,1);
	SetFColor(Colors[1][3],Colors[1][4]);
	CenterAlignedPrint("|||||||||||||||||||",0,GE.ConSize.Width,3,1);
	CenterAlignedPrint("|||||||||",0,GE.ConSize.Width,4,1);
	CenterAlignedPrint("Developers: Hojat Irvani & Parnian Zare",0,GE.ConSize.Width,6,1);
	CenterAlignedPrint(">>>>>>>>> Main Menu <<<<<<<<<",0,GE.ConSize.Width,10,1);
	CenterAlignedPrint("Menu Options:",0,GE.ConSize.Width-16,13,1);
	CenterAlignedPrint("1) League Mode",0,GE.ConSize.Width-15,15,1);
	CenterAlignedPrint("2) Free Mode",0,GE.ConSize.Width-17,16,1);
	SetFColor(Colors[1][1],Colors[1][4]);
	CenterAlignedPrint("3) Special Mode(Career)",0,GE.ConSize.Width-6,17,1);
	SetFColor(Colors[1][2],Colors[1][4]);
	CenterAlignedPrint("4) Color Setting",0,GE.ConSize.Width-13,19,1);
	SetFColor(Colors[1][3],Colors[1][4]);
	CenterAlignedPrint("5) Exit",0,GE.ConSize.Width-22,21,1);
	CenterAlignedPrint("Please Enter Your Selected Mode Number(1 to 5 ?)... ",0,GE.ConSize.Width,24,1);
	ClearKBBuffer();//clear buffer
	while(!((c=getch())>='1' && c<='5'));
	putchar(c);
	Sleep(750);
	system("cls");
	if(c=='5'){
		CPrint("\n\nExiting Game...");Sleep(1500);
		return 0;//Exit whole game
	}else{
		if(c=='1'){
			CPrint("\n\nLeague Mode:\nGame starts in 2 Sec...");
			Sleep(2000);	
		}else if(c=='2')
			CPrint("\n\nFree Mode:");
		else if(c=='3')
			CPrint("\n\nSpecial Mode:");
		return c-'0';
	}
}
예제 #5
0
파일: Window.cpp 프로젝트: jjiezheng/urho3d
void Window::OnDragMove(const IntVector2& position, const IntVector2& screenPosition, int buttons, int qualifiers, Cursor* cursor)
{
    if (dragMode_ == DRAG_NONE)
        return;

    IntVector2 delta = screenPosition - dragBeginCursor_;

    const IntVector2& position_ = GetPosition();
    const IntVector2& size_ = GetSize();
    const IntVector2& minSize_ = GetMinSize();
    const IntVector2& maxSize_ = GetMaxSize();

    switch (dragMode_)
    {
    case DRAG_MOVE:
        SetPosition(dragBeginPosition_ + delta);
        break;

    case DRAG_RESIZE_TOPLEFT:
        SetPosition(Clamp(dragBeginPosition_.x_ + delta.x_, position_.x_ - (maxSize_.x_ - size_.x_), position_.x_ + (size_.x_ - minSize_.x_)),
            Clamp(dragBeginPosition_.y_ + delta.y_, position_.y_ - (maxSize_.y_ - size_.y_), position_.y_ + (size_.y_ - minSize_.y_)));
        SetSize(dragBeginSize_ - delta);
        break;

    case DRAG_RESIZE_TOP:
        SetPosition(dragBeginPosition_.x_, Clamp(dragBeginPosition_.y_ + delta.y_, position_.y_ - (maxSize_.y_ - size_.y_), position_.y_ + (size_.y_ - minSize_.y_)));
        SetSize(dragBeginSize_.x_, dragBeginSize_.y_ - delta.y_);
        break;

    case DRAG_RESIZE_TOPRIGHT:
        SetPosition(dragBeginPosition_.x_, dragBeginPosition_.y_ + delta.y_);
        SetSize(dragBeginSize_.x_ + delta.x_, dragBeginSize_.y_ - delta.y_);
        break;

    case DRAG_RESIZE_RIGHT:
        SetSize(dragBeginSize_.x_ + delta.x_, dragBeginSize_.y_);
        break;

    case DRAG_RESIZE_BOTTOMRIGHT:
        SetSize(dragBeginSize_ + delta);
        break;

    case DRAG_RESIZE_BOTTOM:
        SetSize(dragBeginSize_.x_, dragBeginSize_.y_ + delta.y_);
        break;

    case DRAG_RESIZE_BOTTOMLEFT:
        SetPosition(Clamp(dragBeginPosition_.x_ + delta.x_, position_.x_ - (maxSize_.x_ - size_.x_), position_.x_ + (size_.x_ - minSize_.x_)), dragBeginPosition_.y_);
        SetSize(dragBeginSize_.x_ - delta.x_, dragBeginSize_.y_ + delta.y_);
        break;

    case DRAG_RESIZE_LEFT:
        SetPosition(Clamp(dragBeginPosition_.x_ + delta.x_, position_.x_ - (maxSize_.x_ - size_.x_), position_.x_ + (size_.x_ - minSize_.x_)), dragBeginPosition_.y_);
        SetSize(dragBeginSize_.x_ - delta.x_, dragBeginSize_.y_);
        break;

    default:
        break;
    }

    ValidatePosition();
    SetCursorShape(dragMode_, cursor);
}