Skip to content

Commit

Permalink
confirm dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
zeitlinger committed Jan 4, 2025
1 parent a6472c9 commit 484f254
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 16 deletions.
4 changes: 1 addition & 3 deletions client/src/combat_ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ use server::position::Position;
use server::unit::Unit;

use crate::client_state::{State, StateUpdate};
use crate::dialog_ui::{
cancel_button_with_tooltip, ok_button_with_tooltip,
};
use crate::dialog_ui::{cancel_button_with_tooltip, ok_button_with_tooltip};
use crate::select_ui::{ConfirmSelection, SelectionConfirm};
use crate::unit_ui;
use crate::unit_ui::UnitSelection;
Expand Down
11 changes: 3 additions & 8 deletions client/src/dialog_ui.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
use crate::client_state::{PendingUpdate, ShownPlayer, State, StateUpdate};
use crate::layout_ui::{
bottom_center_text, bottom_right_texture, icon_pos,
};
use crate::layout_ui::{bottom_center_text, bottom_right_texture, icon_pos};
use macroquad::hash;
use macroquad::math::{vec2, Vec2};
use macroquad::ui::widgets::Window;
Expand Down Expand Up @@ -63,10 +61,7 @@ where
(update, open)
}

pub fn show_pending_update(
update: &PendingUpdate,
state: &State,
) -> StateUpdate {
pub fn show_pending_update(update: &PendingUpdate, state: &State) -> StateUpdate {
let t = if update.warning.is_empty() {
"Are you sure?"
} else {
Expand Down Expand Up @@ -97,7 +92,7 @@ pub fn cancel_button_with_tooltip(state: &State, tooltip: &str) -> bool {
#[must_use]
pub fn ok_button(state: &State, valid: bool) -> bool {
ok_button_with_tooltip(
&state,
state,
valid,
if valid { "OK" } else { "Invalid selection" },
)
Expand Down
6 changes: 3 additions & 3 deletions client/src/layout_ui.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::client_state::{ShownPlayer, State};
use crate::client_state::State;
use crate::hex_ui::Point;
use crate::tooltip;
use macroquad::color::WHITE;
Expand Down Expand Up @@ -39,9 +39,9 @@ pub fn bottom_center_texture(state: &State, texture: &Texture2D, p: Vec2, toolti
draw_icon(state, texture, tooltip, anchor + p)
}

pub fn bottom_center_text(state: &State, text: &str, p: Vec2) {
pub fn bottom_center_text(state: &State, text: &str, p: Vec2) {
let p = bottom_center_anchor(state) + p;
state.draw_text(text, p.x, p.y)
state.draw_text(text, p.x, p.y);
}

pub fn bottom_center_anchor(state: &State) -> Vec2 {
Expand Down
4 changes: 2 additions & 2 deletions client/src/player_ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,8 @@ pub fn show_top_left(game: &Game, player: &ShownPlayer, state: &State) {
label(&m);
}
if let Some(u) = &state.pending_update {
for m in u.info {
label(&m);
for m in &u.info {
label(m);
}
}
}
Expand Down

0 comments on commit 484f254

Please sign in to comment.