bn::core namespace
#include <bn_core.h>

Core related functions.

Contents

Functions

void init()
This function must be called before using Butano, and it must be called only once.
void init(const string_view& keypad_commands)
This function must be called before using Butano, and it must be called only once.
auto skip_frames() -> int
Returns the number of frames to skip.
void set_skip_frames(int skip_frames)
Sets the number of frames to skip.
void update()
Updates the screen and all of Butano's subsystems.
void sleep(keypad::key_type wake_up_key)
Sleeps the GBA until the given keypad key is pressed.
void sleep(const span<const keypad::key_type>& wake_up_keys)
Sleeps the GBA until the given keypad keys are pressed.
void reset()
Resets the GBA, going back to the start of main().
auto current_cpu_usage() -> fixed
Returns the current CPU usage.
auto last_cpu_usage() -> fixed
Returns the CPU usage of the last elapsed frame.
auto last_vblank_usage() -> fixed
Returns the V-Blank usage of the last elapsed frame.
auto slow_game_pak() -> bool
Indicates if a slow game pak like the SuperCard SD has been detected or not.

Function documentation

void bn::core::init(const string_view& keypad_commands)

This function must be called before using Butano, and it must be called only once.

Parameters
keypad_commands Keypad commands recorded with the keypad logger.

Instead of reading the keypad of the GBA, these keypad commands are replayed.

int bn::core::skip_frames()

Returns the number of frames to skip.

0 skip frames means ~60 frames per second, 1 skip frame means ~30 frames per second, and so on.

void bn::core::set_skip_frames(int skip_frames)

Sets the number of frames to skip.

0 skip frames means ~60 frames per second, 1 skip frame means ~30 frames per second, and so on.

void bn::core::reset()

Resets the GBA, going back to the start of main().

Keep in mind that it doesn't rewind the stack, so alive objects are not destroyed.

fixed bn::core::current_cpu_usage()

Returns the current CPU usage.

A CPU usage greater than 1 means that at least one screen refresh has been missed.

fixed bn::core::last_cpu_usage()

Returns the CPU usage of the last elapsed frame.

A CPU usage greater than 1 means that at least one screen refresh has been missed.

fixed bn::core::last_vblank_usage()

Returns the V-Blank usage of the last elapsed frame.

A V-Blank usage greater than 1 means that the screen is being redrawn before all of GBA display components being updated.