-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow user to modify width and height of reticle (#354)
* Allow user to modify width, height and scale of reticle * Fix Linux build * Respond to review * Respond to review 2 * Respond to review 3 * Respond to review 4
- Loading branch information
1 parent
d46ecca
commit ec5b750
Showing
14 changed files
with
139 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
Tas::set_reticle_width(SETTINGS.reticle_w); | ||
Tas::set_reticle_height(SETTINGS.reticle_h); | ||
|
||
fn create_reticle_menu() -> Ui { | ||
static mut PLAYER_RETICLE_WIDTH_INPUT_LABEL = Text { text: "Reticle Width" }; | ||
static mut PLAYER_RETICLE_HEIGHT_INPUT_LABEL = Text { text: "Reticle Height" }; | ||
static mut PLAYER_RETICLE_SCALE_INPUT_LABEL = Text { text: "Reticle Scale" }; | ||
Ui::new("Reticle:", List::of( | ||
UiElement::FloatInput(FloatInput { | ||
label: PLAYER_RETICLE_WIDTH_INPUT_LABEL, | ||
input: f"{SETTINGS.reticle_w}", | ||
onclick: fn(input: string) {}, | ||
onchange: fn(input: string) { | ||
PLAYER_RETICLE_WIDTH_INPUT_LABEL.text = "Reticle Width"; | ||
match input.parse_float() { | ||
Result::Ok(num) => { | ||
Tas::set_reticle_width(num); | ||
SETTINGS.reticle_w = num; | ||
SETTINGS.store(); | ||
}, | ||
Result::Err(e) => { | ||
PLAYER_RETICLE_WIDTH_INPUT_LABEL.text = f"Reticle Width (invalid value)"; | ||
}, | ||
} | ||
}, | ||
}), | ||
UiElement::FloatInput(FloatInput { | ||
label: PLAYER_RETICLE_HEIGHT_INPUT_LABEL, | ||
input: f"{SETTINGS.reticle_h}", | ||
onclick: fn(input: string) {}, | ||
onchange: fn(input: string) { | ||
PLAYER_RETICLE_HEIGHT_INPUT_LABEL.text = "Reticle Height"; | ||
match input.parse_float() { | ||
Result::Ok(num) => { | ||
Tas::set_reticle_height(num); | ||
SETTINGS.reticle_h = num; | ||
SETTINGS.store(); | ||
}, | ||
Result::Err(e) => { | ||
PLAYER_RETICLE_HEIGHT_INPUT_LABEL.text = f"Reticle Height (invalid value)"; | ||
}, | ||
} | ||
}, | ||
}), | ||
UiElement::Button(UiButton { | ||
label: Text { text: "Back" }, | ||
onclick: fn(label: Text) { leave_ui() }, | ||
}), | ||
)) | ||
} | ||
|
||
fn create_player_menu() -> Ui { | ||
Ui::new("Player:", List::of( | ||
UiElement::Button(UiButton { | ||
label: Text { text: "Reticle" }, | ||
onclick: fn(label: Text) { enter_ui(create_reticle_menu()); } | ||
}), | ||
UiElement::Button(UiButton { | ||
label: Text { text: "Back" }, | ||
onclick: fn(label: Text) { leave_ui() }, | ||
}), | ||
)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters