当前位置: 首页>>代码示例>>C++>>正文


C++ MouseY函数代码示例

本文整理汇总了C++中MouseY函数的典型用法代码示例。如果您正苦于以下问题:C++ MouseY函数的具体用法?C++ MouseY怎么用?C++ MouseY使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了MouseY函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: MousePress

bool CQuitBox::MousePress(int x, int y, int button)
{
    float mx=MouseX(x);
    float my=MouseY(y);
    if(InBox(mx,my,box)) {
        moveBox=true;
        if(InBox(mx,my,box+resignBox) || InBox(mx,my,box+saveBox) || InBox(mx,my,box+giveAwayBox) || InBox(mx,my,box+teamBox) || InBox(mx,my,box+cancelBox) || InBox(mx,my,box+quitBox) ||
                InBox(mx, my, box + scrollbarBox) || InBox(mx, my, box + scrollBox))
            moveBox=false;
        if (hasScroll && InBox(mx, my, box + scrollBox)) {
            scrolling = true;
            scrollGrab = (box + scrollBox).y2 - my;
        }
        else if (hasScroll && InBox(mx, my, box + scrollbarBox)) {
            if(my < (box + scrollBox).y1)
                *(volatile int *)&startTeam = startTeam + std::min(MAX_QUIT_TEAMS - numTeamsDisp - startTeam, numTeamsDisp);
            if(my > (box + scrollBox).y2)
                *(volatile int *)&startTeam = startTeam - std::min(startTeam, numTeamsDisp);
        }
        else if(InBox(mx,my,box+teamBox)) {
            int team = startTeam + (int)((box.y1 + teamBox.y2 - my) / 0.025f);
            if(team>=gu->myTeam)
                team++;
            if(teamHandler->IsValidTeam(team) && !teamHandler->Team(team)->isDead) {
                // we don't want to give everything to the enemy if there are allies left
                if(noAlliesLeft || (!noAlliesLeft && teamHandler->Ally(gu->myAllyTeam, teamHandler->AllyTeam(team)))) {
                    shareTeam=team;
                }
            }
        }
        return true;
    }
    return false;
}
开发者ID:spring-multiverse,项目名称:spring,代码行数:34,代码来源:QuitBox.cpp

示例2: MouseX

bool CStartPosSelecter::MousePress(int x, int y, int button)
{
	float mx = MouseX(x);
	float my = MouseY(y);
	if ((showReady && InBox(mx, my, readyBox)) || gs->frameNum > 0) {
		return !Ready();
	}

	float dist=ground->LineGroundCol(camera->pos,camera->pos+mouse->dir*gu->viewRange*1.4f);
	if(dist<0)
		return true;

	startPosSet = true;
	inMapDrawer->SendErase(startPos);
	startPos = camera->pos + mouse->dir * dist;

	if(startPos.z<gameSetup->allyStartingData[gu->myAllyTeam].startRectTop *gs->mapy*8)
		startPos.z=gameSetup->allyStartingData[gu->myAllyTeam].startRectTop*gs->mapy*8;

	if(startPos.z>gameSetup->allyStartingData[gu->myAllyTeam].startRectBottom*gs->mapy*8)
		startPos.z=gameSetup->allyStartingData[gu->myAllyTeam].startRectBottom*gs->mapy*8;

	if(startPos.x<gameSetup->allyStartingData[gu->myAllyTeam].startRectLeft*gs->mapx*8)
		startPos.x=gameSetup->allyStartingData[gu->myAllyTeam].startRectLeft*gs->mapx*8;

	if(startPos.x>gameSetup->allyStartingData[gu->myAllyTeam].startRectRight*gs->mapx*8)
		startPos.x=gameSetup->allyStartingData[gu->myAllyTeam].startRectRight*gs->mapx*8;

	net->Send(CBaseNetProtocol::Get().SendStartPos(gu->myPlayerNum, gu->myTeam, 0, startPos.x, startPos.y, startPos.z));

	return true;
}
开发者ID:DeadnightWarrior,项目名称:spring,代码行数:32,代码来源:StartPosSelecter.cpp

示例3: MouseX

void CShareBox::MouseRelease(int x, int y, int button)
{
	float mx = MouseX(x);
	float my = MouseY(y);

	if (InBox(mx, my, box + unitBox)) {
		shareUnits = !shareUnits;
	}
	if ((InBox(mx, my, box + okBox) || InBox(mx, my, box + applyBox)) &&
			 shareTeam != -1 && !teamHandler->Team(shareTeam)->isDead && !teamHandler->Team(gu->myTeam)->isDead) {
		if (shareUnits) {
			Command c;
			c.id = CMD_STOP;
			// make sure the units are stopped and that the selection is transmitted
			selectedUnits.GiveCommand(c, false);
		}
		net->Send(CBaseNetProtocol::Get().SendShare(gu->myPlayerNum, shareTeam, shareUnits, metalShare * teamHandler->Team(gu->myTeam)->metal, energyShare * teamHandler->Team(gu->myTeam)->energy));
		if (shareUnits)
			selectedUnits.ClearSelected();
		lastShareTeam = shareTeam;
	}
	if (InBox(mx, my, box + okBox) || InBox(mx, my, box + cancelBox)) {
		delete this;
		return;
	}
	moveBox = false;
	metalMove = false;
	energyMove = false;
}
开发者ID:Mocahteam,项目名称:SpringPP,代码行数:29,代码来源:ShareBox.cpp

示例4: MousePress

bool CShareBox::MousePress(int x, int y, int button)
{
	float mx=MouseX(x);
	float my=MouseY(y);
	if(InBox(mx,my,box)){
		moveBox=true;
		if(InBox(mx,my,box+okBox) || InBox(mx,my,box+applyBox) || InBox(mx,my,box+cancelBox) || InBox(mx,my,box+unitBox) || InBox(mx,my,box+metalBox) || InBox(mx,my,box+energyBox) || InBox(mx,my,box+teamBox))
			moveBox=false;
		if(InBox(mx,my,box+metalBox)){
			metalMove = true;
			metalShare = std::max(0.f, std::min(1.f,(mx-box.x1-metalBox.x1)/(metalBox.x2-metalBox.x1)));
		}
		if(InBox(mx,my,box+energyBox)){
			energyMove = true;
			energyShare = std::max(0.f, std::min(1.f,(mx-box.x1-energyBox.x1)/(energyBox.x2-energyBox.x1)));
		}
		if(InBox(mx,my,box+teamBox)){
			int team=(int)((box.y1+teamBox.y2-my)/0.025f);
			if(team>=gu->myTeam)
				team++;
			if(team<teamHandler->ActiveTeams() && !teamHandler->Team(team)->isDead)
				shareTeam=team;
		}
		return true;
	}
	return false;
}
开发者ID:Mocahteam,项目名称:SpringPP,代码行数:27,代码来源:ShareBox.cpp

示例5: GML_STDMUTEX_LOCK_NOPROF

bool ProfileDrawer::MousePress(int x, int y, int button)
{
	GML_STDMUTEX_LOCK_NOPROF(time); // MousePress

	const float mx = MouseX(x);
	const float my = MouseY(y);

	// check if a Timer selection box was hit
	if (mx<start_x || mx>end_x || my<end_y-profiler.profile.size()*0.024f-0.01f || my>end_y) {
		return false;
	}

	const int selIndex = (int) ((end_y - my) / 0.024f);

	// switch the selected Timers showGraph value
	if ((selIndex >= 0) && (selIndex < profiler.profile.size())) {
		std::map<std::string, CTimeProfiler::TimeRecord>::iterator pi = profiler.profile.begin();
		for (int i = 0; i < selIndex; i++) {
			++pi;
		}
		pi->second.showGraph = !pi->second.showGraph;
	}

	return false;
}
开发者ID:niavok,项目名称:spring,代码行数:25,代码来源:ProfileDrawer.cpp

示例6: GetTooltip

std::string CQuitBox::GetTooltip(int x, int y)
{
    float mx=MouseX(x);
    float my=MouseY(y);

    if(InBox(mx,my,box+resignBox))
        return "Resign the match, remain in the game";
    if(InBox(mx,my,box+saveBox))
        return "Save the current game state to a file \nfor later reload";
    if(InBox(mx,my,box+giveAwayBox))
        return "Give away all units and resources \nto the team specified below";
    if (hasScroll && InBox(mx, my, box + scrollBox))
        return "Scroll the team list here";
    if (hasScroll && InBox(mx, my, box + scrollbarBox))
        return "Scroll the team list here";
    if(InBox(mx,my,box+teamBox))
        return "Select which team recieves everything";
    if(InBox(mx,my,box+cancelBox))
        return "Return to the game";
    if(InBox(mx,my,box+quitBox))
        return "Forget about the other players and quit";
    if(InBox(mx,my,box))
        return " ";
    return "";
}
开发者ID:spring-multiverse,项目名称:spring,代码行数:25,代码来源:QuitBox.cpp

示例7: MouseX

std::string CQuitBox::GetTooltip(int x, int y)
{
	const float mx = MouseX(x);
	const float my = MouseY(y);

	const ContainerBox boxes[] = {
		resignBox, saveBox, giveAwayBox, scrollBox, scrollbarBox, teamBox, cancelBox, menuBox, quitBox
	};
	const char* toolTips[] = {
		"Resign the match; remain in the game",
		"Save the current game state to a file \nfor later reload",
		"Give away all units and resources \nto the team specified below",
		"Scroll the team list here",
		"Scroll the team list here",
		"Select which team receives everything",
		"Return to the game",
		"Return to menu; quit the game",
		"Return to system; quit the game",
	};

	const char* toolTip = "";

	for (unsigned int n = 0; n < (sizeof(boxes) / sizeof(boxes[0])); n++) {
		if (!InBox(mx, my, box + boxes[n]))
			continue;

		toolTip = toolTips[n];
		break;
	}

	return toolTip;
}
开发者ID:sprunk,项目名称:spring,代码行数:32,代码来源:QuitBox.cpp

示例8: MouseX

std::string CShareBox::GetTooltip(int x, int y)
{
	const float mx = MouseX(x);
	const float my = MouseY(y);

	if (InBox(mx, my, box + okBox)) {
		return "Shares the selected stuff and close dialog";
	} else if (InBox(mx, my, box + applyBox)) {
		return "Shares the selected stuff";
	} else if (InBox(mx, my, box + cancelBox)) {
		return "Close this dialog without sharing";
	} else if (InBox(mx, my, box + unitBox)) {
		return "Toggles if you want to share your\ncurrently selected units";
	} else if (InBox(mx, my, box + metalBox)) {
		return "Click here to select how much metal to share";
	} else if (InBox(mx, my, box + energyBox)) {
		return "Click here to select how much energy to share";
	} else if (hasScroll && InBox(mx, my, box + scrollBox)) {
		return "Scroll the team list here";
	} else if (hasScroll && InBox(mx, my, box + scrollbarBox)) {
		return "Scroll the team list here";
	} else if (InBox(mx, my, box + teamBox)) {
		return "Select which team to share to";
	} else if (InBox(mx, my, box)) {
		return " ";
	} else {
		return "";
	}
}
开发者ID:AlexDiede,项目名称:spring,代码行数:29,代码来源:ShareBox.cpp

示例9: MouseMove

void CQuitBox::MouseMove(int x, int y, int dx,int dy, int button)
{
    float mx=MouseX(x);
    float my=MouseY(y);

    if(scrolling) {
        float scr = (box+scrollbarBox).y2 - (my + scrollGrab);
        float sz = scrollbarBox.y2 - scrollbarBox.y1;
        float tsz = sz / (float)MAX_QUIT_TEAMS;

        *(volatile int *)&startTeam = std::max(0, std::min((int)(scr / tsz + 0.5), MAX_QUIT_TEAMS - numTeamsDisp));
        return;
    }
    if(moveBox) {
        box.x1+=MouseMoveX(dx);
        box.x2+=MouseMoveX(dx);
        box.y1+=MouseMoveY(dy);
        box.y2+=MouseMoveY(dy);
    }
    if(!(hasScroll && (InBox(mx, my, box + scrollBox) || InBox(mx, my, box + scrollbarBox))) && InBox(mx,my,box+teamBox)) {
        int team = startTeam + (int)((box.y1 + teamBox.y2 - my) / 0.025f);
        if(team>=gu->myTeam)
            team++;
        if(teamHandler->IsValidTeam(team) && !teamHandler->Team(team)->isDead) {
            // we don't want to give everything to the enemy if there are allies left
            if(noAlliesLeft || (!noAlliesLeft && teamHandler->Ally(gu->myAllyTeam, teamHandler->AllyTeam(team)))) {
                shareTeam=team;
            }
        }
    }
}
开发者ID:spring-multiverse,项目名称:spring,代码行数:31,代码来源:QuitBox.cpp

示例10: MousePress

bool CResourceBar::MousePress(int x, int y, int button)
{
	if (disabled) {
		return false;
	}

	const float mx=MouseX(x);
	const float my=MouseY(y);

	if(InBox(mx,my,box)){
		moveBox=true;
		if(!gu->spectating){
			if(InBox(mx,my,box+metalBox)){
				moveBox = false;
				float metalShare = std::max(0.f, std::min(1.f,(mx-(box.x1+metalBox.x1))/(metalBox.x2-metalBox.x1)));
				net->Send(CBaseNetProtocol::Get().SendSetShare(gu->myPlayerNum, gu->myTeam, metalShare, gs->Team(gu->myTeam)->energyShare));
			}
			if(InBox(mx,my,box+energyBox)){
				moveBox = false;
				float energyShare = std::max(0.f, std::min(1.f,(mx-(box.x1+energyBox.x1))/(energyBox.x2-energyBox.x1)));
				net->Send(CBaseNetProtocol::Get().SendSetShare(gu->myPlayerNum, gu->myTeam, gs->Team(gu->myTeam)->metalShare, energyShare));
			}
		}
		return true;
	}
	return false;
}
开发者ID:genxinzou,项目名称:svn-spring-archive,代码行数:27,代码来源:ResourceBar.cpp

示例11: MouseX

bool CglList::MouseUpdate(int x, int y)
{
	float mx = MouseX(x);
	float my = MouseY(y);

	int nCurIndex = 0; // The item we're on
	int nDrawOffset = 0; // The offset to the first draw item
	ContainerBox b = box;

	// Get list started up here
	std::vector<std::string>::iterator ii = filteredItems->begin();
	// Skip to current selection - 3; ie: scroll
	while ((nCurIndex + 7) <= place && nCurIndex+13 <= filteredItems->size()) { ii++; nCurIndex++; }

	for (/*ii = items.begin()*/; ii != filteredItems->end() && nDrawOffset < 12; ii++)
	{
		b.y2 = box.y2 - 0.06f - (nDrawOffset * 0.06f);
		b.y1 = b.y2 - 0.05f;

		if (InBox(mx, my, b)) {
			place = nCurIndex;
			return true;
		}

		// Up our index's
		nCurIndex++; nDrawOffset++;
	}
	return false;
}
开发者ID:Gepard,项目名称:spring,代码行数:29,代码来源:glList.cpp

示例12: IsAbove

bool CQuitBox::IsAbove(int x, int y)
{
    float mx=MouseX(x);
    float my=MouseY(y);
    if(InBox(mx,my,box))
        return true;
    return false;
}
开发者ID:spring-multiverse,项目名称:spring,代码行数:8,代码来源:QuitBox.cpp

示例13: MouseX

bool CResourceBar::IsAbove(int x, int y)
{
    if (!enabled) {
        return false;
    }

    const float mx = MouseX(x);
    const float my = MouseY(y);
    return InBox(mx, my, box);
}
开发者ID:niavok,项目名称:spring,代码行数:10,代码来源:ResourceBar.cpp

示例14: IsAbove

bool CTimeProfiler::IsAbove(int x, int y)
{
	float mx=MouseX(x);
	float my=MouseY(y);

	if(!gu->drawdebug || mx<0.65f || mx>0.99f || my<0.99f-profile.size()*0.024f-0.01f || my>0.99f)
		return false;

	return true;
}
开发者ID:genxinzou,项目名称:svn-spring-archive,代码行数:10,代码来源:TimeProfiler.cpp

示例15: GML_STDMUTEX_LOCK_NOPROF

bool ProfileDrawer::IsAbove(int x, int y)
{
	GML_STDMUTEX_LOCK_NOPROF(time); // IsAbove

	const float mx=MouseX(x);
	const float my=MouseY(y);

	if(mx<0.65f || mx>0.99f || my<0.99f - profiler.profile.size()*0.024f-0.01f || my>0.99f)
		return false;

	return true;
}
开发者ID:Gepard,项目名称:spring,代码行数:12,代码来源:ProfileDrawer.cpp


注:本文中的MouseY函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。