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

Core related functions.

Functions

void init()
This function must be called before using Butano, and it must be called only once.
void init(const optional<color>& transparent_color)
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.
void init(const optional<color>& transparent_color, 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 Butano 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().
void hard_reset()
Resets the GBA, going back to the start of main() after showing the BIOS intro.
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 last_missed_frames() -> int
Returns the number of screen refreshes that were missed in the last core::update call.
auto vblank_callback() -> vblank_callback_type
Returns the user function called in V-Blank.
void set_vblank_callback(vblank_callback_type vblank_callback)
Sets the user function called in V-Blank.
auto slow_game_pak() -> bool
Indicates if a slow game pak like the SuperCard SD has been detected or not.
auto system_font() -> const system_font&
Returns the font used to show assert and profiling messages.
void set_system_font(const bn::system_font& font)
Sets the font used to show assert and profiling messages.
auto assert_tag() -> const string_view&
Returns the tag displayed in assert messages.
void set_assert_tag(const string_view& assert_tag)
Sets the tag displayed in assert messages.
void log_stacktrace()
Logs the current stack trace.

Function documentation

void bn::core::init(const optional<color>& transparent_color)

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

Parameters
transparent_color Initial transparent color of the backgrounds.

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.

void bn::core::init(const optional<color>& transparent_color, const string_view& keypad_commands)

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

Parameters
transparent_color Initial transparent color of the backgrounds.
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.

void bn::core::hard_reset()

Resets the GBA, going back to the start of main() after showing the BIOS intro.

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 should have 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 should have been missed.

If you only want to retrieve the number of missed screen refreshes, core::last_missed_frames is more accurate.

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.

void bn::core::log_stacktrace()

Logs the current stack trace.

The stack trace is mangled, you can demangle it with demangler.com for example.