Expand description
🍏 Applet API
This API provides Applet-specific functionality such as accessing Key, Mouse and Text inputs, Window state, and more.
You can use it in combination with the World
Minimal example
The minimal boilerplate that is required to create an applet module.
struct Module {}
ark::require_applet_api!();
impl ark::applet::Applet for Module {
fn new() -> Self {
Module {}
}
fn update(&mut self) {}
}
ark_module::impl_applet!(Module);
For a more complete example see example-applet
Bite-sized examples
Handling key input events
for input in applet().input_events() {
if let EventEnum::Key(KeyInput::KeyPress(VirtualKeyCode::Space)) = input {
// Space has been pressed
}
}
Handling mouse button events
for event in applet().input_events() {
if let EventEnum::Mouse(MouseInput::ButtonPress{ button, .. }) = event {
if let MouseButton::Primary = button {
// Left mouse button has been pressed
}
}
}
Modules
Input handling for applets.
Structs
The applet api gives you access to applet specific functionality, like accessing host events.
A general axis change event, used for gamepad inputs like sticks and throttle.
Represents a key press or a text input event. Text is handled separately due to unicode, multi-key accents etc which you don’t want to simulate manually.
Represents a raw MIDI message.
Contains information about the window
Enums
Axis input event axis enumeration.
An input event, such as a key press
Describes a button of a gamepad controller.
Key event type.
Represents a key press or a text input event. Text is handled separately due to unicode, multi-key accents etc which you don’t want to simulate manually.
Mouse event type enumeration.
Represents a mouse input event.
Touch event type.
Represents a touch input event.
Symbolic name for a keyboard key
Commands for a virtual keyboard
Type Definitions
Identifiers for players, with 0 meaning local player.