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


C++ Store::GetWinner方法代码示例

本文整理汇总了C++中Store::GetWinner方法的典型用法代码示例。如果您正苦于以下问题:C++ Store::GetWinner方法的具体用法?C++ Store::GetWinner怎么用?C++ Store::GetWinner使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Store的用法示例。


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

示例1: Draw

//Drawing function
void Interface::Draw()
{
    //if nothing changed, just return
    if(!changed)
        return;

    //If wrong destination surface or font not initialized, return
    if(!SDest || !font)
        return;

    //clear screen (black)
    Surface::DrawRect(SDest,0,0,1024,768,SDL_MapRGB(SDest->format, 0,0,0));

    //Set default color to yellow
    SetColor(255,255,0);

    //Write our ID
    Surface::DrawFont(SDest,10,10,font,"Vase ID: %s",gStore.GetName());

    //And draw stage-specific stuff
    switch(stage)
    {
    case STAGE_MENU: //For menu stage
        SetColor(0,0,0);
        Surface::DrawRect(SDest,60,80,100,25,SDL_MapRGB(SDest->format,255,255,255));
        Surface::DrawFont(SDest,63,83,font,"Nova hra");

        Surface::DrawRect(SDest,60,130,100,25,SDL_MapRGB(SDest->format,255,255,255));
        Surface::DrawFont(SDest,63,133,font,"Konec");
        break;
    case STAGE_CONNECTING: //For waiting stage (Waiting for oponnent...)
        SetColor(255,255,255);
        Surface::DrawFont(SDest,63,83,font,"Cekam na protihrace...");
        break;
    case STAGE_GAME: //For main game
        Surface::DrawFont(SDest,10,25,font,"ID protihrace: %s",gStore.GetOponnentName());
        //Draw first two lines for frame
        Surface::DrawRect(SDest,10,45,2+40*(2+15),2,SDL_MapRGB(SDest->format,255,255,255));
        Surface::DrawRect(SDest,10,45,2,2+40*(2+15),SDL_MapRGB(SDest->format,255,255,255));
        //And draw whole field
        for(int i = 0; i < 40; i++)
        {
            //Lines...
            Surface::DrawRect(SDest,10,45+2+15+i*(2+15),2+40*(2+15),2,SDL_MapRGB(SDest->format,255,255,255));
            Surface::DrawRect(SDest,10+2+15+i*(2+15),45,2,2+40*(2+15),SDL_MapRGB(SDest->format,255,255,255));
            //Draw field values (blank, cross or circle)
            for(int j = 0; j < 40; j++)
                DrawFieldElem(i,j,gStore.GetFieldValue(i,j));
        }

        //if someone won
        if(gStore.GetWinner())
        {
            thickLineColor(SDest, 10+9+gStore.GetWinCoords(0)*(2+15), 45+2+7+gStore.GetWinCoords(1)*(2+15), 10+9+gStore.GetWinCoords(2)*(2+15), 45+2+7+gStore.GetWinCoords(3)*(2+15), 4, 0x1010FFFF);
        }
        break;
    default:
        break;
    }

    //And after drawing, set changed to false, to avoid re-drawing the same
    changed = false;
}
开发者ID:,项目名称:,代码行数:64,代码来源:


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