コード例 #1
0
ファイル: alliances_window.cpp プロジェクト: cahocachi/DEFCON
    void Render( int realX, int realY, bool highlighted, bool clicked )
    {
        Image *img = g_resource->GetImage( "gui/tick.bmp" );
        
        Vote *vote = g_app->GetWorld()->m_votingSystem.LookupVote(m_voteId);
        if( vote && vote->m_result == Vote::VoteUnknown )
        {   
            Team *myTeam = g_app->GetWorld()->GetMyTeam();
            if( vote->GetRequiredAllianceId() == myTeam->m_allianceId )
            {       
                g_renderer->SetBlendMode( Renderer::BlendModeAdditive );

                g_renderer->RectFill( realX, realY, m_w, m_h, Colour(100,100,100,50) );

                if( highlighted || clicked )
                {
                    g_renderer->RectFill( realX, realY, m_w, m_h, Colour(100,100,100,150) );
                    g_renderer->Blit( img, realX+8, realY+2, 15, 15, Colour(255,255,255,20) );
                }

                if( vote->GetCurrentVote( myTeam->m_teamId ) == m_vote )
                {
                    g_renderer->RectFill( realX, realY, m_w, m_h, Colour(100,100,100,150) );
                    g_renderer->Blit( img, realX+8, realY+2, 15, 15, White );
                }

                g_renderer->Rect( realX, realY, m_w, m_h, Colour(100,100,100,100) );

                g_renderer->SetBlendMode( Renderer::BlendModeNormal );
            }
        }
    }
コード例 #2
0
ファイル: alliances_window.cpp プロジェクト: cahocachi/DEFCON
 void MouseUp()
 {
     Vote *vote = g_app->GetWorld()->m_votingSystem.LookupVote(m_voteId);
     if( vote && vote->m_result == Vote::VoteUnknown )
     {   
         Team *myTeam = g_app->GetWorld()->GetMyTeam();
         if( vote->GetRequiredAllianceId() == myTeam->m_allianceId )
         {
             g_app->GetClientToServer()->CastVote( myTeam->m_teamId, m_voteId, m_vote );
         }
     }
 }