pub fn draw_tile_mixed(&self,  frame: &mut [u8], pos: &(usize, usize), map: &TileMap, stride: usize, grid_pos: &(usize, usize), color: [u8; 4], scale: f32) {
        let pixels = &map.pixels;

        let new_size = ((map.settings.grid_size as f32 * scale) as usize, (map.settings.grid_size as f32 * scale) as usize);

        let g_pos = (grid_pos.0 * map.settings.grid_size, grid_pos.1 * map.settings.grid_size);

        for sy in 0..new_size.0 {
            let y = (sy as f32 / scale) as usize;
            for sx in 0..new_size.1 {

                let x = (sx as f32 / scale) as usize;

                let d = pos.0 * 4 + sx * 4 + (sy + pos.1) * stride * 4;
                let s = (x + g_pos.0) * 4 + (y + g_pos.1) * map.width * 4;

                let mixed_color = self.mix_color(&[pixels[s], pixels[s+1], pixels[s+2], pixels[s+3]], &color, 0.5);

                frame[d..d + 4].copy_from_slice(&mixed_color);
            }
        }
    }
/// Draws a tile mixed with a given color
Draws a tile mixed with a given color
Draws a tile mixed with a given color
pub fn draw_tile_mixed(&self,  frame: &mut [u8], pos: &(usize, usize), map: &TileMap, stride: usize, grid_pos: &(usize, usize), color: [u8; 4], scale: f32) {
        let pixels = &map.pixels;
        let new_size = ((map.settings.grid_size as f32 * scale) as usize, (map.settings.grid_size as f32 * scale) as usize);
        let g_pos = (grid_pos.0 * map.settings.grid_size, grid_pos.1 * map.settings.grid_size);
        for sy in 0..new_size.0 {
            let y = (sy as f32 / scale) as usize;
            for sx in 0..new_size.1 {
                let x = (sx as f32 / scale) as usize;
                let d = pos.0 * 4 + sx * 4 + (sy + pos.1) * stride * 4;
                let s = (x + g_pos.0) * 4 + (y + g_pos.1) * map.width * 4;
                let mixed_color = self.mix_color(&[pixels[s], pixels[s+1], pixels[s+2], pixels[s+3]], &color, 0.5);
                frame[d..d + 4].copy_from_slice(&mixed_color);
            }
        }
    }
pub fn draw_tile_mixed ( & self , frame : & mut [ u8 ] , pos : & ( usize , usize ) , map : & TileMap , stride : usize , grid_pos : & ( usize , usize ) , color : [ u8 ; 4 ] , scale : f32 ) { let pixels = & map . pixels ; let new_size = ( ( map . settings . grid_size as f32 * scale ) as usize , ( map . settings . grid_size as f32 * scale ) as usize ) ; let g_pos = ( grid_pos . 0 * map . settings . grid_size , grid_pos . 1 * map . settings . grid_size ) ; for sy in 0 .. new_size . 0 { let y = ( sy as f32 / scale ) as usize ; for sx in 0 .. new_size . 1 { let x = ( sx as f32 / scale ) as usize ; let d = pos . 0 * 4 + sx * 4 + ( sy + pos . 1 ) * stride * 4 ; let s = ( x + g_pos . 0 ) * 4 + ( y + g_pos . 1 ) * map . width * 4 ; let mixed_color = self . mix_color ( & [ pixels [ s ] , pixels [ s + 1 ] , pixels [ s + 2 ] , pixels [ s + 3 ] ] , & color , 0.5 ) ; frame [ d .. d + 4 ] . copy_from_slice ( & mixed_color ) ; } } }
Draws a tile mixed with a given color
Draws a tile mixed with a given color
&self
frame
&mut [u8]
pos
&(usize, usize)
map
&TileMap
stride
usize
grid_pos
&(usize, usize)
color
[u8; 4]
scale
f32
&self
frame
&mut [u8]
pos
&(usize, usize)
map
&TileMap
stride
usize
grid_pos
&(usize, usize)
color
[u8; 4]
scale
f32