mirror of
https://github.com/italicsjenga/agb.git
synced 2025-01-11 09:31:34 +11:00
Fix all the examples
This commit is contained in:
parent
4f2eddb367
commit
fae71bfbca
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
use agb::{
|
use agb::{
|
||||||
display::{
|
display::{
|
||||||
tiled::{TileFormat, TileSet, TileSetting},
|
tiled::{RegularBackgroundSize, TileFormat, TileSet, TileSetting},
|
||||||
Priority,
|
Priority,
|
||||||
},
|
},
|
||||||
include_gfx,
|
include_gfx,
|
||||||
|
@ -20,7 +20,7 @@ fn main(mut gba: agb::Gba) -> ! {
|
||||||
|
|
||||||
vram.set_background_palettes(water_tiles::water_tiles.palettes);
|
vram.set_background_palettes(water_tiles::water_tiles.palettes);
|
||||||
|
|
||||||
let mut bg = gfx.background(Priority::P0);
|
let mut bg = gfx.background(Priority::P0, RegularBackgroundSize::Background32x32);
|
||||||
|
|
||||||
for y in 0..20u16 {
|
for y in 0..20u16 {
|
||||||
for x in 0..30u16 {
|
for x in 0..30u16 {
|
||||||
|
|
|
@ -6,6 +6,7 @@ use agb::{
|
||||||
display::{
|
display::{
|
||||||
object::{Object, ObjectController, Size, Sprite},
|
object::{Object, ObjectController, Size, Sprite},
|
||||||
palette16::Palette16,
|
palette16::Palette16,
|
||||||
|
tiled::RegularBackgroundSize,
|
||||||
HEIGHT, WIDTH,
|
HEIGHT, WIDTH,
|
||||||
},
|
},
|
||||||
input::Button,
|
input::Button,
|
||||||
|
@ -54,7 +55,10 @@ fn main(mut gba: agb::Gba) -> ! {
|
||||||
vram.set_background_palette_raw(&MAP_PALETTE);
|
vram.set_background_palette_raw(&MAP_PALETTE);
|
||||||
let tileset = TileSet::new(&MAP_TILES, TileFormat::FourBpp);
|
let tileset = TileSet::new(&MAP_TILES, TileFormat::FourBpp);
|
||||||
|
|
||||||
let mut background = gfx.background(agb::display::Priority::P0);
|
let mut background = gfx.background(
|
||||||
|
agb::display::Priority::P0,
|
||||||
|
RegularBackgroundSize::Background32x32,
|
||||||
|
);
|
||||||
|
|
||||||
for (i, &tile) in MAP_MAP.iter().enumerate() {
|
for (i, &tile) in MAP_MAP.iter().enumerate() {
|
||||||
let i = i as u16;
|
let i = i as u16;
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
#![no_std]
|
#![no_std]
|
||||||
#![no_main]
|
#![no_main]
|
||||||
|
|
||||||
use agb::display::{palette16::Palette16, tiled::TileSetting, Priority};
|
use agb::display::{
|
||||||
|
palette16::Palette16,
|
||||||
|
tiled::{RegularBackgroundSize, TileSetting},
|
||||||
|
Priority,
|
||||||
|
};
|
||||||
|
|
||||||
#[agb::entry]
|
#[agb::entry]
|
||||||
fn main(mut gba: agb::Gba) -> ! {
|
fn main(mut gba: agb::Gba) -> ! {
|
||||||
|
@ -13,7 +17,7 @@ fn main(mut gba: agb::Gba) -> ! {
|
||||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||||
])]);
|
])]);
|
||||||
|
|
||||||
let mut bg = gfx.background(Priority::P0);
|
let mut bg = gfx.background(Priority::P0, RegularBackgroundSize::Background32x32);
|
||||||
|
|
||||||
for y in 0..20u32 {
|
for y in 0..20u32 {
|
||||||
for x in 0..30u32 {
|
for x in 0..30u32 {
|
||||||
|
|
|
@ -1,13 +1,16 @@
|
||||||
#![no_std]
|
#![no_std]
|
||||||
#![no_main]
|
#![no_main]
|
||||||
|
|
||||||
use agb::display::example_logo;
|
use agb::display::{example_logo, tiled::RegularBackgroundSize};
|
||||||
|
|
||||||
#[agb::entry]
|
#[agb::entry]
|
||||||
fn main(mut gba: agb::Gba) -> ! {
|
fn main(mut gba: agb::Gba) -> ! {
|
||||||
let (gfx, mut vram) = gba.display.video.tiled0();
|
let (gfx, mut vram) = gba.display.video.tiled0();
|
||||||
|
|
||||||
let mut map = gfx.background(agb::display::Priority::P0);
|
let mut map = gfx.background(
|
||||||
|
agb::display::Priority::P0,
|
||||||
|
RegularBackgroundSize::Background32x32,
|
||||||
|
);
|
||||||
|
|
||||||
example_logo::display_logo(&mut map, &mut vram);
|
example_logo::display_logo(&mut map, &mut vram);
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,10 @@
|
||||||
#![no_main]
|
#![no_main]
|
||||||
|
|
||||||
use agb::{
|
use agb::{
|
||||||
display::{tiled::TileSetting, Font, Priority},
|
display::{
|
||||||
|
tiled::{RegularBackgroundSize, TileSetting},
|
||||||
|
Font, Priority,
|
||||||
|
},
|
||||||
include_font,
|
include_font,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -22,7 +25,7 @@ fn main(mut gba: agb::Gba) -> ! {
|
||||||
|
|
||||||
let background_tile = vram.new_dynamic_tile().fill_with(0);
|
let background_tile = vram.new_dynamic_tile().fill_with(0);
|
||||||
|
|
||||||
let mut bg = gfx.background(Priority::P0);
|
let mut bg = gfx.background(Priority::P0, RegularBackgroundSize::Background32x32);
|
||||||
|
|
||||||
for y in 0..20u16 {
|
for y in 0..20u16 {
|
||||||
for x in 0..30u16 {
|
for x in 0..30u16 {
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
use core::cell::RefCell;
|
use core::cell::RefCell;
|
||||||
|
|
||||||
use agb::{
|
use agb::{
|
||||||
display::example_logo,
|
display::{example_logo, tiled::RegularBackgroundSize},
|
||||||
fixnum::FixedNum,
|
fixnum::FixedNum,
|
||||||
interrupt::{free, Interrupt},
|
interrupt::{free, Interrupt},
|
||||||
};
|
};
|
||||||
|
@ -19,7 +19,10 @@ struct BackCosines {
|
||||||
fn main(mut gba: agb::Gba) -> ! {
|
fn main(mut gba: agb::Gba) -> ! {
|
||||||
let (gfx, mut vram) = gba.display.video.tiled0();
|
let (gfx, mut vram) = gba.display.video.tiled0();
|
||||||
|
|
||||||
let mut background = gfx.background(agb::display::Priority::P0);
|
let mut background = gfx.background(
|
||||||
|
agb::display::Priority::P0,
|
||||||
|
RegularBackgroundSize::Background32x32,
|
||||||
|
);
|
||||||
|
|
||||||
example_logo::display_logo(&mut background, &mut vram);
|
example_logo::display_logo(&mut background, &mut vram);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue