Proper next/prev site buttons

This commit is contained in:
Joshua Barretto 2023-04-01 12:34:58 +01:00
parent 0d7ee4479b
commit 19db823092
4 changed files with 24 additions and 37 deletions

View File

@ -20,6 +20,8 @@ char_selection-skin = Skin
char_selection-eyeshape = Eye Details
char_selection-accessories = Accessories
char_selection-starting_site = Starting Site
char_selection-starting_site_next = Next
char_selection-starting_site_prev = Previous
char_selection-starting_site_name = Name: { $name }
char_selection-starting_site_kind = Kind: { $kind }
char_selection-create_info_name = Your Character needs a name!

View File

@ -74,8 +74,8 @@ use crate::{
},
settings::chat::ChatFilter,
ui::{
self, default_water_color, fonts::Fonts, img_ids::Rotations, slot, slot::SlotKey, Graphic,
Ingameable, ScaleMode, Ui,
self, fonts::Fonts, img_ids::Rotations, slot, slot::SlotKey, Graphic, Ingameable,
ScaleMode, Ui,
},
window::Event as WinEvent,
GlobalState,
@ -106,7 +106,7 @@ use common::{
terrain::{SpriteKind, TerrainChunk, UnlockKind},
trade::{ReducedInventory, TradeAction},
uid::Uid,
util::Dir,
util::{srgba_to_linear, Dir},
vol::RectRasterableVol,
};
use common_base::{prof_span, span};
@ -222,6 +222,9 @@ const SPEECH_BUBBLE_RANGE: f32 = NAMETAG_RANGE;
const EXP_FLOATER_LIFETIME: f32 = 2.0;
const EXP_ACCUMULATION_DURATION: f32 = 0.5;
// TODO: Don't hard code this
pub fn default_water_color() -> Rgba<f32> { srgba_to_linear(Rgba::new(0.0, 0.18, 0.37, 1.0)) }
widget_ids! {
struct Ids {
// Crosshair

View File

@ -1,7 +1,8 @@
use crate::{
hud::default_water_color,
render::UiDrawer,
ui::{
self, default_water_color,
self,
fonts::IcedFonts as Fonts,
ice::{
component::{
@ -1322,43 +1323,27 @@ impl Controls {
vec![map]
} else {
let site_buttons = Row::with_children(vec![
Button::new(
neat_button(
prev_starting_site_button,
Container::new(Text::new("<"))
.width(Length::Fill)
.height(Length::Fill)
.center_x()
.center_y(),
i18n.get_msg("char_selection-starting_site_prev")
.into_owned(),
FILL_FRAC_ONE,
button_style,
Some(Message::PrevStartingSite),
)
.style(
style::button::Style::new(imgs.char_selection)
.hover_image(imgs.char_selection_hover)
.press_image(imgs.char_selection_press),
)
.width(Length::Fill)
.height(Length::Fill)
.on_press(Message::PrevStartingSite)
.into(),
Button::new(
neat_button(
next_starting_site_button,
Container::new(Text::new(">"))
.width(Length::Fill)
.height(Length::Fill)
.center_x()
.center_y(),
i18n.get_msg("char_selection-starting_site_next")
.into_owned(),
FILL_FRAC_ONE,
button_style,
Some(Message::NextStartingSite),
)
.style(
style::button::Style::new(imgs.char_selection)
.hover_image(imgs.char_selection_hover)
.press_image(imgs.char_selection_press),
)
.width(Length::Fill)
.height(Length::Fill)
.on_press(Message::NextStartingSite)
.into(),
])
.max_height(30)
.padding(5)
.max_height(60)
.padding(15)
.into();
let site_slider = char_slider(

View File

@ -1090,6 +1090,3 @@ fn default_scissor(physical_resolution: Vec2<u32>) -> Aabr<u16> {
},
}
}
// TODO: Don't hard code this
pub fn default_water_color() -> Rgba<f32> { srgba_to_linear(Rgba::new(0.0, 0.18, 0.37, 1.0)) }