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 CPU usage of the current frame.
auto current_cpu_ticks() -> int
Returns the CPU timer ticks of the current frame.
auto last_cpu_usage() -> fixed
Returns the CPU usage of the last elapsed frame.
auto last_cpu_ticks() -> int
Returns the CPU timer ticks of the last elapsed frame.
auto last_vblank_usage() -> fixed
Returns the maximum V-Blank usage of the last elapsed frame.
auto last_vblank_ticks() -> int
Returns the maximum V-Blank timer ticks 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 CPU usage of the current frame.

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

int bn::core::current_cpu_ticks()

Returns the CPU timer ticks of the current frame.

A CPU tick count greater than timers::ticks_per_frame() 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.

int bn::core::last_cpu_ticks()

Returns the CPU timer ticks of the last elapsed frame.

A CPU tick count greater than timers::ticks_per_frame() 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 maximum 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 are updated.

int bn::core::last_vblank_ticks()

Returns the maximum V-Blank timer ticks of the last elapsed frame.

A V-Blank tick count greater than timers::ticks_per_vblank() means that the screen is being redrawn before all of GBA display components are 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.