Changeset 227


Ignore:
Timestamp:
Jan 18, 2011, 5:58:13 PM (10 years ago)
Author:
sam
Message:

Spawn several pieces in Monsterz now that we can.

Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/deushax/deushax.cpp

    r221 r227  
    6262    /* Register an input driver and some debug stuff */
    6363    new SdlInput();
    64     new DebugFps();
     64    new DebugFps(10, 10);
    6565    new DebugSprite(game);
    6666    new DebugSphere();
  • trunk/monsterz/board.cpp

    r226 r227  
    5050        for (int i = 0; i < 8; i++)
    5151        {
    52             data->pieces[j][i] = new Piece(game);
     52            int id = (35 + i + (i ^ j + 13) * (2 * j + 711)) % 9;
     53            data->pieces[j][i] = new Piece(game, i, j, 25 + 5 * id);
    5354            Ticker::Ref(data->pieces[j][i]);
    5455        }
  • trunk/monsterz/monsterz.cpp

    r223 r227  
    6363    new SdlInput();
    6464    new Board(game);
    65     new DebugFps();
     65    new DebugFps(460, 20);
    6666
    6767    while (!Ticker::Finished())
  • trunk/monsterz/piece.cpp

    r226 r227  
    3131    Game *game;
    3232    int tiler;
    33     int x, y;
     33    int i, j, id;
    3434};
    3535
     
    3838 */
    3939
    40 Piece::Piece(Game *game)
     40Piece::Piece(Game *game, int i, int j, int id)
    4141{
    4242    data = new PieceData();
     
    4444    Ticker::Ref(game);
    4545    data->tiler = Tiler::Register(PNG_TILES, 48, 48, 1.0f);
     46    data->i = i;
     47    data->j = j;
     48    data->id = id;
    4649}
    4750
     
    5558    Entity::TickDraw(deltams);
    5659
    57     int id = 25;
     60    int id = data->id;
     61    int i = data->i;
     62    int j = data->j;
    5863    data->game->GetScene()->AddTile((data->tiler << 16) | id,
    59                                     data->x + 24, data->y + 177, 2, 0);
     64                                    i * 48 + 24, j * 48 + 177, 2, 0);
    6065}
    6166
  • trunk/monsterz/piece.h

    r226 r227  
    2020{
    2121public:
    22     Piece(Game *game);
     22    Piece(Game *game, int i, int j, int id);
    2323    virtual ~Piece();
    2424
  • trunk/src/debugfps.cpp

    r221 r227  
    2727
    2828private:
     29    int x, y;
    2930    int fontid;
    3031};
     
    3435 */
    3536
    36 DebugFps::DebugFps()
     37DebugFps::DebugFps(int x, int y)
    3738{
    3839    data = new DebugFpsData();
    3940
    4041    data->fontid = Forge::Register("gfx/font/ascii.png");
     42    data->x = x;
     43    data->y = y;
    4144
    4245    drawgroup = DRAWGROUP_HUD;
     
    5053    Font *font = Forge::GetFont(data->fontid);
    5154
     55    int x = data->x;
     56    int y = data->y;
     57
    5258    sprintf(buf, "%2.2f fps (%i)",
    5359            1e3f / Profiler::GetAvg(Profiler::STAT_TICK_FRAME),
    5460            Ticker::GetFrameNum());
    55     font->PrintBold(10, 10, buf);
     61    font->PrintBold(x, y, buf);
    5662
    5763    sprintf(buf, "Game  % 7.2f % 7.2f",
    5864            Profiler::GetAvg(Profiler::STAT_TICK_GAME),
    5965            Profiler::GetMax(Profiler::STAT_TICK_GAME));
    60     font->PrintBold(10, 34, buf);
     66    font->PrintBold(x, y + 24, buf);
    6167
    6268    sprintf(buf, "Draw  % 7.2f % 7.2f",
    6369            Profiler::GetAvg(Profiler::STAT_TICK_DRAW),
    6470            Profiler::GetMax(Profiler::STAT_TICK_DRAW));
    65     font->PrintBold(10, 50, buf);
     71    font->PrintBold(x, y + 40, buf);
    6672
    6773    sprintf(buf, "Blit  % 7.2f % 7.2f",
    6874            Profiler::GetAvg(Profiler::STAT_TICK_BLIT),
    6975            Profiler::GetMax(Profiler::STAT_TICK_BLIT));
    70     font->PrintBold(10, 66, buf);
     76    font->PrintBold(x, y + 56, buf);
    7177
    7278    sprintf(buf, "Frame % 7.2f % 7.2f",
    7379            Profiler::GetAvg(Profiler::STAT_TICK_FRAME),
    7480            Profiler::GetMax(Profiler::STAT_TICK_FRAME));
    75     font->PrintBold(10, 82, buf);
     81    font->PrintBold(x, y + 72, buf);
    7682}
    7783
  • trunk/src/debugfps.h

    r221 r227  
    2424{
    2525public:
    26     DebugFps();
     26    DebugFps(int x, int y);
    2727    virtual ~DebugFps();
    2828
  • trunk/win32/monsterz.vcxproj

    r224 r227  
    1414    <ClInclude Include="..\monsterz\board.h" />
    1515    <ClInclude Include="..\monsterz\game.h" />
     16    <ClInclude Include="..\monsterz\piece.h" />
    1617    <ClInclude Include="..\src\bitfield.h" />
    1718    <ClInclude Include="..\src\core.h" />
     
    4243    <ClCompile Include="..\monsterz\game.cpp" />
    4344    <ClCompile Include="..\monsterz\monsterz.cpp" />
     45    <ClCompile Include="..\monsterz\piece.cpp" />
    4446    <ClCompile Include="..\src\debugfps.cpp" />
    4547    <ClCompile Include="..\src\debugrecord.cpp" />
Note: See TracChangeset for help on using the changeset viewer.