7 //template<unsigned int TILE_WIDTH, unsigned int TILE_HEIGHT>
11 SDL_FreeSurface( tileset
);
14 //template<unsigned int TILE_WIDTH, unsigned int TILE_HEIGHT>
15 bool Tileset::load( const char* ftile
)
18 SDL_FreeSurface( tileset
);
20 tileset
= SDL_LoadBMP( ftile
);
24 SET_WIDTH
= tileset
->w
/ TILE_WIDTH
;
25 SET_HEIGHT
= tileset
->h
/ TILE_HEIGHT
;
33 //template<unsigned int TILE_WIDTH, unsigned int TILE_HEIGHT>
34 void Tileset::Draw( Sint16 x
, Sint16 y
, unsigned int tileID
)
39 return; //throw error?
42 tileRect
.x
= (tileID
% SET_WIDTH
) * TILE_WIDTH
;
43 tileRect
.y
= ((int)(tileID
/ SET_HEIGHT
)) * TILE_HEIGHT
;
44 tileRect
.w
= TILE_WIDTH
;
45 tileRect
.h
= TILE_HEIGHT
;
47 Game::getVideo()->Blit( tileset
, &tileRect
, x
, y
);