Ignore:
Timestamp:
Jan 31, 2011, 11:24:28 PM (10 years ago)
Author:
sam
Message:

Add a text object to display current score.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/monsterz/board.cpp

    r323 r324  
    4949    int counts[MAX_PIECES];
    5050
     51    Text *scoretext;
     52    int score;
     53
    5154    Mash *mashes;
    5255    Emitter *emitter;
     
    9598    {
    9699        data->counts[n] = 0;
    97         data->counticons[n] = new Text(NULL, "monsterz/gfx/font2.png");
     100        data->counticons[n] = new Text(NULL, "monsterz/gfx/font1.png");
     101        Ticker::Ref(data->counticons[n]);
    98102        int3 p = int3(476, 383 - 28 * n, 1);
    99103        data->counticons[n]->SetPos(p);
    100104    }
     105
     106    data->scoretext = new Text(NULL, "monsterz/gfx/font2.png");
     107    data->scoretext->SetPos(int3(604, 432, 1));
     108    Ticker::Ref(data->scoretext);
     109    data->score = 0;
    101110}
    102111
     
    131140    }
    132141
    133     /* Update statistics */
     142    /* Update statistics and score */
     143    char buf[128];
     144    sprintf(buf, "%i", data->score);
     145    data->scoretext->SetText(buf);
     146
    134147    for (int n = 0; n < MAX_PIECES; n++)
    135148    {
    136         char buf[128];
    137149        sprintf(buf, "%i", data->counts[n]);
    138150        data->counticons[n]->SetText(buf);
     
    530542            Ticker::Unref(data->pairs[i][j].piece);
    531543        }
     544    for (int n = 0; n < MAX_PIECES; n++)
     545        Ticker::Unref(data->counticons[n]);
     546    Ticker::Unref(data->scoretext);
    532547    while (data->mashes)
    533548    {
Note: See TracChangeset for help on using the changeset viewer.