Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static int tile_offs_x = 0;
- static int tile_offs_y = 0;
- void sdDrawTiles(int layer, int row_begin, int row_end) {
- const int tile_stride = TILE_SIZE * TILE_SIZE;
- if (row_end == 0) {
- row_end = image_height;
- }
- int* tile_map = sdGetTileIndices(layer);
- const int COLS = tiled_width;
- const int ROWS = tiled_height;
- for (int y = row_begin; y < row_end; ++y) {
- for (int x = 0; x < image_width; ++x) {
- int tilex = ((x + tile_offs_x) & 0b111);
- int tiley = ((y + tile_offs_y) & 0b111);
- int cellx = ((x + tile_offs_x) >> 3) & 0b111111;
- int celly = ((y + tile_offs_y) >> 3) & 0b111111;
- int cellid = cellx + celly * tiled_width;
- int index = tile_map[cellid];
- uint32_t* psrc = &tile_data[index * tile_stride];
- uint32_t src = psrc[tilex + tiley * TILE_SIZE];
- uint32_t* dst = &backbuffer[x + y * image_width];
- (src & 0xFF000000) ? *dst = src : 0;
- //*dst = color32Mix(*dst, src);
- //backbuffer[x + y * client_width] = src;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement