agb_eb_ext 0.25.1

AGB Extension methods
docs.rs failed to build agb_eb_ext-0.25.1
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: agb_eb_ext-0.25.3

AGB Extension

Collection of util methods for AGB

API

backgrounds

Item Description
create_text_bg() Blank P0 background for text
create_filled_bg(data, priority) Create a background filled via fill_with
create_full_filled_bg(data, priority) Same as create_filled_bg but does all 32x32 tiles
background_stack::<N>(layers) Create up to 4 filled backgrounds, P3 (back) → P0 (front)
full_fill(bg, tile_data) Fill an entire 32x32 background

button_highlight

ButtonHighlight — focus indicator that animates between buttons

Method Description
new(x, y) Create at pixel position
set_target(x, y) Set the pixel position to move towards
update() Step towards the target (call once per frame)
pos() Current position in pixels (Vector2D<i32>)

direction

DirectionUp / Down / Left / Right

Method Description
from_input(buttons) First pressed direction, if any
from_recent_input(buttons) First just_pressed direction, if any

gfx

Item Description
ShowSprite::show(at, frame) Draw a &'static Sprite in one call
ShowTag::show(idx, at, frame) Draw one sprite from a Tag
ShowAllTag::show_all(at, frame) Draw every sprite in a Tag in a horizontal row (left to right)
draw_bg_frame(...) Draw a bordered frame (corners/edges/fill) onto a background
draw_bg_tiles(...) Repeat a meta-tile across a background

menu_cursor

MenuCursor — grid/list cursor where every option is on screen

Method Description
new(column_count, count) Create cursor
update(buttons) Move cursor, returns CursorResult
idx() Selected index
pos() / pos_usize() / vec_pos() Selected column/row as (u8, u8), (usize, usize) or Vector2D<i32>
set_idx(idx) Set selected index (clamped)

CursorResultNoChange / Invalid / Moved

scrolling_cursor

ScrollingCursor — wraps MenuCursor for vertically scrolling menus

Method Description
new(column_count, item_count, visible_row_count) Create cursor
update(buttons) Move cursor and scroll, returns CursorResult
first_visible_row() First row to draw
idx(), pos(), pos_usize(), vec_pos(), set_idx(idx) As MenuCursor

rng

SeedGen — accumulates entropy each frame to seed a RandomNumberGenerator

Item Description
SeedGen::update(buttons) Mix input into the seed (once per frame)
SeedGen::create_rng() Build a RandomNumberGenerator from the seed
next_u16(rng) Random u16
next_u16_in(rng, min, max) Random u16 in an inclusive range
next_in(rng, max) Random between 0..max
shuffle(rng, items) Shuffle slice
random_get(rng, items) Randomly get item from slice
random_get_mut(rng, items) Randomly get mut item from slice

transitions

FadeStartStep1Step5End, with next() returning the following step (None at End), and Into<FadeAmount>

Function Description
fade_to_black(amount, bg_ids, frame) Fade out to black
fade_from_black(amount, bg_ids, frame) Fade in from black
fade_to_white(amount, bg_ids, frame) Fade out to white
fade_from_white(amount, bg_ids, frame) Fade in from white
reset_fade(bg_ids, frame) Clear any fade