本文整理汇总了C++中CCard::FaceUp方法的典型用法代码示例。如果您正苦于以下问题:C++ CCard::FaceUp方法的具体用法?C++ CCard::FaceUp怎么用?C++ CCard::FaceUp使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCard
的用法示例。
在下文中一共展示了CCard::FaceUp方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandleMouseDownEvent
void HandleMouseDownEvent(SDL_Event &event)
{
CCardRegion *srcReg;
if(event.button.button == SDL_BUTTON_LEFT){
srcReg = Scorpion.OnMouseDown(event.button.x, event.button.y);
if(srcReg == NULL) return;
//clicked on the top of the foundations
if((srcReg->Id == CRD_TABLEAU) && srcReg->PtOnTop(event.button.x, event.button.y)){
srcReg->SetCardFaceUp(true, srcReg->Size() - 1);
}
//clicked on the tableau or piles for dragging
if(((srcReg->Id == CRD_TABLEAU) || (srcReg->Id == CRD_FOUNDATION)) && Scorpion.InitDrag(event.button.x, event.button.y)){
startdrag = true;
SDL_WM_GrabInput(SDL_GRAB_ON);
}
//clicked on the stock pile
if(srcReg->Id == CRD_STOCK){
//printf("clicked on stock pile\n");
CCardStack *cs = new CCardStack;
for(int i = 0; i < 4; i++){
*cs = Scorpion[0].Pop(1);
cs->SetCardsFaceUp(true);
Scorpion.InitDrag(cs, -1, -1);
Scorpion.DoDrop(&Scorpion[i]);
}
}
}
//substitute right-click for double-click event
if(event.button.button == SDL_BUTTON_RIGHT){
srcReg = Scorpion.OnMouseDown(event.button.x, event.button.y);
if(srcReg == NULL) return;
CCardRegion *cr;
CCard card = srcReg->GetCard(srcReg->Size()-1);
//clicked on the top of the foundations
if(((srcReg->Id == CRD_FOUNDATION) || (srcReg->Id == CRD_STOCK)) && card.FaceUp() && srcReg->PtOnTop(event.button.x, event.button.y)){
if((cr = Scorpion.FindDropRegion(CRD_FOUNDATION, card))){
CCardStack *cs = new CCardStack;
*cs = srcReg->Pop(1);
Scorpion.InitDrag(cs, -1 , -1);
Scorpion.DoDrop(cr);
}
}
}
}