Changeset 340


Ignore:
Timestamp:
Feb 3, 2011, 2:28:47 AM (10 years ago)
Author:
sam
Message:

Add a Thumbs class to display the sidebar thumbnail icons.

Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/monsterz/Makefile.am

    r339 r340  
    44monsterz_SOURCES = \
    55    monsterz.cpp monsterz.h title.cpp title.h interface.cpp interface.h \
    6     fusion.cpp fusion.h board.cpp board.h piece.cpp piece.h mash.cpp mash.h
     6    fusion.cpp fusion.h board.cpp board.h piece.cpp piece.h mash.cpp mash.h \
     7    thumbs.cpp thumbs.h
    78monsterz_CXXFLAGS = @LOL_CFLAGS@ @PIPI_CFLAGS@
    89monsterz_LDADD = $(top_builddir)/src/liblol.a
  • trunk/monsterz/board.cpp

    r331 r340  
    2121#include "board.h"
    2222#include "piece.h"
     23#include "thumbs.h"
    2324#include "mash.h"
    2425#include "monsterz.h"
     
    3536    int2 dim;
    3637    int npieces;
    37     int board, tiles, icons;
     38    int board, tiles;
    3839    int click, whip;
    3940
     
    4647    int nmoves;
    4748
    48     Text *counticons[MAX_PIECES];
    49     int counts[MAX_PIECES];
    50 
    5149    Text *scoretext;
    5250    int score;
     
    5452    Mash *mashes;
    5553    Emitter *emitter;
     54    Thumbs *thumbs;
    5655    int2 src_cell, dst_cell;
    5756
     
    8079    data->board = Tiler::Register(PNG_BOARD, 384, 384, 1.0f);
    8180    data->tiles = Tiler::Register(PNG_TILES, 48, 48, 1.0f);
    82     data->icons = Tiler::Register(PNG_ICONS, 24, 24, 1.0f);
    8381    data->click = Sampler::Register(WAV_CLICK);
    8482    data->whip = Sampler::Register(WAV_WHIP);
     
    9492    data->state = BoardData::IDLE;
    9593
    96     for (int n = 0; n < MAX_PIECES; n++)
    97     {
    98         data->counts[n] = 0;
    99         data->counticons[n] = new Text(NULL, "monsterz/gfx/font1.png");
    100         Ticker::Ref(data->counticons[n]);
    101         int3 p = int3(476, 383 - 28 * n, 1);
    102         data->counticons[n]->SetPos(p);
    103     }
     94    data->thumbs = new Thumbs(MAX_PIECES);
     95    Ticker::Ref(data->thumbs);
    10496
    10597    data->scoretext = new Text(NULL, "monsterz/gfx/font2.png");
     
    145137    }
    146138
    147     /* Update statistics and score */
     139    /* Update score */
    148140    data->scoretext->SetInt(data->score);
    149     for (int n = 0; n < MAX_PIECES; n++)
    150         data->counticons[n]->SetInt(data->counts[n]);
    151141
    152142    switch (data->state)
     
    225215    Scene::GetDefault()->AddTile((data->board << 16) | 0,
    226216                                 position.x, position.y, 1, 0);
    227 
    228     /* Mini monsterz */
    229     for (int n = 0; n < MAX_PIECES; n++)
    230     {
    231         int2 p = int2(444, 380 - 28 * n);
    232         Scene::GetDefault()->AddTile((data->icons << 16) | n, p.x, p.y, 11, 0);
    233     }
    234217}
    235218
     
    334317            /* The mash becomes the new owner of the disappearing piece */
    335318            mash->AddPiece(data->pairs[i][j].piece);
    336             data->counts[data->pairs[i][j].id - 1]++;
     319            data->thumbs->AddCount(data->pairs[i][j].id - 1, 1);
    337320
    338321#if 0 // Test for piece creation
     
    529512            Ticker::Unref(data->pairs[i][j].piece);
    530513        }
    531     for (int n = 0; n < MAX_PIECES; n++)
    532         Ticker::Unref(data->counticons[n]);
     514    Ticker::Unref(data->thumbs);
    533515    Ticker::Unref(data->scoretext);
    534516    while (data->mashes)
     
    543525    Tiler::Deregister(data->board);
    544526    Tiler::Deregister(data->tiles);
    545     Tiler::Deregister(data->icons);
    546527    Sampler::Deregister(data->click);
    547528    Sampler::Deregister(data->whip);
  • trunk/win32/monsterz.vcxproj

    r339 r340  
    1818    <ClInclude Include="..\monsterz\monsterz.h" />
    1919    <ClInclude Include="..\monsterz\piece.h" />
     20    <ClInclude Include="..\monsterz\thumbs.h" />
    2021    <ClInclude Include="..\monsterz\title.h" />
    2122    <ClInclude Include="..\src\audio.h" />
     
    5758    <ClCompile Include="..\monsterz\monsterz.cpp" />
    5859    <ClCompile Include="..\monsterz\piece.cpp" />
     60    <ClCompile Include="..\monsterz\thumbs.cpp" />
    5961    <ClCompile Include="..\monsterz\title.cpp" />
    6062    <ClCompile Include="..\src\audio.cpp" />
  • trunk/win32/monsterz.vcxproj.filters

    r339 r340  
    9292    <ClInclude Include="..\monsterz\interface.h" />
    9393    <ClInclude Include="..\monsterz\piece.h" />
     94    <ClInclude Include="..\monsterz\thumbs.h" />
    9495    <ClInclude Include="..\monsterz\title.h" />
    9596    <ClInclude Include="..\src\sampler.h">
     
    180181    <ClCompile Include="..\monsterz\monsterz.cpp" />
    181182    <ClCompile Include="..\monsterz\piece.cpp" />
     183    <ClCompile Include="..\monsterz\thumbs.cpp" />
    182184    <ClCompile Include="..\monsterz\title.cpp" />
    183185    <ClCompile Include="..\src\sampler.cpp">
Note: See TracChangeset for help on using the changeset viewer.