Changeset 154


Ignore:
Timestamp:
09/22/2008 06:58:33 PM (3 years ago)
Author:
guyru
Message:

display the number of rolls left on the roll button

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/MainFrame.cpp

    r151 r154  
    449449        if (m_rolls <= 0) //we don't have remaining rolls  
    450450                ((wxButton*) FindWindow(ID_ROLL)) -> Enable(false); 
     451         
     452        // change the displayed roll counter 
     453        wxString caption = wxString::Format(wxT("Roll! (%i)"),m_rolls); 
     454        FindWindow(ID_ROLL)->SetLabel(caption); 
    451455 
    452456        //restore the 'keep' checkboxes 
     
    650654        m_score_dice.SetDice(dice); 
    651655        m_score_dice.SetYahtzeeJoker(YahtzeeJoker()); 
    652         m_rolls -= 1; 
     656        --m_rolls; 
     657         
     658        // change the displayed roll counter 
     659        wxString caption = wxString::Format(wxT("Roll! (%i)"),m_rolls); 
     660        FindWindow(ID_ROLL)->SetLabel(caption); 
     661 
    653662        #ifndef DEBUG 
    654         if (m_rolls <= 0)  
     663        if (m_rolls <= 0) { 
    655664                ((wxButton*) FindWindow(ID_ROLL)) -> Enable(false); 
     665                FindWindow(ID_ROLL)->SetLabel(wxT("Roll!")); 
     666        } 
     667 
    656668        #endif 
    657669         
     
    901913        m_rolls = 3; 
    902914        ((wxButton*) FindWindow(ID_ROLL)) -> Enable(true); 
     915 
     916        // reset the roll count in the caption 
     917        FindWindow(ID_ROLL)->SetLabel(wxT("Roll! (3)")); 
    903918        for (int i=0; i<5; i++){  
    904919                ((wxCheckBox*) FindWindow(i + ID_DICE1KEEP)) -> SetValue(false); 
     
    12411256        } 
    12421257        FindWindow(ID_ROLL)->Enable(roll_button_enabled); 
     1258 
     1259        // if there are rolls left we should display the count of them 
     1260        if (roll_button_enabled) { 
     1261                wxString caption = wxString::Format(wxT("Roll! (%i)"),m_rolls); 
     1262                FindWindow(ID_ROLL)->SetLabel(caption); 
     1263        } 
     1264 
    12431265         
    12441266        //BEGIN layout for the dice section of the score board 
Note: See TracChangeset for help on using the changeset viewer.