Skip to main content

MaaCustomControllerCallbacks

Struct MaaCustomControllerCallbacks 

Source
#[repr(C)]
pub struct MaaCustomControllerCallbacks {
Show 17 fields pub connect: Option<unsafe extern "C" fn(trans_arg: *mut c_void) -> MaaBool>, pub connected: Option<unsafe extern "C" fn(trans_arg: *mut c_void) -> MaaBool>, pub request_uuid: Option<unsafe extern "C" fn(trans_arg: *mut c_void, buffer: *mut MaaStringBuffer) -> MaaBool>, pub get_features: Option<unsafe extern "C" fn(trans_arg: *mut c_void) -> MaaControllerFeature>, pub start_app: Option<unsafe extern "C" fn(intent: *const c_char, trans_arg: *mut c_void) -> MaaBool>, pub stop_app: Option<unsafe extern "C" fn(intent: *const c_char, trans_arg: *mut c_void) -> MaaBool>, pub screencap: Option<unsafe extern "C" fn(trans_arg: *mut c_void, buffer: *mut MaaImageBuffer) -> MaaBool>, pub click: Option<unsafe extern "C" fn(x: i32, y: i32, trans_arg: *mut c_void) -> MaaBool>, pub swipe: Option<unsafe extern "C" fn(x1: i32, y1: i32, x2: i32, y2: i32, duration: i32, trans_arg: *mut c_void) -> MaaBool>, pub touch_down: Option<unsafe extern "C" fn(contact: i32, x: i32, y: i32, pressure: i32, trans_arg: *mut c_void) -> MaaBool>, pub touch_move: Option<unsafe extern "C" fn(contact: i32, x: i32, y: i32, pressure: i32, trans_arg: *mut c_void) -> MaaBool>, pub touch_up: Option<unsafe extern "C" fn(contact: i32, trans_arg: *mut c_void) -> MaaBool>, pub click_key: Option<unsafe extern "C" fn(keycode: i32, trans_arg: *mut c_void) -> MaaBool>, pub input_text: Option<unsafe extern "C" fn(text: *const c_char, trans_arg: *mut c_void) -> MaaBool>, pub key_down: Option<unsafe extern "C" fn(keycode: i32, trans_arg: *mut c_void) -> MaaBool>, pub key_up: Option<unsafe extern "C" fn(keycode: i32, trans_arg: *mut c_void) -> MaaBool>, pub scroll: Option<unsafe extern "C" fn(dx: i32, dy: i32, trans_arg: *mut c_void) -> MaaBool>,
}
Expand description

@brief The custom controller API.

To create a custom controller, you need to implement this API.

You do not have to implement all the functions in this API. Instead, just implement the functions you need. Do note that if an unimplemented function is called, the framework will likely crash.

Fields§

§connect: Option<unsafe extern "C" fn(trans_arg: *mut c_void) -> MaaBool>§connected: Option<unsafe extern "C" fn(trans_arg: *mut c_void) -> MaaBool>§request_uuid: Option<unsafe extern "C" fn(trans_arg: *mut c_void, buffer: *mut MaaStringBuffer) -> MaaBool>

Write result to buffer.

§get_features: Option<unsafe extern "C" fn(trans_arg: *mut c_void) -> MaaControllerFeature>§start_app: Option<unsafe extern "C" fn(intent: *const c_char, trans_arg: *mut c_void) -> MaaBool>§stop_app: Option<unsafe extern "C" fn(intent: *const c_char, trans_arg: *mut c_void) -> MaaBool>§screencap: Option<unsafe extern "C" fn(trans_arg: *mut c_void, buffer: *mut MaaImageBuffer) -> MaaBool>

Write result to buffer.

§click: Option<unsafe extern "C" fn(x: i32, y: i32, trans_arg: *mut c_void) -> MaaBool>§swipe: Option<unsafe extern "C" fn(x1: i32, y1: i32, x2: i32, y2: i32, duration: i32, trans_arg: *mut c_void) -> MaaBool>§touch_down: Option<unsafe extern "C" fn(contact: i32, x: i32, y: i32, pressure: i32, trans_arg: *mut c_void) -> MaaBool>§touch_move: Option<unsafe extern "C" fn(contact: i32, x: i32, y: i32, pressure: i32, trans_arg: *mut c_void) -> MaaBool>§touch_up: Option<unsafe extern "C" fn(contact: i32, trans_arg: *mut c_void) -> MaaBool>§click_key: Option<unsafe extern "C" fn(keycode: i32, trans_arg: *mut c_void) -> MaaBool>§input_text: Option<unsafe extern "C" fn(text: *const c_char, trans_arg: *mut c_void) -> MaaBool>§key_down: Option<unsafe extern "C" fn(keycode: i32, trans_arg: *mut c_void) -> MaaBool>§key_up: Option<unsafe extern "C" fn(keycode: i32, trans_arg: *mut c_void) -> MaaBool>§scroll: Option<unsafe extern "C" fn(dx: i32, dy: i32, trans_arg: *mut c_void) -> MaaBool>

Trait Implementations§

Source§

impl Clone for MaaCustomControllerCallbacks

Source§

fn clone(&self) -> MaaCustomControllerCallbacks

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for MaaCustomControllerCallbacks

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Copy for MaaCustomControllerCallbacks

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.