|
@@ -21,8 +21,8 @@ namespace
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-TILESET::Tileset(unsigned short *sheet, unsigned sheet_width, unsigned sheet_height, unsigned tile_width, unsigned tile_height)
|
|
|
|
|
- : sheet(sheet), sheet_width(sheet_width), sheet_height(sheet_height), tile_width(tile_width), tile_height(tile_height)
|
|
|
|
|
|
|
+TILESET::Tileset(unsigned short *sheet, unsigned tile_width, unsigned tile_height)
|
|
|
|
|
+ : sheet(sheet), tile_width(tile_width), tile_height(tile_height)
|
|
|
{
|
|
{
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -33,7 +33,7 @@ void TILESET::add_animation(int index, tinystl::vector<WalrusRPG::Frame> anim)
|
|
|
|
|
|
|
|
void TILESET::render_tile(unsigned int index, unsigned x, unsigned y) const
|
|
void TILESET::render_tile(unsigned int index, unsigned x, unsigned y) const
|
|
|
{
|
|
{
|
|
|
- unsigned num_tiles_x = sheet_width / tile_width;
|
|
|
|
|
|
|
+ unsigned num_tiles_x = sheet[0] / tile_width;
|
|
|
//unsigned num_tiles_y = sheet_height / tile_height;
|
|
//unsigned num_tiles_y = sheet_height / tile_height;
|
|
|
GRAPHICS::draw_sprite_sheet(sheet, x, y, UTILS::Rect(tile_width * (index % num_tiles_x), tile_height * (index / num_tiles_x), tile_width, tile_height));
|
|
GRAPHICS::draw_sprite_sheet(sheet, x, y, UTILS::Rect(tile_width * (index % num_tiles_x), tile_height * (index / num_tiles_x), tile_width, tile_height));
|
|
|
}
|
|
}
|