Changeset 637


Ignore:
Timestamp:
Feb 12, 2011, 12:01:20 AM (11 years ago)
Author:
sam
Message:

Allow to query for a tileset's size and/or number of tiles.

Location:
trunk/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/tiler.cpp

    r633 r637  
    6868}
    6969
     70int2 Tiler::GetSize(int id)
     71{
     72    TileSet *tileset = (TileSet *)data->tilesets.GetEntity(id - 1);
     73#if !FINAL_RELEASE
     74    if (!tileset)
     75    {
     76        fprintf(stderr, "ERROR: getting size for null tiler #%i\n", id);
     77        return 0;
     78    }
     79#endif
     80    return tileset->GetSize();
     81}
     82
     83int2 Tiler::GetCount(int id)
     84{
     85    TileSet *tileset = (TileSet *)data->tilesets.GetEntity(id - 1);
     86#if !FINAL_RELEASE
     87    if (!tileset)
     88    {
     89        fprintf(stderr, "ERROR: getting count for null tiler #%i\n", id);
     90        return 0;
     91    }
     92#endif
     93    return tileset->GetCount();
     94}
     95
    7096void Tiler::BlitTile(uint32_t code, int x, int y, int z, int o)
    7197{
  • trunk/src/tiler.h

    r633 r637  
    2626    static void Deregister(int id);
    2727
     28    static int2 GetSize(int id);
     29    static int2 GetCount(int id);
    2830    static void BlitTile(uint32_t code, int x, int y, int z, int o);
    2931};
  • trunk/src/tileset.cpp

    r633 r637  
    158158}
    159159
     160int2 TileSet::GetSize() const
     161{
     162    return data->size;
     163}
     164
     165int2 TileSet::GetCount() const
     166{
     167    return data->count;
     168}
     169
    160170void TileSet::BlitTile(uint32_t id, int x, int y, int z, int o)
    161171{
  • trunk/src/tileset.h

    r633 r637  
    3939public:
    4040    /* New methods */
     41    int2 GetSize() const;
     42    int2 GetCount() const;
    4143    void BlitTile(uint32_t id, int x, int y, int z, int o);
    4244
Note: See TracChangeset for help on using the changeset viewer.