File tree Expand file tree Collapse file tree 4 files changed +16
-5
lines changed Expand file tree Collapse file tree 4 files changed +16
-5
lines changed Original file line number Diff line number Diff line change 1
1
[package ]
2
2
name = " gameutil-rs"
3
- version = " 0.1 .0"
3
+ version = " 0.2 .0"
4
4
edition = " 2021"
5
5
6
6
[dependencies ]
7
7
windows-dll = " 0.3.0"
8
8
winapi = { version = " 0.3.9" , features = [" processthreadsapi" ] }
9
9
sysinfo = " 0.22.4"
10
10
nwg = {version = " ^1.0.12" , package = " native-windows-gui" }
11
+ livesplit-hotkey = " 0.6.0"
11
12
12
13
[target .'cfg(target_os="windows")' .build-dependencies ]
13
14
winres = " ^0.1"
@@ -16,5 +17,4 @@ winres = "^0.1"
16
17
opt-level = 3
17
18
lto = true
18
19
codegen-units = 1
19
- panic = " abort"
20
- debug = 0
20
+ panic = " abort"
Original file line number Diff line number Diff line change 1
1
use nwg:: NativeUi ;
2
2
3
- mod sys;
3
+ pub mod sys;
4
4
5
5
#[ derive( Default ) ]
6
6
pub struct GameUtil {
Original file line number Diff line number Diff line change @@ -146,3 +146,12 @@ pub fn cleanworkingset() {
146
146
}
147
147
}
148
148
}
149
+
150
+ // TODO: args for more hotkeys and callbacks
151
+ pub fn hotkey ( ) -> livesplit_hotkey:: Hook {
152
+ let hotkey = livesplit_hotkey:: Hook :: new ( ) . expect ( "failed to make new hotkey!" ) ;
153
+ hotkey. register ( livesplit_hotkey:: KeyCode :: F4 , move || {
154
+ cleanworkingset ( ) ;
155
+ } ) . expect ( "failed to register hotkey!" ) ;
156
+ hotkey
157
+ }
Original file line number Diff line number Diff line change 3
3
mod gui;
4
4
5
5
fn main ( ) {
6
+ let hotkey = gui:: sys:: hotkey ( ) ;
6
7
gui:: gui_init ( ) ;
7
- }
8
+ hotkey. unregister ( livesplit_hotkey:: KeyCode :: F4 ) . expect ( "failed to unregister hotkey!" ) ;
9
+ }
You can’t perform that action at this time.
0 commit comments