Changeset 1198 for trunk/monsterz


Ignore:
Timestamp:
Apr 7, 2012, 11:55:29 PM (8 years ago)
Author:
sam
Message:

core: allow each blitted tile to be stretched differently.

Location:
trunk/monsterz
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/monsterz/board.cpp

    r1184 r1198  
    22// Monsterz
    33//
    4 // Copyright: (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
     4// Copyright: (c) 2005-2012 Sam Hocevar <sam@hocevar.net>
    55//   This program is free software; you can redistribute it and/or
    66//   modify it under the terms of the Do What The Fuck You Want To
     
    102102    data->npieces = minnpieces;
    103103    data->maxnpieces = maxnpieces;
    104     data->screen = Tiler::Register(PNG_BACKGROUND, ivec2(640, 480), ivec2(0), vec2(1.0f));
    105     data->board = Tiler::Register(PNG_BOARD, ivec2(384), ivec2(0), vec2(1.0f));
    106     data->tiles = Tiler::Register(PNG_TILES, data->size, ivec2(0), vec2(1.0f));
    107     data->icons = Tiler::Register(PNG_ICONS, ivec2(24), ivec2(0), vec2(1.0f));
     104    data->screen = Tiler::Register(PNG_BACKGROUND, ivec2(640, 480), ivec2(0));
     105    data->board = Tiler::Register(PNG_BOARD, ivec2(384), ivec2(0));
     106    data->tiles = Tiler::Register(PNG_TILES, data->size, ivec2(0));
     107    data->icons = Tiler::Register(PNG_ICONS, ivec2(24), ivec2(0));
    108108    data->click = Sampler::Register(WAV_CLICK);
    109109    data->whip = Sampler::Register(WAV_WHIP);
     
    254254    Entity::TickDraw(deltams);
    255255
    256     Scene::GetDefault()->AddTile(data->board, 0, position, 0);
    257     Scene::GetDefault()->AddTile(data->screen, 0, ivec3(0, 0, 10), 0);
     256    Scene::GetDefault()->AddTile(data->board, 0, position, 0, vec2(1.0f));
     257    Scene::GetDefault()->AddTile(data->screen, 0, ivec3(0, 0, 10), 0, vec2(1.0f));
    258258
    259259    switch (data->game)
  • trunk/monsterz/interface.cpp

    r1184 r1198  
    22// Monsterz
    33//
    4 // Copyright: (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
     4// Copyright: (c) 2005-2012 Sam Hocevar <sam@hocevar.net>
    55//   This program is free software; you can redistribute it and/or
    66//   modify it under the terms of the Do What The Fuck You Want To
     
    5757    data->title = NULL;
    5858    data->board = NULL;
    59     data->tiles = Tiler::Register(PNG_TILES, ivec2(48), ivec2(0), vec2(1.0f));
     59    data->tiles = Tiler::Register(PNG_TILES, ivec2(48), ivec2(0));
    6060    data->state = InterfaceData::INIT;
    6161
     
    100100    {
    101101        mouse += ivec3(-6, 6 - 48, 30);
    102         Scene::GetDefault()->AddTile(data->tiles, 22, mouse, 0);
     102        Scene::GetDefault()->AddTile(data->tiles, 22, mouse, 0, vec2(1.0f));
    103103    }
    104104}
  • trunk/monsterz/piece.cpp

    r1184 r1198  
    22// Monsterz
    33//
    4 // Copyright: (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
     4// Copyright: (c) 2005-2012 Sam Hocevar <sam@hocevar.net>
    55//   This program is free software; you can redistribute it and/or
    66//   modify it under the terms of the Do What The Fuck You Want To
     
    9494    case PIECE_HUNT:
    9595        data->size = ivec2(48);
    96         data->tileset = Tiler::Register(PNG_TILES, data->size, ivec2(0), vec2(1.0f));
     96        data->tileset = Tiler::Register(PNG_TILES, data->size, ivec2(0));
    9797        data->pieceid = 80 + 20 * pieceid;
    9898        break;
     
    383383
    384384    if (data->state != PieceData::DEAD)
    385         Scene::GetDefault()->AddTile(data->tileset, pieceid, ivec3(x, y, z), 0);
     385        Scene::GetDefault()->AddTile(data->tileset, pieceid, ivec3(x, y, z), 0, vec2(1.0f));
    386386
    387387    if (data->state == PieceData::GRAB && Platform::GetMouseCount())
    388         Scene::GetDefault()->AddTile(data->tileset, 0, ivec3(x, y, 9), 0);
     388        Scene::GetDefault()->AddTile(data->tileset, 0, ivec3(x, y, 9), 0, vec2(1.0f));
    389389}
    390390
  • trunk/monsterz/thumbs.cpp

    r1184 r1198  
    22// Monsterz
    33//
    4 // Copyright: (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
     4// Copyright: (c) 2005-2012 Sam Hocevar <sam@hocevar.net>
    55//   This program is free software; you can redistribute it and/or
    66//   modify it under the terms of the Do What The Fuck You Want To
     
    4747  : data(new ThumbsData())
    4848{
    49     data->icons = Tiler::Register(PNG_ICONS, ivec2(24), ivec2(0), vec2(1.0f));
     49    data->icons = Tiler::Register(PNG_ICONS, ivec2(24), ivec2(0));
    5050
    5151    data->npieces = 0;
     
    7474    {
    7575        ivec3 p = ivec3(459, 372 - 27 * n, 11);
    76         Scene::GetDefault()->AddTile(data->icons, n, p, 0);
     76        Scene::GetDefault()->AddTile(data->icons, n, p, 0, vec2(1.0f));
    7777    }
    7878}
  • trunk/monsterz/title.cpp

    r1189 r1198  
    142142    srand(rand() ^ time(NULL));
    143143
    144     data->logo = Tiler::Register(PNG_TITLE_LOGO, ivec2(380, 181), ivec2(0), vec2(1.0f));
     144    data->logo = Tiler::Register(PNG_TITLE_LOGO, ivec2(380, 181), ivec2(0));
    145145    data->logo_sprite = new Sprite(data->logo, 0);
    146146    data->logo_sprite->position = vec3(640 / 2 - 380 / 2, 250, 10);
    147147    Ticker::Ref(data->logo_sprite);
    148148
    149     data->ground = Tiler::Register(PNG_TITLE_GROUND, ivec2(384, 80), ivec2(0), vec2(1.0f));
     149    data->ground = Tiler::Register(PNG_TITLE_GROUND, ivec2(384, 80), ivec2(0));
    150150    data->ground_pos = ivec2((bbox[1] - bbox[0]).xy / vec2(2, 4))
    151151                     - ivec2(192, 80);
    152152
    153     data->rocks = Tiler::Register(PNG_TITLE_ROCKS, ivec2(640, 155), ivec2(0), vec2(1.0f));
     153    data->rocks = Tiler::Register(PNG_TITLE_ROCKS, ivec2(640, 155), ivec2(0));
    154154    data->rocks_pos = ivec2((bbox[1] - bbox[0]).xy / vec2(2, 2))
    155155                    - ivec2(320, 240);
    156156
    157     data->title = Tiler::Register(PNG_TITLE, ivec2(384), ivec2(0), vec2(1.0f));
    158     data->stars = Tiler::Register(PNG_STARS, ivec2(384, 144), ivec2(0), vec2(1.0f));
    159     data->clouds = Tiler::Register(PNG_CLOUDS, ivec2(160, 32), ivec2(0), vec2(1.0f));
    160     data->eagle.tiles = Tiler::Register(PNG_EAGLE, ivec2(16), ivec2(0), vec2(1.0f));
     157    data->title = Tiler::Register(PNG_TITLE, ivec2(384), ivec2(0));
     158    data->stars = Tiler::Register(PNG_STARS, ivec2(384, 144), ivec2(0));
     159    data->clouds = Tiler::Register(PNG_CLOUDS, ivec2(160, 32), ivec2(0));
     160    data->eagle.tiles = Tiler::Register(PNG_EAGLE, ivec2(16), ivec2(0));
    161161    for (int n = 0; n < 6; n++)
    162162        data->anim[n] = Tiler::Register(PNG_TITLEANIM[n],
    163                                         animsize[n], ivec2(0), vec2(1.0f));
     163                                        animsize[n], ivec2(0));
    164164    for (int n = 0; n < 7; n++)
    165165        data->event[n] = Tiler::Register(PNG_TITLEEVENT[n],
    166                                          eventsize[n], ivec2(0), vec2(1.0f));
     166                                         eventsize[n], ivec2(0));
    167167    data->state = TitleData::IDLE;
    168168    data->period = TitleData::DAY;
     
    312312    int backid = (int)data->period;
    313313    Scene::GetDefault()->AddTile(data->title, backid,
    314                     ivec3(data->ground_pos.x, data->ground_pos.y, 1), 0);
     314              ivec3(data->ground_pos.x, data->ground_pos.y, 1), 0, vec2(1.0f));
    315315
    316316    /* The stars */
     
    318318    {
    319319        Scene::GetDefault()->AddTile(data->stars, 0,
    320                                      ivec3(24 + 0, 72 + 240, 2), 0);
     320                                     ivec3(24 + 0, 72 + 240, 2), 0, vec2(1.0f));
    321321    }
    322322
     
    330330        Scene::GetDefault()->AddTile(data->clouds, cloudid,
    331331                                     ivec3(data->cloudpos[n].x,
    332                                            data->cloudpos[n].y, 2), 0);
     332                                           data->cloudpos[n].y, 2), 0,
     333                                     vec2(1.0f));
    333334        Scene::GetDefault()->AddTile(data->clouds, cloudid,
    334335                                     ivec3(data->cloudpos[n].x - bbox[1].x
    335336                                                               + bbox[0].x,
    336                                            data->cloudpos[n].y, 2), 0);
     337                                           data->cloudpos[n].y, 2), 0,
     338                                     vec2(1.0f));
    337339    }
    338340
     
    347349        int y = data->eagle.y + 5.0f * sinf(phase);
    348350        Scene::GetDefault()->AddTile(data->eagle.tiles, eagleid,
    349                                      ivec3(24 + x, 72 + y, 3), 0);
     351                                     ivec3(24 + x, 72 + y, 3), 0, vec2(1.0f));
    350352    }
    351353
     
    355357    {
    356358        Scene::GetDefault()->AddTile(data->ground, 0,
    357                                      ivec3(x, data->ground_pos.y, 0), 0);
     359                                     ivec3(x, data->ground_pos.y, 0), 0,
     360                                     vec2(1.0f));
    358361    }
    359362
    360363    /* The rocks */
    361364    Scene::GetDefault()->AddTile(data->rocks, 0,
    362                                  ivec3(data->rocks_pos, 10), 0);
     365                                 ivec3(data->rocks_pos, 10), 0,
     366                                 vec2(1.0f));
    363367
    364368    /* Maybe an animation? */
     
    391395        Scene::GetDefault()->AddTile(tiler, tileid,
    392396                                     ivec3(data->ground_pos.x + pos.x,
    393                                            data->ground_pos.y + pos.y, 1), 0);
     397                                           data->ground_pos.y + pos.y, 1), 0,
     398                                     vec2(1.0f));
    394399}
    395400
Note: See TracChangeset for help on using the changeset viewer.