Struct agb::display::tiled::VRamManager
source · pub struct VRamManager { /* private fields */ }
Implementations§
source§impl VRamManager
impl VRamManager
sourcepub fn new_dynamic_tile<'a>(&mut self) -> DynamicTile<'a>
pub fn new_dynamic_tile<'a>(&mut self) -> DynamicTile<'a>
Examples found in repository?
examples/mixer_32768.rs (line 98)
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
fn init_background(bg: &mut RegularMap, vram: &mut VRamManager) {
let background_tile = vram.new_dynamic_tile().fill_with(0);
vram.set_background_palette_raw(&[
0x0000, 0x0ff0, 0x00ff, 0xf00f, 0xf0f0, 0x0f0f, 0xaaaa, 0x5555, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
]);
for y in 0..20u16 {
for x in 0..30u16 {
bg.set_tile(
vram,
(x, y).into(),
&background_tile.tile_set(),
background_tile.tile_setting(),
);
}
}
vram.remove_dynamic_tile(background_tile);
}
More examples
examples/stereo_sound.rs (line 86)
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
fn init_background(bg: &mut RegularMap, vram: &mut VRamManager) {
let background_tile = vram.new_dynamic_tile().fill_with(0);
vram.set_background_palette_raw(&[
0x0000, 0x0ff0, 0x00ff, 0xf00f, 0xf0f0, 0x0f0f, 0xaaaa, 0x5555, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
]);
for y in 0..20u16 {
for x in 0..30u16 {
bg.set_tile(
vram,
(x, y).into(),
&background_tile.tile_set(),
background_tile.tile_setting(),
);
}
}
vram.remove_dynamic_tile(background_tile);
}
sourcepub fn remove_dynamic_tile(&mut self, dynamic_tile: DynamicTile<'_>)
pub fn remove_dynamic_tile(&mut self, dynamic_tile: DynamicTile<'_>)
Examples found in repository?
examples/mixer_32768.rs (line 116)
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
fn init_background(bg: &mut RegularMap, vram: &mut VRamManager) {
let background_tile = vram.new_dynamic_tile().fill_with(0);
vram.set_background_palette_raw(&[
0x0000, 0x0ff0, 0x00ff, 0xf00f, 0xf0f0, 0x0f0f, 0xaaaa, 0x5555, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
]);
for y in 0..20u16 {
for x in 0..30u16 {
bg.set_tile(
vram,
(x, y).into(),
&background_tile.tile_set(),
background_tile.tile_setting(),
);
}
}
vram.remove_dynamic_tile(background_tile);
}
More examples
examples/stereo_sound.rs (line 104)
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
fn init_background(bg: &mut RegularMap, vram: &mut VRamManager) {
let background_tile = vram.new_dynamic_tile().fill_with(0);
vram.set_background_palette_raw(&[
0x0000, 0x0ff0, 0x00ff, 0xf00f, 0xf0f0, 0x0f0f, 0xaaaa, 0x5555, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
]);
for y in 0..20u16 {
for x in 0..30u16 {
bg.set_tile(
vram,
(x, y).into(),
&background_tile.tile_set(),
background_tile.tile_setting(),
);
}
}
vram.remove_dynamic_tile(background_tile);
}
pub fn replace_tile( &mut self, source_tile_set: &TileSet<'_>, source_tile: u16, target_tile_set: &TileSet<'_>, target_tile: u16 )
sourcepub fn set_background_palette_raw(&mut self, palette: &[u16])
pub fn set_background_palette_raw(&mut self, palette: &[u16])
Copies raw palettes to the background palette without any checks.
Examples found in repository?
examples/mixer_32768.rs (lines 100-103)
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
fn init_background(bg: &mut RegularMap, vram: &mut VRamManager) {
let background_tile = vram.new_dynamic_tile().fill_with(0);
vram.set_background_palette_raw(&[
0x0000, 0x0ff0, 0x00ff, 0xf00f, 0xf0f0, 0x0f0f, 0xaaaa, 0x5555, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
]);
for y in 0..20u16 {
for x in 0..30u16 {
bg.set_tile(
vram,
(x, y).into(),
&background_tile.tile_set(),
background_tile.tile_setting(),
);
}
}
vram.remove_dynamic_tile(background_tile);
}
More examples
examples/stereo_sound.rs (lines 88-91)
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
fn init_background(bg: &mut RegularMap, vram: &mut VRamManager) {
let background_tile = vram.new_dynamic_tile().fill_with(0);
vram.set_background_palette_raw(&[
0x0000, 0x0ff0, 0x00ff, 0xf00f, 0xf0f0, 0x0f0f, 0xaaaa, 0x5555, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
]);
for y in 0..20u16 {
for x in 0..30u16 {
bg.set_tile(
vram,
(x, y).into(),
&background_tile.tile_set(),
background_tile.tile_setting(),
);
}
}
vram.remove_dynamic_tile(background_tile);
}
sourcepub fn set_background_palettes(&mut self, palettes: &[Palette16])
pub fn set_background_palettes(&mut self, palettes: &[Palette16])
Copies palettes to the background palettes without any checks.