1
0
Fork 0
mirror of https://github.com/doukutsu-rs/doukutsu-rs synced 2025-11-30 08:08:18 +00:00

decorative border fix + spacing (#52)

* decorative border fix + spacing

* extra shifting around
This commit is contained in:
Daedliy 2022-01-21 17:00:36 -03:00 committed by GitHub
parent 6226df68ca
commit ce6de7c0a0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 23 deletions

View file

@ -1449,7 +1449,7 @@ impl EngineConstants {
menu_right_top: Rect { left: 236, top: 0, right: 244, bottom: 8 },
menu_left_bottom: Rect { left: 0, top: 16, right: 8, bottom: 24 },
menu_right_bottom: Rect { left: 236, top: 16, right: 244, bottom: 24 },
menu_top: Rect { left: 8, top: 0, right: 236, bottom: 8 },
menu_top: Rect { left: 8, top: 0, right: 232, bottom: 8 },
menu_middle: Rect { left: 8, top: 8, right: 236, bottom: 16 },
menu_bottom: Rect { left: 8, top: 16, right: 236, bottom: 24 },
menu_left: Rect { left: 0, top: 8, right: 8, bottom: 16 },

View file

@ -27,14 +27,14 @@ impl MenuEntry {
pub fn height(&self) -> f64 {
match self {
MenuEntry::Hidden => 0.0,
MenuEntry::Active(_) => 14.0,
MenuEntry::DisabledWhite(_) => 14.0,
MenuEntry::Disabled(_) => 14.0,
MenuEntry::Toggle(_, _) => 14.0,
MenuEntry::Options(_, _, _) => 14.0,
MenuEntry::DescriptiveOptions(_, _, _, _) => 14.0,
MenuEntry::SaveData(_) => 30.0,
MenuEntry::NewSave => 30.0,
MenuEntry::Active(_) => 16.0,
MenuEntry::DisabledWhite(_) => 16.0,
MenuEntry::Disabled(_) => 16.0,
MenuEntry::Toggle(_, _) => 16.0,
MenuEntry::Options(_, _, _) => 16.0,
MenuEntry::DescriptiveOptions(_, _, _, _) => 16.0,
MenuEntry::SaveData(_) => 32.0,
MenuEntry::NewSave => 32.0,
}
}
@ -97,13 +97,13 @@ impl Menu {
}
pub fn update_height(&mut self) {
let mut height = 6.0;
let mut height = 8.0;
for entry in &self.entries {
height += entry.height();
}
self.height = height.max(6.0) as u16;
self.height = height.max(8.0) as u16;
}
pub fn draw(&self, state: &mut SharedGameState, ctx: &mut Context) -> GameResult {
@ -228,14 +228,14 @@ impl Menu {
batch.draw(ctx)?;
}
y = self.y as f32 + 6.0;
y = self.y as f32 + 8.0;
for entry in &self.entries {
match entry {
MenuEntry::Active(name) | MenuEntry::DisabledWhite(name) => {
state.font.draw_text(
name.chars(),
self.x as f32 + 20.0,
y,
y - 2.0,
&state.constants,
&mut state.texture_set,
ctx,
@ -245,7 +245,7 @@ impl Menu {
state.font.draw_colored_text(
name.chars(),
self.x as f32 + 20.0,
y,
y - 2.0,
(0xa0, 0xa0, 0xff, 0xff),
&state.constants,
&mut state.texture_set,
@ -259,7 +259,7 @@ impl Menu {
state.font.draw_text(
name.chars(),
self.x as f32 + 20.0,
y,
y - 2.0,
&state.constants,
&mut state.texture_set,
ctx,
@ -268,7 +268,7 @@ impl Menu {
state.font.draw_text(
value_text.chars(),
self.x as f32 + 25.0 + name_text_len,
y,
y - 2.0,
&state.constants,
&mut state.texture_set,
ctx,
@ -281,7 +281,7 @@ impl Menu {
state.font.draw_text(
name.chars(),
self.x as f32 + 20.0,
y,
y - 2.0,
&state.constants,
&mut state.texture_set,
ctx,
@ -290,7 +290,7 @@ impl Menu {
state.font.draw_text(
value_text.chars(),
self.x as f32 + 25.0 + name_text_len,
y,
y - 2.0,
&state.constants,
&mut state.texture_set,
ctx,
@ -304,7 +304,7 @@ impl Menu {
state.font.draw_text(
name.chars(),
self.x as f32 + 20.0,
y,
y - 2.0,
&state.constants,
&mut state.texture_set,
ctx,
@ -313,7 +313,7 @@ impl Menu {
state.font.draw_text(
value_text.chars(),
self.x as f32 + 25.0 + name_text_len,
y,
y - 2.0,
&state.constants,
&mut state.texture_set,
ctx,
@ -322,7 +322,7 @@ impl Menu {
state.font.draw_colored_text(
description_text.chars(),
self.x as f32 + 20.0,
y + 14.0,
y + 12.0,
(0xa0, 0xa0, 0xff, 0xff),
&state.constants,
&mut state.texture_set,
@ -377,7 +377,7 @@ impl Menu {
self.entry_y = self.entries[0..(self.selected)].iter().map(|e| e.height()).sum::<f64>().max(0.0) as u16;
}
let mut y = self.y as f32 + 6.0;
let mut y = self.y as f32 + 8.0;
for (idx, entry) in self.entries.iter_mut().enumerate() {
let entry_bounds = Rect::new_size(self.x, y as isize, self.width as isize, entry.height() as isize);
y += entry.height() as f32;

View file

@ -26,7 +26,7 @@ static DISCORD_LINK: &str = "https://discord.gg/fbRsNNB";
impl SettingsMenu {
pub fn new() -> SettingsMenu {
let main = Menu::new(0, 0, 200, 0);
let main = Menu::new(0, 0, 220, 0);
let graphics = Menu::new(0, 0, 180, 0);
let sound = Menu::new(0, 0, 260, 0);