| 1 |
/// <reference types="backbone" /> |
| 2 |
import { CoreDOMWidgetModel } from './widget_core'; |
| 3 |
import { DOMWidgetView, unpack_models, ViewList, JupyterLuminoPanelWidget, WidgetView, Dict } from '@jupyter-widgets/base'; |
| 4 |
import { Panel } from '@lumino/widgets'; |
| 5 |
export declare class ControllerButtonModel extends CoreDOMWidgetModel { |
| 6 |
defaults(): Backbone.ObjectHash; |
| 7 |
} |
| 8 |
/** |
| 9 |
* Very simple view for a gamepad button. |
| 10 |
*/ |
| 11 |
export declare class ControllerButtonView extends DOMWidgetView { |
| 12 |
render(): void; |
| 13 |
update(): void; |
| 14 |
support: HTMLDivElement; |
| 15 |
bar: HTMLDivElement; |
| 16 |
label: HTMLDivElement; |
| 17 |
} |
| 18 |
export declare class ControllerAxisModel extends CoreDOMWidgetModel { |
| 19 |
defaults(): Backbone.ObjectHash; |
| 20 |
} |
| 21 |
/** |
| 22 |
* Very simple view for a gamepad axis. |
| 23 |
*/ |
| 24 |
export declare class ControllerAxisView extends DOMWidgetView { |
| 25 |
render(): void; |
| 26 |
update(): void; |
| 27 |
support: HTMLDivElement; |
| 28 |
bullet: HTMLDivElement; |
| 29 |
label: HTMLDivElement; |
| 30 |
} |
| 31 |
export declare class ControllerModel extends CoreDOMWidgetModel { |
| 32 |
static serializers: { |
| 33 |
buttons: { |
| 34 |
deserialize: typeof unpack_models; |
| 35 |
}; |
| 36 |
axes: { |
| 37 |
deserialize: typeof unpack_models; |
| 38 |
}; |
| 39 |
}; |
| 40 |
defaults(): Backbone.ObjectHash; |
| 41 |
initialize(attributes: Backbone.ObjectHash, options: any): void; |
| 42 |
/** |
| 43 |
* Waits for a gamepad to be connected at the provided index. |
| 44 |
* Once one is connected, it will start the update loop, which |
| 45 |
* populates the update of axes and button values. |
| 46 |
*/ |
| 47 |
wait_loop(): void; |
| 48 |
/** |
| 49 |
* Given a native gamepad object, returns a promise for a dictionary of |
| 50 |
* controls, of the form |
| 51 |
* { |
| 52 |
* buttons: list of Button models, |
| 53 |
* axes: list of Axis models, |
| 54 |
* } |
| 55 |
*/ |
| 56 |
setup(pad: Gamepad): Promise<Dict<ControllerButtonModel[]>>; |
| 57 |
/** |
| 58 |
* Update axes and buttons values, until the gamepad is disconnected. |
| 59 |
* When the gamepad is disconnected, this.reset_gamepad is called. |
| 60 |
*/ |
| 61 |
update_loop(): void; |
| 62 |
/** |
| 63 |
* Resets the gamepad attributes, and start the wait_loop. |
| 64 |
*/ |
| 65 |
reset_gamepad(): void; |
| 66 |
/** |
| 67 |
* Creates a gamepad button widget. |
| 68 |
*/ |
| 69 |
_create_button_model(index: number): Promise<ControllerButtonModel>; |
| 70 |
/** |
| 71 |
* Creates a gamepad axis widget. |
| 72 |
*/ |
| 73 |
_create_axis_model(index: number): Promise<ControllerAxisModel>; |
| 74 |
readout: string; |
| 75 |
} |
| 76 |
/** |
| 77 |
* A simple view for a gamepad. |
| 78 |
*/ |
| 79 |
export declare class ControllerView extends DOMWidgetView { |
| 80 |
_createElement(tagName: string): HTMLElement; |
| 81 |
_setElement(el: HTMLElement): void; |
| 82 |
initialize(parameters: WidgetView.IInitializeParameters): void; |
| 83 |
render(): void; |
| 84 |
update_label(): void; |
| 85 |
add_button(model: ControllerButtonModel): Promise<ControllerButtonView>; |
| 86 |
add_axis(model: ControllerAxisModel): Promise<ControllerAxisView>; |
| 87 |
remove(): void; |
| 88 |
button_views: ViewList<ControllerButtonView>; |
| 89 |
axis_views: ViewList<ControllerAxisView>; |
| 90 |
label: HTMLDivElement; |
| 91 |
axis_box: Panel; |
| 92 |
button_box: Panel; |
| 93 |
model: ControllerModel; |
| 94 |
luminoWidget: JupyterLuminoPanelWidget; |
| 95 |
} |
| 96 |
//# sourceMappingURL=widget_controller.d.ts.map |