3 releases
Uses new Rust 2024
new 0.1.2 | Apr 18, 2025 |
---|---|
0.1.1 | Apr 17, 2025 |
0.1.0 | Apr 17, 2025 |
#262 in Game dev
216 downloads per month
150KB
2K
SLoC
gba_rumble
Library for enabling rumble functionality on the Game Boy Advance.
This crate supports rumble through both the cartridge itself using general purpose I/O (GPIO) and the Game Boy Player's rumble functionality. Functionality is provided for detecting available rumble features and using them fully.
The library is designed to be usable regardless of what other GBA development libraries may be in use. It is usable with popular libraries like gba
and agb
.
Usage
There are two ways to use this library: by using a cartridge's built-in rumble through Gpio
and by using the Game Boy Player's rumble functionality through GameBoyPlayer
.
Cartridge (GPIO) Rumble
To use a cartridge's built-in rumble through general purpose I/O (GPIO), use the Gpio
struct.
let gpio = gba_rumble::Gpio;
// Activate the cartridge's rumble. This will continue until `stop()` is called.
gpio.start();
// Deactivate the cartridge's rumble.
gpio.stop();
Game Boy Player
To use the Game Boy Player's rubmle functionality, detect the Game Boy Player by calling GameBoyPlayer::detect()
at the beginning of your program.
if let Some(game_boy_player) = gba_rumble::GameBoyPlayer::detect() {
// When a Game Boy Player is detected, you can interact with it through the returned
// `GameBoyPlayer` object.
//
// To actually use it, you must also call `game_boy_player_interrupt()` when a serial
// interrupt is received. This will be specific to your own code and any frameworks you may
// be using.
// Update the serial connection once a frame.
game_boy_player.update();
// Activate rumble in the controller. This will continue until `stop()` is called.
game_boy_player.start();
// Deactivate rumble in the controller.
game_boy_player.stop();
}
License
This project is licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
Dependencies
~95KB