Ignore:
Timestamp:
Mar 14, 2011, 2:40:24 AM (10 years ago)
Author:
sam
Message:

monsterz: create a Score class to display the score text and increment it
progressively.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/monsterz/board.cpp

    r737 r740  
    2424#include "board.h"
    2525#include "piece.h"
     26#include "score.h"
    2627#include "thumbs.h"
    2728#include "mash.h"
     
    6162    int next[2], rotation;
    6263
    63     Text *scoretext;
    64     int score;
     64    Score *score;
    6565
    6666    Mash *mashes;
     
    155155    data->whipdelay = 0.0f;
    156156
    157     data->scoretext = new Text(NULL, "monsterz/gfx/font2.png");
    158     data->scoretext->SetAlign(Text::ALIGN_RIGHT);
    159     data->scoretext->SetPos(vec3i(624, 432, 20));
    160     Ticker::Ref(data->scoretext);
    161     data->score = 0;
     157    data->score = new Score(0);
     158    data->score->SetPos(vec3i(624, 432, 20));
     159    Ticker::Ref(data->score);
    162160
    163161    position = vec3i(24, 72, 1);
     
    188186            it = &(*it)->nextmash;
    189187    }
    190 
    191     /* Update score */
    192     data->scoretext->SetInt(data->score);
    193188
    194189    switch (data->state)
     
    455450    }
    456451
     452    int multiplier = 20;
     453
    457454    /* Remove matching pieces and store them in Mash objects */
    458455    do
     
    516513        mash->nextmash = data->mashes;
    517514        data->mashes = mash;
     515
     516        data->score->Add(multiplier);
     517        multiplier *= 2;
    518518    }
    519519    while(ListMashes(list));
     
    818818    }
    819819    Ticker::Unref(data->thumbs);
    820     Ticker::Unref(data->scoretext);
     820    Ticker::Unref(data->score);
    821821    while (data->mashes)
    822822    {
Note: See TracChangeset for help on using the changeset viewer.