Changeset 325


Ignore:
Timestamp:
Feb 1, 2011, 2:20:03 AM (11 years ago)
Author:
sam
Message:

Implement Text::SetInt().

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/monsterz/board.cpp

    r324 r325  
    141141
    142142    /* Update statistics and score */
    143     char buf[128];
    144     sprintf(buf, "%i", data->score);
    145     data->scoretext->SetText(buf);
    146 
     143    data->scoretext->SetInt(data->score);
    147144    for (int n = 0; n < MAX_PIECES; n++)
    148     {
    149         sprintf(buf, "%i", data->counts[n]);
    150         data->counticons[n]->SetText(buf);
    151     }
     145        data->counticons[n]->SetInt(data->counts[n]);
    152146
    153147    switch (data->state)
  • trunk/src/text.cpp

    r320 r325  
    5454}
    5555
     56void Text::SetInt(int val)
     57{
     58    if (data->text)
     59        free(data->text);
     60    char buf[128];
     61    sprintf(buf, "%i", val);
     62    data->text = strdup(buf);
     63}
     64
    5665void Text::SetPos(int3 pos)
    5766{
  • trunk/src/text.h

    r294 r325  
    2828
    2929    void SetText(char const *text);
     30    void SetInt(int val);
    3031    void SetPos(int3 pos);
    3132
Note: See TracChangeset for help on using the changeset viewer.