Quick little tweak to make the build speed up while a build is running.
This commit is contained in:
parent
94c9cd75a8
commit
d1c2352237
4 changed files with 14 additions and 112 deletions
14
gui.cpp
14
gui.cpp
|
@ -78,6 +78,7 @@ void GUI::main_loop() {
|
|||
|
||||
void GUI::build_success() {
|
||||
$hit_error = false;
|
||||
configure_status_shader(1, $hit_error);
|
||||
$gui.show_sprite("face", "build_success");
|
||||
sound::stop("building");
|
||||
sound::play("build_success");
|
||||
|
@ -86,6 +87,7 @@ void GUI::build_success() {
|
|||
|
||||
void GUI::build_failed(bool play_sound, const string &command) {
|
||||
$hit_error = true;
|
||||
configure_status_shader(1, $hit_error);
|
||||
$gui.show_sprite("face", "build_failed");
|
||||
sound::stop("building");
|
||||
|
||||
|
@ -96,9 +98,13 @@ void GUI::build_failed(bool play_sound, const string &command) {
|
|||
output(fmt::format("!!! BUILD FAILED. Your command correct? '{}'", command));
|
||||
}
|
||||
|
||||
void GUI::configure_status_shader(size_t line_length, bool is_error) {
|
||||
void GUI::configure_status_shader(int speedup, bool is_error) {
|
||||
auto& effect = $gui.get<guecs::Effect>($log);
|
||||
effect.$shader->setUniform("line_length", (int)line_length);
|
||||
|
||||
if(speedup > 0) {
|
||||
effect.$shader->setUniform("speedup", speedup);
|
||||
}
|
||||
|
||||
if(!$hit_error && is_error) {
|
||||
$hit_error = is_error;
|
||||
}
|
||||
|
@ -108,7 +114,7 @@ void GUI::configure_status_shader(size_t line_length, bool is_error) {
|
|||
}
|
||||
|
||||
void GUI::update_status(GameEngine &game, size_t line_length, bool is_error) {
|
||||
configure_status_shader(line_length, is_error);
|
||||
configure_status_shader(line_length * 0, is_error);
|
||||
|
||||
$status = fmt::format(L"HP {}\nRounds {}\nStreaks {}\nDeaths {}",
|
||||
game.hit_points, game.rounds,
|
||||
|
@ -119,6 +125,7 @@ void GUI::update_status(GameEngine &game, size_t line_length, bool is_error) {
|
|||
}
|
||||
|
||||
void GUI::you_died() {
|
||||
configure_status_shader(0, $hit_error);
|
||||
$gui.show_sprite("face", "you_died");
|
||||
sound::stop("building");
|
||||
sound::play("you_died");
|
||||
|
@ -128,6 +135,7 @@ void GUI::you_died() {
|
|||
|
||||
void GUI::building() {
|
||||
$hit_error = false;
|
||||
configure_status_shader(20, $hit_error);
|
||||
$gui.show_sprite("face", "building");
|
||||
output("############# START ############");
|
||||
output(">>>> Will it Build?");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue