Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Orbclient Window Shortcuts
Description
Shortcut support for orbclient::Window
The library makes used of:
and therefore requires to be build with rust nightly. The default branch to be cloned from is 'testing'.
Prerequisites & Implementation
The lib is available on creates.io. In your Cargo.toml (I may not update the latest version number in the README.md):
orbclient_window_shortcuts = "0.1.2"
In your lib or bin code:
use ;
The orbclient requires sdl2 or orbital (redox os) to run, and may not be installed on your system. On Arch Linux your can use pacman to install libsdl2.
$ pacman -Syu sdl2
On Ubuntu you may install libsdl2 from a 3rd party or compile it from sources:
# wget https://www.libsdl.org/release/SDL2-2.0.5.tar.gz -O SDL2-2.0.5.tar.gz
# tar -xzvf SDL2-2.0.5.tar.gz
$ cd SDL2-2.0.5 && ./configure && make && sudo make install
Implementation for your Window
application:
// Provides the capturing of default shortcuts: CTRL+O (Open), CTRL+N (New), CTRL-Q (Quit)
let mut sceq = with_defaults;
In a loop to capture window events implement EventOption::Key(ke):
Every keystroke that's a supported shortcut will return a ShortcutId::{New, Open, Quit}
, which
can be matched.
events: loop
The future and potential features
- A few obvious features. Enabling / disabling a set of shortcuts
- Refacturing to a more rust idiomatic code
- A descriptive approach to plugin application dependent shortcuts
I take any advice and ideas which I will considere when my rust programming capabilities improve. :)
Contribution
Very much appreciated. Please file bug, enahncement or question issues, or fork and request pulls. Thank you very much.